Open System Services System Calls Reference Manual (G06.25+, H06.03+)
sendto(2) OSS System Calls Reference Manual
DESCRIPTION
The sendto( ) function sends a message through a connection-oriented or connectionless socket.
If the socket is connectionless, the message is sent to the address speci
fied in the sockaddr struc-
ture pointed to by the dest_addr parameter. If the socket is connection-oriented, the
dest_addr
parameter is ignored.
Successful completion of a call to sendto( ) does not imply successful delivery of the message. A
return value of -1 indicates only locally detected errors.
If the sending socket has no space to hold the message to be transmitted and the socket
’s file
descriptor is blocking (O_NONBLOCK is not set), the sendto( ) function blocks until space is
available. If the sending socket has no space to hold the message to be transmitted and the
socket’s file descriptor is marked nonblocking (O_NONBLOCK is set), the sendto() function
fails and sets errno to [EWOULDBLOCK].
NOTES
When data can be sent, a call to the select() function indicates that the file descriptor for the
socket is ready for writing.
RETURN VALUES
Upon successful completion, the sendto( ) function returns the number of bytes sent. Otherwise,
the value -1 is returned and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the sendto() function sets errno to the corresponding
value:
[EACCES] The socket is in the AF_UNIX domain and either search permission is denied for
a component of the pathname in the sockaddr structure, or write access to the
specified socket is denied.
[EAFNOSUPPORT]
Addresses in the specified address family cannot be used with this socket.
[EBADF] The socket parameter is not a valid file descriptor.
[ECONNRESET]
One of the following conditions occurred:
• The transport-provider process for this socket is no longer available.
• The TCP/IP subsystem for this socket is no longer available.
• The connection was forcibly closed by the peer socket.
The socket can only be closed.
[EDESTADDRREQ]
The socket is not connection-oriented and does not have its peer address set, and
no destination address was specified.
[EFAULT] A user-supplied memory buffer cannot be accessed.
[EHOSTUNREACH]
The destination host cannot be reached.
7−30 Hewlett-Packard Company 527186-003