zmq_ipc.txt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. zmq_ipc(7)
  2. ==========
  3. NAME
  4. ----
  5. zmq_ipc - 0MQ local inter-process communication transport
  6. SYNOPSIS
  7. --------
  8. The inter-process transport passes messages between local processes using a
  9. system-dependent IPC mechanism.
  10. NOTE: The inter-process transport is currently only implemented on operating
  11. systems that provide UNIX domain sockets.
  12. ADDRESSING
  13. ----------
  14. A 0MQ endpoint is a string consisting of a 'transport'`://` followed by an
  15. 'address'. The 'transport' specifies the underlying protocol to use. The
  16. 'address' specifies the transport-specific address to connect to.
  17. For the inter-process transport, the transport is `ipc`, and the meaning of
  18. the 'address' part is defined below.
  19. Binding a socket
  20. ~~~~~~~~~~~~~~~~
  21. When binding a 'socket' to a local address using _zmq_bind()_ with the 'ipc'
  22. transport, the 'endpoint' shall be interpreted as an arbitrary string
  23. identifying the 'pathname' to create. The 'pathname' must be unique within the
  24. operating system namespace used by the 'ipc' implementation, and must fulfill
  25. any restrictions placed by the operating system on the format and length of a
  26. 'pathname'.
  27. When the address is wild-card `*`, _zmq_bind()_ shall generate a unique temporary
  28. pathname. The caller should retrieve this pathname using the ZMQ_LAST_ENDPOINT
  29. socket option. See linkzmq:zmq_getsockopt[3] for details.
  30. NOTE: any existing binding to the same endpoint shall be overridden. That is,
  31. if a second process binds to an endpoint already bound by a process, this
  32. will succeed and the first process will lose its binding. In this behaviour,
  33. the 'ipc' transport is not consistent with the 'tcp' or 'inproc' transports.
  34. NOTE: the endpoint pathname must be writable by the process. When the endpoint
  35. starts with '/', e.g., `ipc:///pathname`, this will be an _absolute_ pathname.
  36. If the endpoint specifies a directory that does not exist, the bind shall fail.
  37. NOTE: on Linux only, when the endpoint pathname starts with `@`, the abstract
  38. namespace shall be used. The abstract namespace is independent of the
  39. filesystem and if a process attempts to bind an endpoint already bound by a
  40. process, it will fail. See unix(7) for details.
  41. NOTE: IPC pathnames have a maximum size that depends on the operating system.
  42. On Linux, the maximum is 113 characters including the "ipc://" prefix (107
  43. characters for the real path name).
  44. Unbinding wild-card address from a socket
  45. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46. When wild-card `*` 'endpoint' was used in _zmq_bind()_, the caller should use
  47. real 'endpoint' obtained from the ZMQ_LAST_ENDPOINT socket option to unbind
  48. this 'endpoint' from a socket using _zmq_unbind()_.
  49. Connecting a socket
  50. ~~~~~~~~~~~~~~~~~~~
  51. When connecting a 'socket' to a peer address using _zmq_connect()_ with the
  52. 'ipc' transport, the 'endpoint' shall be interpreted as an arbitrary string
  53. identifying the 'pathname' to connect to. The 'pathname' must have been
  54. previously created within the operating system namespace by assigning it to a
  55. 'socket' with _zmq_bind()_.
  56. EXAMPLES
  57. --------
  58. .Assigning a local address to a socket
  59. ----
  60. // Assign the pathname "/tmp/feeds/0"
  61. rc = zmq_bind(socket, "ipc:///tmp/feeds/0");
  62. assert (rc == 0);
  63. ----
  64. .Connecting a socket
  65. ----
  66. // Connect to the pathname "/tmp/feeds/0"
  67. rc = zmq_connect(socket, "ipc:///tmp/feeds/0");
  68. assert (rc == 0);
  69. ----
  70. SEE ALSO
  71. --------
  72. linkzmq:zmq_bind[3]
  73. linkzmq:zmq_connect[3]
  74. linkzmq:zmq_inproc[7]
  75. linkzmq:zmq_tcp[7]
  76. linkzmq:zmq_pgm[7]
  77. linkzmq:zmq_vmci[7]
  78. linkzmq:zmq_getsockopt[3]
  79. linkzmq:zmq[7]
  80. AUTHORS
  81. -------
  82. This page was written by the 0MQ community. To make a change please
  83. read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.