TCP/IP Programming Manual

shutdown, shutdown_nw
The shutdown and shutdown_nw functions shut down data transfer, partially or completely, on
an actively connected TCP socket.
C Synopsis
#include <socket.h>
#include <netdb.h>
error = shutdown (socket, how);
error = shutdown_nw (socket, how, tag);
int error, socket, how;
long tag;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
error := shutdown (socket, how);
error := shutdown_nw (socket, how, tag);
INT(32) error,
socket,
how;
INT(32) tag;
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 in Errors (page 189).
socket
input value; specifies the socket number for the socket, as returned by the call to socket or
socket_nw.
how
input value; specifies what kind of operations on the socket are to be shut down. It must be
one of the following values:
Disallow further reads (calls to recv and recv_nw).0
Disallow further writes (calls to send, send_nw, and send_nw2)1
Disallow both reads and writes.2
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:
An invalid value was passed for the how parameter.EINVAL
The specified socket was not connected or already shut down.ENOTCONN
shutdown, shutdown_nw 189