Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

spt_sendtox(2) OSS System Calls Reference Manual
DESCRIPTION
The spt_sendtox() function is a 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 specified 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
To use this function in a threaded application that uses the Standard POSIX Threads library on
systems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-
lowing tasks:
Include the spthread.h header file in the application.
Compile the application using the _SPT_MODEL_ feature test macro or equivalent
compiler command option in addition to any other feature test macros in use.
Link the application to the zsptdll library (/G/system/zdllnnn/zsptdll).
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:
7404 Hewlett-Packard Company 527186-023