recv(2) DG/UX 4.30 recv(2)
NAME
recv - Receive a message from a socket.
SYNOPSIS
#include <sys/socket.h>
int recv (s, buf, len, user_flags)
int s;
char * buf;
int len;
int user_flags;
PARAMETERS
s File descriptor of socket to receive data
from.
buf Buffer for data.
len Length of buffer for data (bytes).
user_flags Flags for transfer.
DESCRIPTION
This call can only be used with connected sockets.
If the message is too long to fit in the supplied buffer,
excess bytes may be discarded depending on the type of
socket the message is received from; datagram sockets
truncate messages, stream sockets don't preserve packet
boundaries so only the amount of data requested is received
with no loss of data.
The user_flags argument is constructed by or-ing zero or
more literals beginning with "MSG_". See <sys/socket.h> for
a description of what flags exist and what they do.
If no messages are available at the socket, the call waits
for a message to arrive, unless the socket is nonblocking
(see ioctl). In that case, an error EAGAIN will be
returned.
The select call may be used to determine when more data
arrives.
ACCESS CONTROL
None.
RETURN VALUE
Recv() returns the number of bytes received.
Licensed material--property of copyright holder(s) Page 1
recv(2) DG/UX 4.30 recv(2)
0..<len> Number of bytes transferred.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EBADF The argument <s> is not an active valid
descriptor.
ENOTSOCK The argument <s> is not a socket.
EAGAIN The socket is marked non-blocking and the
receive operation would block.
EINTR The receive was interrupted by delivery of a
signal before any data was available for the
receive.
EFAULT The data was specified to be received into a
non-existent or protected part of the process
address space.
EINVAL Invalid argument.
ENOTCONN The socket is not connected. Use
recvfrom(2).
EOPNOTSUPP The <flags> argument included the MSG_OOB
flag applied to a UDP socket.
SEE ALSO
The related manual sections: read(2), send(2), socket(2).
Licensed material--property of copyright holder(s) Page 2