当前位置:网站首页>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
边栏推荐
- Dynamics 365 find field filtering
- 648. Word replacement
- Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
- MATLAB signal processing [Q & A essays · 2]
- PCB wiring rules of PCI Express interface
- 建筑建材行业SRM供应商云协同管理平台解决方案,实现业务应用可扩展可配置
- V-for traversal object
- Cloud native is devouring everything. How should developers deal with it?
- B_QuRT_User_Guide(39)
- B_QuRT_User_Guide(36)
猜你喜欢

B_QuRT_User_Guide(36)

Add data analysis tools in Excel

家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化

B_QuRT_User_Guide(36)

RE1 attack and defense world reverse

Three questions TDM

电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级

2022第六季完美童模陕西总决赛圆满落幕
![给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」](/img/21/2e99dd6173ab4925ec22290cd4a357.png)
给出一个数组,如 [7864, 284, 347, 7732, 8498],现在需要将数组中的数字拼接起来,返回「最大的可能拼出的数字」

ROS2专题(03):ROS1和ROS2的区别【02】
随机推荐
System design overview
Force deduction solution summary 648 word replacement
高效的S2B2C电商系统,是这样帮助电子材料企业提升应变能力的
Description of longitude and latitude PLT file format
【7.4】25. K 个一组翻转链表
USB (XV) 2022-04-14
Deep understanding of MySQL lock and transaction isolation level
云原生数据仓库AnalyticDB MySQL版用户手册
Cloud native data warehouse analyticdb MySQL user manual
[microservices SCG] gateway integration Sentinel
Unity3d Learning Notes 6 - GPU instantiation (1)
Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
Happy gathering time
深入理解Mysql锁与事务隔离级别
SAP 内存参数调优过程
Matlab-SEIR传染病模型预测
Caip2021 preliminary VP
JS get the key and value of the object
MATLAB signal processing [Q & A essays · 2]
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response