Terminating a TCP connection
Either end of the connection can call the
close() system call.
If the other end has closed the
connection, and there is no buffered
data, reading from a TCP socket returns
0 to indicate EOF.