当前位置:网站首页>TCP-三次握手和四次挥手简单理解
TCP-三次握手和四次挥手简单理解
2022-07-04 03:51:00 【我不是萧海哇~~~~】
三次握手(three-way handshaking)
1.背景:TCP位于传输层,作用是提供可靠的字节流服务,为了准确无误地将数据送达目的地,TCP协议采纳三次握手策略。
2.原理:
1)发送端首先发送一个带有SYN(synchronize)标志地数据包给接收方。
2)接收方接收后,回传一个带有SYN/ACK标志的数据包传递确认信息,表示我收到了。
3)最后,发送方再回传一个带有ACK标志的数据包,代表我知道了,表示’握手‘结束。
通俗的说法
1)Client:嘿,李四,是我,听到了吗?
2)Server:我听到了,你能听到我的吗?
3)Client:好的,我们互相都能听到对方的话,我们的通信可以开始了。
四次挥手(Four-Way-Wavehand)
1.意义:当被动方收到主动方的FIN报文通知时,它仅仅表示主动方没有数据再发送给被动方了。但未必被动方所有的数据都完整的发送给了主动方,所以被动方不会马上关闭SOCKET,它可能还需要发送一些数据给主动方后,再发送FIN报文给主动方,告诉主动方同意关闭连接,所以这里的ACK报文和FIN报文多数情况下都是分开发送的。
2.原理:
1)第一次挥手:Client发送一个FIN,用来关闭Client到Server的数据传送,Client进入FIN_WAIT_1状态。
2)第二次挥手:Server收到FIN后,发送一个ACK给Client,确认序号为收到序号+1(与SYN相同,一个FIN占用一个序号),Server进入CLOSE_WAIT状态。
3)第三次挥手:Server发送一个FIN,用来关闭Server到Client的数据传送,Server进入LAST_ACK状态。
4)第四次挥手:Client收到FIN后,Client进入TIME_WAIT状态,接着发送一个ACK给Server,确认序号为收到序号+1,Server进入CLOSED状态,完成四次挥手
通俗的说法
1)Client:我所有东西都说完了
2)Server:我已经全部听到了,但是等等我,我还没说完
3)Server:好了,我已经说完了
4)Client:好的,那我们的通信结束l
链接:https://www.jianshu.com/p/d3725391af59
边栏推荐
- Idea configuration 360zip open by default -- external tools
- [book club issue 13] multimedia processing tool ffmpeg tool set
- MySQL maxscale realizes read-write separation
- 2022-07-03: there are 0 and 1 in the array. Be sure to flip an interval. Flip: 0 becomes 1, 1 becomes 0. What is the maximum number of 1 after turning? From little red book. 3.13 written examination.
- [csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability
- '2'>' 10'==true? How does JS perform implicit type conversion?
- 毕业设计:设计秒杀电商系统
- CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
- Small record of thinking
- Support the first triggered go ticker
猜你喜欢

指针数组和数组指针

I Build a simple microservice project

Restore the subtlety of window position

Parameterization of controls in katalon

SQL语句加强练习(MySQL8.0为例)

【微服务|openfeign】@FeignClient详解

Mitsubishi M70 macro variable reading Mitsubishi M80 public variable acquisition Mitsubishi CNC variable reading acquisition Mitsubishi CNC remote tool compensation Mitsubishi machine tool online tool

2021 RSC | Drug–target affinity prediction using graph neural network and contact maps

ctf-pikachu-XSS
![[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability](/img/46/cb5a10ffe3fcdffb7da68dbaef5b1f.png)
[csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability
随机推荐
深度优先搜索简要讲解(附带基础题)
02 specific implementation of LS command
毕业设计:设计秒杀电商系统
"Implement both software and hardware" to help build a new cloud computing data center
Support the first triggered go ticker
'2'>' 10'==true? How does JS perform implicit type conversion?
AAAI2022 | Word Embeddings via Causal Inference: Gender Bias Reducing and Semantic Information Preserving
Tcpclientdemo for TCP protocol interaction
CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
01 QEMU starts the compiled image vfs: unable to mount root FS on unknown block (0,0)
pytest多进程/多线程执行测试用例
【罗技】m720
Cesiumjs 2022^ source code interpretation [0] - article directory and source code engineering structure
Go 语言入门很简单:Go 实现凯撒密码
指针数组和数组指针
2021 RSC | Drug–target affinity prediction using graph neural network and contact maps
JDBC advanced
渗透实战-guest账户-mimikatz-向日葵-sql提权-离线解密
Confession code collection, who says program apes don't understand romance
用于TCP协议交互的TCPClientDemo