From da37c45b0c7200eea96118952e671972b71df4ce Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Fri, 28 May 2010 01:38:43 +0200 Subject: Clarify zmq_bind/zmq_connect Use the term 'endpoint' correctly, and drop the nonsense about local/remote addresses which doesn't clearly explain what is going on --- doc/zmq_bind.txt | 28 +++++++++++++++------------- doc/zmq_connect.txt | 26 ++++++++++++++------------ 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/doc/zmq_bind.txt b/doc/zmq_bind.txt index 983ce93..c76d05a 100644 --- a/doc/zmq_bind.txt +++ b/doc/zmq_bind.txt @@ -4,34 +4,36 @@ zmq_bind(3) NAME ---- -zmq_bind - assign a local address to a socket +zmq_bind - accept connections on a socket SYNOPSIS -------- -*int zmq_bind (void '*socket', const char '*address');* +*int zmq_bind (void '*socket', const char '*endpoint');* DESCRIPTION ----------- -The _zmq_bind()_ function shall assign a local address specified by the -'address' argument to the socket referenced by the 'socket' argument. +The _zmq_bind()_ function shall create an endpoint for accepting connections +and bind it to the socket referenced by the 'socket' argument. -The 'address' argument is a string consisting of two parts as follows: -'transport'://'endpoint'. The 'transport' part specifies the underlying -transport protocol to use. The meaning of the 'endpoint' part is specific to +The 'endpoint' argument is a string consisting of two parts as follows: +'transport'`://`'address'. The 'transport' part specifies the underlying +transport protocol to use. The meaning of the 'address' part is specific to the underlying transport protocol selected. The following transports are defined: +'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7] +'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7] 'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7] 'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7] -'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7] -'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7] -A single socket may have an arbitrary number of local addresses assigned to it -using _zmq_bind()_, while also being connected to an arbitrary number of peer -addresses using _zmq_connect()_. +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 linkzmq:zmq_socket[3] for a description of the exact +semantics involved when connecting or binding a socket to multiple endpoints. RETURN VALUE @@ -63,7 +65,7 @@ EXAMPLE /* Create a ZMQ_PUB socket */ void *socket = zmq_socket (context, ZMQ_PUB); assert (socket); -/* Bind it to a in-process transport with the endpoint 'my_publisher' */ +/* Bind it to a in-process transport with the address 'my_publisher' */ int rc = zmq_bind (socket, "inproc://my_publisher"); assert (rc == 0); /* Bind it to a TCP transport on port 5555 of the 'eth0' interface */ diff --git a/doc/zmq_connect.txt b/doc/zmq_connect.txt index d31b87b..2bc8e4f 100644 --- a/doc/zmq_connect.txt +++ b/doc/zmq_connect.txt @@ -4,34 +4,36 @@ zmq_connect(3) NAME ---- -zmq_connect - connect a socket to a peer address +zmq_connect - connect a socket SYNOPSIS -------- -*int zmq_connect (void '*socket', const char '*address');* +*int zmq_connect (void '*socket', const char '*endpoint');* DESCRIPTION ----------- The _zmq_connect()_ function shall connect the socket referenced by the -'socket' argument to a peer address specified by the 'address' argument. +'socket' argument to the endpoint specified by the 'endpoint' argument. -The 'address' argument is a string consisting of two parts as follows: -'transport'`://`'endpoint'. The 'transport' part specifies the underlying -transport protocol to use. The meaning of the 'endpoint' part is specific to +The 'endpoint' argument is a string consisting of two parts as follows: +'transport'`://`'address'. The 'transport' part specifies the underlying +transport protocol to use. The meaning of the 'address' part is specific to the underlying transport protocol selected. The following transports are defined: +'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7] +'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7] 'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7] 'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[7] -'ipc':: local inter-process communication transport, see linkzmq:zmq_ipc[7] -'inproc':: local in-process (inter-thread) communication transport, see linkzmq:zmq_inproc[7] -A single socket may be connected to an arbitrary number of peer addresses using -_zmq_connect()_, while also having an arbitrary number of local addresses -assigned to it using _zmq_bind()_. +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 linkzmq:zmq_socket[3] for a description of the exact +semantics involved when connecting or binding a socket to multiple endpoints. NOTE: The connection will not be performed immediately but as needed by 0MQ. Thus a successful invocation of _zmq_connect()_ does not indicate that a @@ -61,7 +63,7 @@ EXAMPLE /* Create a ZMQ_SUB socket */ void *socket = zmq_socket (context, ZMQ_SUB); assert (socket); -/* Connect it to an in-process transport with the endpoint 'my_publisher' */ +/* Connect it to an in-process transport with the address 'my_publisher' */ int rc = zmq_connect (socket, "inproc://my_publisher"); assert (rc == 0); /* Connect it to the host server001, port 5555 using a TCP transport */ -- cgit v1.2.3