mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 07:56:09 +00:00
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
This commit is contained in:
parent
74f1a4a579
commit
da37c45b0c
@ -4,34 +4,36 @@ zmq_bind(3)
|
|||||||
|
|
||||||
NAME
|
NAME
|
||||||
----
|
----
|
||||||
zmq_bind - assign a local address to a socket
|
zmq_bind - accept connections on a socket
|
||||||
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
*int zmq_bind (void '*socket', const char '*address');*
|
*int zmq_bind (void '*socket', const char '*endpoint');*
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
The _zmq_bind()_ function shall assign a local address specified by the
|
The _zmq_bind()_ function shall create an endpoint for accepting connections
|
||||||
'address' argument to the socket referenced by the 'socket' argument.
|
and bind it to the socket referenced by the 'socket' argument.
|
||||||
|
|
||||||
The 'address' argument is a string consisting of two parts as follows:
|
The 'endpoint' argument is a string consisting of two parts as follows:
|
||||||
'transport'://'endpoint'. The 'transport' part specifies the underlying
|
'transport'`://`'address'. The 'transport' part specifies the underlying
|
||||||
transport protocol to use. The meaning of the 'endpoint' part is specific to
|
transport protocol to use. The meaning of the 'address' part is specific to
|
||||||
the underlying transport protocol selected.
|
the underlying transport protocol selected.
|
||||||
|
|
||||||
The following transports are defined:
|
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]
|
'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7]
|
||||||
'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[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
|
With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
|
||||||
using _zmq_bind()_, while also being connected to an arbitrary number of peer
|
multiple endpoints using _zmq_connect()_, while simultaneously accepting
|
||||||
addresses using _zmq_connect()_.
|
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
|
RETURN VALUE
|
||||||
@ -63,7 +65,7 @@ EXAMPLE
|
|||||||
/* Create a ZMQ_PUB socket */
|
/* Create a ZMQ_PUB socket */
|
||||||
void *socket = zmq_socket (context, ZMQ_PUB);
|
void *socket = zmq_socket (context, ZMQ_PUB);
|
||||||
assert (socket);
|
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");
|
int rc = zmq_bind (socket, "inproc://my_publisher");
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
/* Bind it to a TCP transport on port 5555 of the 'eth0' interface */
|
/* Bind it to a TCP transport on port 5555 of the 'eth0' interface */
|
||||||
|
@ -4,34 +4,36 @@ zmq_connect(3)
|
|||||||
|
|
||||||
NAME
|
NAME
|
||||||
----
|
----
|
||||||
zmq_connect - connect a socket to a peer address
|
zmq_connect - connect a socket
|
||||||
|
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
*int zmq_connect (void '*socket', const char '*address');*
|
*int zmq_connect (void '*socket', const char '*endpoint');*
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
The _zmq_connect()_ function shall connect the socket referenced by the
|
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:
|
The 'endpoint' argument is a string consisting of two parts as follows:
|
||||||
'transport'`://`'endpoint'. The 'transport' part specifies the underlying
|
'transport'`://`'address'. The 'transport' part specifies the underlying
|
||||||
transport protocol to use. The meaning of the 'endpoint' part is specific to
|
transport protocol to use. The meaning of the 'address' part is specific to
|
||||||
the underlying transport protocol selected.
|
the underlying transport protocol selected.
|
||||||
|
|
||||||
The following transports are defined:
|
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]
|
'tcp':: unicast transport using TCP, see linkzmq:zmq_tcp[7]
|
||||||
'pgm', 'epgm':: reliable multicast transport using PGM, see linkzmq:zmq_pgm[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
|
With the exception of 'ZMQ_PAIR' sockets, a single socket may be connected to
|
||||||
_zmq_connect()_, while also having an arbitrary number of local addresses
|
multiple endpoints using _zmq_connect()_, while simultaneously accepting
|
||||||
assigned to it using _zmq_bind()_.
|
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.
|
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
|
Thus a successful invocation of _zmq_connect()_ does not indicate that a
|
||||||
@ -61,7 +63,7 @@ EXAMPLE
|
|||||||
/* Create a ZMQ_SUB socket */
|
/* Create a ZMQ_SUB socket */
|
||||||
void *socket = zmq_socket (context, ZMQ_SUB);
|
void *socket = zmq_socket (context, ZMQ_SUB);
|
||||||
assert (socket);
|
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");
|
int rc = zmq_connect (socket, "inproc://my_publisher");
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
/* Connect it to the host server001, port 5555 using a TCP transport */
|
/* Connect it to the host server001, port 5555 using a TCP transport */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user