当前位置:网站首页>Three handshakes and four disconnects of TCP
Three handshakes and four disconnects of TCP
2022-07-27 02:30:00 【m0_ seventy-two million five hundred and eighty-six thousand an】
TCP The purpose of the three handshakes is to establish a connection between the client and the server , It is convenient for a series of data transmission in the future .
Three handshakes
The first handshake : The client sends a message to the server with the ID SYN A connectable request packet ( The package serial number is randomly generated , namely seq number=x), Request a connection to the server .
The second handshake : The server confirms that it has received the SYN After the message , Return to your own SYN message (seq number=y One of the serial numbers SYN Connection request package ) In response , And send a message with ACK Identify an answer packet (ack=y+1).
The third handshake : The client received a message from the server SYN+ACK After the packet , Will send a message with ACK Identification confirmation package (ack=y+1), After sending , The client and server enter ESTABLISHED state , That is, the connection is successful .
Four disconnects
Disconnect for the first time : After the data that the client needs to transmit to the server is transmitted , The client will send a message with FIN Identified packets (FIN=1,seq number=x), Request to disconnect from the server .
Second disconnection : The server received a message with FIN After the identified packet , Return to the client with ACK Identified packets , namely ACK message (ACK=1,ack=x+1), It indicates that the server has received the message from the client , At this time, the server stops accepting connections , That is, the server is CLOSE_WAIT state .
Disconnect for the third time : The server will send a message with FIN Identified packets (FIN=1,seq number=y) , And send a message with ACK Identification confirmation package (ACK=1,ack=x+1) This means that the data that the server needs to transmit to the client has been transmitted , Used to stop the server from sending data to the client .
Disconnect for the fourth time : Client received FIN After the identified packet , There will still be one ACK The identified message is used as a reply (ACK=1,ack=y+1), At this time, the client stops accepting connections , That is, the client is CLOSE_WAIT state .
边栏推荐
猜你喜欢

C language - first program, print, variables and constants

OSPF路由信息协议-拓扑实验

OSPF basic experimental configuration

小姐姐笔记:我是如何学习简单源码拓展视野的

Full company mGRE and star topology mGRE

MGRE、PPP、HDLC综合实验

C language -- nesting of relational and logical operators, if statements, switch statements, and branch structures

最新多线程&高并发学习资料,面试心里有底气

【用C语言绘制直角坐标系】

About unsafe problems such as fopen and strError encountered in vs2022 or advanced version running environment
随机推荐
Lora communication application development
【你了解Cache吗——全面理解高速缓冲存储器】
RISC-V工具链编译笔记
今天浅讲一下转义字符【萌新版】
HCIP 双向重发布以及路由策略
光光光仔的CSDN之旅
Guangguangzai's CSDN journey
Hcip first day static routing comprehensive experiment
LabelImg标注的xml格式转yolov5
HCIP第一天静态路由综合实验
静态路由实验配置
C语言的常数知识讲解
【封神演绎、十五分钟让你彻底学会栈的使用!!!】
ESP8266Wi-Fi数据通讯
HandsomeForum学习论坛
JUC并发编程
Can bus communication application
记录第N次SQL异常
Find a specific number in an ordered array
求解整数的每一位