TCP/IP Programming Manual

error = recv_nw (socket, buffer_ptr, length, flags, tag);
int nrcvd, socket;
char *buffer_ptr;
int length, flags, error;
long tag;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
nrcvd := recv (socket, buffer_ptr, length, flags);
error := recv_nw (socket, buffer_ptr, length, flags, tag);
INT(32) nrcvd,
socket;
STRING .EXT buffer_ptr;
INT(32) length,
flags,
error;
INT(32) tag;
nrcvd
return value; the number of bytes received by the recv function. This is the return value for
recv. A zero length message indicates end of file (EOF).
If the call is not successful, —1 is returned and the external variable errno is set as indicated
below in “Errors.
error
return value; if the call is successful, a zero is returned. If the call is not successful, —1 is
returned. If the call failed, the external variable errno is set as indicated below in “Errors.
socket
input value; specifies the socket number for the socket, as returned by the call to socket or
socket_nw.
buffer_ptr
input and return value; on completion, points to the received data.
length
input value; the size of the buffer pointed to by buffer_ptr.
flags
input value; specifies the kind of data to be read and is one or more of the following:
Read out-of-band data. This corresponds to the TCP URG flag. You should not select this
flag for UDP sockets, or the call fail. This constraint is imposed by UDP, which does not
support out-of-band data.
MSG_OOB
Read the incoming message without removing it from the input queue.MSG_PEEK
No flag; read data normally.0
tag
input value; the tag parameter to be used for the nowait operation initiated by recv_nw. For
more information, see Asynchrony and Nowaited Operations (page 34).
154 Library Routines