TCP protocol-server and client status transition diagram

Source: Internet
Author: User

 

Status transition between the TCP server and the client

 

Understanding status transition is the basis for using the netstat command to diagnose network problems. It is also the key to understanding the process of calling the connect, accept, and close functions.

The following is a connection process in TCP: the client initiates a connection request --> establishes a connection --> interacts with information --> the client initiates a request to close the connection --> closes the connection.

(1) Client TCP status Sequence

(2) TCP status sequence of the server

Client time_wait status

It is worth noting that, in the client TCP status transition diagram, the customer has a time_wait status. Why do we still need such a status when closing the connection?

First, let's look at the following figure:

If the last Ack is lost in the network, the server that fails to receive the confirmation signal resends the last fin, which requires the client to maintain a status information to allow it to resend the final ack. If such status information is not maintained, it will respond with RST (another type of TCP segment), and the server will resolve this RST to receive errors.

However, if TCP needs to complete the necessary work to completely terminate the two-direction data stream of a connection (full-duplex shutdown ), the loss of any of the four sub-sections in the closed connection must be handled correctly. This is one of the important reasons for the time_wait status to exist.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.