zmq_ctx_get_ext(3)

zmq_ctx_get_ext3

Get extended context options

Usage

int zmq_ctx_get_ext (void *context, int option_name, void *option_value, size_t *option_len);

Overview

The zmq_ctx_get() function shall retrieve the value for the option specified by the option_name argument and store it in the buffer pointed to by the option_value argument. The option_len argument is the size in bytes of the buffer pointed to by option_value; upon successful completion zmq_ctx_get_ext() shall modify the option_len argument to indicate the actual size of the option value stored in the buffer.

The zmq_ctx_get_ext() function accepts all the option names accepted by zmq_ctx_get(). Options that make most sense to retrieve using zmq_ctx_get_ext() instead of zmq_ctx_get() are:

ZMQ_THREAD_NAME_PREFIX: Get name prefix for I/O threads

The ZMQ_THREAD_NAME_PREFIX argument gets the string prefix of each thread created for the internal context’s thread pool.

Option value typecharacter string
Option value unitN/A
Default valueempty string

Return value

The zmq_ctx_get_ext() function returns a value of 0 or greater if successful. Otherwise it returns -1 and sets errno to one of the values defined below.

Errors

EINVAL

The requested option option_name is unknown.

EFAULT

The provided context is invalid.

Examples

Setting a prefix on internal ZMQ thread names:.

void *context = zmq_ctx_new ();
const char prefix[] = "MyApp";
size_t prefixLen = sizeof(prefix);
zmq_ctx_set (context, ZMQ_THREAD_NAME_PREFIX, &prefix, &prefixLen);
char buff[256];
size_t buffLen = sizeof(buff);
int rc = zmq_ctx_get (context, ZMQ_THREAD_NAME_PREFIX, &buff, &buffLen);
assert (rc == 0);
assert (buffLen == prefixLen);

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.

From zeromq 4.3.5-3 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.