Transmit a message to another socket.
The send
call may be used only when the socket is in a connected state (so that the intended recipient is known). The only difference between send
and write
is the presence of flags. With a zero flags argument, send
is equivalent to write
. Also, the following call
send(sockfd, buf, len, flags);
is equivalent to
sendto(sockfd, buf, len, flags, NULL, 0);
There is no indication of failure to deliver.
When the message does not fit into the send buffer of the socket, send
normally blocks, unless the socket has been placed in nonblocking I/O mode. In nonblocking mode it would fail with SendError.WouldBlock
. The select
call may be used to determine when it is possible to send more data.