Bug 11489 - Documentation for the shutdown function is misleading
Summary: Documentation for the shutdown function is misleading
Status: RESOLVED DUPLICATE of bug 1983
Alias: None
Product: glibc
Classification: Unclassified
Component: manual (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Roland McGrath
Depends on:
Reported: 2010-04-12 17:37 UTC by Neil Roberts
Modified: 2014-06-30 18:16 UTC (History)
2 users (show)

See Also:
Last reconfirmed:
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description Neil Roberts 2010-04-12 17:37:01 UTC
The documentation for the shutdown function with SHUT_WR says:

          Stop trying to transmit data from this socket.  Discard any
          data waiting to be sent.  Stop looking for acknowledgement of
          data already sent; don't retransmit it if it is lost.

This implies that shutdown effectively aborts the connection and loses data 
which is very misleading. I'm pretty sure that for TCP shutdown will still cause 
the queued data to be written. It will then just set the FIN flag on the final 
packet. There is much alternative documentation which implies this behaviour, 
such as UNIX Network Programming by Richard Stevens:

"SHUT_WR. The write half of the connection is closed.— In the case of TCP, this 
is called a half-close (Section 18.5 of TCPv1). Any data currently in the socket 
send buffer will be sent, followed by TCP's normal connection termination 
Comment 1 Ondrej Bilka 2013-10-21 06:48:29 UTC

*** This bug has been marked as a duplicate of bug 1983 ***