1ZMQ_BIND(3)                       0MQ Manual                       ZMQ_BIND(3)
2
3
4

NAME

6       zmq_bind - accept connections on a socket
7

SYNOPSIS

9       int zmq_bind (void *socket, const char *endpoint);
10

DESCRIPTION

12       The zmq_bind() function shall create an endpoint for accepting
13       connections and bind it to the socket referenced by the socket
14       argument.
15
16       The endpoint argument is a string consisting of two parts as follows:
17       transport://address. The transport part specifies the underlying
18       transport protocol to use. The meaning of the address part is specific
19       to the underlying transport protocol selected.
20
21       The following transports are defined:
22
23       inproc
24           local in-process (inter-thread) communication transport, see
25           zmq_inproc(7)
26
27       ipc
28           local inter-process communication transport, see zmq_ipc(7)
29
30       tcp
31           unicast transport using TCP, see zmq_tcp(7)
32
33       pgm, epgm
34           reliable multicast transport using PGM, see zmq_pgm(7)
35
36       With the exception of ZMQ_PAIR sockets, a single socket may be
37       connected to multiple endpoints using zmq_connect(), while
38       simultaneously accepting incoming connections from multiple endpoints
39       bound to the socket using zmq_bind(). Refer to zmq_socket(3) for a
40       description of the exact semantics involved when connecting or binding
41       a socket to multiple endpoints.
42

RETURN VALUE

44       The zmq_bind() function shall return zero if successful. Otherwise it
45       shall return -1 and set errno to one of the values defined below.
46

ERRORS

48       EPROTONOSUPPORT
49           The requested transport protocol is not supported.
50
51       ENOCOMPATPROTO
52           The requested transport protocol is not compatible with the socket
53           type.
54
55       EADDRINUSE
56           The requested address is already in use.
57
58       EADDRNOTAVAIL
59           The requested address was not local.
60
61       ENODEV
62           The requested address specifies a nonexistent interface.
63
64       ETERM
65           The 0MQ context associated with the specified socket was
66           terminated.
67
68       EFAULT
69           The provided socket was not valid (NULL).
70
71       EMTHREAD
72           No I/O thread is available to accomplish the task.
73

EXAMPLE

75       Binding a publisher socket to an in-process and a TCP transport.
76
77           /* Create a ZMQ_PUB socket */
78           void *socket = zmq_socket (context, ZMQ_PUB);
79           assert (socket);
80           /* Bind it to a in-process transport with the address 'my_publisher' */
81           int rc = zmq_bind (socket, "inproc://my_publisher");
82           assert (rc == 0);
83           /* Bind it to a TCP transport on port 5555 of the 'eth0' interface */
84           rc = zmq_bind (socket, "tcp://eth0:5555");
85           assert (rc == 0);
86
87

SEE ALSO

89       zmq_connect(3) zmq_socket(3) zmq(7)
90

AUTHORS

92       This 0MQ manual page was written by Martin Sustrik
93       <sustrik@250bpm.com[1]> and Martin Lucina <mato@kotelna.sk[2]>.
94

NOTES

96        1. sustrik@250bpm.com
97           mailto:sustrik@250bpm.com
98
99        2. mato@kotelna.sk
100           mailto:mato@kotelna.sk
101
102
103
1040MQ 2.1.4                         03/30/2011                       ZMQ_BIND(3)
Impressum