1ZMQ_MSG_GET(3)                    0MQ Manual                    ZMQ_MSG_GET(3)
2
3
4

NAME

6       zmq_msg_get - get message property
7

SYNOPSIS

9       int zmq_msg_get (zmq_msg_t *message, int property);
10

DESCRIPTION

12       The zmq_msg_get() function shall return the value for the property
13       specified by the property argument for the message pointed to by the
14       message argument.
15
16       The following properties can be retrieved with the zmq_msg_get()
17       function:
18
19       ZMQ_MORE
20           Indicates that there are more message frames to follow after the
21           message.
22
23       ZMQ_SRCFD
24           Returns the file descriptor of the socket the message was read
25           from. This allows application to retrieve the remote endpoint via
26           getpeername(2). Be aware that the respective socket might be closed
27           already, reused even. Currently only implemented for TCP sockets.
28
29       ZMQ_SHARED
30           Indicates that a message MAY share underlying storage with another
31           copy of this message.
32

RETURN VALUE

34       The zmq_msg_get() function shall return the value for the property if
35       successful. Otherwise it shall return -1 and set errno to one of the
36       values defined below.
37

ERRORS

39       EINVAL
40           The requested property is unknown.
41

EXAMPLE

43       Receiving a multi-frame message.
44
45           zmq_msg_t frame;
46           while (true) {
47               //  Create an empty 0MQ message to hold the message frame
48               int rc = zmq_msg_init (&frame);
49               assert (rc == 0);
50               //  Block until a message is available to be received from socket
51               rc = zmq_msg_recv (socket, &frame, 0);
52               assert (rc != -1);
53               if (zmq_msg_get (&frame, ZMQ_MORE))
54                   fprintf (stderr, "more\n");
55               else {
56                   fprintf (stderr, "end\n");
57                   break;
58               }
59               zmq_msg_close (&frame);
60           }
61
62

SEE ALSO

64       zmq_msg_set(3) zmq_msg_init(3) zmq_msg_close(3) zmq(7)
65

AUTHORS

67       This page was written by the 0MQ community. To make a change please
68       read the 0MQ Contribution Policy at
69       http://www.zeromq.org/docs:contributing.
70
71
72
730MQ 4.3.4                         01/21/2023                    ZMQ_MSG_GET(3)
Impressum