On the TCP sliding window mechanism

1. On the TCP sliding window mechanism

Concept of
  the sliding window is a buffer when transferring data between two hosts. Each TCP / IP host supports two sliding windows,
  one for receiving data and one for transmitting data. Window size represents the data amount of the computer may be buffered.

2. Works

1. The sliding window during operation
  the transmission data stream control protocol TCP sliding window by using the mode. In the transport layer, the data according to a certain
  labeled same size packet format. Each of the sliding window contains a certain number of data packets, the size of the sliding window can
  be adjusted. Each host on the network maintains a send window and a receive window. The sender may send a number of packets corresponding to the size of the sliding window, and adds header information before each data packet, then waits for the receiver returns confirmation information. Because TCP is a connection-oriented protocol, you can guarantee the integrity and accuracy of data transmission, when a packet loss occurs during transmission, the receiver will ask the sender retransmit data from the breakpoint.
  When the TCP receive data from the application layer, TCP header with a sequence number which is added to the packet and
  IP, the IP and send it to the destination host.
  When each packet transmission, the source host set the retransmission timer, described before re-sending the data packet waiting
  time of the ACK. In general, after the first attempt fails, a retransmission timer is set to the retry time of the previous
  two times times. Backup each data packet in the transmission window until it receives an ACK.
  When the packet reaches the destination host receives the window, they are placed in accordance with the sequence number. When the destination host receives a number of consecutive
  time data segment, it sends a recognition on the data (ACK) response message to the source host, which with the current window size. Once the source host receives a packet and recognition, will be sliding transmission window. If the retransmission timer is set in
  the room, the source host is not received approval of the existing data, the data will be retransmitted. The retransmitted data packet network and the burden of the source host. The following application example to understand their role in it.

3. Application Example sliding window

"Three-way handshake" example describes a typical TCP transmission process. TCP can obtain better transmission performance using a method called TCP sliding window. In TCP "three-way handshake" process, two hosts switching transmission window size, the receiving host to set its reception window size to coincide the transmission window and the size of the sending host. Window size indicating that the maximum number of segments can be transmitted at any one time. TCP window size is the protocol format by "window" field, given in each of the packets to the destination host.
  The sending host sends a window by creating, in order to set its maximum transfer size. For example, if the sending host set
  transmission window size is 6, as shown in FIG. 1
  which means that the sending host can continuously transmit a maximum of six data segments, this time the target host must be confirmed in order to continue transmitting subsequent data segments .
  Here Insert Picture Description

After (i.e. 1 to paragraph 6) (1) continuously sends the first segment 6, the sending host must wait for acknowledgment of the receiving host.
  If the receiving host receives only segments 1, 2 and 5, the receiving host comprises a back section 3 of SEQ ID NO confirmation, and it was confirmed that a segment 2. In this case, the sending host rightward sliding window slides two acknowledgment segments, segment 7 and 8 appears in the sliding window. as shown in picture 2.
Here Insert Picture Description

(2) sending host transmits a succession of six data segments (i.e., segments 3 to 8). 6 assumed that this segment are received correctly, the receiving
  host comprises a sequence number sent back for confirmation of section 9, i.e., before the data representing the segments have been correctly received. 9, paragraph 9 expected transmission. In this case, the sending host slides rightward sliding window identified in paragraph 6, 9 to 14 of the sliding window appears, as shown in FIG.

Here Insert Picture Description

As can be seen by the above example, by means of a sliding window can improve the transmission performance of TCP data. Because TCP is no need for
  each data segment for confirmation, only a transmission confirmation window width of the first segment.

Summary
  sliding window size has a great impact on network performance. If the sliding window is too small, frequently on the network
  transmission acknowledgment information, take up a lot of network bandwidth; If the sliding window is too large, for higher efficiency, prone to network packet loss, the transmission is repeated multiple times data, which also consumes network bandwidth.
  Sliding window size decision factors, including the amount of data network bandwidth, reliability, and needs to be transmitted.

Published 168 original articles · won praise 1 · views 2958

Guess you like

Origin blog.csdn.net/yrx420909/article/details/104483862