当前位置:网站首页>You need to know the TCP wave four times
You need to know the TCP wave four times
2022-08-01 01:08:00 【Front-end watermelon brother】
Hello everyone, I'm the front-end watermelon brother.Today I will tell you about the four waves of TCP.
After establishing a TCP connection for a period of time, if you want to disconnect the TCP connection, the process of waving TCP four times will be performed to complete the disconnection operation.
The process of TCP four times is a bit like the three-way handshake that TCP establishes a connection.About the three-way handshake, you can read my article: "TCP three-way handshake you need to know"
The following figure shows the structure of the TCP header. Our TCP four-way wave mainly uses the yellow part.

The initiator of the three-way handshake must be different from the client, and the initiator of the disconnection of the TCP connection can be any party.For the convenience of explanation, below we describe the client as the initiator.
TCP four wave process
Let's look at the schematic first.

The first wave, the client sends a TCP request to the server, and the
in the TCP headerFIN set to 1
seq is set to a random number x
FIN is a flag bit that means finish, 1 is equivalent to true.
seq is a serial number, a place for data, we set it as a random number here to confirm to the server, so as to correspond to this TCP request.
The second wave, the server sends the TCP, and adds the
in the TCP headerACK is set to 1 (acknowledge, meaning "received")
The ack confirmation number is set to x+1 (x is from the first wave)
When the client receives this TCP request, it means that the channel from the client to the server has been closed, and you can no longer send normal data requests to the server.
At this time, the server can still send data to the client.If the server has some previous TCP requests that have not had time to respond, it can still return during the second wave and the third wave.
The third wave, the server sends a TCP request to the client:
FIN set to 1
seq is set to a random number y
Similar to the first wave, only this time the sender is the server.
The fourth wave, the client sends a TCP request to the server:
ACK set to 1
ack confirmation number set to y+1
After the server receives this request, the server can successfully change to the CLOSE state.The client will wait for a period of time before entering the closed state, because the fourth wave may not be successfully sent to the server, so wait and see if the server will resend the first wave because it did not receive the fourth wave.Three waves.
End
Different from the TCP three-way handshake.There are four full waves of TCP to close the connection.This is because between the second wave and the third wave, there may be some slow-processing data that the server needs to send to return, so the two waves are not combined.
I am the front-end watermelon brother, welcome to follow me and master more front-end knowledge.
边栏推荐
- 欧拉系统(euleros):升级Mysql
- 自动化机器学习pycaret: PyCaret Basic Auto Classification LightGBM
- OSF understands the agile development model in one minute
- MYSQL查询截取优化分析
- Js replication
- RTL8762DK RTC(五)
- 微信小程序之小程序页面语法
- 蓝图:杨辉三角排列
- JQESAP系统里的胖接口Fat interface
- Southern University of Science and Technology: Xiaoying Tang | AADG: Automatic Enhancement for Generalization in the Field of Retinal Image Segmentation
猜你喜欢

MYSQL查询截取优化分析

RTL8762DK uses DebugAnalyzer (four)

Kyoto University: Masaki Waga | Dynamic Masking for Reinforcement Learning in Black Box Environments

NIO programming

STK8321 I2C(昇佳-加速度传感器)示例

MYSQL逻辑架构

cobaltstrike

RTL8762DK Lighting/LED (3)

Application of integrated stepper motor in UAV automatic airport

ECCV2022 Workshop | 复杂环境中的多目标跟踪和分割
随机推荐
In 2022, the latest eight Chongqing construction members (electrical construction workers) simulation question bank and answers
Matlab / Arcgis处理nc数据
STK8321 I2C(昇佳-加速度传感器)示例
RTL8762DK WDG (six)
Carefully summarize thirteen suggestions to help you create more suitable MySQL indexes
ECCV2022 Workshop | 复杂环境中的多目标跟踪和分割
Luogu P3373: 线段树
MVCC总结
MYSQL-批量插入数据
Southern University of Science and Technology: Xiaoying Tang | AADG: Automatic Enhancement for Generalization in the Field of Retinal Image Segmentation
pycaret source code analysis: download dataset\Lib\site-packages\pycaret\datasets.py
ECCV2022 Workshop | Multi-Object Tracking and Segmentation in Complex Environments
RTL8762DK RTC(五)
元宇宙改变人类工作模式的四种方式
How to Design High Availability and High Performance Middleware - Homework
MYSQL经典面试题
二叉树遍历非递归程序 -- 使用栈模拟系统栈
精心总结十三条建议,帮你创建更合适的MySQL索引
Key Points Estimation and Point Instance
500 miles