Node:Sending Data, Next:Receiving Data, Up:Transferring Data
The send
function is declared in the header file
sys/socket.h
. If your flags argument is zero, you can just
as well use write
instead of send
; see I/O Primitives. If the socket was connected but the connection has broken,
you get a SIGPIPE
signal for any use of send
or
write
(see Miscellaneous Signals).
int send (int socket, void *buffer, size_t size, int flags) | Function |
The send function is like write , but with the additional
flags flags. The possible values of flags are described
in Socket Data Options.
This function returns the number of bytes transmitted, or Note, however, that a successful return value merely indicates that the message has been sent without error, not necessarily that it has been received without error. The following
This function is defined as a cancellation point in multi-threaded programs, so one has to be prepared for this and make sure that allocated resources (like memory, files descriptors, semaphores or whatever) are freed even if the thread is canceled. |