Open System Services System Calls Reference Manual (G06.25+, H06.03+)
send(2) OSS System Calls Reference Manual
NAME
send - Sends a message on a connected socket
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/socket.h>
ssize_t send(
int socket,
const void *buffer,
size_t length,
int flags
);
PARAMETERS
socket Specifies the file descriptor of the socket.
buffer Points to the buffer containing the message to send.
length Specifies the length in bytes of the message to send.
flags Is a value that controls message transmission. The value of the flags parameter
is formed by bitwise ORing zero or more of the following values:
MSG_DONTROUTE
Sends without using routing tables. (Not recommended, use for
debugging purposes only.)
MSG_OOB Sends out-of-band data on sockets that support out-of-band com-
munications.
DESCRIPTION
The send() function begins transmission of a message to a peer socket. The send( ) function
sends a message only when the socket is connected.
The length of the message to be sent is specified by the length parameter. If the message is too
long to pass through the underlying protocol, the send( ) function fails and does not transmit the
message.
Successful completion of a call to send() does not imply successful delivery of the message. A
return value of -1 indicates only locally detected errors.
If the sending socket has no space to hold the message to be transmitted and the socket’s file
descriptor is blocking (O_NONBLOCK is not set), the send( ) function blocks until space is
available. If the sending socket has no space to hold the message to be transmitted and the
socket’s file descriptor is marked nonblocking (O_NONBLOCK is set), the send() function fails
and sets errno to [EWOULDBLOCK].
NOTES
When data can be sent, a call to the select() function indicates that the file descriptor for the
socket is ready for writing.
Calling the send( ) function with a flags parameter of 0 (zero) is identical to calling the write()
function.
7−22 Hewlett-Packard Company 527186-003