Open System Services System Calls Reference Manual (G06.28+, H06.05+)
System Functions (s and S) spt_sendtox(2)
dest_len Specifies the length of the sockaddr structure pointed to by the
dest_addr parameter.
DESCRIPTION
The spt_sendtox() function is the thread-aware version of the sendto( ) function.
The spt_sendtox() 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 structure 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 spt_sendtox() does not imply successful delivery of the mes-
sage. 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 spt_sendtox() 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 spt_sendtox()
function fails and sets errno to [EWOULDBLOCK].
NOTES
The macro to map sendto() to spt_sendtox() is available in C applications when
SPT_THREAD_AWARE_NONBLOCK has been defined in the following manner before
including spthread.h:
#define SPT_THREAD_AWARE_NONBLOCK
The alias to link sendto() to spt_sendtox() is available in C++ applications when
SPT_THREAD_AWARE_PRAGMA_NONBLOCK has been defined in the following manner
before including spthread.h:
#define SPT_THREAD_AWARE_PRAGMA_NONBLOCK
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 spt_sendtox() function returns the number of bytes sent. Oth-
erwise, the value -1 is returned and errno is set to indicate the error.
If the socket becomes invalid (is closed by another thread), -1 is returned with an errno value of
[EBADF]. If a signal is received via the pthread_kill() function and is not blocked, ignored, or
handled, -1 is returned with an errno value of [EINTR].
ERRORS
If any of these conditions occur, the spt_sendtox() function sets errno to the corresponding
value:
[EACCES] The socket is in the AF_UNIX domain and either search permis-
sion is denied for a component of the pathname in the sockaddr
structure, or write access to the specified socket is denied.
[EAFNOSUPPORT]
You cannot use addresses in the specified address family with
this socket.
527186-007 Hewlett-Packard Company 7−303