zmq_recv.txt 1.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
zmq_recv(3)
===========


NAME
----
zmq_recv - retrieves a message from the socket


SYNOPSIS
--------
'int zmq_recv (void *s, zmq_msg_t *msg, int flags);'


DESCRIPTION
-----------
Receive a message from the socket 's', store it in
'msg' .  Any content previously in 'msg' will be properly deallocated.  'flags'
19 20
argument can be combination of the flags described below.

21
*ZMQ_NOBLOCK*::
22 23
The flag specifies that the operation should be performed in
non-blocking mode. I.e. if it cannot be processed immediately,
24
error should be returned with 'errno' set to EAGAIN.
25

26 27 28

RETURN VALUE
------------
29
In case of success the function returns zero. Otherwise it returns -1 and
30 31 32 33 34 35
sets 'errno' to the appropriate value.


ERRORS
------
*EAGAIN*::
36
it's a non-blocking receive and there's no message available at the moment.
37
*ENOTSUP*::
38
function isn't supported by particular socket type.
39
*EFSM*::
40
function cannot be called at the moment, because socket is not in the
41
appropriate state. This error may occur with sockets that switch between
42
several states (e.g. ZMQ_REQ).
43 44 45 46 47


EXAMPLE
-------
----
48 49 50 51 52
zmq_msg_t msg;
int rc = zmq_msg_init (&msg);
assert (rc == 0);
rc = zmq_recv (s, &msg, 0);
assert (rc == 0);
53 54 55 56 57 58 59 60 61 62 63 64 65
----


SEE ALSO
--------
linkzmq:zmq_send[3]
linkzmq:zmq_msg_init[3]
linkzmq:zmq_msg_data[3]
linkzmq:zmq_msg_size[3]


AUTHOR
------
66
Martin Sustrik <sustrik at 250bpm dot com>