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

NAME

6       zmq_connect - connect a socket
7

SYNOPSIS

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

DESCRIPTION

12       The zmq_connect() function shall connect the socket referenced by the
13       socket argument to the endpoint specified by the endpoint argument.
14
15       The endpoint argument is a string consisting of two parts as follows:
16       transport://address. The transport part specifies the underlying
17       transport protocol to use. The meaning of the address part is specific
18       to the underlying transport protocol selected.
19
20       The following transports are defined:
21
22       inproc
23           local in-process (inter-thread) communication transport, see
24           zmq_inproc(7)
25
26       ipc
27           local inter-process communication transport, see zmq_ipc(7)
28
29       tcp
30           unicast transport using TCP, see zmq_tcp(7)
31
32       pgm, epgm
33           reliable multicast transport using PGM, see zmq_pgm(7)
34
35       With the exception of ZMQ_PAIR sockets, a single socket may be
36       connected to multiple endpoints using zmq_connect(), while
37       simultaneously accepting incoming connections from multiple endpoints
38       bound to the socket using zmq_bind(). Refer to zmq_socket(3) for a
39       description of the exact semantics involved when connecting or binding
40       a socket to multiple endpoints.
41
42           Note
43           The connection will not be performed immediately but as needed by
44           0MQ. Thus a successful invocation of zmq_connect() does not
45           indicate that a physical connection was or can actually be
46           established.
47

RETURN VALUE

49       The zmq_connect() function shall return zero if successful. Otherwise
50       it shall return -1 and set errno to one of the values defined below.
51

ERRORS

53       EPROTONOSUPPORT
54           The requested transport protocol is not supported.
55
56       ENOCOMPATPROTO
57           The requested transport protocol is not compatible with the socket
58           type.
59
60       ETERM
61           The 0MQ context associated with the specified socket was
62           terminated.
63
64       EFAULT
65           The provided socket was not valid (NULL).
66
67       EMTHREAD
68           No I/O thread is available to accomplish the task.
69

EXAMPLE

71       Connecting a subscriber socket to an in-process and a TCP transport.
72
73           /* Create a ZMQ_SUB socket */
74           void *socket = zmq_socket (context, ZMQ_SUB);
75           assert (socket);
76           /* Connect it to an in-process transport with the address 'my_publisher' */
77           int rc = zmq_connect (socket, "inproc://my_publisher");
78           assert (rc == 0);
79           /* Connect it to the host server001, port 5555 using a TCP transport */
80           rc = zmq_connect (socket, "tcp://server001:5555");
81           assert (rc == 0);
82
83

SEE ALSO

85       zmq_bind(3) zmq_socket(3) zmq(7)
86

AUTHORS

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

NOTES

92        1. sustrik@250bpm.com
93           mailto:sustrik@250bpm.com
94
95        2. mato@kotelna.sk
96           mailto:mato@kotelna.sk
97
98
99
1000MQ 2.1.4                         03/30/2011                    ZMQ_CONNECT(3)
Impressum