COHERENT manpages

This page displays the COHERENT manpage for send() [Send a message to a socket].

List of available manpages
Index


send() -- Sockets Function (libsocket)

Send a message to a socket
#include <sys/socket.h>
#include <sys/types.h>
int send(socket, message, length, flags)
int socket;
char *message;
int length, flags;

The function send() sends a message to a socket.

socket is  the socket to  which the messages  are sent.  It  must have been
created by the function  socket(), and connected by the function connect().
buffer points  to the chunk  of memory that  holds the message  to be sent;
length gives the amount of allocated memory to which buffer points.

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, send() 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,  send() 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 send() 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(),
sendto(),
socket()