[zeromq-dev] bind/connect assimetry
Martin Sustrik
sustrik at 250bpm.com
Thu Jan 20 12:30:16 CET 2011
Hi Ilja,
> Is it expected send blocks against bound socket without counterpart
> and does not against connected socket without counterpart? Is it
> expected behavior?
...
> I wonder if one of 0mq goals is to isolate application programmers
> from right bind/connect order (leaving out of the scope inproc
> issue), why bound and connected sockets are [sometimes] different?
Yes, it's expected behaviour.
0MQ creates queues per underlying connection, e.g. if your socket is
connected to 3 peer sockets there are 3 messages queues.
With bind, you allow peers to connect to you, thus you don't know how
many peers there will be in the future and you cannot create the queues
in advance. Instead, queues are created as individual peers connect.
With connect, 0MQ knows that there's going to be a single peer and thus
it can create a single queue immediately.
Consequently, when sending a message to bound socket with no peers,
there's no queue to store the message to. Not so with connected socket.
Martin
More information about the zeromq-dev
mailing list