1ZMQ_CLOSE(3) 0MQ Manual ZMQ_CLOSE(3)
2
3
4
6 zmq_close - close 0MQ socket
7
9 int zmq_close (void *socket);
10
12 The zmq_close() function shall destroy the socket referenced by the
13 socket argument. Any outstanding messages physically received from the
14 network but not yet received by the application with zmq_recv() shall
15 be discarded. The behaviour for discarding messages sent by the
16 application with zmq_send() but not yet physically transferred to the
17 network depends on the value of the ZMQ_LINGER socket option for the
18 specified socket.
19
20 zmq_close() must be called exactly once for each socket. If it is never
21 called, zmq_ctx_term() will block forever. If it is called multiple
22 times for the same socket or if socket does not point to a socket, the
23 behaviour is undefined.
24
25 Note
26 The default setting of ZMQ_LINGER does not discard unsent messages;
27 this behaviour may cause the application to block when calling
28 zmq_ctx_term(). For details refer to zmq_setsockopt(3) and
29 zmq_ctx_term(3).
30
31 Note
32 This API will complete asynchronously, so not everything will be
33 deallocated after it returns. See above for details about linger.
34
36 The zmq_close() function shall return zero if successful. Otherwise it
37 shall return -1 and set errno to one of the values defined below.
38
40 ENOTSOCK
41 The provided socket was NULL.
42
44 zmq_socket(3) zmq_ctx_term(3) zmq_setsockopt(3) zmq(7)
45
47 This page was written by the 0MQ community. To make a change please
48 read the 0MQ Contribution Policy at
49 http://www.zeromq.org/docs:contributing.
50
51
52
530MQ 4.3.4 07/23/2022 ZMQ_CLOSE(3)