Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ shutdown(2) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

connect(2)

socket(2)

SHUTDOWN(2)  —  Series 300 and 800 Only

NAME

shutdown − shut down a socket

SYNOPSIS

shutdown(s, how)
int s, how;

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 0, further receives are disallowed.  If how is 1, further sends are disallowed.  If how is 2, further sends and receives are 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 return an end-of-file condition. A socket that has been shut down for sending causes 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) 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, only marks 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 1 or 2, the connection begins to be closed gracefully in addition to the normal actions.  However, the shutdown call does not wait for the completion of the graceful disconnection.  The disconnection is complete when both sides of the connection have done a shutdown with how equal to 1 or 2.  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 does for the close(2) call.  For more information on how the close(2) call interacts with sockets, see socket(2).

If a shutdown is performed on a SOCK_STREAM socket that has a listen(2) pending on it, that socket becomes fully shut down when how = 1. 

RETURN VALUE

If the call is successful, 0 is returned. If it fails, −1 is returned and an error code is stored in errno. 

DIAGNOSTICS

The shutdown call fails if:

[EBADF] S is not a valid descriptor. 

[ENOTSOCK] S is a file, not a socket. 

[EINVAL] The specified socket is not connected. 

DEPENDENCIES

Implemented on the Series 300 and 800 only. 

AUTHOR

UCB (University of California at Berkeley)

SEE ALSO

close(2), connect(2), socket(2). 

Hewlett-Packard Company  —  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026