当前位置:网站首页>A detailed summary of four handshakes (or four waves) over TCP connections
A detailed summary of four handshakes (or four waves) over TCP connections
2022-06-25 04:27:00 【Life is sweet and good luck is good】
The process of waving four times :
( client || The server can initiate a wave motion . Suppose the client starts waving first ( Close request ). Suppose the client is considered the active party , The server is treated as a passive party .)
| First wave | Second wave | Third wave | Fourth wave |
From A to B | client → The server | The server → client | The server → client | client → The server |
state | client : ESTABLISHED→ FIN_WAIT1 | The server : ESTABLISHED→ CLOSE_WAIT client : FIN_WAIT1→ FIN_WAIT2 | The server : CLOSE_WAIT→ LAST_ACK
| client : FIN_WAIT2→ TIME_WAIT( After waiting for the time designed by the timer )→CLOSED The server : LAST_ACK→ CLOSED
|
Message name | FIN message ( Connection release message segment ) | ACK message ( Confirm message segment ) | FIN message ( Connection release message segment ) | ACK message ( Confirm message segment ) |
What | FIN = 1 Serial number :seq = u | ACK = 1 Confirmation no. = Client initial serial number (ISN)+ 1: ack = u + 1, seq = v | FIN = 1, ACK = 1 Confirmation no. ack = u + 1, seq = w | ACK = 1 Confirmation no. ack = w + 1, seq = u + 1 |
What do you mean by that? | FIN == Finish Represents it ( client ) Don't send any more data | ACK == Acknowledge Inform the other party ( client ): Your sending channel has been closed | FIN == Finish Represents it ( client ) Don't send any more data | ACK == Acknowledge Inform the other party ( client ): Your sending channel has been closed |
Whether the transmission channel is closed |
| The active party has received ACK message , State by FIN_WAIT1→ FIN_WAIT2, The transmission channel of the active party is closed . | The active party has received FIN message , The kernel automatically replies ACK message , The connection state is determined by FIN_WAIT2→ TIME_WAIT,Linux About under the system 1min after TIME_WAIT State connection will be closed completely . | The passive party receives ACK message , Connection is closed . |

About TIME_WAIT Several problems of state :
Why should the active party TIME_WAIT( After waiting for the time designed by the timer )→ CLOSED ?
Because the active side sends... To the passive side ACK message , The passive party does not receive ACK The message was still in LAST_ACK state , If the active party sends this ACK The message did not reach the passive party , The passive party will resend FIN message .
If the active party does not retain TIME_WAIT state , Directly from TIME_WAIT To CLOSED state , At this time, the port connected by the active party is free , You can create a new connection . But the passive side FIN The message may arrive again ( The router in the network repeatedly sends || The passive party has not received tcp_orphan_retries Parameter retransmitted ), In this way, new connections for normal communication may be sent repeatedly FIN The message is closed by mistake . therefore , Retain TIME_WAIT Status can be used to cope with resending FIN message .
TIME_WAIT How to deal with too many states ?
TIME_WAIT Too many states will occupy system resources .
terms of settlement ?
• modify TIME_WAIT Upper limit of connection status
• Start the rapid recycling mechanism
• Turn on the reuse mechanism
• Modify short connection to long connection
• The client actively disconnects
Refer to the post :https://yuanrengu.com/2020/77eef79f.html
边栏推荐
- 【LeetCode】143. 重排链表
- [proteus simulation] Arduino uno key controls the flashing increase / decrease display of nixie tube
- Numpy NP tips: squeeze and other processing of numpy arrays
- 彻底理解数据库事务
- Communication problems in parent and child components of uniapp
- How to install opencv? Opencv download installation tutorial
- How to draw an industry investment map
- Hello CTP (IV) - CTP transaction API
- Text keyword extraction: ansj
- Laravel document sorting 2. Route related
猜你喜欢

95% of programmers fish here

Color NFT series representing diversity launched on the sandbox market platform

5 key indicators of SEO: ranking + traffic + session + length of stay + bounce rate

Hello CTP (IV) - CTP transaction API

Text keyword extraction: ansj

Cesium graphic annotation circle, square, polygon, ellipse, etc

Cesium loading display thermal diagram

SEO的5大关键指标:排名+流量+会话+停留时长+跳出率

1280_ C language to find the average value of two unsigned integer

Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)
随机推荐
"How to carry out industrial positioning" in local / Park industrial planning
Cesium drag 3D model
小心被偷脸!天天用的人脸识别风险原来这么多?
2021.6.14 notes
What is the difference between learning code, rolling code and fixed code? The number of repeated codes, coding capacity and the principle of rolling code
Error 1062 is reported during MySQL insertion, but I do not have this field.
Summary of various problems encountered by cocos2d-x
Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
acmStreamOpen返回值问题
Cesium graphic annotation circle, square, polygon, ellipse, etc
EasyRecovery15非常好用的电脑数据恢复软件
Synchronous and asynchronous functions (callback function, promise, generator, async/await)
Introduction to intstream API
A-table mouse over the display hand, the current line can be clicked
Color NFT series representing diversity launched on the sandbox market platform
[kubernetes series] installation and use of Helm
1280_ C language to find the average value of two unsigned integer
LeetCode 剑指Offer II 091 粉刷房子[动态规划] HERODING的LeetCode之路
Laravel document sorting 9. Blade template
sql_ mode=only_ full_ group_ By's pit