Discussion on the related problems of four wave waving of TCP three-time handshake

Source: Internet
Author: User

The handshake wave and state transition of TCP are the basis of many network problems. Discuss and record relevant issues here.

First, this diagram outlines the process of TCP connection and disconnection:

Note Several of these states:

LISTEN, Syn-send, SYN-RCVD, established, Fin-wait-1, close-wait, Fin_wait-2, Last-ack, time-wait, CLOSE.

It seems that there are some cases of sending fin packets at the same time, but easy to confuse, so I think can be ignored.

Below, there are some notable issues:

1. Why the connection is 3 times the handshake, and the time of disconnection is 4 times.

Answer: The ACK and SYN can be returned together because the connection was initiated. While disconnecting, the receiver may also have data not issued, so fin can not be issued directly, can only send an ACK first.

2.3 Handshake, what happens if the last Ack is lost.

Answer: The receiver waits for an ACK timeout and then re-sends the previous syn+ack, and times out doubles to avoid network congestion. The connection is not yet established. If the sender sends a data message, it receives the RST packet returned by the receiving party.

3. Why Time_wait is 2MSL.

Answer:

1. In order to prevent the last ACK from being lost. If the ACK is lost, the receiver re-emits fin, at which point the sender needs to resend the ACK. You can avoid repeated time-out retransmission by the receiver.

2. Prevent the appearance of lost Duplicatie + incarnation connection. Lost duplicate refers to a recurring packet that has been delayed due to network congestion, and incarnation connection refers to a new connection that is identical to the original socket pair. When both are present, the data is likely to be confusing. Waiting for 2MSL, you can let the lost duplicate package disappear in the network.

Content reference:

http://blog.csdn.net/whuslei/article/details/6667471

Http://blog.sina.com.cn/s/blog_5d2054d9010189l2.html

Discussion on the related problems of four wave waving of TCP three-time handshake

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.