send(2) SDK R4.11 send(2)
NAME
send - send a message from a socket
SYNOPSIS
#include <sys/socket.h>
int send (s, msg, len, userflags)
int s;
const void * msg;
int len;
int userflags;
where:
s File descriptor of the socket to send message from
msg Message buffer
len Length of message (in bytes)
userflags Flags to use when sending
DESCRIPTION
Send transmits a message to another socket. Send can be used only
when the socket is connected.
The length of the message is given by the len argument. If the
message is too long to pass atomically through the underlying
protocol, then the error EMSGSIZE is returned, and the message is not
transmitted.
No indication of failure to deliver is implicit in a send. Return
values of -1 indicate some locally detected errors.
If no message space is available at the socket to hold the message to
be transmitted, then send normally blocks, unless the socket has been
placed in non-blocking I/O mode. The select call determines when you
may send more data.
The userflags parameter may be set to SOF_OOB to send out-of-band
data on sockets that support this notion (e.g., SOCK_STREAM).
ACCESS CONTROL
None.
RETURN VALUE
1..len Completed successfully. The call returns the number of
characters sent.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EBADF The argument s is not an active valid file descriptor.
ENOTSOCK The argument s is not a socket.
EFAULT An invalid user space address was specified for a
parameter.
EMSGSIZE The socket requires that message be sent atomically, and
the size of the message made this impossible.
EAGAIN The socket is marked non-blocking and the requested
operation would block.
EINTR The send was interrupted by delivery of a signal before any
data was delivered.
ENOTCONN Tried to send on unconnected socket.
EOPNOTSUPP
The flags argument included the MSG_OOB flag applied to a
UDP socket.
EPIPE An established connection on a SOCK_STREAM socket was
closed by the remote peer.
SEE ALSO
recv(2), socket(2).
Licensed material--property of copyright holder(s)