zmq_close.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. zmq_close(3)
  2. ============
  3. NAME
  4. ----
  5. zmq_close - close 0MQ socket
  6. SYNOPSIS
  7. --------
  8. *int zmq_close (void '*socket');*
  9. DESCRIPTION
  10. -----------
  11. The _zmq_close()_ function shall destroy the socket referenced by the 'socket'
  12. argument. Any outstanding messages physically received from the network but not
  13. yet received by the application with _zmq_recv()_ shall be discarded. The
  14. behaviour for discarding messages sent by the application with _zmq_send()_ but
  15. not yet physically transferred to the network depends on the value of the
  16. _ZMQ_LINGER_ socket option for the specified 'socket'.
  17. _zmq_close()_ must be called exactly once for each socket. If it is never called,
  18. _zmq_ctx_term()_ will block forever. If it is called multiple times for the same
  19. socket or if 'socket' does not point to a socket, the behaviour is undefined.
  20. NOTE: The default setting of _ZMQ_LINGER_ does not discard unsent messages;
  21. this behaviour may cause the application to block when calling _zmq_ctx_term()_.
  22. For details refer to linkzmq:zmq_setsockopt[3] and linkzmq:zmq_ctx_term[3].
  23. NOTE: This API will complete asynchronously, so not everything will be deallocated
  24. after it returns. See above for details about linger.
  25. RETURN VALUE
  26. ------------
  27. The _zmq_close()_ function shall return zero if successful. Otherwise it shall
  28. return `-1` and set 'errno' to one of the values defined below.
  29. ERRORS
  30. ------
  31. *ENOTSOCK*::
  32. The provided 'socket' was NULL.
  33. SEE ALSO
  34. --------
  35. linkzmq:zmq_socket[3]
  36. linkzmq:zmq_ctx_term[3]
  37. linkzmq:zmq_setsockopt[3]
  38. linkzmq:zmq[7]
  39. AUTHORS
  40. -------
  41. This page was written by the 0MQ community. To make a change please
  42. read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.