public void ShouldAllowInfinitePolling() { Ctx contextNew = ZMQ.CtxNew(); SocketBase receiver = ZMQ.Socket(contextNew, ZmqSocketType.Dealer); ZMQ.Bind(receiver, "inproc://test"); Task.Factory.StartNew(() => { Thread.Sleep(500); SocketBase sender = ZMQ.Socket(contextNew, ZmqSocketType.Dealer); ZMQ.Connect(sender, "inproc://test"); ZMQ.Send(sender, "ping", SendReceiveOptions.None); ZMQ.Close(sender); }); var pollItems = new PollItem[] { new PollItem(receiver, PollEvents.PollIn) }; Assert.DoesNotThrow(() => ZMQ.Poll(pollItems, -1)); var msg = ZMQ.Recv(receiver, SendReceiveOptions.DontWait); var actual = Encoding.ASCII.GetString(msg.Data, 0, msg.Size); Assert.AreEqual("ping", actual); ZMQ.Close(receiver); ZMQ.Term(contextNew); }
protected internal virtual Msg ReceiveInternal(SendReceiveOptions options, out bool hasMore) { var msg = ZMQ.Recv(m_socketHandle, options); hasMore = msg.HasMore; return(msg); }
void puller_PollInHandler(ZMQ.Socket socket, ZMQ.IOMultiPlex revents) { var message = socket.Recv(UTF8Encoding.UTF8); Console.WriteLine("Message received" + message); }