int recvmsg(int s, struct msghdr *message, int flags);
For a SOCK_STREAM socket, as much information is returned
as is currently available, up to the size of the specified buffer.
If the socket has been configured for inline reception of out-of-band
data (socket option SO_OOBINLINE) and out-of-band data is unread,
only out-of-band data is returned.
The application may use the
For SOCK_DGRAM sockets, data is extracted from the
first queued message, up to the size of the specified buffer. If
the datagram or message is larger than the specified buffer, as
much data are stored in the buffer as possible and
If from is nonzero and the socket is not connection-oriented, the network address of the peer that sent the data is copied to the corresponding structure sockaddr. The value returned by fromlen is initialized to the size of this structure and is modified on return to indicate the actual size of the address stored there.
If the socket is connection-oriented and the remote side has shut down
the connection gracefully, a
flags may be used to influence the behavior of the function invocation beyond the options specified for the associated socket. That is, the semantics of this function are determined by the socket options and the flags parameter. The latter is constructed by or-ing any of the following values:
Peek at the incoming data. The data is copied into the buffer but is not removed from the input queue.
Process out-of-band data.
Specifies a socket descriptor from which data should be received.
Points to a msghdr structure which contains both the buffer which is to contain the source address, plus the address of buffers into which the incoming message is stored. The msg_flags field is ignored.
Allows the caller to control the reception by peeking at incoming data (MSG_PEEK)or by sending or receiving out-of-band data (MSG_OOB).
s is an invalid descriptor
The virtual circuit was aborted because of a timeout or other failure.
The virtual circuit was reset by the remote host executing a hard or abortive close.
buf is an invalid pointer.
A signal interrupted the
Socket has not been bound using
bind(), or an invalid flag was specified, or len was 0 or negative.
The message was too large to be stored in the specified buffer and was truncated.
The network subsystem has failed.
The connection is broken; the remote host reset.
The socket was not connected.
s is not a socket descriptor
MSG_OOB was specified on socket that does not support out of band data.
The socket has been shut down.
The connection has been dropped because of a network failure.
s is nonblocking and
UNIX 98, with exceptions.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
bind(), connect(), ioctl(), read(), recv(), recvfrom(), send(), sendmsg(), sendto(), socket()
PTC MKS Toolkit 10.3 Documentation Build 39.