[zeromq-dev] Sending via ROUTER socket to ROUTER socket fails initially with "No route to host"

Anoop Karollil anoop.karollil at gmail.com
Tue Apr 9 22:39:52 CEST 2013


Thanks Pieter. Does the hand shaking happen at connect? Because suppose 
there is a delay after the connect, before the initial send, the send 
succeeds.

If the handshaking does happen at connect, and if it is possible to make 
sure the connect returns only after the handshaking is done, that would 
fix the weird behaviour. Of course it is weird only when you expect a 
successful connect to indicate 'pipe' established and the ability to 
send successfully after.

But I am guessing since the connect should succeed even if the peer 
hasn't bound, it would be hard to wait till the handshake happens, as it 
could potentially take forever.

Anoop

Pieter Hintjens wrote:
> OK, we found it. There is some internal handshaking before a message
> can be routed, even if the ROUTER socket connects out. There's no way
> for libzmq to know the identity of the peer until it receives the
> identity from the peer.
>
> ROUTER pipes are created only for known identities, i.e. for a peer
> that has sent us its identity, no matter who connected to whom.
>
> We could force pipe creation in some way but it would require changes.
>
> Hope this helps.
>
> -Pieter
>
> On Fri, Apr 5, 2013 at 11:13 PM, Anoop Karollil
> <anoop.karollil at gmail.com> wrote:
>> Pieter Hintjens wrote:
>>>
>>> On Mon, Apr 1, 2013 at 6:23 PM, Anoop Karollil <anoop.karollil at gmail.com>
>>> wrote:
>>>
>>>> Pieter, any clue as to why the send with the connected (not bound)
>>>> ROUTER socket might be failing initially?
>>>
>>>
>>> No clue, but if you can make a minimal test case in C, we can
>>> investigate. Afaik it should work and this would be considered a bug.
>>
>>
>> Attached are two C programs that reproduce the problem. The broker binds and
>> receives. The client connects and then sends. The send fails initially and
>> then succeeds.



More information about the zeromq-dev mailing list