RECEIVE(2X) — Unix Programmer’s Manual
NAME
receive − receive message from a socket
SYNOPSIS
#include <sys/socket.h> cc = receive(s, from, buf, len);
int cc, s;
struct sockaddr ∗from;
char ∗buf;
int len;
DESCRIPTION
Receive is used to receive a message from a SOCK_DGRAM or SOCK_RAW socket. The source address of the message is placed in from. The length of the message is returned in cc. If the message is too long to fit in the supplied buffer, then excess characters are discarded.
If no messages are available at the socket, the receive waits for a message to arrive, unless the socket is nonblocking (see ioctlnew(2x)) in which case a cc of −1 is returned with the external variable errno set to EWOULDBLOCK.
The select(2x) call may be used to determine when more data arrives.
SEE ALSO
BUGS
An option to provide a SIGIO signal when data is available to be received is planned, but not yet implemented.
This call is provisional, and will exist in a slightly different form in 4.2bsd.
7th Edition — 3/17/82