TCP/IP protocol (3): Traffic Control (Sliding Window Protocol)

Source: Internet
Author: User
1. traffic control is used to manage the traffic at both ends, so as not to cause the receiving end to overflow due to sending blocks, or to waste time due to the handling speed of the receiving end. Used: Sliding Window, in bytes

2. window has three actions: expand (right), collapse (left to right), and contract (Right to left). These three actions are controlled by the receiving end.

Union: indicates that the corresponding bytes have been confirmed.

Expand: allows the cache to send more bytes.

Shrink (not expected, some implementations are forbidden): indicates that the message can be sent, but cannot be sent now. However, if the scaled message is sent, the problem may occur; to avoid this, the receiving end will not communicate until there is more cache space in the cache.

The size of the Start window depends on the size of the Receiving Window rwnd (the window size field of TCP packets) and the size of the congestion window cwnd (see congestion control)

Size of the Start window = min {rwnd, cwnd };

3. Close the window: if the window is scaled back, rwnd = 0 indicates that the window is unwilling to receive data temporarily. In this case, the initiator does not contract the window, and the other is to stop sending data. (In order to avoid deadlocks, some test reports are used to send the test regularly. For details, see the timer section)

4. problem: in some cases, because the data at the initiator or receiver is slow, a large amount of 1-byte data may be pity and a lot of resources are wasted.

(1) When the originating process produces data slowly, one byte of data is sent from time to time, So TCP will send one byte and one byte, with low efficiency.

Solution (NagleAlgorithm):

A. Send the first data block

B. Then, wait until the sending cache has enough data (maximum packet segment length), or wait until the receiving end confirms the ACK before sending data.

C. Process of repeating B

(2) because the receiving process consumes a low amount of data, the receiving end may send the information with a window size of 1 and transmit the data in 1 byte.

Solution (2 types)

A. Clark method: Before half of the received cache is empty, or there is enough space for the maximum packet length, the size of the receiving window is 0.

B. Delayed confirmation: wait until the received message segment is confirmed, or wait for a period of time (usually 500 ms)

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.