Closing Sockets

A SOCK_STREAM socket can be discarded by a close() interface call. If data is queued to a socket that delivers after a close(), the protocol continues to transfer the data. The data is discarded if it remains undelivered after an arbitrary period. For more information, see the close(2) man page.

A shutdown closes SOCK_STREAM sockets. Both processes can acknowledge that they are no longer sending. This call has the form:

shutdown(s, how);

where how is defined as:

0

Disallows further data reception

1

Disallows further data transmission

2

Disallows further transmission and further reception

For more information about closing SOCK_STREAM sockets, see the shutdown(3C) man page.