HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)
r
recv(2) recv(2)
• The MSG_PEEK flag is supported; the two flags can be combined.
• If a message is received that is larger than the user-controlled maximum message size, the X.25 sub-
system RESETs the circuit, discards the data, and sends the out-of-band event
OOB_VC_MESSAGE_TOO_BIG
to the socket.
X/Open Sockets Only
For
X/Open Sockets, the
msghdr structure has the following form:
(UNIX 03)
struct msghdr {
void *msg_name; /* optional address */
socklen_t msg_namelen; /* size of address */
struct iovec *msg_iov; /* scatter array for data */
int msg_iovlen; /* # of elements in msg_iov */
void *msg_control; /* ancillary data, see below */
socklen_t msg_controllen; /* ancillary data buffer len */
int msg_flags; /* flags on received message */
}
Obsolescent (UNIX 95)
struct msghdr {
void *msg_name; /* optional address */
size_t msg_namelen; /* size of address */
struct iovec *msg_iov; /* scatter array for data */
int msg_iovlen; /* # of elements in msg_iov */
void *msg_control; /* ancillary data, see below */
size_t msg_controllen; /* ancillary data buffer len */
int msg_flags; /* flags on received message */
}
msg_control specifies a buffer to receive any ancillary data sent along with the message. Ancillary data
consists of a sequence of pairs, each consisting of a cmsghdr structure followed by a data array. The data
array contains the ancillary data message, and the cmsghdr structure contains descriptive information
that allows an application to correctly parse the data. cmsghdr has the following structure:
(UNIX 03)
struct cmsghdr {
socklen_t cmsg_len; /* data byte count, including hdr*/
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
}
Obsolescent (UNIX 95)
struct cmsghdr {
size_t cmsg_len; /* data byte count, including hdr*/
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
}
If the cmsg_level is SOL_SOCKET, and cmsg_type is SCM_RIGHTS, then it indicates that the data array
contains the access rights to be received. Access rights are supported only for AF_UNIX. Access rights are
limited to file descriptors of size int.
If the cmsg_level is IPPROTO_IPV6 , then cmsg_type must be one of the supported types:
IPV6_PKTINFO , IPV6_HOPLIMIT, IPV6_NEXTHOP , IPV6_RTHDR, IPV6_HOPOPTS ,
IPV6_DSTOPTS or IPV6_RTHDRDSTOPTS. (See description in IPv6(7P)).
If ancillary data are not being transferred, set the msg_control field to NULL, and set the msg_controllen
field to 0.
338 Hewlett-Packard Company − 4 − HP-UX 11i Version 3: February 2007