当前位置:网站首页>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.
边栏推荐
- Summary of MySQL common interview questions (recommended collection!!!)
- Duplicate entry 'XXX' for key 'XXX.PRIMARY' solution.
- [mysql improves query efficiency] Mysql database query is slow to solve the problem
- Goodbye to the cumbersome Excel, mastering data analysis and processing technology depends on it
- wx.miniProgram.navigateTo在web-view中跳回小程序并传参
- Mysql application cannot find my.ini file after installation
- Quickly master concurrent programming --- the basics
- MySQL优化:从十几秒优化到三百毫秒
- Unity Framework Design Series: How Unity Designs Network Frameworks
- Linux的mysql报ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘ (using password NOYSE)
猜你喜欢
随机推荐
SQL语句中对时间字段进行区间查询
账号或密码多次输入错误,进行账号封禁
分布式事务——分布式事务简介、分布式事务框架 Seata(AT模式、Tcc模式、Tcc Vs AT)、分布式事务—MQ
剑指offer专项突击版 --- 第 3 天
分布式事务处理方案大 PK!
C语言指针详解
.NET-9. A mess of theoretical notes (concepts, ideas)
DVWA shooting range environment construction
剑指offer专项突击版 --- 第 4 天
matlab simulink欠驱动水面船舶航迹自抗扰控制研究
【JS面试题】面试官:“[1,2,3].map(parseInt)“ 输出结果是什么?答上来就算你通过面试
Sql解析转换之JSqlParse完整介绍
Pytorch教程Introduction中的神经网络实现示例
SQL injection of DVWA
Why use Flink and how to get started with Flink?
numpy和pytorch中的元素拼接操作:stack,concatenat,cat
Unity resources management series: Unity framework how to resource management
剑指offer专项突击版 ---- 第2天
面试官,不要再问我三次握手和四次挥手
Moment Pool Cloud quickly installs packages such as torch-sparse and torch-geometric








