当前位置:网站首页>UDP message structure and precautions
UDP message structure and precautions
2022-07-27 15:43:00 【Skinny monkey 117】
Catalog
The original situation of the network
The original situation of the network
The original situation of the network : Data in the network , Between routers , Jumping 、 Like a relay , To the target host , There are two problems :
1. Network transmission is unreliable
1) The data you sent , The other party does not guarantee to receive2) There is no guarantee that the other party will receive it strictly in the order in which it was sent
Because the road may be different , It is difficult to guarantee that the data will arrive in the order of departure .
2. The Internet is not secure
1) All the data you send , The routers along the way can be checked or modified ( hacking 、 Tampering )2) Others can fake the data you send
The transport layer UDP
User Datagram Protocol User message protocol
UDP Is a very simple transport layer protocol , It just fulfills the most basic responsibilities of the transport layer ( stay host to host Together with the case , Realization process to process).
The network layer itself is unreliable ,UDP I haven't done any treatment , therefore ,UDP It's not reliable .It's not reliable here , Not at all UDP What did you do , Just become unreliable , It is UDP You've done nothing at all? , Therefore, the unreliability of the network layer is directly expressed to the application layer , So from the perspective of application layer , We just said UDP It's not reliable .
UDP What has been done ( Mechanism )
UDP The head of the newspaper (header) What does it look like , The contents of these headers , It's all cooperation UDP The agreement fulfills its duties .
1. Responsibilities in the header of all network protocols :How to unpack ( How to put header and payload Separate )
byte[]data = {12345}
2. The problem of distribution , stay UDP in , The problem of distribution is actually process to process The problem of .
UDP Public praise of (UDP Characteristics ) From the perspective of application layer :
shortcoming : unreliable
advantage : There is no connection 、 Data oriented message 、 The cost is low ( cheap )
UDP Header structure
How can the recipient be based on header Unpack the data in . because header The length of is fixed ( Fixed length ), front 8 Bytes must be header, The rest must be payload.
UDP length : The length of the whole message .64kb16 position (bit) = 2 byte (byte) = 2^16-1=65535——>65535 / 1024 = 64kb
How to make it for distribution , Which process of the application layer should the data be handed over ?
Use the destination port . At the same time, it can support reply , Also bring the source port .
The checksum
UDP buffer
buffer
UDP No send buffer
UDP There's a receive buffer
Summary
边栏推荐
猜你喜欢

C语言:数据的存储

Leetcode 783. binary search tree node minimum distance tree /easy

数组名是首元素地址吗?

Spark Bucket Table Join

HaoChen CAD building 2022 software installation package download and installation tutorial

复杂度分析

【剑指offer】面试题45:把数组排成最小的数

C语言:三子棋游戏

NPM install error unable to access

Troubleshooting the slow startup of spark local programs
随机推荐
[正则表达式] 单个字符匹配
[0 basic operations research] [super detail] column generation
【剑指offer】面试题53-Ⅱ:0~n-1中缺失的数字——二分查找
Network equipment hard core technology insider router Chapter 16 dpdk and its prequel (I)
[daily question 1] 558. Intersection of quadtrees
HaoChen CAD building 2022 software installation package download and installation tutorial
js使用一元运算符简化字符串转数字
[正则表达式] 匹配多个字符
使用Prometheus监控Spark任务
实体类(VO,DO,DTO)的划分
【剑指offer】面试题42:连续子数组的最大和——附0x80000000与INT_MIN
Learn parquet file format
[系统编程] 进程,线程问题总结
Spark 3.0 DPP实现逻辑
[正则表达式] 匹配开头和结尾
Singles cup, web:web check in
C:浅谈函数
Push down of spark filter operator on parquet file
Network equipment hard core technology insider router Chapter 21 reconfigurable router
Multi table query_ Exercise 1 & Exercise 2 & Exercise 3









