1ZMQ_MSG_INIT(3) 0MQ Manual ZMQ_MSG_INIT(3)
2
3
4
6 zmq_msg_init - initialise empty 0MQ message
7
9 int zmq_msg_init (zmq_msg_t *msg);
10
12 The zmq_msg_init() function shall initialise the message object
13 referenced by msg to represent an empty message. This function is most
14 useful when called before receiving a message with zmq_msg_recv().
15
16 Caution
17 Never access zmq_msg_t members directly, instead always use the
18 zmq_msg family of functions.
19
20 Caution
21 The functions zmq_msg_init(), zmq_msg_init_data(),
22 zmq_msg_init_size() and zmq_msg_init_buffer() are mutually
23 exclusive. Never initialise the same zmq_msg_t twice.
24
26 The zmq_msg_init() function always returns zero.
27
29 No errors are defined.
30
32 Receiving a message from a socket.
33
34 zmq_msg_t msg;
35 rc = zmq_msg_init (&msg);
36 assert (rc == 0);
37 int nbytes = zmq_msg_recv (socket, &msg, 0);
38 assert (nbytes != -1);
39
40
42 zmq_msg_init_size(3) zmq_msg_init_buffer(3) zmq_msg_init_data(3)
43 zmq_msg_close(3) zmq_msg_data(3) zmq_msg_size(3) zmq(7)
44
46 This page was written by the 0MQ community. To make a change please
47 read the 0MQ Contribution Policy at
48 http://www.zeromq.org/docs:contributing.
49
50
51
520MQ 4.3.4 01/22/2022 ZMQ_MSG_INIT(3)