HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
s
send(2) send(2)
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 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 98)
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 */
}
The supported value for cmsg_level is SOL_SOCKET, and the supported value for cmsg_type is
SCM_RIGHTS. Together they indicate the data array contains the access rights to be sent. Access rights
are supported only for AF_UNIX. Access rights are limited to file descriptors of size int. 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.
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 flag 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
forward a datagram from this socket because the datagram exceeds the MTU of
the next-hop network and the "Don’t Fragment" (DF) bit in the datagram is set.
(See SO_PMTU in getsockopt(2)).
HP-UX Release 11i: December 2000 4 Section 2297
___
___