当前位置:网站首页>图解网络: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为什么不能二次握手建立连接
- 总结
边栏推荐
- 【DesignMode】适配器模式(adapter pattern)
- How to use the flutter framework to develop and run small programs
- Multithreading and high concurrency (8) -- summarize AQS shared lock from countdownlatch (punch in for the third anniversary)
- Spark AQE
- Power query data format conversion, Split Merge extraction, delete duplicates, delete errors, transpose and reverse, perspective and reverse perspective
- MDK debug时设置数据实时更新
- 电机的简介
- FFMPEG关键结构体——AVCodecContext
- Model analysis of establishment time and holding time
- Idea remotely submits spark tasks to the yarn cluster
猜你喜欢

Leetcode:20220213 week race (less bugs, top 10% 555)

Extension and application of timestamp

Priority queue (heap)

Multithreading and high concurrency (8) -- summarize AQS shared lock from countdownlatch (punch in for the third anniversary)
![Choose to pay tribute to the spirit behind continuous struggle -- Dialogue will values [Issue 4]](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
Choose to pay tribute to the spirit behind continuous struggle -- Dialogue will values [Issue 4]

Data analysis thinking analysis methods and business knowledge - analysis methods (III)

Classical concurrency problem: the dining problem of philosophers

State mode design procedure: Heroes in the game can rest, defend, attack normally and attack skills according to different physical strength values.

notepad++正則錶達式替換字符串

FPGA内部硬件结构与代码的关系
随机推荐
Huawei equipment configuration ospf-bgp linkage
多线程与高并发(8)—— 从CountDownLatch总结AQS共享锁(三周年打卡)
7.5 simulation summary
Pointer pointer array, array pointer
Common API classes and exception systems
FFMPEG关键结构体——AVFormatContext
Knowledge about the memory size occupied by the structure
免费的聊天机器人API
FFT learning notes (I think it is detailed)
NLP generation model 2017: Why are those in transformer
Anconda download + add Tsinghua +tensorflow installation +no module named 'tensorflow' +kernelrestart: restart failed, kernel restart failed
Calculate sha256 value of data or file based on crypto++
如何利用Flutter框架开发运行小程序
Data analysis thinking analysis methods and business knowledge - analysis methods (III)
Data analysis thinking analysis methods and business knowledge -- analysis methods (II)
Problems and solutions of converting date into specified string in date class
Extracting profile data from profile measurement
uniapp开发,打包成H5部署到服务器
Spark获取DataFrame中列的方式--col,$,column,apply
AtCoder Beginner Contest 254【VP记录】