zmq_inproc.txt 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. zmq_inproc(7)
  2. =============
  3. NAME
  4. ----
  5. zmq_inproc - 0MQ local in-process (inter-thread) communication transport
  6. SYNOPSIS
  7. --------
  8. The in-process transport passes messages via memory directly between threads
  9. sharing a single 0MQ 'context'.
  10. NOTE: No I/O threads are involved in passing messages using the 'inproc'
  11. transport. Therefore, if you are using a 0MQ 'context' for in-process messaging
  12. only you can initialise the 'context' with zero I/O threads. See
  13. linkzmq:zmq_init[3] for details.
  14. ADDRESSING
  15. ----------
  16. A 0MQ endpoint is a string consisting of a 'transport'`://` followed by an
  17. 'address'. The 'transport' specifies the underlying protocol to use. The
  18. 'address' specifies the transport-specific address to connect to.
  19. For the in-process transport, the transport is `inproc`, and the meaning of
  20. the 'address' part is defined below.
  21. Assigning a local address to a socket
  22. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  23. When assigning a local address to a 'socket' using _zmq_bind()_ with the
  24. 'inproc' transport, the 'endpoint' shall be interpreted as an arbitrary string
  25. identifying the 'name' to create. The 'name' must be unique within the 0MQ
  26. 'context' associated with the 'socket' and may be up to 256 characters in
  27. length. No other restrictions are placed on the format of the 'name'.
  28. Connecting a socket
  29. ~~~~~~~~~~~~~~~~~~~
  30. When connecting a 'socket' to a peer address using _zmq_connect()_ with the
  31. 'inproc' transport, the 'endpoint' shall be interpreted as an arbitrary string
  32. identifying the 'name' to connect to. Before version 4.0 he 'name' must have
  33. been previously created by assigning it to at least one 'socket' within the
  34. same 0MQ 'context' as the 'socket' being connected. Since version 4.0 the
  35. order of _zmq_bind()_ and _zmq_connect()_ does not matter just like for the tcp
  36. transport type.
  37. EXAMPLES
  38. --------
  39. .Assigning a local address to a socket
  40. ----
  41. // Assign the in-process name "#1"
  42. rc = zmq_bind(socket, "inproc://#1");
  43. assert (rc == 0);
  44. // Assign the in-process name "my-endpoint"
  45. rc = zmq_bind(socket, "inproc://my-endpoint");
  46. assert (rc == 0);
  47. ----
  48. .Connecting a socket
  49. ----
  50. // Connect to the in-process name "#1"
  51. rc = zmq_connect(socket, "inproc://#1");
  52. assert (rc == 0);
  53. // Connect to the in-process name "my-endpoint"
  54. rc = zmq_connect(socket, "inproc://my-endpoint");
  55. assert (rc == 0);
  56. ----
  57. SEE ALSO
  58. --------
  59. linkzmq:zmq_bind[3]
  60. linkzmq:zmq_connect[3]
  61. linkzmq:zmq_ipc[7]
  62. linkzmq:zmq_tcp[7]
  63. linkzmq:zmq_pgm[7]
  64. linkzmq:zmq_vmci[7]
  65. linkzmq:zmq[7]
  66. AUTHORS
  67. -------
  68. This page was written by the 0MQ community. To make a change please
  69. read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.