当前位置:网站首页>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
边栏推荐
- Mysql database
- 可以接收多种数据类型参数——可变参数
- 《C语言程序设计》(谭浩强第五版) 第9章 用户自己建立数据类型 习题解析与答案
- Ningde's position in the times is not guaranteed?
- 《C语言程序设计》(谭浩强第五版) 第7章 用函数实现模块化程序设计 习题解析与答案
- Configuration table and page information automatically generate curd operation page
- Chapter 8 of C language programming (fifth edition of Tan Haoqiang) is good at using pointer exercises to analyze and answer
- 月薪10k-20k都无法回答的事务问题,你会吗?
- Use of ADB command [1]
- Use split to solve the "most common words" problem
猜你喜欢

OLED multi-level menu record

Peut recevoir plusieurs paramètres de type de données - paramètres variables

A set of combination boxing to create an idea eye protection scheme

svg标签中利用<polygon/>循环数组绘制多边形

Course design of Database Principle -- material distribution management system

Ningde's position in the times is not guaranteed?
![Use of ADB command [1]](/img/e6/fb8fd6956c226f75b831f8eb46277f.png)
Use of ADB command [1]

Yes Redis using distributed cache in NE6 webapi

The most understandable life cycle of dependency injection

Web Course Design - his system
随机推荐
场景题:A系统如何使用B系统的页面
Docker拉取mysql并连接
Mysql database
C language to achieve address book - (static version)
Data mining series (3)_ Data mining plug-in for Excel_ Estimation analysis
Yes Redis using distributed cache in NE6 webapi
[authentication / authorization] customize an authentication handler
Miniapi of. Net7 (special section): NET7 Preview3
EasyUI's combobox implements three-level query
MySQL索引详解【B+Tree索引、哈希索引、全文索引、覆盖索引】
Chapter 8 of C language programming (fifth edition of Tan Haoqiang) is good at using pointer exercises to analyze and answer
The backtracking of stack is used to solve the problem of "the longest absolute path of file"
IDEA查看历史记录【文件历史和项目历史】
What kind of experience is it to prepare for a month to participate in ACM?
超好用的【通用Excel导入功能】
The most understandable life cycle of dependency injection
宁德时代地位不保?
poi根据数据创建导出excel
数据挖掘系列(3)_Excel的数据挖掘插件_估计分析
Use of slice grammar sugar in C #