zmq_disconnect.txt 2.2 KB

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