Detailed TCP protocol (three) - Reliable Transmission

A purpose, reliable transmission

We know that IP provides unreliable best-effort delivery service, then how TCP for reliable transport service in front of the blog wrote it, with error detection, timer, retransmission and other measures, TCP uses these measures, and with a sliding window protocol providing the transmission speed (performance)

TCP is a reliable transmission purposes to ensure a process of reading out the data from the receive buffer stream is error-free, no missing, non-redundant, non-scrambled byte stream

Two, TCP how to implement reliable transport service

From the perspective of the sender, and transmitting a retransmission divided into two cases

2.1 normal transmission

The sender receives data from the upper application, the data is divided into data blocks (MSS) for TCP transmission, into the send window.

If the send window is full, You can refuse to receive data, the sender transmits data to prevent too fast, resulting in a slower host buffer overflow (flow control).

If the send window dissatisfiedAfter numbered data block in bytes, a sender transmits pipelined data processing, received confirmation, then send back data

2.2 retransmission data

2.2.1 recipient received bad data

And by checking, error detection , the receiver receives the error data is lost, and send the message, the acknowledgment number in the packet is the last received sequence number + 1, then the sender will retransmit the data acknowledgment number

2.2.2 timer times out (considered lost)

In each sender sends a data, will be open for a timer, the timeout when the recipient does not receive confirmation, it is considered a long lost.

This case is divided into two, one is really lost, one is no longer lost when the timeout, and later received data

The first: really lost
Here Insert Picture Description
Confirmation information is lost, the timeout duration, then re send sequence number 180 of the data

NOTE: ACK data loss and loss is the same, the packet sequence number and the acknowledgment number contained in the corresponding data, TCP is not very clear reception side and transmission side

Second: When the timeout is long and receives data
Here Insert Picture Description
As shown, the acknowledgment sequence number 200 than the time interval 180, then re-transmits data number 180, without the retransmission of data number 200, because the base number of 180

2.2.3 fast retransmission (considered lost)

Upon receipt of TCP the ACK repeated three times, even when there is no longer than the timeout will resend the data , as shown below
Here Insert Picture Description
, when the host wishes to receive data number B 200, but lost, send 200 an acknowledgment sequence number four, the fourth time (this time in triplicate) No. 200 would be considered lost, re-sending 200 data number.

2.3 reordering

TCP segment encapsulated in an IP datagram transmitted, arriving IP datagrams may be routed through different scrambled, it is necessary will be rearranged segments

2.4 redundant data

Due to network delay and retransmission, redundant data so TCP will have redundant data is discarded

Third, the summary

Here Insert Picture Description
Through the above measures can achieve reliable transmission of TCP

He published 198 original articles · won praise 94 · views 90000 +

Guess you like

Origin blog.csdn.net/shang_0122/article/details/104484955