ZMQ_CTX_GET(3)
π ZMQ_CTX_GET β get context options β¨
okay bestie so this is a page from the 0MQ Manual (yes, the whole manual, we're doing the whole thing) and it's literally about peeking at your context's settings. no cap.
πΈ SYNOPSIS πΈ
int zmq_ctx_get (void *context, int option_name);
π DESCRIPTION π
The zmq_ctx_get() function shall return the option specified by the option_name argument. that's it. that's the whole vibe. you hand it a name, it hands you the tea. π
The zmq_ctx_get() function accepts the following option names:
π¦ ZMQ_IO_THREADS: Get number of I/O threads
The ZMQ_IO_THREADS argument returns the size of the 0MQ thread pool for this context. like, how many little worker bees this context has. π
π¦ ZMQ_MAX_SOCKETS: Get maximum number of sockets
The ZMQ_MAX_SOCKETS argument returns the maximum number of sockets allowed for this context.
π¦ ZMQ_MAX_MSGSZ: Get maximum message size
The ZMQ_MAX_MSGSZ argument returns the maximum size of a message allowed for this context. Default value is INT_MAX. (yes, that's the big one. huge. iconic.)
π¦ ZMQ_ZERO_COPY_RECV: Get message decoding strategy
The ZMQ_ZERO_COPY_RECV argument return whether message decoder uses a zero copy strategy when receiving messages. Default value is 1.
NOTE: in DRAFT state, not yet available in stable releases. so like, it's in its experimental era. don't come for me if it's not there yet. π
π¦ ZMQ_SOCKET_LIMIT: Get largest configurable number of sockets
The ZMQ_SOCKET_LIMIT argument returns the largest number of sockets that zmq_ctx_set(3) will accept. it's the ceiling, the final boss, the absolute most.
π¦ ZMQ_IPV6: Set IPv6 option
The ZMQ_IPV6 argument returns the IPv6 option for the context.
(and yes bestie, the heading literally says "Set" even though we're getting. that's not me, that's the source. I'm just the messenger. π)
π¦ ZMQ_BLOCKY: Get blocky setting
The ZMQ_BLOCKY argument returns 1 if the context will block on terminate, zero if the "block forever on context termination" gambit was disabled by setting ZMQ_BLOCKY to false on all new contexts. the gambit!! disarmed!! π₯
π¦ ZMQ_THREAD_SCHED_POLICY: Get scheduling policy for I/O threads
The ZMQ_THREAD_SCHED_POLICY argument returns the scheduling policy for internal context's thread pool.
π¦ ZMQ_THREAD_NAME_PREFIX: Get name prefix for I/O threads
The ZMQ_THREAD_NAME_PREFIX argument gets the numeric prefix of each thread created for the internal context's thread pool. so you can tell your threads apart in top. very main character of them. π
π¦ ZMQ_MSG_T_SIZE: Get the zmq_msg_t size at runtime
The ZMQ_MSG_T_SIZE argument returns the size of the zmq_msg_t structure at runtime, as defined in the include/zmq.h public header. This is useful for example for FFI bindings that can't simply do a sizeof(). shoutout to the FFI girlies who can't cheat with a compile-time sizeof(), this one's for you π«Ά
β RETURN VALUE β
The zmq_ctx_get() function returns a value of 0 or greater if successful. Otherwise it returns -1 and sets errno to one of the values defined below.
so: happy path = 0 or up. sad path = -1 and go check errno. that's the whole situation. π
π ERRORS π
EINVALβ The requested option option_name is unknown. you asked for a thing that does not exist. it's giving "who is she". πEFAULTβ The provided context is invalid. that context is not real bestie, it's not passing the vibe check. π
π EXAMPLE π
Setting a limit on the number of sockets.
void *context = zmq_ctx_new ();
zmq_ctx_set (context, ZMQ_MAX_SOCKETS, 256);
int max_sockets = zmq_ctx_get (context, ZMQ_MAX_SOCKETS);
assert (max_sockets == 256);
Switching off the context deadlock gambit.
zmq_ctx_set (ctx, ZMQ_BLOCKY, false);
π SEE ALSO π
go read those too, bestie, they're part of the lore. π
π 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.
like, the whole community wrote this. it takes a village. π«Ά
and that's the page bestie!! β¨ this one's from 0MQ 4.3.5, dated 10/09/2023, and it lives in section 3 of the manual β so when you cite it, it's zmq_ctx_get(3). mwah π
π
π¦ where this page comes from
- epel 10: zeromq 4.3.5-18.el10_0 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 43: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 43: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 44: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- fedora 44: zeromq 4.3.5-22.fc43 Β· MPL-2.0 AND BSD-3-Clause AND MIT
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- opensuse-leap 16.0: zeromq-devel 4.3.5-160000.2.2 Β· MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms