[zeromq-dev] router-to-router pattern: how to ensure peer is ready

Kah-Chan Low kahchanlow at yahoo.com
Wed Oct 10 18:12:32 CEST 2012

I am a newbie to ZMQ and in my project I need to use a router-to-router (instead of router-to-dealer) pattern.  This is because sockets on both the server and client sides need to be able to send particular messages to specific peers.  A client needs to send a server immediately after connecting to a server.  To prevent the message from getting dropped I need some kind of handshaking protocol to make sure that the server is ready to accept message.  Is there any way this can be accomplished?  I have been testing the socket option ZMQ_FAIL_UNROUTABLE and it seems to work.
One way to make sure that the server receive the initial message from the client is to set the ZMQ_FAIL_UNROUTABLE socket option at the client and have the client keep on sending the same initial message to the server until zmq_send() succeeds.  This is not elegant but is the only way I can think of.
Any better way of handling this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121010/8fce20f7/attachment.htm>

More information about the zeromq-dev mailing list