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

NAME

6       zmq_bind - accept incoming connections on a socket
7

SYNOPSIS

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

DESCRIPTION

12       The zmq_bind() function binds the socket to a local endpoint and then
13       accepts incoming connections on that endpoint.
14
15       The endpoint is a string consisting of a transport:// followed by an
16       address. The transport specifies the underlying protocol to use. The
17       address specifies the transport-specific address to bind to.
18
19       0MQ provides the the following transports:
20
21       tcp
22           unicast transport using TCP, see zmq_tcp(7)
23
24       ipc
25           local inter-process communication transport, see zmq_ipc(7)
26
27       inproc
28           local in-process (inter-thread) communication transport, see
29           zmq_inproc(7)
30
31       pgm, epgm
32           reliable multicast transport using PGM, see zmq_pgm(7)
33
34       vmci
35           virtual machine communications interface (VMCI), see zmq_vmci(7)
36
37       udp
38           unreliable unicast and multicast using UDP, see zmq_udp(7)
39
40       Every 0MQ socket type except ZMQ_PAIR and ZMQ_CHANNEL supports
41       one-to-many and many-to-one semantics. The precise semantics depend on
42       the socket type and are defined in zmq_socket(3).
43
44       The ipc, tcp, vmci and udp transports accept wildcard addresses: see
45       zmq_ipc(7), zmq_tcp(7), zmq_vmci(7) and zmq_udp(7) for details.
46
47           Note
48           the address syntax may be different for zmq_bind() and
49           zmq_connect() especially for the tcp, pgm and epgm transports.
50
51           Note
52           following a zmq_bind(), the socket enters a mute state unless or
53           until at least one incoming or outgoing connection is made, at
54           which point the socket enters a ready state. In the mute state, the
55           socket blocks or drops messages according to the socket type, as
56           defined in zmq_socket(3). By contrast, following a
57           libzmq:zmq_connect[3], the socket enters the ready state.
58

RETURN VALUE

60       The zmq_bind() function returns zero if successful. Otherwise it
61       returns -1 and sets errno to one of the values defined below.
62

ERRORS

64       EINVAL
65           The endpoint supplied is invalid.
66
67       EPROTONOSUPPORT
68           The requested transport protocol is not supported.
69
70       ENOCOMPATPROTO
71           The requested transport protocol is not compatible with the socket
72           type.
73
74       EADDRINUSE
75           The requested address is already in use.
76
77       EADDRNOTAVAIL
78           The requested address was not local.
79
80       ENODEV
81           The requested address specifies a nonexistent interface.
82
83       ETERM
84           The 0MQ context associated with the specified socket was
85           terminated.
86
87       ENOTSOCK
88           The provided socket was invalid.
89
90       EMTHREAD
91           No I/O thread is available to accomplish the task.
92

EXAMPLE

94       Binding a publisher socket to an in-process and a TCP transport.
95
96           /* Create a ZMQ_PUB socket */
97           void *socket = zmq_socket (context, ZMQ_PUB);
98           assert (socket);
99           /* Bind it to a in-process transport with the address 'my_publisher' */
100           int rc = zmq_bind (socket, "inproc://my_publisher");
101           assert (rc == 0);
102           /* Bind it to a TCP transport on port 5555 of the 'eth0' interface */
103           rc = zmq_bind (socket, "tcp://eth0:5555");
104           assert (rc == 0);
105
106

SEE ALSO

108       zmq_connect(3) zmq_socket(3) zmq(7)
109

AUTHORS

111       This page was written by the 0MQ community. To make a change please
112       read the 0MQ Contribution Policy at
113       http://www.zeromq.org/docs:contributing.
114
115
116
1170MQ 4.3.4                         01/30/2021                       ZMQ_BIND(3)
Impressum