[zeromq-dev] recv in REQ client blocks forever if XREP server dies

Martin Sustrik sustrik at 250bpm.com
Sun Dec 5 08:29:10 CET 2010


Troy,

> I want to develop a reconnection strategy in my client program so that
> whenever the XREP server terminates and restarts, the client will get an
> error and then repeatedly retry connecting to the server. Alternatively,
> I would like the new instance of the server to take over the previously
> established XREP end of the connection and start handling the next
> request from the clients.

0MQ does reconnect for you. No need for any assistance from your side. 
Same for two servers problem. Just connect the client to both servers.

The only thing not implemented at the moment is request resend when it 
is lost due to server failure.

To implement that use zmq_poll(timeout) to wait for a reply and resend 
the request once the timeout is reached.

Martin



More information about the zeromq-dev mailing list