当前位置:网站首页>TCP三次握手、四次断开
TCP三次握手、四次断开
2022-07-26 22:50:00 【less than _ermi】
TCP的三次握手、四次断开主要关注TCP头部序列号和确认号以及几个标记部位。三次握手就是建立一个TCP连接时,确认客户端和服务端的序列号。
三次握手:最开始的时候,客户端和服务端都处于关闭状态,服务器主动监听某个端口,客户端随机生成序列号,发送给服务端连接请求,在服务端接收到了客户端的连接请求后,自己也初始化对应的序列号,发送给客户端,客户端收到服务端的消息后便知道了服务端已经知道自己的序列号并且自己也知道了服务端的序列号,此时客户端只需要告诉服务端自己已经接收到了它发送过来的序列号,当服务端收到客户端发给他的消息(我已经接收到了你的序列号)的时候,客户端和服务端连接就确立了。总结下来就是双方把自己的序列号发给对方,看对方是否可以收到,三次握手就可以看到双方都有接收和发送能力。
四次断开:建立连接完之后,客户端和服务端都处于确立连接的状态,如果客户端想要主动断开连接,告诉服务端我要主动断开连接,服务端收到消息后告知客户端收到的消息已确认接收无误。这时候,等待服务端确认已经没有数据返回给客户端后,告诉客户端断开连接的信息,自己进入等待连接断开的状态,客户端收到断开连接的信息告诉服务端确认断开,自己进入连接结束的状态,服务端收到确认断开信息后,服务端就进入了关闭状态,客户端在连接结束状态等待一会儿过后也进入了关闭状态。
边栏推荐
猜你喜欢

7.13 Weilai approved the written examination in advance

HCIP第一天静态路由综合实验

NAT network address translation experiment

About unsafe problems such as fopen and strError encountered in vs2022 or advanced version running environment

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

(title + detailed idea + annotated code) codeforces round 805 (Div. 3) F Equate Multisets

动态路由配置

7.16 written examination of Duoyi network

OSPF basic configuration application (comprehensive experiment: interference election default routing area summary authentication -- interface authentication)

Brief introduction of VLAN principle and specific experimental configuration
随机推荐
Experiment of total connection and star topology of mGRE
Codeforces Round #809 (Div. 2), problem: (C) Qpwoeirut And The City
Educational Codeforces Round 132 (Rated for Div. 2), problem: (D) Rorororobot
多线程中 synchronized 锁升级的原理是什么?
First knowledge of C language (2)
STM32 introductory tutorial lesson 2
HCIA静态路由基础模拟实验
The basic configuration of static routing (planning of IP address and configuration of static routing) realizes the accessibility of the whole network.
Lvs+keepalived project practice
ESP8266Wi-Fi数据通讯
数字芯片的面积优化:第三届“华为杯”研究生创芯大赛数字方向上机题1详解
Lesson 5 - key control LED
最新京东短信登录+傻妞机器人保姆级部署教程(2022/7/24)
全连MGRE与星型拓扑MGRE
2022 latest live broadcast monitoring 24-hour monitoring (III) analysis of barrage in live broadcast room
Use of golang - sync package (waitgroup, once, mutex, rwmutex, cond, pool, map)
C language - value range of data type and basic data type
Lora光照传感器节点数据采集
广域网技术实验
【C语言程序设计】分支结构