[zeromq-dev] ZMQ reconnection

Emmanuel TAUREL taurel at esrf.fr
Wed Mar 14 10:52:13 CET 2012

Hello all,

I am using ZMQ 3.1 and the PUB-SUB communication pattern.
Is there a way to disable the ZMQ automatic reconnection feature?

I know it exist the socket options RECONNECT_IVL and RECONNECT_IVL_MAX 
but according to my knowledge,
they simply allow to delay ZMQ reconnection attempts.

In our system, our publisher processes choose random port number when 
they start. This means that the ZMQ reconnection schema is
useless for us and we have our own way to reconnect subscribers to 

Even, what happens in the following scenario is:
- I start a publisher which takes port p1
- I start a subscriber which connects to the publisher using port p1
- I kill the publisher
- The subscriber enters the ZMQ reconnection algorithm
- I restart the publisher which takes port p2
- The subscriber will reconnect to the publisher using our own way of 
- The subscriber process continue to try reconnecting to p1 due to ZMQ 
reconnection algorithm until......
I guess one ZMQ thread is used for this reconnection. Will this generate 
problems for ZMQ if this thread tries to reconnect with no end?

Thank's for your answers


More information about the zeromq-dev mailing list