laitimes

Interview Serial Cannon Series (XX): What is tcp's sliding window protocol

  1. What is the sliding window protocol for TCP

    Sliding window protocol for flow control when network data transmission to avoid the occurrence of congestion. This protocol allows the sender to send multiple data packets before stopping and waiting for confirmation. Because the sender does not have to stop for confirmation every packet, the protocol can speed up the transmission of data and improve network throughput. It is essentially data that describes the size of the receiver's TCO datagram buffer, based on which the sender calculates how long it can send. When this window size is 0, the sender will stop sending data. Start the timer and wait for this window to become non-0.

      The sliding window protocol must guarantee the sequential transmission of packets, the sequence number in the send window represents the packet that has been sent but has not yet received an acknowledgment, and the send window continues to maintain a series of unacknowledged packets because the packets within the sender window may be lost or damaged during transmission, so the sending process must save all packets in the send window for retransmission. Once the send window reaches its maximum value, the sending process must stop receiving new packets until there is an idle buffer. Packets outside the receive window are dropped, and when a packet with a sequence number equal to the lower limit of the receive window arrives, it is submitted to the application and an acknowledgment is sent to the sender, and the receive window moves forward one bit. The upper and lower limits of the send window and the receive window do not need to be the same, nor does the size of the receive window need to be the same, but the receive window size needs to be fixed and the send window size can change with the packet.

  2. Will the size of the sliding window change?

    TCP is a duplex protocol where both sides of a session can receive and send data at the same time. Each side of a TCP session maintains a send window and a receive window, and the size of each receive window depends on the limitations of the application, system, and hardware. When the link gets better or worse, this window changes.

  3. Under what circumstances will this protocol be deadlocked, and how to solve the deadlock

    Shortly after the receiver sends a zero-window packet to the sender, the receiver's receive cache has some storage space, so the receiver sends a Message Segment of Windows size = 2 to the sender, but this packet segment is lost during transmission. The sender waits for the notification of the non-zero window sent by the receiver, while the receiver waits for the sender to send the data, thus deadlocking.

      The solution to deadlock is that TCP has a persistent timer for each connection. As long as the TCP connection party receives the other party's zero window notification, it starts the continuous timer, and if the time set by the continuous timer expires, it sends a zero window probe packet segment (carrying only 1 byte of data), and the other party gives the current window value when confirming this probe packet.

Reference (the copyright of the excerpted text belongs to the original author):

https://blog.csdn.net/m0_37962600/article/details/79951780

https://baike.baidu.com/item/ sliding window protocol/10291557?fr=aladdin

https://www.jianshu.com/p/07bd39becbfd

Author: Coding Brick House

Public number: Coding brick home

Source: https://www.cnblogs.com/xiaoyangjia/

The copyright of this article belongs to the author and the blog garden, anyone or group, institutions in full or partial reprint, excerpts, please indicate the author and the original link in a conspicuous position in the article.

Read on