ZMQ_MSG_GET(3)
π ZMQ_MSG_GET(3) π
okay so bestie, welcome to zmq_msg_get β it's a page from the 0MQ Manual and honestly? it's giving "tiny function, big secrets". let's get into it π«Ά
β¨ NAME β¨
zmq_msg_get β get message property π
β¨ SYNOPSIS β¨
int zmq_msg_get (zmq_msg_t *message, int property);
β¨ DESCRIPTION β¨
so like. the zmq_msg_get() function shall return the value for the property you ask for β you name that property in the property argument β for the message that the message argument is pointing at. that's it. that's the whole vibe. πΈ
here are the properties you can pull out with zmq_msg_get(), no cap:
ZMQ_MORE π
indicates that there are more message frames to follow after the message. like, this is not the last one, keep going, there's more where that came from.
ZMQ_SRCFD π₯
returns the file descriptor of the socket the message was read from. this lets your application retrieve the remote endpoint via getpeername(2) β iconic. but bestie, be aware: the respective socket might already be closed, or even reused π (reused! the audacity). currently only implemented for TCP sockets.
ZMQ_SHARED π¦
indicates that a message MAY share underlying storage with another copy of this message. "may" is doing a lot of heavy lifting here β it's not a promise, it's a possibility. periodt.
β¨ RETURN VALUE β¨
if everything slays, zmq_msg_get() shall return the value for the property. otherwise? it shall return -1 and set errno to one of the values defined below. π
β¨ ERRORS β¨
EINVALβ the requested property is unknown. like, you asked for a property that doesn't exist. it's not them, it's you.
β¨ EXAMPLE β¨
receiving a multi-frame message π (this is the main character scenario fr fr):
zmq_msg_t frame;
while (true) {
// Create an empty 0MQ message to hold the message frame
int rc = zmq_msg_init (&frame);
assert (rc == 0);
// Block until a message is available to be received from socket
rc = zmq_msg_recv (socket, &frame, 0);
assert (rc != -1);
if (zmq_msg_get (&frame, ZMQ_MORE))
fprintf (stderr, "more\n");
else {
fprintf (stderr, "end\n");
break;
}
zmq_msg_close (&frame);
}
β¨ SEE ALSO β¨
zmq_msg_set(3) zmq_msg_init(3) zmq_msg_close(3) zmq(7) π
β¨ AUTHORS β¨
this page was written by the 0MQ community π«Ά if you wanna make a change, please read the 0MQ Contribution Policy at http://www.zeromq.org/docs:contributing β they'd love to have you, fr.
okay and that's the whole page bestie, tysm for reading π this was the 0MQ 4.3.5 version, dated 10/09/2023, and honestly it ate. go forth and get those message properties. 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