Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (s and S) spt_recvx(2)
NAME
spt_recvx - Receives a message from a connected socket (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series and J series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <sys/socket.h>]
#include <spthread.h>
ssize_t spt_recvx(
int socket,
void *buffer,
size_t length,
int flags
);
PARAMETERS
socket Specifies the file descriptor of the socket.
buffer Points to the buffer where the message should be written.
length Specifies the length in bytes of the buffer pointed to by the buffer parameter.
flags Is a value that controls message reception. The value of the flags parameter is
formed by bitwise ORing zero or more of the following values:
MSG_OOB Requests out-of-band data.
MSG_PEEK Peeks at an incoming message. The data is treated as unread and
the next call to the spt_recvx() function (or similar function)
will still return this data.
DESCRIPTION
The spt_recvx() function is a thread-aware version of the recv() function.
The spt_recvx() function receives messages from a connected socket.
For message-based sockets (sockets of type SOCK_DGRAM), the entire message must be read
in one call. If a message is too long to fit in the supplied buffer and MSG_PEEK is not set in the
flags parameter, the excess bytes are discarded.
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_recvx() function blocks until a message arrives. If no mes-
sages are available at the socket and the socket’s file descriptor is marked nonblocking
(O_NONBLOCK is set), the spt_recvx() function fails and sets errno to [EWOULDBLOCK].
NOTES
The macro to map recv() to spt_recvx() 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 recv() to spt_recvx() is available in C++ applications when
SPT_THREAD_AWARE_PRAGMA_NONBLOCK has been defined in the following manner
before including spthread.h:
527186-023 Hewlett-Packard Company 7−377