zmq_msg_routing_id.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. zmq_msg_routing_id(3)
  2. =====================
  3. NAME
  4. ----
  5. zmq_msg_routing_id - return routing ID for message, if any
  6. SYNOPSIS
  7. --------
  8. *uint32_t zmq_msg_routing_id (zmq_msg_t '*message');*
  9. DESCRIPTION
  10. -----------
  11. The _zmq_msg_routing_id()_ function returns the routing ID for the message,
  12. if any. The routing ID is set on all messages received from a 'ZMQ_SERVER'
  13. socket. To send a message to a 'ZMQ_SERVER' socket you must set the routing
  14. ID of a connected 'ZMQ_CLIENT' peer. Routing IDs are transient.
  15. RETURN VALUE
  16. ------------
  17. The _zmq_msg_routing_id()_ function shall return zero if there is no routing
  18. ID, otherwise it shall return an unsigned 32-bit integer greater than zero.
  19. EXAMPLE
  20. -------
  21. .Receiving a client message and routing ID
  22. ----
  23. void *ctx = zmq_ctx_new ();
  24. assert (ctx);
  25. void *server = zmq_socket (ctx, ZMQ_SERVER);
  26. assert (server);
  27. int rc = zmq_bind (server, "tcp://127.0.0.1:8080");
  28. assert (rc == 0);
  29. zmq_msg_t message;
  30. rc = zmq_msg_init (&message);
  31. assert (rc == 0);
  32. // Receive a message from socket
  33. rc = zmq_msg_recv (server, &message, 0);
  34. assert (rc != -1);
  35. uint32_t routing_id = zmq_msg_routing_id (&message);
  36. assert (routing_id);
  37. ----
  38. SEE ALSO
  39. --------
  40. linkzmq:zmq_msg_set_routing_id[3]
  41. AUTHORS
  42. -------
  43. This page was written by the 0MQ community. To make a change please
  44. read the 0MQ Contribution Policy at <http://www.zeromq.org/docs:contributing>.