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

Martin Sustrik sustrik at 250bpm.com
Sun Dec 5 08:51:46 CET 2010


Troy,

> recv is not expected to fail if the server that has bound to the
> endpoint dies? The only way to for the client to detect that situation
> is by using poll with a timeout? This is not the behaviour that I would
> have expected and so I spent the last two days reading the
> documentation, experimenting and endlessly searching the devlist
> archives trying to find out what I was doing wrong. :-)

Feel free to submit a documentation patch. Maybe mentioning the 
reconnect semantics in zmq_connect(3)?

> I think you are saying that I would have to write my client code like
> this:
>
> send the request to the XREP server
> poll the REP socket with a timeout
> if event from REP socket
>     recv the response from the server
> else if timeout
>     handle the failure of the request and get ready to send another
>     request
>
> Is that right?

Yes.

Martin



More information about the zeromq-dev mailing list