What does the read call return on earth if there are already both FIN and RST in the TCP buffer? <p>Assuming that the client and server send packets according to the order of sequence as shown in the figure, the client does not know FIN has arrived. </p> <p>It sends “hello again” to the server, the server responds to the client with an RST and the RST has arrived. Then if the client is blocking on a read, why it return 0 due to the FIN instead of -1 because the RST? In the 《Effective TCP/IP programming》, it tells us that the core will return ECONNRESET error. </p> <p>My operating system is Ubuntu 12.10. Is it related with the operating system? Please tell me some TCP’s details on this implementation. Thanks in advance.</p> <p><img src="https://i.stack.imgur.com/qcGY7.jpg" alt="enter image description here"></p>