recv(2) DG/UX 5.4R3.00 recv(2)
NAME
recv - receive a message from a socket
SYNOPSIS
#include <sys/socket.h>
int recv (s, buf, len, userflags)
int s;
void * buf;
int len;
int userflags;
where:
s File descriptor of socket to receive data from
buf Buffer for data
len Length of buffer for data (bytes)
userflags Flags for transfer
DESCRIPTION
This call can be used only 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 userflags 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(2)].
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.
0..len Number of bytes transferred.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EBADF The argument s is not an active valid descriptor.
Licensed material--property of copyright holder(s) 1
recv(2) DG/UX 5.4R3.00 recv(2)
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
ioctl(2), read(2), recvfrom(2), select(2), send(2), socket(2).
Licensed material--property of copyright holder(s) 2