blob: ef7c3b91c42fcd8e028c3b37da8538f23ec5defb [file] [log] [blame]
sp_recvmsg(3)
=============
NAME
----
sp_recvmsg - receive a pre-allocated message
SYNOPSIS
--------
*#include <sp/sp.h>*
*int sp_recvmsg (int 's', void **msg, int 'flags');*
DESCRIPTION
-----------
Receive a message from the socket 's' and store the pointer to the buffer into
'msg' argument. If successful, the returned buffer has to be later deallocated
using linknanomsg:sp_freemsg[3] function.
The 'flags' argument is a combination of the flags defined below:
*SP_DONTWAIT*::
Specifies that the operation should be performed in non-blocking mode. If the
message cannot be received straight away, the function will fail with 'errno'
set to EAGAIN.
RETURN VALUE
------------
If the function succeeds number of bytes in the message is returned. Otherwise,
negative number is returned and 'errno' is set to to one of the values defined
below.
ERRORS
------
*EFAULT*::
The library is not initialised.
*EBADF*::
The provided socket is invalid.
*ENOTSUP*::
The operation is not supported by this socket type.
*EFSM*::
The operation cannot be performed on this socket at the moment because socket is
not in the appropriate state. This error may occur with socket types that
switch between several states.
*EAGAIN*::
Non-blocking mode was requested and there's no message to receive at the moment.
*EINTR*::
The operation was interrupted by delivery of a signal before the message was
received.
*ETIMEDOUT*::
Individual socket types may define their own specific timeouts. If such timeout
is hit this error will be returned.
*ETERM*::
The library is terminating.
EXAMPLE
-------
----
void *msg;
sp_recvmsg (s, &msg, 0);
sp_freemsg (msg);
----
SEE ALSO
--------
linknanomsg:sp_recv[3]
linknanomsg:sp_allocmsg[3]
linknanomsg:sp_freemsg[3]
linknanomsg:sp_sendmsg[3]
linknanomsg:nanomsg[7]
AUTHORS
-------
Martin Sustrik <sustrik@250bpm.com>