当前位置:网站首页>Sliding window summary of TCP connections
Sliding window summary of TCP connections
2022-06-13 01:16:00 【A simple heart】
< One >1, Recently I encountered a problem in my work ,tcp Connection establishment is normal , But sending packets to the receiving end in the sending direction is , The receiver program is in a suspended state , Unable to receive data , After checking, it is found that the receiver has sent... To the sender ZeroWindows Data packets of , That is, the sliding window is 0 The situation of , This situation causes the sender not to send the relevant data .
2, Slide window Introduction
stay tcp There are two cases in the connection. One is the fixed window , The other is sliding window , The following describes the principles of the two windows .
a> Fixed window , Is the size of the buffer agreed by both sides of the connection , Used to receive the required data , But this method is not good , Or waste , Or not enough ,( Insufficient conditions will block the transmission of link data, resulting in inefficiency ) In a word, the data transmission mode is not very good .
b> The sliding window
Sliding window is a kind of flow control technology .
It essentially describes the receiver TCP Datagram buffer size data , According to this data, the sender can calculate how much data it can send , If the sender receives the receiver with a window size of 0 Of TCP The datagram , Then the sender will stop sending data , Wait until the receiver sends the window whose size is not 0 The arrival of the datagram
c> working principle
When sending data for the first time, the window size is determined according to the link bandwidth .
Suppose the window is 3. At this time, after receiving the data, the receiver will confirm the data and tell the sender how much data I hope to receive next time .
In the diagram above : We see that the receiver sent ACK = 3( This is the sending sequence to the sender 2 Yes , The next time the receiver expects to receive 3 Sequence signal ), At this time, the sender will know the first time I sent after receiving this data 3 The other party only received two data , I knew the third data was not received by the other party , The next time you return it, start from 3 Data starts to be sent . At this time, the window size becomes 2.
As shown in the figure below :

See... Sent by the receiver ACK yes 5 It means that the next data he wants to receive is 5, The sender knows what I just sent 2 Data received by the other party , This is the time to start sending 5 Data .
The above is the introduction of sliding window .
Be careful : Attitude data transmission process , The corresponding data transmission processing should be handled according to the actual situation , Can split packets , Send the actual data required in batch . It can be determined by the length of the transmitted data according to the corresponding structure . It can better avoid sending sticky packets .
< Two >socket Communication connection .
Client connection denied , appear Connection refused. It was found that , On the client side SYN After the newspaper , The server sent... To the client RST,ACK The data packet , Means to reestablish the connection . Common phenomena , The server does not listen to the corresponding port . Because the ports used by the client and server are the same ip Inconsistency leads to . Such problems , This will cause reconnection failure , Connection denied , situation .
resolvent : Make sure that both engines are used ip The port is consistent with ( The precondition that the port is not occupied ).
边栏推荐
- 刘徽与《九章算术》《海岛算经》简介
- Leetcode-19- delete the penultimate node of the linked list (medium)
- Leetcode-14- longest common prefix (simple)
- Pipeline流水线项目构建
- Unitywebrequest asynchronous Download
- FLIP动画实现思路
- Remove duplicates from an ordered array
- Dynamic planning - good article link
- Continue when the condition is not asked, execute the parameter you compare
- Common skills for quantitative investment - drawing 3: drawing the golden section line
猜你喜欢

Stmarl: a spatio temporal multi agentreinforcement learning approach for cooperative traffic

Jenkins continuous integration operation

Binary tree - right view

spiral matrix visit Search a 2D Matrix

How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of DBCD, ROC, vroc, Cr and psy index strategy income

Most elements leetcode

Liu Hui and introduction to nine chapter arithmetic and island arithmetic

4K sea bottom and water surface fabrication method and ocean bump displacement texture Download

使用Pygame创建一个简单游戏界面
![[Latex] 插入图片](/img/0b/3304aaa03d3fea3ebb93b0348c3131.png)
[Latex] 插入图片
随机推荐
Pytorch's leafnode understanding
Breadth first search for node editor runtime traversal
切线与切平面
Leetcode-19- delete the penultimate node of the linked list (medium)
Leetcode question brushing 04 string
Wikipedia API User Guide
RSA encryption colloquial explanation
How to choose stocks? Which indicator strategy is reliable? Quantitative analysis and comparison of strategic returns of BBI, MTM, obv, CCI and priceosc indicators
Wal mechanism of MySQL
3623. Merge two ordered arrays
Binary tree -- using hierarchical sequence and middle sequence to determine a tree
生态聚合NFT来袭,Metaverse Ape引领Web 3.0元宇宙新范式革命
ArrayList underlying source code
spiral matrix visit Search a 2D Matrix
[JS] battle chess
MySQL performance analysis - explain
Characteristics of transactions -- atomicity (implementation principle)
Leetcode-15- sum of three numbers (medium)
Several categories of software testing are clear at a glance
Leetcode question brushing 06 bit operation