[zeromq-dev] ROUTER not routing?

Justin Karneges justin at affinix.com
Fri Feb 7 22:18:00 CET 2014

Yes, when B is run again, it creates a new bind socket. A's connect 
socket will then reconnect to it. B does not care what the identity is 
of A's socket, so I think this is not a problem. For example, I can 
restart A repeatedly and all is fine.

On 02/07/2014 01:06 PM, Ahmet Kakıcı wrote:
> I think you are creating new socket at step 4, then "Router" will assign
> new socket identites to incoming peers.
> https://github.com/zeromq/libzmq/blob/9c6aa1e9e00ab11a1c716e1fd2f1c56030972e30/src/router.cpp#L437
> That's why you cannot send replies to a client with same identity.
> On Fri, Feb 7, 2014 at 10:51 PM, Justin Karneges <justin at affinix.com
> <mailto:justin at affinix.com>> wrote:
>     Hi,
>     1) ROUTER in program A is set to connect to a bind socket in program B.
>     2) Both programs are started, and the connection is established.
>     3) A determines B's socket identity out-of-band, and is able to send
>     messages to B.
>     3) B is terminated and the connection is lost.
>     4) B is started again, and the connection is re-established.
>     5) A determines B's socket identity out-of-band, and is no longer able
>     to send messages to B.
>     It seems this problem does not happen if B retains the same socket
>     identity across reconnects. However, if it uses a random identity (to be
>     discovered out-of-band by A), then routing will never work again after
>     the first restart of B. The A program must be restarted in order to make
>     things right again.
>     My guess is that each connect queue on a ROUTER socket is somehow bound
>     for life against the first identity it sees. Is this intentional
>     behavior?

More information about the zeromq-dev mailing list