A SOCK_STREAM socket can be discarded by a close(2) interface call. If data is queued to a socket that promises reliable delivery after a close(2), the protocol continues to try to transfer the data. The data is discarded if it remains undelivered after an arbitrary period.
A shutdown(3SOCKET)
closes SOCK_STREAM
sockets gracefully. Both processes can acknowledge
that they are no longer sending. This call has the form:
shutdown(s, how);
where how is defined as
Disallows further data reception
Disallows further data transmission
Disallows further transmission and further reception