当前位置:网站首页>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 -边栏推荐
- [virtual machine data recovery] data recovery of XenServer virtual machine unavailable due to unexpected power failure
- Is it safe for Huishang futures to open an account? What should Huishang futures pay attention to when opening an account?
- 微服务化解决文库下载业务问题实践
- [hcie security] dual computer hot standby - primary and standby backup
- Multivariable time series prediction using LSTM -- problem summary
- 洛谷-线段覆盖-(区间排序问题总结)
- <button> 与 <input type=“button“ />
- 任正非再谈美国打压:活下去就是胜利,要战胜美国
- Serial port communication failure
- (C语言)文件的基本操作
猜你喜欢

Flutter Performance Optimization Practice - UI chapter

Serial port communication failure

【MySQL系列】-索引知多少

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

Difference between redis hash and string

golang版本管理gvm

idea中debug时如何进入指定的用户方法体中?

2022 open atom global open source summit agenda express | list of sub forum agenda on July 27
![[Oracle training] - deploy Ogg known as zero downtime migration](/img/bc/4ee0493129d5abab931ca50dbdce6f.png)
[Oracle training] - deploy Ogg known as zero downtime migration

2022-7-26 the seventh group of abstractions and interfaces
随机推荐
Deployment of kubernetes
idea中debug时如何进入指定的用户方法体中?
IT系统为什么需要可观测性?
Relevant contents about wireless communication
Difference between redis hash and string
拖放表格行
Devops has been practiced for many years. What is the most painful thing?
2022-7-26 the seventh group of abstractions and interfaces
[MySQL series] - how much do you know about the index
Get the direction of text selection
Preview image before uploading
留存收益率计算公式
CFdiv1+2-Pathwalks-(树状数组+线性dp)
Props with type Object/Array must...
Why does it system need observability?
立即报名:7 月 29 日推荐系统峰会 2022
Niuke multi school -journey- (map building distra+ card often optimization)
HTTP cache browser cache that rabbits can understand
Summary of common interview questions on computer network, including answers
JS click the picture to print the image