zmq_msg_init.txt 1.26 KB
Newer Older
1 2 3 4 5 6
zmq_msg_init(3)
===============


NAME
----
Martin Lucina's avatar
Martin Lucina committed
7
zmq_msg_init - initialise empty 0MQ message
8 9 10 11


SYNOPSIS
--------
Martin Lucina's avatar
Martin Lucina committed
12
*int zmq_msg_init (zmq_msg_t '*msg');*
13 14 15 16


DESCRIPTION
-----------
Martin Lucina's avatar
Martin Lucina committed
17 18
The _zmq_msg_init()_ function shall initialise the message object referenced by
'msg' to represent an empty message.  This function is most useful when called
19
before receiving a message with _zmq_msg_recv()_.
Martin Lucina's avatar
Martin Lucina committed
20 21 22

CAUTION: Never access 'zmq_msg_t' members directly, instead always use the
_zmq_msg_ family of functions.
23

24
CAUTION: The functions _zmq_msg_init()_, _zmq_msg_init_data()_ and
25
_zmq_msg_init_size()_ are mutually exclusive. Never initialise the same
26 27
'zmq_msg_t' twice.

28 29 30

RETURN VALUE
------------
31
The _zmq_msg_init()_ function always returns zero.
32 33 34 35 36 37 38 39 40


ERRORS
------
No errors are defined.


EXAMPLE
-------
Martin Lucina's avatar
Martin Lucina committed
41
.Receiving a message from a socket
42 43 44 45
----
zmq_msg_t msg;
rc = zmq_msg_init (&msg);
assert (rc == 0);
46
int nbytes = zmq_msg_recv (socket, &msg, 0);
Dahko's avatar
Dahko committed
47
assert (nbytes != -1);
48 49 50 51 52 53 54
----


SEE ALSO
--------
linkzmq:zmq_msg_init_size[3]
linkzmq:zmq_msg_init_data[3]
Martin Lucina's avatar
Martin Lucina committed
55
linkzmq:zmq_msg_close[3]
56 57
linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]
Martin Lucina's avatar
Martin Lucina committed
58
linkzmq:zmq[7]
59 60


61 62
AUTHORS
-------
63 64
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>.