Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
recvmsg(2) OSS System Calls Reference Manual
NAME
recvmsg - Receives a message from a socket using a message structure
LIBRARY
G-series native OSS processes: system library
H-series and J-series OSS processes: implicit libraries
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
SYNOPSIS
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/socket.h>
ssize_t recvmsg(
int socket,
struct msghdr *message,
int flags);
PARAMETERS
socket Specifies the file 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_flags 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 flags 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 fit in the supplied buffer and MSG_PEEK is not set in the
6−34 Hewlett-Packard Company 527186-023