summaryrefslogtreecommitdiff
path: root/doc/zmq_recv.3
diff options
context:
space:
mode:
Diffstat (limited to 'doc/zmq_recv.3')
-rw-r--r--doc/zmq_recv.3122
1 files changed, 122 insertions, 0 deletions
diff --git a/doc/zmq_recv.3 b/doc/zmq_recv.3
new file mode 100644
index 0000000..e15d47c
--- /dev/null
+++ b/doc/zmq_recv.3
@@ -0,0 +1,122 @@
+'\" t
+.\" Title: zmq_recv
+.\" Author: [see the "AUTHORS" section]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Date: 10/14/2014
+.\" Manual: 0MQ Manual
+.\" Source: 0MQ 4.0.5
+.\" Language: English
+.\"
+.TH "ZMQ_RECV" "3" "10/14/2014" "0MQ 4\&.0\&.5" "0MQ Manual"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+zmq_recv \- receive a message part from a socket
+.SH "SYNOPSIS"
+.sp
+\fBint zmq_recv (void \fR\fB\fI*socket\fR\fR\fB, void \fR\fB\fI*buf\fR\fR\fB, size_t \fR\fB\fIlen\fR\fR\fB, int \fR\fB\fIflags\fR\fR\fB);\fR
+.SH "DESCRIPTION"
+.sp
+The \fIzmq_recv()\fR function shall receive a message from the socket referenced by the \fIsocket\fR argument and store it in the buffer referenced by the \fIbuf\fR argument\&. Any bytes exceeding the length specified by the \fIlen\fR argument shall be truncated\&. If there are no messages available on the specified \fIsocket\fR the \fIzmq_recv()\fR function shall block until the request can be satisfied\&. The \fIflags\fR argument is a combination of the flags defined below:
+.PP
+\fBZMQ_DONTWAIT\fR
+.RS 4
+Specifies that the operation should be performed in non\-blocking mode\&. If there are no messages available on the specified
+\fIsocket\fR, the
+\fIzmq_recv()\fR
+function shall fail with
+\fIerrno\fR
+set to EAGAIN\&.
+.RE
+.SS "Multi\-part messages"
+.sp
+A 0MQ message is composed of 1 or more message parts\&. 0MQ ensures atomic delivery of messages: peers shall receive either all \fImessage parts\fR of a message or none at all\&. The total number of message parts is unlimited except by available memory\&.
+.sp
+An application that processes multi\-part messages must use the \fIZMQ_RCVMORE\fR \fBzmq_getsockopt\fR(3) option after calling \fIzmq_recv()\fR to determine if there are further parts to receive\&.
+.SH "RETURN VALUE"
+.sp
+The \fIzmq_recv()\fR function shall return number of bytes in the message if successful\&. Note that the value can exceed the value of the \fIlen\fR parameter in case the message was truncated\&. If not successful the function shall return \-1 and set \fIerrno\fR to one of the values defined below\&.
+.SH "ERRORS"
+.PP
+\fBEAGAIN\fR
+.RS 4
+Non\-blocking mode was requested and no messages are available at the moment\&.
+.RE
+.PP
+\fBENOTSUP\fR
+.RS 4
+The
+\fIzmq_recv()\fR
+operation is not supported by this socket type\&.
+.RE
+.PP
+\fBEFSM\fR
+.RS 4
+The
+\fIzmq_recv()\fR
+operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state\&. This error may occur with socket types that switch between several states, such as ZMQ_REP\&. See the
+\fImessaging patterns\fR
+section of
+\fBzmq_socket\fR(3)
+for more information\&.
+.RE
+.PP
+\fBETERM\fR
+.RS 4
+The 0MQ
+\fIcontext\fR
+associated with the specified
+\fIsocket\fR
+was terminated\&.
+.RE
+.PP
+\fBENOTSOCK\fR
+.RS 4
+The provided
+\fIsocket\fR
+was invalid\&.
+.RE
+.PP
+\fBEINTR\fR
+.RS 4
+The operation was interrupted by delivery of a signal before a message was available\&.
+.RE
+.SH "EXAMPLE"
+.PP
+\fBReceiving a message from a socket\fR.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+char buf [256];
+nbytes = zmq_recv (socket, buf, 256, 0);
+assert (nbytes != \-1);
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.SH "SEE ALSO"
+.sp
+\fBzmq_send\fR(3) \fBzmq_getsockopt\fR(3) \fBzmq_socket\fR(7) \fBzmq\fR(7)
+.SH "AUTHORS"
+.sp
+This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&.