How TCP transport protocol for flow control?

How TCP transport protocol for flow control?

TCP flow control, is simply to make the data transmission end of the transmission rate is not too fast, so that the data receiver had time to receive, using a sliding window mechanism can easily implement flow control for data transmission on the end of a TCP connection. TCP window in bytes, not segments, transmission end data transmission window can not exceed the value of the receiving window of the receiving side is given, the flow control mechanism is to control the packet loss rate, the main purpose: to understand the data to transfer the data receiving terminal end of the current reception capability, the transmission rate can be flexibly adjusted. Flow control mechanism is shown below:

How TCP transport protocol for flow control?

Sliding window:

TCP uses a sliding window of variable size, flow control, the window size in bytes.

Agreed upon by both data transmission window when the connection is established. But in the course of communication, the data receiving side according to their own resources, dynamically adjust the transmission window size to each other at any time. Sliding window example is shown below:

How TCP transport protocol for flow control?

Sliding window to introduce reason:

We can be understood as a buffer window (but some windows and buffers but not the same).

Without these "windows", then the TCP after sending each piece of data must wait before sending the next piece of data after the data receiver acknowledges, do so TCP transport efficiency is too low.

The solution is, when the transmitting side continues to wait for an acknowledgment to transmit data, assuming the data is sent to the X-th segment is received profile data receiving side, if X is within an acceptable range that is acceptable to do so. This is the reason the window (buffer) introduced.

Sliding window:

A, X receive window data
receiving terminal buffer size. This window value on the receiving side window field in the TCP header of packets transmitted to the sender.

B, Y congestion window
transmitting side buffer size

C, Z data transmission window
upper limit value of the send window Min = [X-, the Y]
① When X <Y, the terminal is capable of receiving the maximum receiving transmission window restriction data.
② When Y <time X, the limit is a maximum data transmission network congestion window.

Example sliding window Introduction:

Data transmission side has transmitted the 400 bytes of data, but only the first 200 bytes of the received acknowledgment data, while the window size unchanged. It may also send 300 bytes.

How TCP transport protocol for flow control?

The other end of the data transmission received confirmation of the first 400 bytes of data, but the other end notice of data transmission window must be reduced to 400 bytes. Up to now the data transmission terminal may also send 400 bytes of data.

Rolling Window Demand knowledge points:

A, you can accept the data receiver buffer size will be placed in the TCP header "window size" field, to the data transmission side through the notification ACK.

B, the larger the window size field, the higher the throughput of the network

C, the window size is the maximum value without waiting for acknowledgment and may continue to transmit data, that is to say does not require a response data receiving end, the data to be continuously transmitted.

D, in order to maintain the operating system kernel sliding window, you need to open up the transmit buffer, to record the current as well as what data there is no answer, only confirmed data response had to be removed from the buffer. PS: If the transmit buffer is too large, there will be space overhead.

After E, the data receiving end once found own buffer is almost full, it will set the window size to be a smaller value notified to the data transmission side, the transmission side receives the data value, its own transmission speed slows .

F., If the data receiving side finds himself buffer is full, the window size will be set to 0, then the data transmission is no longer transmitting data terminal, but needs to send a periodic window probe segment, so that the data receiving side window tell size data transmission side.

PS: In the TCP header, there is a window 16 for the field that is used to store the window size information.

TCP segment transmission timing selection

. 1, TCP maintain a variable which is equal to the maximum segment size MSS, as long as the data stored in the buffer reaches MSS bytes are assembled into a TCP segment sent.

2, by the application specified in claim sender transmits segments, i.e., TCP supports a push operation.

3, is a timer period to the sender, and then put into the current existing cache data segments sent.

Guess you like

Origin blog.51cto.com/13609234/2429763