当前位置:网站首页>图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
2022-07-06 00:33:00 【InfoQ】
什么是TCP?
- 英文全称:
Transmission Control Protocol
- 中文名称:传输控制协议

TCP三次握手
生活中的三次握手

- 小明:你好,请问是小美吗?【第一次握手】
- 小美:是的,我是小美。【第二次握手】
- 小明:好的,我知道你是小美了。【第三次握手】
专业角度的三次握手
- 服务端:服务端是专用于运行服务以满足其他计算机需求的物理计算机

- 客户端:客户端是访问服务器提供的服务的计算机硬件设备或软件
- SYN:同步序列号(Synchronize Sequence Number),这是从客户端到服务端的第一个数据包,可以描述为建立连接的请求,如果 SYN 为 1,则表示设备要建立安全连接,否则不。

- ACK:确认(Acknowledgement),可以说是SYN的响应,如果 ACK 为 1,则设备已收到 SYN 消息并确认,否则没有。



- 第一步:TCP客户端向服务端发送 TCP SYN 数据包来开始连接,数据包包含一个随机序列号n,它表示客户端应传输的数据的序列号的开始。

- 第二步:服务端收到数据包,并用它的序列号(m)进行响应,它的响应还包括确认号,即客户端的序列号加 1,此处为n+1。

- 第三步:客户端通过发送确认号来响应服务器,该确认号是服务端的序列号加 1,此处为m+1.

TCP三次握手抓包分析

172.16.16.128:2826212.58.226.142:80- 第一步:主机
172.16.16.128:2826向主机212.58.226.142:80发送[SYN] Seq=0
- 第二步:主机
212.58.226.142:80向主机172.16.16.128:2826发送[SYN,ACK] Seq=0,Ack=1
- 第三步:主机
172.16.16.128:2826向主机212.58.226.142:80发送[ACK] Seq=1,Ack=1
TCP窗口
Win=8192
其他参数
- MSS(Maximum Segment Size),最大段大小。
- WS(Windows Scaling),用于控制最大 TCP 接收窗口大小。
TCP为什么不能二次握手建立连接
- 服务端需要确认服务端可以从客户端接收数据包
- 客户端需要确认客户端可以从服务端接收数据包
- 客户端需要确认服务端可以从客户端接收数据包
- 服务端需要确认客户端可以从服务端接收数据包

- 小明问:“你好,请问时小美吗?”:发送成功后,小明确定可以他从小美接收信息,验证了第一个条件【服务端需要确认服务端可以从客户端接收数据包】
- 小美回:“是的,我是小美”:发送成功后,小美确定她可以从小明接收信息,也能确认小明可以从她这边接收信息,验证了第二、第三个条件【客户端需要确认客户端可以从服务端接收数据包】【客户端需要确认服务端可以从客户端接收数据包】
- 小明回:“好的,我知道你是小美了”:发送成功后,小明确定可以小美可以从他这边接收信息,验证了四个条件【服务端需要确认客户端可以从服务端接收数据包】
总结
- 什么是TCP?
- TCP三次握手
- 生活中的三次握手
- 专业角度的三次握手
- TCP三次握手抓包分析
- TCP窗口
- 其他参数
- TCP为什么不能二次握手建立连接
- 总结
边栏推荐
- Spark SQL null value, Nan judgment and processing
- What is information security? What is included? What is the difference with network security?
- FFT learning notes (I think it is detailed)
- 【DesignMode】装饰者模式(Decorator pattern)
- Codeforces round 804 (Div. 2) [competition record]
- notepad++正則錶達式替換字符串
- The global and Chinese markets of dial indicator calipers 2022-2028: Research Report on technology, participants, trends, market size and share
- How to use the flutter framework to develop and run small programs
- Ffmpeg captures RTSP images for image analysis
- 云导DNS和知识科普以及课堂笔记
猜你喜欢
随机推荐
FFMPEG关键结构体——AVCodecContext
NLP generation model 2017: Why are those in transformer
FFT learning notes (I think it is detailed)
State mode design procedure: Heroes in the game can rest, defend, attack normally and attack skills according to different physical strength values.
Idea远程提交spark任务到yarn集群
Idea remotely submits spark tasks to the yarn cluster
How to solve the problems caused by the import process of ecology9.0
Problems and solutions of converting date into specified string in date class
Common API classes and exception systems
MySql——CRUD
MySql——CRUD
Atcoder beginer contest 254 [VP record]
DEJA_ Vu3d - cesium feature set 055 - summary description of map service addresses of domestic and foreign manufacturers
NSSA area where OSPF is configured for Huawei equipment
Configuring OSPF load sharing for Huawei devices
wx. Getlocation (object object) application method, latest version
[binary search tree] add, delete, modify and query function code implementation
LeetCode 1598. Folder operation log collector
Knowledge about the memory size occupied by the structure
Classical concurrency problem: the dining problem of philosophers









