当前位置:网站首页>Solution to the problem of sticking and unpacking TCP
Solution to the problem of sticking and unpacking TCP
2022-07-26 21:28:00 【Official account: on knowledge】
TCP Solution to the problem of sticking and unpacking
Why? TCP And UDP No glue bag
1️⃣ because udp Packets of have protection boundaries .
2️⃣tcp Is in the form of a byte stream , That is, there is no boundary , Therefore, packet sticking and unpacking may occur when the application layer data is in the transport layer .
The reason for this problem is illustrated
1️⃣ Byte stream can be understood as data flowing in a two-way channel , This data is actually what we often call binary data , In short, it's a lot of 01 strand . these 01 There is no boundary between strings .
2️⃣ Application layer TCP Protocol data , It is not sent to the destination host in the unit of message , Instead, it is sent to the downstream in the form of byte stream , This data may be cut and assembled into various data packets , After receiving these packets, the receiver does not restore the original message correctly , Therefore, the phenomenon of sticking package appears .
Sticking case 
Unpacking 
unpacking & Sticky package

Solution
Application layer measures
1️⃣ The size of the package .
2️⃣ Add fixed characters to the end of the package , such as :FTP The solution in : Add... At the end \r\n
3️⃣ The message header + Message body . There is the length of the message body in the message header .
4️⃣ Customize .
- END -边栏推荐
- encodeURI VS encodeURIComponent
- Object.getOwnPropertyNames() VS Object.keys()
- Some unexpected bug records
- kubernetes之Deployment
- Calculation formula of retained earnings rate
- 1-《PyTorch深度学习实践》-线性模型
- 微服务化解决文库下载业务问题实践
- 串口通信失败
- [virtual machine data recovery] data recovery of XenServer virtual machine unavailable due to unexpected power failure
- [question] browser get request with token
猜你喜欢

ECCV 2022 | 同时完成四项跟踪任务!Unicorn: 迈向目标跟踪的大统一

Detailed illustration of B-tree and its implementation in C language

What are the characteristics of low code tools? The two development tracks of low code that can be seen by discerning people!

工业基础类IFC—提取模型结构树
![[MySQL series] - how much do you know about the index](/img/d7/5045a846580be106e2bf16d7b30581.png)
[MySQL series] - how much do you know about the index

Summary of 4 years of software testing experience and interviews with more than 20 companies after job hopping

Apaas low code platform (I) | leave complexity to yourself and simplicity to users

Today, the company came across an Alibaba P8, which was really seen as the ceiling of the foundation

LeetCode 练习——剑指 Offer II 005. 单词长度的最大乘积

golang版本管理gvm
随机推荐
Ros2 method of obtaining current system time
传三星从比利时获得EUV光刻胶
What are the characteristics of low code tools? The two development tracks of low code that can be seen by discerning people!
【HCIA安全】NAT网络地址转换
缩放文本以适合元素内部
HTTP cache browser cache that rabbits can understand
Mysql -count :count(1)、count(*)、count(列名)的区别
【Flutter -- GetX】弹框 - Dialog、Snackbar、BottomSheet
How to implement Devops with automation tools | including low code and Devops application practice
Devsecops, speed and security
Summary of common interview questions of computer composition principle, including answers
Show load indicator when loading iframe
[HCIA security] bidirectional nat
记一次invalid bound statement xxxxxx 问题解决思路
Industrial basic IFC - extract model structure tree
ROS2节点通信实现零拷贝
JS click the picture to print the image
Niuke brush questions - MySQL series
Devops has been practiced for many years. What is the most painful thing?
测试用例千万不能随便,记录由一个测试用例异常引起的思考