HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)

s
send(2) send(2)
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 of ancillary data to send 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 sent. Access rights are supported only for AF_UNIX. Access rights are lim-
ited 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.
The msg_flags member is ignored.
X/Open Sockets Compilation Environment
See xopen_networking(7).
RETURN VALUE
send(), sendmsg(), and sendto() return the following values:
n Successful completion. n is the number of bytes sent.
1 Failure. errno is set to indicate the error.
ERRORS
If send(), sendmsg(),orsendto() fails, errno is set to one of the following values.
[EACCES] Process doing a send() of a broadcast packet does not have broadcast capabil-
ity enabled for the socket. Use setsockopt() to enable broadcast capability.
[EAFNOSUPPORT] The specified address is not a valid address for the address family of this socket.
[EAGAIN] Nonblocking I/O is enabled using the O_NONBLOCK ag with fcntl(), and
the requested operation would block, or the socket has an error that was set
asynchronously. An asynchronous error can be caused by a gateway failing to
HP-UX 11i Version 3: February 2007 4 Hewlett-Packard Company 379