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); }
/// <summary> /// Connect the socket to an address /// </summary> /// <param name="address">Address to connect to</param> public void Connect(string address) { ZMQ.Connect(m_socketHandle, address); }