[zeromq-dev] Reconnecting the Client side of a REQ-REP socket

Jasper Jaspers jaspers01995 at gmail.com
Fri Mar 23 02:53:39 CET 2018

In my application (C++ / Linux / zeromq 4.2)  there are several sockets
within a single context.  Some of the REQ-REP sockets have transient
servers and the clients need to be reconnected gracefully and quickly when
the servers change.  I'm having problems reconnecting the client side of
the REQ-REP socket when the server side changes.  The client's REQ socket
is stuck waiting for a reply from the server's REP socket that it never

 I have a way of notifying the client that the server has changed and it
needs to reconnect, however I don't know how to unblock the client's
receive call ( waiting for the reply).  I do have a timeout set on receive
call but I'd like to have the client reconnect a lot sooner than waiting
for the timeout to expire before reconnecting.  I see that calling
zmq_term() on the context should unblock the receive call, but I can't use
that since I have other connected sockets within the context that I don't
want to disrupt.  Does anyone have a suggestion on how to resolve this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180322/37df165d/attachment.htm>

More information about the zeromq-dev mailing list