Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (r) recv(2)
NAME
recv - Receives a message from a connected socket
LIBRARY
G-series native OSS processes: system library
H-series and J-series OSS processes: implicit libraries
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
SYNOPSIS
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/socket.h>
ssize_t recv(
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 recv() function (or similar function) will still
return this data.
DESCRIPTION
The recv() 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 recv() 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 recv() function fails and sets errno to [EWOULDBLOCK].
To pass a 32-bit pointer from a 32-bit Guardian or OSS client, recv() or recv64_() may be
called.
To pass a 64-bit pointer from a 32-bit Guardian or OSS client, recv64_() must be called.
32-bit Guardian and 64-bit OSS clients can pass 32-bit pointers and 64-bit pointers to recv64_( ).
527186-023 Hewlett-Packard Company 6−21