当前位置:网站首页>UDP 的报文结构和注意事项
UDP 的报文结构和注意事项
2022-07-27 14:35:00 【瘦皮猴117】
目录
网络的原生情况
网络的原生情况:网络中的数据,是经过路由器之间,一跳一跳地、接力一样地,传送到目标主机上的,会带来两个问题:
1.网络传送是不可靠的
1)你发送了的数据,对方不保证一定能收到2)不能保证严格按照发送时的顺序被对方接收到
由于路可能不同,数据很难保证按照出发的顺序到达。
2.网络是不安全的
1)你发送的所有数据,沿途的路由器都可以进行查看或者修改(窃听、篡改)2)别人可以伪造成你发送的数据
传输层的UDP
User Datagram Protocol用户报文协议
UDP是一个很简单的传输层协议,它只是做到了传输层最基本的职责(在host to host 连同的情况下,实现process to process)。
网络层本身是不可靠的,UDP又没有做过任何的处理,所以,UDP是不可靠的。这里的不可靠,并不是UDP做了什么,才变得不可靠了,而是UDP什么都没做,所以把网络层的不可靠特性直接表达给了应用层,所以站在应用层的角度,我们才说UDP是不可靠的。
UDP做了哪些工作(机制)
UDP的报头(header)长什么样,这些报头中的内容,都是配合UDP协议完成它的职责的。
1.所有网络协议的报头中都要具备的职责:如何进行解包(怎么把数据中的header和 payload 分开)
byte[]data = {12345}
2.分用的问题,在UDP中,分用的问题实际上就是 process to process的问题。
UDP 的对外口碑(UDP 的特点)站在应用层的角度:
缺点:不可靠
优点:无连接、面向数据报文、成本低(便宜)
UDP报头结构
接收者如何可以根据header 中的数据进行解包。因为header的长度是定长(固定长度),前8个字节一定是header,剩下的一定是payload。
UDP长度:整个报文的长度。64kb16位(bit) = 2字节(byte) = 2^16-1=65535——>65535 / 1024 = 64kb
怎么做分用的,数据该交给应用层的哪个进程?
利用目的端口。同时可以支持回信,也把源端口带上。
校验和
UDP缓冲区
缓冲区
UDP没有发送缓冲区
UDP有接收缓冲区
小结
边栏推荐
- $router.back(-1)
- 初识结构体
- Spark 3.0 Adaptive Execution 代码实现及数据倾斜优化
- Leetcode 190. reverse binary bit operation /easy
- Network equipment hard core technology insider router Chapter 10 Cisco asr9900 disassembly (III)
- Network equipment hard core technology insider router Chapter 21 reconfigurable router
- Fluent -- layout principle and constraints
- 实体类(VO,DO,DTO)的划分
- go语言慢速入门——基本内置类型
- Spark动态资源分配的资源释放过程及BlockManager清理过程
猜你喜欢

Spark troubleshooting finishing

Leetcode 190. reverse binary bit operation /easy

How to edit a framework resource file separately

Alibaba's latest summary 2022 big factory interview real questions + comprehensive coverage of core knowledge points + detailed answers

Spark 任务Task调度异常分析

Spark 3.0 Adaptive Execution 代码实现及数据倾斜优化

Spark 3.0 DPP implementation logic

Spark 3.0 DPP实现逻辑

复杂度分析

【剑指offer】面试题42:连续子数组的最大和——附0x80000000与INT_MIN
随机推荐
Dan bin Investment Summit: on the importance of asset management!
How "Crazy" is Hefu Laomian, which is eager to be listed, with capital increasing frequently?
[正则表达式] 匹配分组
Network equipment hard core technology insider router Chapter 13 from deer by device to router (Part 1)
IJCAI 2022 outstanding papers were published, and 298 Chinese mainland authors won the first place in two items
C语言:自定义类型
Implement custom spark optimization rules
Set the position of the prompt box to move with the mouse, and solve the problem of incomplete display of the prompt box
股票开户佣金优惠,炒股开户哪家证券公司好网上开户安全吗
Unity3d learning note 10 - texture array
QT (XIII) qchart drawing line chart
Go language learning notes (1)
STL value string learning
C语言:数据的存储
flutter —— 布局原理与约束
Spark 3.0 DPP implementation logic
go语言慢速入门——go运算符
Using Prometheus to monitor spark tasks
Is it safe to open an account on a mobile phone?
QT (IV) mixed development using code and UI files









