ROUTER socket does not support reconnection from clients with multiple NICs


ZeroMQ supports multiple NICs for its sockets. If a client gets disconnected with queued messages, it will automatically try to reconnect with the other available NICs. However, there is a problem if the client, say a DEALER socket, has set its identity (using ZMQ_IDENTITY). The identity does not change upon reconnect. A server with a ROUTER socket that receives the new client's connection will see the same ZMQ_IDENTITY again. However, since the new incoming connection uses a different address (due to a different NIC) but has the same identity, the ROUTER socket will automatically place it into a list of "anonymous" connections. The client has no way of receiving responses.

Suggested Fix:

The behaviour I was thinking about would be very simple: when the router socket encounters a connection with an already taken identity, it allows the new connection to assume that identity.

Ideally, any queued messages would have to be transferred to the queues for the new connection, rather than just dropping them.

This new behaviour could be enabled via a new flag for zmq_setsockopt. However, it would have to assume a trusted/secured network.

Please see zeromq-dev mailing list discussions with Pieter Hintjens regarding this issue at:


Discovered issue when using Windows Server 2012, though I don't think the problem is limited to that OS.

In terms of hardware, must have multiple NICs on machine that connects to the ROUTER socket (in my case, it is a DEALER socket with an identity)




Mark Barbisan




Affects versions