当前位置:网站首页>TCP three handshakes and four waves
TCP three handshakes and four waves
2022-04-23 03:16:00 【GeXueliu】
Three handshakes
- In one sentence, summarize the necessity of three handshakes ?
Both the client and the server should confirm that the other party can send , Acceptable . - Why not shake hands twice ?
The second handshake : When the server receives the connection establishment request , send out ack+syn package , That is, the second handshake is completed ( here , The server just sent ack+syn package , I don't know if it will be accepted correctly )
therefore , Two handshakes can cause the following problems .
- After the second handshake, the server establishes a connection ( Need to allocate resources such as memory ), But sent ack+syn The loss of , The client cannot establish a connection , The server is always waiting . Waste of resources .
- After the second handshake, the server establishes a connection , Then the client sends a connection request , But the request is blocked on the network , The client sent another connection request , After the second request is received by the server , The first connection request also reached the server , Cause the old connection to be responded .
- The third handshake can carry data , You can also not carry data .
Four waves
- In one sentence, summarize the necessity of four waves ?
Both the client and the server confirm that they have no data to send , No data to accept , And after the disconnection signal is received , Only then can it be disconnected . - Why not wave three times ?
When the server sends for the second time FIN when , Then the server is in a state where no data can be received , The state of having no data to send . The server needs to ensure the disconnection signal FIN Received by the client , To disconnect , So you need a fourth handshake . otherwise , The client has been waiting . The client received FIN when , It is necessary to ensure that the disconnection signal ACK Received by the server , So delay 2MSL. - wait for 2MSL The function of rear disconnection ?
wait for 2MSL Then disconnect , Ensure that the server receives the last ACK. If not delayed 2MSL Immediately disconnect and then send a new request , Just disconnect the signal ACK And not received by the server . The server will repeatedly send FIN, Wait for the last time ACK, But the client will only send new requests at this time syn package , The server will think that the request code is wrong . Reset connection . Make sure ACK Received , The subsequent connection will not be affected . - Make sure for the last time ACK To be received , Why not wait 1MSL?
1MSL Is the maximum life cycle of the message . Waiting time ensures When the last time ACK When not received , Retransmitted by the server FIN It will be recognized by the client again .2MSL Enough , Longer waiting times are not necessary .
版权声明
本文为[GeXueliu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220627323043.html
边栏推荐
- Fight leetcode again (290. Word law)
- Course design of Database Principle -- material distribution management system
- Eight elder brothers chronicle [4]
- Drawing polygons with < polygon / > circular array in SVG tag
- Top 9 task management system in 2022
- ASP. Net 6 middleware series - conditional Middleware
- Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions
- Middle and rear binary tree
- 编码电机PID调试(速度环|位置环|跟随)
- Source generator actual combat
猜你喜欢
再战leetcode (290.单词规律)
Top 9 task management system in 2022
xutils3修改了我提报的一个bug,开心
在.NE6 WebApi中使用分布式缓存Redis
手机连接电脑后,QT的QDIR怎么读取手机文件路径
be based on. NETCORE development blog project starblog - (1) why do you need to write your own blog?
Data mining series (3)_ Data mining plug-in for Excel_ Estimation analysis
C WPF UI framework mahapps switching theme
The most easy to understand dependency injection and control inversion
超好用的Excel异步导出功能
随机推荐
Knowledge of software testing~
荐读 | 分享交易员的书单,向名家请教交易之道,交易精彩无比
Web Course Design - his system
This new feature of C 11, I would like to call it the strongest!
12.<tag-链表和常考点综合>-lt.234-回文链表
Mysql database design specification
数据挖掘系列(3)_Excel的数据挖掘插件_估计分析
[Mysql] LEFT函數 | RIGHT函數
C syntax sugar empty merge operator [?] And null merge assignment operator [? =]
C语言实现通讯录----(静态版本)
手机连接电脑后,QT的QDIR怎么读取手机文件路径
ThreadLocal 测试多线程变量实例
If the deep replication of objects is realized through C #?
Experiment 5 components and event handling
The most understandable life cycle of dependency injection
软件测试相关知识~
Establishing and traversing binary tree
[vs Code] solve the problem that the jupyter file displays exceptions in vs code
Is it difficult to choose binary version control tools? After reading this article, you will find the answer
Source generator actual combat