2023-10-21 01:50:38 +02:00
|
|
|
= zmq_msg_get(3)
|
2011-11-06 14:03:51 +01:00
|
|
|
|
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== NAME
|
2012-03-21 20:19:40 +01:00
|
|
|
zmq_msg_get - get message property
|
2011-11-06 14:03:51 +01:00
|
|
|
|
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== SYNOPSIS
|
2012-03-21 20:19:40 +01:00
|
|
|
*int zmq_msg_get (zmq_msg_t '*message', int 'property');*
|
2011-11-06 14:03:51 +01:00
|
|
|
|
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== DESCRIPTION
|
2012-03-21 20:19:40 +01:00
|
|
|
The _zmq_msg_get()_ function shall return the value for the property
|
|
|
|
specified by the 'property' argument for the message pointed to by the
|
|
|
|
'message' argument.
|
2011-11-06 14:03:51 +01:00
|
|
|
|
2012-03-21 20:19:40 +01:00
|
|
|
The following properties can be retrieved with the _zmq_msg_get()_ function:
|
2011-11-06 14:03:51 +01:00
|
|
|
|
|
|
|
*ZMQ_MORE*::
|
2012-03-21 20:19:40 +01:00
|
|
|
Indicates that there are more message frames to follow after the 'message'.
|
2011-11-06 14:03:51 +01:00
|
|
|
|
2014-01-07 01:09:51 +01:00
|
|
|
*ZMQ_SRCFD*::
|
2014-07-29 20:43:38 +02:00
|
|
|
Returns the file descriptor of the socket the 'message' was read from. This
|
|
|
|
allows application to retrieve the remote endpoint via 'getpeername(2)'. Be
|
|
|
|
aware that the respective socket might be closed already, reused even.
|
2014-01-07 01:09:51 +01:00
|
|
|
Currently only implemented for TCP sockets.
|
|
|
|
|
2014-07-13 01:05:49 +02:00
|
|
|
*ZMQ_SHARED*::
|
2014-07-29 20:43:38 +02:00
|
|
|
Indicates that a message MAY share underlying storage with another copy of
|
|
|
|
this message.
|
2014-07-13 01:05:49 +02:00
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== RETURN VALUE
|
2012-09-20 20:39:45 +02:00
|
|
|
The _zmq_msg_get()_ function shall return the value for the property if
|
|
|
|
successful. Otherwise it shall return `-1` and set 'errno' to one of the
|
|
|
|
values defined below.
|
2011-11-06 14:03:51 +01:00
|
|
|
|
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== ERRORS
|
2011-11-06 14:03:51 +01:00
|
|
|
*EINVAL*::
|
2012-03-21 20:19:40 +01:00
|
|
|
The requested _property_ is unknown.
|
2011-11-06 14:03:51 +01:00
|
|
|
|
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== EXAMPLE
|
2012-03-21 20:19:40 +01:00
|
|
|
.Receiving a multi-frame message
|
2011-11-06 14:03:51 +01:00
|
|
|
----
|
2013-11-04 14:15:23 +01:00
|
|
|
zmq_msg_t frame;
|
2011-11-06 14:03:51 +01:00
|
|
|
while (true) {
|
2012-03-21 20:19:40 +01:00
|
|
|
// Create an empty 0MQ message to hold the message frame
|
|
|
|
int rc = zmq_msg_init (&frame);
|
2011-11-06 14:03:51 +01:00
|
|
|
assert (rc == 0);
|
2012-02-16 01:41:09 +01:00
|
|
|
// Block until a message is available to be received from socket
|
2012-12-23 17:47:32 +01:00
|
|
|
rc = zmq_msg_recv (socket, &frame, 0);
|
2011-11-06 14:03:51 +01:00
|
|
|
assert (rc != -1);
|
2012-03-21 20:19:40 +01:00
|
|
|
if (zmq_msg_get (&frame, ZMQ_MORE))
|
2012-02-16 01:41:09 +01:00
|
|
|
fprintf (stderr, "more\n");
|
2011-11-06 14:03:51 +01:00
|
|
|
else {
|
2012-02-16 01:41:09 +01:00
|
|
|
fprintf (stderr, "end\n");
|
|
|
|
break;
|
2011-11-06 14:03:51 +01:00
|
|
|
}
|
2013-11-04 14:15:23 +01:00
|
|
|
zmq_msg_close (&frame);
|
2011-11-06 14:03:51 +01:00
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== SEE ALSO
|
2023-11-03 11:36:47 +01:00
|
|
|
* xref:zmq_msg_set.adoc[zmq_msg_set]
|
|
|
|
* xref:zmq_msg_init.adoc[zmq_msg_init]
|
|
|
|
* xref:zmq_msg_close.adoc[zmq_msg_close]
|
|
|
|
* xref:zmq.adoc[zmq]
|
2011-11-06 14:03:51 +01:00
|
|
|
|
|
|
|
|
2023-10-21 01:50:38 +02:00
|
|
|
== AUTHORS
|
2013-04-11 18:53:02 +02:00
|
|
|
This page was written by the 0MQ community. To make a change please
|
2023-11-22 23:18:23 +01:00
|
|
|
read the 0MQ Contribution Policy at <https://zeromq.org/how-to-contribute/>.
|