7

How TCP endpoint receiving FIN known whether the peer TCP endpoint has done close() or shutdown(fd, SHUT_WR)?

view full story
linux-howto

http://stackoverflow.com – Consider a TCP connection is established between two TCP endpoints and one of them invokes either: close(): Here, no further read or write is permitted. shutdown(fd, SHUT_WR): This converts full duplex connection to simplex where the endpoint invoking SHUT_WR can still read. However, in both the cases FIN is sent on the wire to the peer endpoint. So the question is how the TCP endpoint which receives FIN can distinguish whether the peer endpoint has done close () or SHUT_WR since in the latter scenario it should still be able to send data? (HowTos)