This function sends data to a connected peer.
You can use this function only on connected sockets. To send
data on an unconnected socket, use the sendmsg() or sendto()
function. The send() function passes data along to its connected
peer, which can receive the data by using the recv() or read()
function.
Normally the send() function blocks if there is no space for
the incoming data in the buffer. It waits until the buffer space
becomes available. If the socket is set to nonblocking and there
is no space for the data, the send() function fails with the
EWOULDBLOCK error.
If the message is too large to be sent in one piece, and the
socket type is SOCK_DGRAM, which requires that messages be sent
in one piece, send() fails with the EMSGSIZE error.
If the address specified is an INADDR_BROADCAST address, then
the SO_BROADCAST socket option must have been set and the process
must have SYSPRV or BYPASS privilege for the I/O operation to
succeed.
A success return from the send() does not guarantee that the data
has been received by the peer. All errors (except EWOULDBLOCK)
are detected locally. To determine when it is possible to send
more data, use the select() function.
Related Functions
See also read(), recv(), recvmsg(), recvfrom(), getsockopt(),
and socket().