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)
If the O_NDELAY flag is set using fcntl() (defined in <sys/fcntl.h> and explained in fcntl(2) and
fcntl(5)), nonblocking I/O is enabled. In this case, the send() request completes in one of three ways:
If there is enough space available in the system to buffer all of the data, send() completes suc-
cessfully, having written out all of the data, and returns the number of bytes written.
If there is not enough space in the buffer to write out the entire request, send() completes suc-
cessfully, having written as much data as possible, and returns the number of bytes it was able to
write.
If there is no space in the system to buffer any of the data, send() completes successfully, having
written no data, and returns 0.
If the O_NDELAY flag is cleared using fcntl(), nonblocking I/O is disabled. In this case, the send()
always executes completely (blocking as necessary) and returns the number of bytes written.
Since the fcntl() O_NONBLOCK and O_NDELAY flags and ioctl() FIOSNBIO requests are sup-
ported, the following clarifies on how these features interact. If the O_NONBLOCK or O_NDELAY flag has
been set, send() requests behave accordingly, regardless of any FIOSNBIO requests. If neither the
O_NONBLOCK flag nor the O_NDELAY flag has been set, FIOSNBIO requests control the behavior of
send().
By default nonblocking I/O is disabled.
The supported values for flags are zero or MSG_OOB (to send out-of-band data). A write() call made to
a socket behaves in exactly the same way as
send() with flags set to zero. MSG_OOB is not supported for
AF_UNIX or AF_VME_LINK sockets.
select(2) can be used to determine when it is possible to send more data.
AF_CCITT Only
Sockets of the address family AF_CCITT operate in message mode. Although they are specified as
connection-based (SOCK_STREAM) sockets, the X.25 subsystem communicates via messages. They require
that a connection be established with the
connect() or accept() calls.
The O_NDELAY flag is not supported. Use FIOSNBIO requests to control nonblocking I/O. If the avail-
able buffer space is not large enough for the entire message and the socket is in nonblocking mode,
errno
is set to [EWOULDBLOCK]. If the amount of data in the
send() exceeds the maximum outbound mes-
sage size,
errno is set to [EMSGSIZE].
The sendto() call is not supported.
Each call sends either a complete or a partial X.25 message. This is controlled by the setting of the More-
Data-To-Follow (MDTF) bit. If the user wants to send a partial message, MDTF should be set to 1 before
the send() call. The MDTF bit should be cleared to 0 before sending the final message fragment.
Message fragment length may range from 0 bytes up to the size of the socket’s send buffer (see
af_ccitt(7F)). The MDTF bit and multiple send() calls can be combined to transmit complete X.25 packet
sequences (i.e., zero or more DATA packets in which the More Data bit is set, followed by one DATA packet
in which the More Data bit is clear) of arbitrary length. Note that a 0-byte message is not actually sent,
but may be necessary to flush a complete X.25 message if the user is controlling the MDTF bit.
Sockets of the AF_CCITT address family can send 1 byte of out-of-band data (known as an INTERRUPT
data packet in X.25 terminology), or up to 32 bytes if the X.25 interface is configured for 1984 CCITT X.25
recommendations. INTERRUPT data packets sent in blocking mode cause the process to block until
confirmation is received. INTERRUPT data packets sent with the socket in nonblocking mode do not cause
the process to block; instead, an out-of-band message is queued to the socket when the INTERRUPT
confirmation packet is received (see recv(2)).
_XOPEN_SOURCE_EXTENDED Only
For X/Open Sockets, the msghdr structure has the following form:
(UNIX 98)
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 */
Section 2296 3 HP-UX Release 11i: December 2000
___
___