当前位置:网站首页>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 .
边栏推荐
猜你喜欢

【洋哥带你玩转线性表(四)——链式队列】

HCIP oSPF综合实验

MySQL course 1. simple command line -- simple record welcome to supplement and correct errors

ESP8266Wi-Fi数据通讯

多线程中 synchronized 锁升级的原理是什么?

Wechat applet: user wechat login process (attached: flow chart + source code)

数字集成电路:CMOS反相器(一)静态特性

(the most detailed in History) codeforces round 805 (Div. 3) e Split Into Two Sets

(prefix and / thinking) codeforces round 806 (Div. 4) F Yet Another Problem About Pairs Satisfying an Inequality

Record the star user of handsomeblog
随机推荐
【C语言】strlen与sizeof相关区分
C language -- nesting of relational and logical operators, if statements, switch statements, and branch structures
HCIP 双向重发布以及路由策略
Nb-iot networking communication
NAT网络地址转换协议-拓扑实验
在腾讯测试岗干了5年,7月无情被辞,想给还在划水的兄弟提个醒.....
Can bus communication application
MGRE, PPP, HDLC comprehensive experiment
勤写标兵——云小井
(prefix and / thinking) codeforces round 806 (Div. 4) F Yet Another Problem About Pairs Satisfying an Inequality
怎么判断一个数是奇数还是偶数?
HCIP-第二天
HCIP-第五天-OSPF扩展配置实验
(super detailed version, don't know to comment at any time) codeforces round 804 (Div. 2) C the third problem
MySQL course 1. simple command line -- simple record welcome to supplement and correct errors
今天浅讲一下转义字符【萌新版】
【洋哥带你玩转线性表(三)——双向链表】
记录HandsomeBlog的star用户
Codeforces Round #809 (Div. 2), problem: (C) Qpwoeirut And The City
在有序数组找具体某个数字