Open System Services System Calls Reference Manual (G06.28+)
System Functions (s and S) spt_recvfromx(2)
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
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 the following conditions occurs, the spt_recvfromx() function sets errno to the
corresponding value:
[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.
527186-005 Hewlett-Packard Company 7−267