IPX/SPX Programming Manual

Library Routines
HP NonStop IPX/SPX Programming Manual528022-001
5-33
recv, recv_nw
buffer_ptr
points, on completion, to the data received.
length
is the size of the buffer pointed to by buffer_ptr.
flags
specifies the type of data to be read, and is one or more of the following:
tag
is the tag parameter to be used for the nowait operation initiated by recv_nw.
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:
Usage Guidelines
Use the following guidelines for the recv and recv_nw functions:
Use recv on a socket created for waited operations. Use recv_nw on a socket
created with the socket_nw call for nowait operations. The operation initiated by
recv_nw must be completed with a call to the AWAITIOX procedure.
To determine the number of characters read from recv_nw, check the third
parameter (the count transferred) returned by the AWAITIOX procedure. Refer to
the Guardian Procedure Calls Reference Manual for details about the AWAITIOX
procedure and its parameters.
recv and recvfrom could 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_nw or recvfrom_nw nowait operations,
followed by calling AWAITIOX with a timer value of 10 seconds. If the timer
expires, call send or sendto from the local host. If the send or sendto call fails,
the connection is down.
MSG_PEEK Read the incoming message without removing it from
the input queue.
0 No flag; read data normally.
ENOTCONN The specified socket was not connected.
ESHUTDOWN The specified socket was shut down.
ETIMEDOUT The connection timed out.
ECONNRESET The connection was reset by the remote host.