7

TCP FIN not sent on doing 'close ()' for a multi-threaded TCP client

view full story
linux-howto

http://stackoverflow.com – I have written below multi-threaded TCP client which basically spawns a separate thread for receiving the data however the data is being written in the main thread only having taken input from the user on standard input. Now, having pressed ctrl^D then implementation comes out of the loop (around the getline () call) and closes the socket descriptor but no FIN is seen on the wire. However, replacing close() with shutdown () makes a difference. With close() no FIN is sent on the wire but with shutdown(fd, SHUT_WR) FIN is sent on the wire? Why is this difference? #include <stdio.h> #in (HowTos)