当前位置:网站首页>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
边栏推荐
- 代表多样性的彩色 NFT 系列上线 The Sandbox 市场平台
- openmmlab-环境配置
- Development of trading system (XIII) -- Analysis of quickfix source code
- Shutter fittedbox component
- 什么是持久化?redis 持久化中的RDB和AOF是什么?
- Basic use of OBS browser+ browser
- How many images can opencv open?
- Hello CTP (III) - CTP quotation API
- Development of trading system (x) -- fix agreement
- PHP code audit 2 - these functions must be known and understood
猜你喜欢

Summary of various problems encountered by cocos2d-x

navicat可不可以直接操作安卓数据库SQLite

MySQL插入过程报错1062,但是我没有该字段。

Lecture record: history and development of strapdown inertial navigation solution

5 key indicators of SEO: ranking + traffic + session + length of stay + bounce rate
![L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
L'épée leetcode fait référence au chemin leetcode de l'offre II 091 pour peindre la maison [planification dynamique] heroding

Is opencv open source?

UCLA | generative pre training for black box optimization

Error 1062 is reported during MySQL insertion, but I do not have this field.

acmStreamOpen返回值问题
随机推荐
代表多样性的彩色 NFT 系列上线 The Sandbox 市场平台
Mysql的order by
numpy np tips: numpy数组的squeeze等处理
OBS Browser+浏览器的基本使用
navicat可不可以直接操作安卓数据库SQLite
Hello CTP (IV) - CTP transaction API
numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
2020.3.3 notes async/await and promise and Then processes and threads
Simple integration of client go gin 11 delete
"How to carry out industrial positioning" in local / Park industrial planning
Development of trading system (XI) -- Introduction to quickfix
Laravel document sorting 4. Controller
1. Phase II of the project - user registration and login
微信小程序父子组件之间传值
Although the Internet in the traditional sense has long ceased to exist, this does not mean that the Internet has long disappeared
论文阅读《LSD-SLAM: Large-Scale Direct Monocular SLAM》
Finereport displays and hides column data according to conditions
如何绘制产业招商地图
BSC smart contract dividend mainstream currency | including marketing wallet | deflation | reflow | dividend free token | available for direct deployment
Laravel document sorting 7. View