当前位置:网站首页>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
边栏推荐
- Acmstreamopen return value problem
- 地方/园区产业规划之 “ 如何进行产业定位 ”
- 数字时代的“文艺复兴”?起底数字藏品,让人欢喜让人愁
- sql_ mode=only_ full_ group_ By's pit
- Laravel document sorting 9. Blade template
- [openwrt] we recommend a domestically developed version of openwrt, an introduction to istoreos. It is very easy to use. It is mainly optimized. It solves the problem of Sinicization.
- How to draw an industry investment map
- Failed to install redis interface
- NFT insider 63: the sandbox reached a cooperation with Time magazine, and YGG established Spain's subdao
- PHP code audit 1 - php Ini
猜你喜欢

Laravel document sorting 4. Controller

《Missing Parts》NFT 作品集第 5 系列上线 The Sandbox 市场平台

【openwrt】推荐一个国内开发的openwrt的版本,iStoreOS简介,非常好用,主要是做了一些优化。解决了汉化的问题。

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

Intel 13th generation core showed its true colors for the first time: 68mb cache improved significantly

Lecture record: history and development of strapdown inertial navigation solution

AI quantitative transaction (II) -- tushare financial data framework

How many images can opencv open?

i. Max development board learning record

Hello CTP (III) - CTP quotation API
随机推荐
kenlm
sql_ mode=only_ full_ group_ By's pit
【LeetCode】22. 括号生成
numpy np tips:使用opencv对数组插值放缩到固定形状 cv2.resize(res, dsize=(64, 64), interpolation=cv2.INTER_CUBIC)
WMS仓储管理系统的使用价值,你知道多少
Intel 13th generation core showed its true colors for the first time: 68mb cache improved significantly
Nodejs 通过Heidisql连接mysql出现ER_BAD_DB_ERROR: Unknown database 'my_db_books'
PHP code audit 1 - php Ini
如何绘制产业招商地图
关于TCP连接四次握手(或者叫四次挥手)的详细总结
@Requestbody solution get parameter is null
kenlm
Numpy NP tips: use OpenCV to interpolate and zoom the array to a fixed shape cv2 resize(res, dsize=(64, 64), interpolation=cv2. INTER_ CUBIC)
Development of trading system (IX) -- dark pool technology
PHP code audit 2 - these functions must be known and understood
地方/园区产业规划之 “ 如何进行产业定位 ”
Flutter FittedBox组件
Flutter Builder & futurebuilder components
Development of trading system (XI) -- Introduction to quickfix
Laravel document sorting 9. Blade template