ZMQ\_MSG\_SET\_ROUTING\_(3) 0MQ Manual ZMQ\_MSG\_SET\_ROUTING\_(3)

# [NAME](#NAME)

zmq\_msg\_set\_routing\_id - set routing ID property on message

# [SYNOPSIS](#SYNOPSIS)

**int zmq\_msg\_set\_routing\_id (zmq\_msg\_t \*message, uint32\_t routing\_id);**

# [DESCRIPTION](#DESCRIPTION)

The *zmq\_msg\_set\_routing\_id()* function sets the *routing\_id* specified, on the the message pointed to by the *message* argument. The *routing\_id* must be greater than zero. To get a valid routing ID, you must receive a message from a *ZMQ\_SERVER* socket, and use the libzmq:zmq\_msg\_routing\_id method. Routing IDs are transient.

# [RETURN VALUE](#RETURN_VALUE)

The *zmq\_msg\_set\_routing\_id()* function shall return zero if successful. Otherwise it shall return -1 and set *errno* to one of the values defined below.

# [ERRORS](#ERRORS)

**EINVAL**

The provided *routing\_id* is zero.

# [SEE ALSO](#SEE_ALSO)

[**zmq\_msg\_routing\_id**(3)](/man/os/zeromq/zmq_msg_routing_id.3) [**zmq**(7)](/man/os/zeromq/zmq.7)

# [AUTHORS](#AUTHORS)

This page was written by the 0MQ community. To make a change please read the 0MQ Contribution Policy at **http://www.zeromq.org/docs:contributing**.

10/26/2026 0MQ 4.3.5

---

Document: zmq_msg_set_routing_id(3) from zeromq 4.3.5-r15 (Chainguard OS)
Source: https://github.com/zeromq/libzmq
