当前位置:网站首页>Understand TCP's three handshakes and four waves with love
Understand TCP's three handshakes and four waves with love
2022-07-07 23:31:00 【Little river god is tangled】
One 、TCP/IP The connection of
When socket Established TCP/IP After the connection , The server will always listen to the connection request of the client , After the connection is successful, it will be a more reliable connection . Reason why TCP Reliable connection , That's because connecting and disconnecting require complex processes .
Just like a pair of lovers . Before they became boyfriend and girlfriend , There must be one side that constantly seeks the other , Or they spent some unforgettable time together , They depend on each other . Then one of them said " Be my daughter ( male ) Friends "( This is it. TCP The first handshake of the connection ), Then the other party agreed ( There is a second handshake ), Low three handshakes is naturally a formal boyfriend and girlfriend .
Two 、 Three handshakes
TCP The third handshake is to confirm the connection , Ensure that the server and client can communicate normally .“ Three handshakes ” It is actively opened by the client , The server is turned on passively . It's not hard to understand , We are learning socket When programming , When programming the server , There is a code to listen to the connection :listen, Then there's another API :accpet Respond to the connection of the client :
Each handshake carries a message :SYN Data packets . Every time you send data, you should confirm the integrity of the data , It's like a token of love ( The first handshake ). In the picture ack Is the reply signal , Received SYN after , hold SYN Here you are, with your own Keepsake ( The second handshake ), Prove that I have received your token of love SYN. The third time I received it was from myself SYN after , Confirm that you can communicate ( The third handshake ), Complete the connection .
3、 ... and 、 Four waves
Long period of division , A long time must be divided. , Since there is a handshake, there is a breakup , Ah No … wave .TCP The four waves are Confirm that the communication is disconnected , The process is initiated by one end disconnect request , The other party responds to the disconnection request .
That is, between boyfriend and girlfriend, one day, someone suddenly felt that both sides were inappropriate , Break up ( Namely TCP Your first wave ); The other party said yes , Can break up ( Produce a second wave ); Break up can , When I get off work , Give you a love token after work (FIN)( This is a Third wave ); Received the changed Keepsake (FIN) Confirm the breakup ,( Fourth wave ).
The second wave , Only the reply signal is sent , Because the receiver may still be dealing with tasks in process , Wait for the task to finish , This is the third wave .
5、 ... and 、 Why only three handshakes and four waves
Because when that girl broke up , I'm still working overtime ( The receiving end is still processing the necessary procedures ), I can only tell her ,“ Okay, I get it ”( The receiving end can only pass ACK Tell the sender , A disconnect request has been received ), Only after the overtime work is over can I return the love keepsake of that year to her ( After the receiving end processes the program , Send again FIN+(ACK+1) It means the third wave ).
Master : Tiktok Shangguan programmable -> Chen lichen
边栏推荐
- B_ QuRT_ User_ Guide(40)
- 做自媒体视频剪辑怎么赚钱呢?
- Explain
- First week of July
- FreeLink开源呼叫中心设计思想
- USB (XVI) 2022-04-28
- LDO voltage stabilizing chip - internal block diagram and selection parameters
- Caip2021 preliminary VP
- Coreseek:第二步建索引及測试
- Experience sharing of system architecture designers in preparing for the exam: the direction of paper writing
猜你喜欢
Puce à tension stabilisée LDO - schéma de bloc interne et paramètres de sélection du modèle
Unity3d learning notes 5 - create sub mesh
云原生正在吞噬一切,开发者该如何应对?
Digital procurement management system for fresh food industry: help fresh food enterprises solve procurement problems and implement online procurement throughout the process
2022第六季完美童模陕西总决赛圆满落幕
经纬度PLT文件格式说明
高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的
Given an array, such as [7864, 284, 347, 7732, 8498], now you need to splice the numbers in the array to return the "largest possible number."
List. How to achieve ascending and descending sort() 2020.8.6
Explain
随机推荐
LeeCode -- 6. Zigzag transformation
树后台数据存储(採用webmethod)[通俗易懂]
Summary of common methods of object class (September 14, 2020)
B_QuRT_User_Guide(38)
13、 System optimization
sql 数据库执行问题
FPGA basics catalog
One week learning summary of STL Standard Template Library
伸展树(一) - 图文解析与C语言实现
三问TDM
Unity3D学习笔记6——GPU实例化(1)
B_ QuRT_ User_ Guide(40)
Caip2021 preliminary VP
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
0-1背包问题
2022注册测绘师备考开始 还在不知所措?手把手教你怎么考?
Solution: prompt "unsupported video format" when inserting avi format video into the message
2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
2021icpc Shanghai h.life is a game Kruskal reconstruction tree
In the field of software engineering, we have been doing scientific research for ten years!