TCP/IP Detailed learning note--tcp time-out and retransmission

Source: Internet
Author: User

1. Basic Concepts

TCP can secure the security of the data in transit, because it sends the data to each other each time, will wait for the other side to give a confirmation, when the confirmation is not received for a long time, the sending side will resend the data.

2. Time-Out measurement

To measure the timeout, TCP must send a special sequence number of bytes and receive an acknowledgment containing that byte between the RTT, but the acknowledgment itself is delayed, so there is generally a simple formula for measuring the time-out
RTO = RB
where r is the smoothing factor that changes with the RTT

3. Congestion Avoidance algorithm

The front of the blog has written that when the sending side using slow-start algorithm, because of its sending data segment exponential growth, it is also easy to reach the limit of the network channel, at this time, the network routing will be part of the packet loss, so TCP and send to set a congestion algorithm, this algorithm is used to solve the packet loss problem

拥塞算法假定正常情况下分组的丢失率是非常小的低于(1%),所以当双方出现大量丢失分组现象,则说明网络出现拥堵

Congestion avoidance algorithms and slow-start algorithms are generally used together, at this time need to give the sender to maintain two variables, one is the congestion window CWnd, and a slow-start gate Ssthresh, the algorithm process is as follows
(1) For a given connection, the CWnd is initialized to 1, and Ssthresh is 65535 bytes
(2) The data of the TCP output cannot exceed the minimum value of the Notification window and congestion window given by the receiver, the congestion window is the traffic control used by the sender, and the advertisement window is the traffic control that receives the imitation use.
(3) When congestion occurs (timeout or duplicate acknowledgement is received), the Ssthresh is set to the current window's general, that is, congestion and the minimum value of the notification window
(4) At this time we first slow start, send the data segment will be exponential growth, quickly reached the modified Ssthresh (window of the general) value, when slow start will not be exponential growth in the amount of transmission, but each received a confirmation, the amount of transmission increased by 1 linear growth

4. Fast re-transmission and fast recovery

When we receive an out-of-sequence message segment, TCP needs to generate an ACK immediately (a duplicate ACK), which should not be delayed, which is to let the other party know that the message segment was received out of sequence and tell the other
Since we do not know whether a duplicate ACK is caused by a missing segment or simply by reordering, we wait a little bit and make a judgment. When the reordered message segment is processed and a new ACK is generated, only 1-2 duplicate ACK may be received, and if more than 3 ACK is received it is likely that the segment is lost, so we will retransmit the missing segment directly, Instead of waiting for the timeout timer to overflow (that is, it does not have to wait until the timeout time to be judged lost), the next step is to implement the congestion avoidance algorithm, which is fast recovery.

5. Measure by each route

Many metrics are now maintained in the newer TCP implementation routing table entries, and when a TCP connection is closed, if enough data has been emitted to obtain meaningful statistics, and the destination node's routing table entry is not a default table entry, the following information is saved in the routing table entry: Smooth RTT, Slow start threshold, etc.

6. Re-grouping

When the TCP retransmission, it does not have to retransmit the same message segment, instead TCP allows to re-group, and to send a larger segment of the message

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

TCP/IP Detailed learning note--tcp time-out and retransmission

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.