1.1.24.13 sendto

C

ssize_t sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)

Description

Send a message on a socket.

Parameters

ParametersDescription
fdSocket file descriptor.
bufPointer to buffer containing data to send.
lenLength of data to send.
flagsOption for transmission, currently ignored.
addrPointer to address structure.
alenLength of address structure.

Returns

The number of bytes sent or -1 for error, see errno.

Remarks

errnoDescription
EBADFThe argument fd is not a valid file descriptor.
EFAULTSystem fault.
ENOTSOCKThe file descriptor fd does not refer to a socket.
EWOULDBLOCKThe socket is marked nonblocking and the send operation would block.
ENOMEMInsufficient memory is available.
EMSGSIZEThe argument data is too long to pass atomically through the underlying protocol
EDESTADDRREQThe socket is not connection-mode, and no peer address is set.
ENOTCONNThe socket is not connected, and no target has been given.