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

spt_recvfromx(2) OSS System Calls Reference Manual
For stream-based sockets (sockets of type SOCK_STREAM), message boundaries are ignored.
For such sockets, data is returned as soon as it becomes available; no data is discarded.
If no messages are available at the socket and the socket’s file descriptor is blocking
(O_NONBLOCK is not set), the spt_recvfromx() function blocks until a message arrives. If no
messages are available at the socket and the socket’s file descriptor is marked nonblocking
(O_NONBLOCK is set), the spt_recvfromx() function fails and sets errno to [EWOULD-
BLOCK].
If the address parameter is not a null pointer, the source address of the received message is stored
in the sockaddr structure pointed to by the address parameter, and the length of this address is
stored in the object pointed to by the address_len parameter.
If the actual length of the address is greater than the length of the supplied sockaddr structure,
the address is truncated when stored.
NOTES
The macro to map recvfrom() to spt_recvfromx() 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 recvfrom() to spt_recvfromx() 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 is available, a call to the select() function indicates that the file descriptor for the
socket is ready for reading.
RETURN VALUES
Upon successful completion, the spt_recvfromx() function returns the length of the received
message in bytes. If no data is available and the peer socket has performed an orderly shutdown,
then 0 (zero) is returned.
If the spt_recvfromx() function call fails, 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 occurs, the spt_recvfromx() function sets errno to the corresponding
value:
7370 Hewlett-Packard Company 527186-023