当前位置:网站首页>Three handshakes and four waves
Three handshakes and four waves
2022-07-31 05:31:00 【The flowers are blooming in the south of the city^】
Three handshake
1. The first handshake: The client sends a data packet with the bit code SYN = 1 (the SYN flag bit is set) and randomly generates the initial sequence number Seq = J to the server.The server is informed by SYN = 1 (set) that the client has requested to establish a connection.
2. The second handshake: After the server receives the request, it needs to confirm the connection information, and sends the confirmation number to the client Ack = (client's Seq +1, J+1), SYN = 1, ACK = 1 (SYN,ACK flag bit is set), randomly generated sequence number Seq = K data packet.
3. The third handshake: After the client receives it, check whether the Ack is correct, that is, the Seq +1 (J+1) sent for the first time, and whether the bit code ACK is 1.If it is correct, the client will send Ack = (Seq+1 on the server side, K+1), ACK = 1, and an acknowledgment packet whose sequence number Seq is the server acknowledgment number J.After the server receives it and confirms the previously sent Seq(K+1) value and ACK= 1 (ACK is set), the connection is established successfully.After these three steps, the client and the server successfully establish a TCP connection.These three steps are collectively referred to as the three-way handshake.
The above Seq represents the sequence number, Ack represents the confirmation number, SYN and ACK and FIN are all flag bits.ACK is set to 1 to indicate that the acknowledgment number field is valid, if ACK is 0, the segment does not contain acknowledgment information.SYN is used in the connection establishment process. In the connection request, SYN = 1 and ACK = 0 indicate that the segment does not have a piggybacked acknowledgment field.The connection reply will piggyback an acknowledgment, so the reply will have SYN= 1 and ACK= 1.Also there is no cost to send an ACK, so we will see that once a connection is established, the ACK flag is always set to 1
Four waves
1. The client sends a FIN Seq = M (FIN set, serial number is M) packet to close the data transfer from the client to the server.
2. When the server receives this FIN, it sends back an ACK, confirming that the sequence number Ack is the received sequence number M+1.
3. The server closes the connection with the client and sends a FIN Seq = N to the client.
4. The client sends back an ACK message for confirmation, and the confirmation sequence number Ack is the received sequence number N+1.
For the four times of wave, in fact, if you look carefully, it is twice, because TCP is full-duplex, and both sides must be closed.At the time of termination, one side is passive, so it seems to be four waves.
边栏推荐
- Interviewer, don't ask me to shake hands three times and wave four times again
- MYSQL下载及安装完整教程
- TOGAF之架构标准规范(一)
- Interview Redis High Reliability | Master-Slave Mode, Sentinel Mode, Cluster Cluster Mode
- Unity Framework Design Series: How Unity Designs Network Frameworks
- What are the advantages and disadvantages of Unity shader forge and the built-in shader graph?
- [Detailed explanation of ORACLE Explain]
- 基于flask的三方登陆的流程
- Centos7 install mysql5.7 steps (graphical version)
- MySQL optimization: from ten seconds to three hundred milliseconds
猜你喜欢
sql语句之多表查询
Interviewer: If the order is not paid within 30 minutes, it will be automatically canceled. How to do this?
剑指offer专项突击版 --- 第 3 天
Typec手机有线网卡网线转网口转接口快充方案
mysql uses on duplicate key update to update data in batches
【mysql 提高查询效率】Mysql 数据库查询好慢问题解决
MySQL window function
Temporal客户端模型
[mysql improves query efficiency] Mysql database query is slow to solve the problem
MYSQL一站式学习,看完即学完
随机推荐
剑指offer专项突击版 --- 第 3 天
TOGAF之架构标准规范(一)
信息系统项目管理师核心考点(五十五)配置管理员(CMO)的工作
A complete introduction to JSqlParse of Sql parsing and conversion
C语言教程(三)-if和循环
Temporal客户端模型
一文了解大厂的DDD领域驱动设计
docker安装postgresSQL和设置自定义数据目录
【LeetCode-SQL每日一练】——2. 第二高的薪水
12个MySQL慢查询的原因分析
.NET-9. A mess of theoretical notes (concepts, ideas)
[Detailed explanation of ORACLE Explain]
C语言的文件操作(一)
MySQL优化之慢日志查询
DVWA shooting range environment construction
DVWA installation tutorial (understand what you don't understand · in detail)
剑指offer专项突击版 ---- 第1天
【MySQL8入门到精通】基础篇- Linux系统静默安装MySQL,跨版本升级
Shell重油常压塔模拟仿真与控制
Minio upload file ssl certificate is not trusted