1ZMQ_MSG_ROUTING_ID(3)             0MQ Manual             ZMQ_MSG_ROUTING_ID(3)
2
3
4

NAME

6       zmq_msg_routing_id - return routing ID for message, if any
7

SYNOPSIS

9       uint32_t zmq_msg_routing_id (zmq_msg_t *message);
10

DESCRIPTION

12       The zmq_msg_routing_id() function returns the routing ID for the
13       message, if any. The routing ID is set on all messages received from a
14       ZMQ_SERVER socket. To send a message to a ZMQ_SERVER socket you must
15       set the routing ID of a connected ZMQ_CLIENT peer. Routing IDs are
16       transient.
17

RETURN VALUE

19       The zmq_msg_routing_id() function shall return zero if there is no
20       routing ID, otherwise it shall return an unsigned 32-bit integer
21       greater than zero.
22

EXAMPLE

24       Receiving a client message and routing ID.
25
26           void *ctx = zmq_ctx_new ();
27           assert (ctx);
28
29           void *server = zmq_socket (ctx, ZMQ_SERVER);
30           assert (server);
31           int rc = zmq_bind (server, "tcp://127.0.0.1:8080");
32           assert (rc == 0);
33
34           zmq_msg_t message;
35           rc = zmq_msg_init (&message);
36           assert (rc == 0);
37
38           //  Receive a message from socket
39           rc = zmq_msg_recv (server, &message, 0);
40           assert (rc != -1);
41           uint32_t routing_id = zmq_msg_routing_id (&message);
42           assert (routing_id);
43
44

SEE ALSO

46       zmq_msg_set_routing_id(3)
47

AUTHORS

49       This page was written by the 0MQ community. To make a change please
50       read the 0MQ Contribution Policy at
51       http://www.zeromq.org/docs:contributing.
52
53
54
550MQ 4.3.4                         07/23/2021             ZMQ_MSG_ROUTING_ID(3)
Impressum