IPX/SPX Programming Manual

Library Routines
HP NonStop IPX/SPX Programming Manual528022-001
5-53
shutdown, shutdown_nw
tag
is the tag parameter to be used for the nowait operation initiated by
shutdown_nw.
Errors
If an error occurs, the external variable errno is set to one of the following values:
Usage Guidelines
Use shutdown on a socket created for waited operations, or shutdown_nw on a
socket created for nowait operations. The operation initiated by shutdown_nw
must be completed with a call to the AWAITIOX procedure.
Because the shutdown function shuts down an active connection, it has no
meaning for the UDP, IP, or IPX protocols.
After a socket is shut down, there is a delay before the port can be reused. This
delay occurs so that any stray packets can be flushed from the network. The length
of the delay varies, based on the average round-trip time for packets in the
network.
The shutdown and shutdown_nw functions do not destroy the socket. To destroy
a socket, call the FILE_CLOSE procedure to destroy it.
For information on error checking, see Nowait Call Errors on page 5-5.
Example
The following example calls the shutdown function. (Data transfer on socket s1 is
shutdown; no further reads or writes are allowed.):
#include <socket.h>
#include <netdb.h>
...
\* Code to create socket s1, connect socket to server,
* and transfer data appears here.
*\
...
\* When finished transferring data, execute the following
* code.
*\
if (shutdown (s1, 2) < 0)
perror ("Shutdown failed.");
EINVAL An invalid value was passed for the how parameter.
ENOTCONN The specified socket was not connected or already shut down.