1ZMQ_DISCONNECT(3) 0MQ Manual ZMQ_DISCONNECT(3)
2
3
4
6 zmq_disconnect - Disconnect a socket from an endpoint
7
9 int zmq_disconnect (void *socket, const char *endpoint);
10
12 The zmq_disconnect() function shall disconnect a socket specified by
13 the socket argument from the endpoint specified by the endpoint
14 argument. Note the actual disconnect system call might occur at a later
15 time.
16
17 Upon disconnection the will also stop receiving messages originating
18 from this endpoint. Moreover, the socket will no longuer be able to
19 queue outgoing messages to this endpoint. The outgoing message queue
20 associated with the endpoint will be discarded. However, if the
21 socket’s linger period is non-zero, libzmq will still attempt to
22 transmit these discarded messages, until the linger period expires.
23
24 The endpoint argument is as described in zmq_connect(3)
25
26 Note
27 The default setting of ZMQ_LINGER does not discard unsent messages;
28 this behaviour may cause the application to block when calling
29 zmq_ctx_term(). For details refer to zmq_setsockopt(3) and
30 zmq_ctx_term(3).
31
33 The zmq_disconnect() function shall return zero if successful.
34 Otherwise it shall return -1 and set errno to one of the values defined
35 below.
36
38 EINVAL
39 The endpoint supplied is invalid.
40
41 ETERM
42 The 0MQ context associated with the specified socket was
43 terminated.
44
45 ENOTSOCK
46 The provided socket was invalid.
47
48 ENOENT
49 The provided endpoint is not in use by the socket.
50
52 Connecting a subscriber socket to an in-process and a TCP transport.
53
54 /* Create a ZMQ_SUB socket */
55 void *socket = zmq_socket (context, ZMQ_SUB);
56 assert (socket);
57 /* Connect it to the host server001, port 5555 using a TCP transport */
58 rc = zmq_connect (socket, "tcp://server001:5555");
59 assert (rc == 0);
60 /* Disconnect from the previously connected endpoint */
61 rc = zmq_disconnect (socket, "tcp://server001:5555");
62 assert (rc == 0);
63
64
66 zmq_connect(3) zmq_socket(3) zmq(7)
67
69 This page was written by the 0MQ community. To make a change please
70 read the 0MQ Contribution Policy at
71 http://www.zeromq.org/docs:contributing.
72
73
74
750MQ 4.3.4 07/22/2023 ZMQ_DISCONNECT(3)