Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (r) recvmsg(2)
NAME
recvmsg - Receives a message from a socket using a message structure
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/socket.h>
ssize_t recvmsg(
int socket,
struct msghdr *message,
int ags
);
PARAMETERS
socket Species the le descriptor of the socket.
message Points to a msghdr structure containing both the buffer to store the source
address and the buffers for the incoming message. The length and format of the
address depend on the address family for the socket. The msg_ags member of
the structure is ignored on input but might contain meaningful values on output.
For:
AF_INET sockets
A pointer in msghdr to the address structure sockaddr_in must
be cast as a struct sockaddr.
AF_INET6 sockets
A pointer to the address structure sockaddr_in6 must be cast as
a struct sockaddr.
AF_UNIX sockets
A pointer to the address structure sockaddr_un must be cast as a
struct sockaddr.
flags Is a value that controls message reception. The value of the ags parameter is
formed by bitwise ORing zero or more of the following values:
MSG_OOB Requests out-of-band data.
MSG_PEEK Peeks at an incoming message. The data is treated as unread,
and the next call to the recvmsg() function (or a similar func-
tion) will still return this data.
DESCRIPTION
The recvmsg() function receives messages from a connection-oriented or connectionless socket
using the msghdr structure. The recvmsg() function is normally used with connectionless sock-
ets because it includes parameters that permit a calling program to retrieve the source address of
the received data.
For message-based sockets (sockets of type SOCK_DGRAM), the entire message must be read
in one call. If a message is too long to t in the supplied buffer and MSG_PEEK is not set in the
ags parameter, the excess bytes are discarded, and MSG_TRUNC is set in the msg_ags eld
of the msghdr structure.
For stream-based sockets (sockets of type SOCK_STREAM), message boundaries are ignored.
For such sockets, data is returned as soon as it becomes available; no data is discarded.
527186-003 Hewlett-Packard Company 619