TCP/IP Programming Manual

tag
input value; the tag parameter to be used for the nowait operation initiated by recv_nw64_.
For more information, see Asynchrony and Nowaited Operations (page 34).
Errors
If an error occurs, the return value is set to -1, and the external variable errno is set to one of the
following values:
There is pending out-of-band data. This must be cleared with a call to recv64_ with the
MSG_OOB flag set. (This error does not apply to UDP sockets.)
EHAVEOOB
The specified socket was not connected.ENOTCONN
The specified socket was shut down.ESHUTDOWN
The connection timed out.ETIMEDOUT
The connection was reset by the remote host.ECONNRESET
Usage Guidelines
Use the following guidelines for the recv64_ and recv_nw64_ functions:
Use recv64_ on a socket created for waited operations. Use recv_nw64_ on a socket
created with the socket_nw call for nowait operations. The operation initiated by
recv_nw64_ must be completed with a call to the FILE_AWAITIO64_ procedure.
To determine the number of characters read from recv_nw64_, check the third parameter
(the count transferred) returned by the FILE_AWAITIO64_ procedure. For information about
the FILE_AWAITIO64_ procedure and its parameters, see Guardian Procedure Calls Reference
Manual.
recv64_ and recvfrom64_ might wait indefinitely if the network terminates the connection
ungracefully, without returning an error code. This is standard TCP/IP behavior. Avoid the
wait by calling recv_nw64_ or recvfrom_nw64_ nowait operations, followed by
FILE_AWAITIO64_ call with a timer value of 10 seconds. If the timer expires, call send64_
or sendto64_ from the local host. If the send64_ or sendto64_ call fails, the connection
is down.
The sending side of a connection indicates end-of-file by closing or shutting down its socket.
The receiving side recognizes end-of-file when the recv64_ or recvfrom64_ calls have 0
bytes in their length-of-buffer field. This is standard practice, not specific to the Guardian
socket library implementation.
If the MSG_OOB flag is set by itself, only the last byte of urgent data sent from the remote site
is received. To receive multiple bytes of urgent data in the normal data stream, you must set
the socket option SO_OOBINLINE, and call recv64_ with the MSG_OOB flag set. recv64_
call returns data through the last byte of urgent data. The SO_OOBINLINE socket option is
set with either the setsockopt or setsockopt_nw functions. To determine where the last
byte of urgent data occurs, use the socket_ioctl() operation SIOCATMARK.
For information on checking errors, see Nowait Call Errors (page 86).
Example
The following programming example calls the recv64_ function. (In the example, rsock is a
socket created by a previous call to socket):
#include <socket.h>
#include <netdb.h>
...
int status, tosend;
char buffer [8*1024];
recv64_, recv_nw64_ 157