TCP/IP Programming Manual
C Synopsis
#include <socket.h>
#include <netdb.h>
nsent = send (socket, buffer_ptr, buffer_length, flags);
int nsent, socket;
char *buffer_ptr;
int buffer_length, flags;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
nsent := send (socket, buffer_ptr, buffer_length, flags);
INT(32) nsent,
socket;
STRING .EXT buffer_ptr;
INT(32) buffer_length,
flags;
nsent
return value; specifies the number of bytes sent. This is the return value.
If the call is not successful, —1 is returned and the external variable errno is set as indicated
in Errors (page 167).
socket
input value; specifies the socket number for the socket, as returned by the call to socket.
buffer_ptr
input value; points to the data to be sent.
buffer_length
input value; the size of the buffer pointed to by buffer_ptr.
flags
input value; specifies the kind of data to be sent, or specifies a routing restriction. flags has
one of the following values:
Send this message only if the destination is located on the local network; do not send
the message through a gateway.
MSG_DONTROUTE
Send the data as out-of-band data. This corresponds to the TCP URG flag.MSG_OOB
Send normal data.0
Errors
If an error occurs, the external variable errno is set to one of the following values:
The send buffer is already full.EALREADY
The message was too large to be sent atomically, as required by the socket options.EMSGSIZE
The specified socket was not connected.ENOTCONN
The specified socket was shut down.ESHUTDOWN
The connection timed out.ETIMEDOUT
The connection was reset by the remote host.ECONNRESET
An invalid flags value was specified.EINVAL
send 167