[zeromq-dev] inter-thread push and pull

Ian Barber ian.barber at gmail.com
Fri Jun 8 11:23:17 CEST 2012


On Fri, Jun 8, 2012 at 1:58 AM, Steven McCoy <steven.mccoy at miru.hk> wrote:

> This is mentioned in the guide:
>
> In theory with ØMQ sockets, it does not matter which end connects, and
> which end binds.
>
>
> With inter-thread sockets I must have the bound socket up before the
> connecting client.  The missing statement is that only socket can be bound
> to an endpoint, whilst multiple sockets can be connected?  Can this be made
> more obvious in the manpages as it is hidden in the guide.
>

Yeah, inproc is a special case in that regard - I'm not sure it's
necessarily worth bringing up at that point in the guide, just because of
risk of more general confusion. The point that only one thing can bind to
an endpoint (on any of the unicast transports) is valid though, I can see
it being worth a note saying 'only one socket can bind to an endpoint at a
time'.

WRT to the manpages, the current zmq_bind has:

With the exception of *ZMQ_PAIR* sockets, a single socket may be connected
to multiple endpoints using *zmq_connect()*, while simultaneously accepting
incoming connections from multiple endpoints bound to the socket using *
zmq_bind()*. Refer to zmq_socket(3)
<http://api.zeromq.org/3-1:zmq_socket>for a description of the exact
semantics involved when connecting or
binding a socket to multiple endpoints.

Maybe we should update that to:

With the exception of *ZMQ_PAIR* sockets, a single socket may be connected
to multiple endpoints using *zmq_connect()*, while simultaneously accepting
incoming connections from multiple endpoints bound to a single socket using
*zmq_bind()*. Refer to zmq_socket(3)
<http://api.zeromq.org/3-1:zmq_socket>for a description of the exact
semantics involved when connecting or
binding a socket to multiple endpoints.

Nothing in there really addresses the connect/bind order - perhaps we could
add a line to the zmq_connect page, which currently mentions the async
nature.

For most socket types the order in which a listening socket is bound and a
connecting socket is connected does not matter, in that that connection
will be attempted asynchronously, and retried until it succeeds. However,
for inproc:// scheme sockets, the zmq_bind() must be executed before any
sockets zmq_connect() to that endpoint.

I'll send a req for those changes if they look sensible.

Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120608/04c23e35/attachment.htm>


More information about the zeromq-dev mailing list