SHUTDOWN(2) Series 300 Only SHUTDOWN(2)
NAME
shutdown - shut down a socket
SYNOPSIS
shutdown(s, how)
int s, how;
HP-UX COMPATIBILITY
Level: HP-UX/NON-STANDARD
Origin: UCB
Remarks: Implemented on the Series 300 only.
DESCRIPTION
The shutdown system call is used to shut down a socket. In
the case of a full-duplex connection, shutdown can be used
to either partially or fully shut down the socket, depending
upon the value of how. If how is zero, then further
receives will be disallowed. If how is one, then further
sends will be disallowed. If how is two, then further sends
and receives will be disallowed. The s parameter is a
socket descriptor for the socket to be shut down.
Once the socket has been shut down for receives, all further
recv(2) calls will return an end-of-file condition. A
socket that has been shut down for sending will cause
further send(2) calls to return an EPIPE error and send the
SIGPIPE signal. After a socket has been fully shut down,
operations other than recv(2) and send(2) will return
appropriate errors, and the only other thing that can be
done to the socket is a close(2).
Multiple shutdowns on a connected socket and shutdowns on a
socket that is not connected might not return errors.
A shutdown on a connectionless socket, such as SOCK_DGRAM,
will only mark the socket unable to do further send(2) or
recv(2) calls, depending upon how. Once this type of socket
has been disabled for both sending and receiving data, it
becomes fully shut down. For SOCK_STREAM sockets, if how is
one or two, then the actual connection will begin to be
closed gracefully in addition to the normal actions.
However, the shutdown call will not wait for the completion
of the graceful disconnection. The disconnection will be
complete when both sides of the connection have done a
shutdown with how equal to one or two. Once the connection
has been completely terminated, the socket becomes fully
shut down. The SO_LINGER option (see socket(2)) does not
have any meaning for the shutdown call, but only for the
close(2) call. For more information on how the close(2)
call interacts with sockets, see socket(2).
Hewlett-Packard - 1 - (printed 7/16/86)
SHUTDOWN(2) Series 300 Only SHUTDOWN(2)
If a shutdown is performed on a SOCK_STREAM socket that is
not connected, or has a listen(2) pending on it, then that
socket becomes fully shut down, regardless of the value of
how.
The shutdown call will fail if:
[EBADF] S is not a valid descriptor.
[ENOTSOCK] S is a file, not a socket.
[EINVAL] The specified socket is not connected.
[ENET] A hardware error is detected on the interface
card.
DIAGNOSTICS
A 0 is returned if the call succeeds, -1 if it fails.
SEE ALSO
close(2), connect(2), socket(2).
Hewlett-Packard - 2 - (printed 7/16/86)