当前位置:网站首页>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.
边栏推荐
- Southern University of Science and Technology: Xiaoying Tang | AADG: Automatic Enhancement for Generalization in the Field of Retinal Image Segmentation
- RTL8762DK RTC(五)
- Google "Cloud Developer Quick Checklist"; Tsinghua 3D Human Body Dataset; SenseTime "Universal Vision Framework" open class; Web3 Minimalist Getting Started Guide; Free Books for Efficient Deep Learni
- MYSQL逻辑架构
- Rasa 3.x Study Series - Rasa - Issues 4918 Study Notes
- leetcode:1562. 查找大小为 M 的最新分组【模拟 + 端点记录 + 范围合并】
- 自动化机器学习pycaret: PyCaret Basic Auto Classification LightGBM
- Rasa 3.x 学习系列- Rasa - Issues 4898 学习笔记
- 七月集训(第31天) —— 状态压缩
- 二叉树遍历非递归程序 -- 使用栈模拟系统栈
猜你喜欢
Matlab/Arcgis processing nc data
[AMEX] LGBM Optuna American Express Credit Card Fraud Contest kaggle
【密码学/密码分析】基于TMTO的密码分析方法
虹科分享|如何用移动目标防御技术防范未知因素
leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]
Key Points Estimation and Point Instance
Blueprint: Yang Hui's Triangular Arrangement
Academicians of the two academies speak bluntly: Don't be superstitious about academicians
Carefully summarize thirteen suggestions to help you create more suitable MySQL indexes
JVM面试题总结(持续更新中)
随机推荐
Named Entity Recognition - Model: BERT-MRC
类和对象:中
js 实现复制功能
/usr/sbin/vmware-authdlauncher: error while loading shared libraries: libssl.so.1.0.2*解决办法
ROS2系列知识(4): 理解【服务】的概念
RTL8762DK WDG(六)
Web3.0:构建 NFT 市场(一)
设计消息队列存储消息数据的MySQL表格
Item 36: Specify std::launch::async if asynchronicity is essential.
Key Points Estimation and Point Instance
JS时间戳的意义是什么?知道sql会考虑加时间戳,JS的时间戳用于什么场景?
考研备考方案
ECCV2022 Workshop | 复杂环境中的多目标跟踪和分割
Rasa 3.x Study Series - Rasa - Issues 4918 Study Notes
MYSQL索引解析
mySql data view
Unity3D学习笔记10——纹理数组
GDB 源码分析系列文章五:动态库延迟断点实现机制
值传递还是引用传递(By Value or By Reference)
Carefully organize 16 MySQL usage specifications to reduce problems by 80% and recommend sharing with the team