~ubuntu-branches/ubuntu/saucy/zeromq3/saucy

« back to all changes in this revision

Viewing changes to doc/zmq_recv.txt

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-06-04 21:21:09 UTC
  • Revision ID: package-import@ubuntu.com-20120604212109-b7b3m0rn21o8oo2q
Tags: upstream-3.1.0~beta+dfsg
ImportĀ upstreamĀ versionĀ 3.1.0~beta+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
zmq_recv(3)
 
2
===========
 
3
 
 
4
 
 
5
NAME
 
6
----
 
7
zmq_recv - receive a message part from a socket
 
8
 
 
9
 
 
10
SYNOPSIS
 
11
--------
 
12
*int zmq_recv (void '*socket', void '*buf', size_t 'len', int 'flags');*
 
13
 
 
14
 
 
15
DESCRIPTION
 
16
-----------
 
17
The _zmq_recv()_ function shall receive a message from the socket referenced
 
18
by the 'socket' argument and store it in the buffer referenced by the 'buf'
 
19
argument. Any bytes exceeding the length specified by the 'len' argument shall
 
20
be truncated. If there are no messages available on the specified 'socket'
 
21
the _zmq_recv()_ function shall block until the request can be satisfied.
 
22
The 'flags' argument is a combination of the flags defined below:
 
23
 
 
24
*ZMQ_DONTWAIT*::
 
25
Specifies that the operation should be performed in non-blocking mode. If there
 
26
are no messages available on the specified 'socket', the _zmq_recv()_
 
27
function shall fail with 'errno' set to EAGAIN.
 
28
 
 
29
 
 
30
Multi-part messages
 
31
~~~~~~~~~~~~~~~~~~~
 
32
A 0MQ message is composed of 1 or more message parts. Each message
 
33
part is an independent 'zmq_msg_t' in its own right. 0MQ ensures atomic
 
34
delivery of messages; peers shall receive either all _message parts_ of a
 
35
message or none at all. The total number of message parts is unlimited except
 
36
by available memory.
 
37
 
 
38
An application that processes multipart messages must use the _ZMQ_RCVMORE_
 
39
linkzmq:zmq_getsockopt[3] option after calling _zmq_recv()_ to determine if
 
40
there are further parts to receive.
 
41
 
 
42
RETURN VALUE
 
43
------------
 
44
The _zmq_recv()_ function shall return number of bytes in the message
 
45
if successful. Note that the value can exceed the value of the 'len' parameter
 
46
in case the message was truncated. If not successful the function shall return
 
47
`-1` and set 'errno' to one of the values defined below.
 
48
 
 
49
 
 
50
ERRORS
 
51
------
 
52
*EAGAIN*::
 
53
Non-blocking mode was requested and no messages are available at the moment.
 
54
*ENOTSUP*::
 
55
The _zmq_recv()_ operation is not supported by this socket type.
 
56
*EFSM*::
 
57
The _zmq_recv()_ operation cannot be performed on this socket at the moment
 
58
due to the socket not being in the appropriate state.  This error may occur with
 
59
socket types that switch between several states, such as ZMQ_REP.  See the
 
60
_messaging patterns_ section of linkzmq:zmq_socket[3] for more information.
 
61
*ETERM*::
 
62
The 0MQ 'context' associated with the specified 'socket' was terminated.
 
63
*ENOTSOCK*::
 
64
The provided 'socket' was invalid.
 
65
*EINTR*::
 
66
The operation was interrupted by delivery of a signal before a message was
 
67
available.
 
68
 
 
69
 
 
70
EXAMPLE
 
71
-------
 
72
.Receiving a message from a socket
 
73
----
 
74
char buf [256];
 
75
nbytes = zmq_recv (socket, buf, 256, 0);
 
76
assert (nbytes != -1);
 
77
----
 
78
 
 
79
 
 
80
SEE ALSO
 
81
--------
 
82
linkzmq:zmq_recvmsg[3]
 
83
linkzmq:zmq_send[3]
 
84
linkzmq:zmq_sendmsg[3]
 
85
linkzmq:zmq_getsockopt[3]
 
86
linkzmq:zmq_socket[7]
 
87
linkzmq:zmq[7]
 
88
 
 
89
 
 
90
AUTHORS
 
91
-------
 
92
+This man page was written by Martin Sustrik <sustrik@250bpm.com>, Martin
 
93
+Lucina <martin@lucina.net> and Pieter Hintjens <ph@imatix.com>.
 
94