[zeromq-dev] ZMQ_EVENT_CONNECTED and ROUTER socket

Andre Caron andre.l.caron at gmail.com
Wed Jan 14 06:40:49 CET 2015

Indeed, for router-router setup such as that one you basically need to ping the peer until it replies to know that the connection is established.


> On Jan 13, 2015, at 7:46 PM, Joshua Lang <joshual at zillow.com> wrote:
> pyzmq: 14.4.1
> zeromq: 4.0.5 (version bundled with pyzmq)
> I'm using a ROUTER socket connected to a known ROUTER socket, similar to the freelance pattern described in the zeromq guide. On initial startup, the data producers will sometimes fail to send data with the "No route to host" error. This is expected, as described in this thread: http://lists.zeromq.org/pipermail/zeromq-dev/2013-March/020952.html
> Similar to that old thread, adding a sleep after the connect to the remote peers avoids the error, though seems less than ideal. Is there a better way to effectively block until the ROUTER-ROUTER socket connection is available? Initially I looked into the new socket monitor API in zeromq 4.0:  http://api.zeromq.org/4-0:zmq-socket-monitor . It seemed promising, but does not appear to do want I need. After waiting for the ZMQ_EVENT_CONNECTED event for a remote peer, sending to that peer will still fail with the "No route to host" error. I suspect (haven't looked through source yet) that the ZMQ_EVENT_CONNECTED is raised once the TCP connection is setup, but before zeromq sends the remote peer's identity back to the data producer. Is this correct? The documentation wasn't very clear on exactly what the ZMQ_EVENT_CONNECTED event meant, so I had hoped it meant that the remote endpoint was connected and sends to it would succeed
> It seems as if I want to block until the connections are ready, I'd need to actually try and send some data until the send succeeds?
> Thanks,
> -j
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150114/46dc2e2a/attachment.htm>

More information about the zeromq-dev mailing list