[zeromq-dev] ZMQ_EVENT_CONNECTED and ROUTER socket

Joshua Lang joshual at zillow.com
Wed Jan 14 01:46:17 CET 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150114/5b18824e/attachment.htm>


More information about the zeromq-dev mailing list