COHERENT manpages
This page displays the COHERENT manpage for sendto() [Send a message to a socket].
List of available manpages
Index
sendto() -- Sockets Function (libsocket)
Send a message to a socket
#include <sys/socket.h>
#include <sys/types.h>
int send(socket, message, length, flags, addr, alen)
int socket; char *message; int length, flags;
sockaddr_t *addr; int alen;
The function sendto() sends a message to a socket. Unlike the related
function sendto(), it works regardless of whether the socket is connected.
socket is the socket to which the messages are sent. It must have been
created by the function socket(). buffer points to the chunk of memory into
which the message is to be written; length gives the amount of allocated
memory to which buffer points. If from is not NULL, sendto() initializes
it to the the source address of the message. It initializes alen to the
size of the buffer associated with address, and modifies it upon return to
the size of the address stored there.
flags ORs together either or both of the following flags:
MSG_OOB
Send ``out-of-band'' data on sockets that support this notion. The
underlying protocol must also support out-of-band data.
MSG_DONTROUTE
The socket turned on for the duration of the operation. It is used
only by diagnostic or routing programs.
If all goes well, sendto() returns the number of bytes it sent. If
something goes wrong, it returns -1 and sets errno to one of the following
values:
EAGAIN
If socket has no buffer space available, sendto() normally waits until
space becomes available (which is a blocking operation). socket,
however, is marked as non-blocking.
EBADF
socket does not identify a valid socket.
EINTR
A signal interrupted sendto() before it could send any data.
EMSGSIZE
socket requires that message be sent atomically, and the message was
too long.
ENOMEM
Insufficient user memory was available to complete the operation.
ENOTSOCK
socket describes a file, not a socket.
EPROTO
A protocol error has occurred.
See Also
connect(),
libsocket,
recv(),
send(),
socket()
Notes
At present, the COHERENT implementation of sendto() always behaves as if
address were initialized to NULL.