当前位置:网站首页>Network protocol details: UDP
Network protocol details: UDP
2022-07-24 02:11:00 【Gold content of Xiaobai】
Catalog
Unreliable network transmission
Application layer observation UDP Characteristics
Network problems
There are many variables in the network , Because there are too many propagation routes to go through , The final data may not be complete .
Unreliable network transmission
1. Sent data , The other party may not receive
2. Cannot be received by the other party strictly in the order of sending
Network insecurity
1. The data we send is likely to be viewed during route , modify , Eavesdropping, etc
2. Someone may forge the data we send directly to others
So about the above two points , It needs to be handed over to the network layer
The transport layer UDP
full name User Datagram Protocol : User message protocol
UDP It is a very simple transport layer protocol , Only the most basic responsibilities of the transport layer can be completed .
say UDP unreliable , It's really because he didn't do anything , Not protective .
UDP Working mechanism
I think the teacher's picture is very good , So I will only make a few conceptual explanations
First map

UDP The head of the newspaper (header), It can be understood that achievement is the address on the express list , I'll elaborate later .
payload That is, data content , Provided by the application layer and packaged by the transport layer
that UDP The responsibility of the application layer is to payload pack , label , Then send it to the network layer ,
As for whether it reaches the receiver , The sender cannot know .
Application layer observation UDP Characteristics
shortcoming
unreliable , It is reflected in the above scarlet letter .
advantage
There is no connection : It will not occupy the server all the time
Data oriented message : I won't open the data package to see , It will not destroy the data sequence structure and integrity
The cost is low : Is cheap
UDP Header structure
UDP Of header Let both sides go IP And port , length 8 Bytes
The figure shows the whole message structure ,UDP Length is the message length
payload Is to remove header The remaining message length

checksum( The checksum )
It's like verifying integrity , Like you steam After downloading and decompressing, you should verify whether the file is correct , Sending documents on the Internet should also be used .
It is mostly used for long-distance communication , Ensure data integrity and accuracy .
When I send , I will put the original data checksum Put it in header in , As soon as the receiver receives , Will calculate another checksum, Comparison of two calibrations , Dissimilarity , It proves that the data is damaged or modified .
UDP Receive buffer
Buffer concept
From the application layer to the data link layer , The area where data is stored can be called a buffer , The concept is more abstract

Receive buffer
UDP No send buffer , Only receive buffer .
We understand it as , Receiving party UDP After receiving data , It doesn't need to be taken away by the application layer immediately , Put it in the receiving buffer and wait silently , But if the application layer gets the data when there is nothing in the receiving buffer , If there is no timeout mechanism , Will die waiting .
UDP Send success
In a word ,UDP As long as you put the data on the Internet, it will be sent successfully , Whether I receive it or not has nothing to do with me
UDP Transmission summary
1. send out
1. Receive from the application layer first payload data , It is equivalent to copying the memory data of the application layer to its own kernel memory area
2. Get ready header part :
1). Source port (socket There are , You don't have to write it yourself )
2). Target port
3).UDP length
4).checksum
3.header+payload Equivalent to datagram
4. Just pack it up datagram Send it to the network layer
5. As long as the network layer sends successfully ( The data has reached the network card )
6. Notify the application layer of sending successfully
If the receiving party can receive , It must be intact data , This is the benefit of data message orientation
2. receive
1. Put the package received from the network layer into the kernel buffer
2. adopt header Fixed length , Break up the package into header Part and payload part - Unpack
3. Read header part , Including ports ,ip Information ,checksum( The checksum ), Length etc.
4. Throw the wrong length , No one needs to tell
5.checksum( The checksum ) No, throw it directly
6. hold payload Put it in the receive buffer
7. Notify the application layer that the data has arrived
8. Application layer to get
9. The application layer has never come , Information can still be thrown
边栏推荐
- Computer room construction data
- One year after graduation, I gave up the internship opportunity and taught myself software testing at home. The internship of my classmates has just ended. I have become a 12K monthly salary testing e
- 解决script标签写在元素节点前面无法获取元素节点的问题
- J. Serval and essay (tarjan finds topological order)
- Summary of the first change to open source middleware keycloak
- Perlin noise and random terrain
- The communication principle between native components, applets and clients, and the operation principle of video, map, canvas, picker, etc
- 什么叫裸写SQL?express操作mysql用什么中件间或插件好呢?
- Upload files to flash file system through Arduino IDE
- 1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮
猜你喜欢

Summary of the first change to open source middleware keycloak

Database paradigm and schema decomposition

One year after graduation, I gave up the internship opportunity and taught myself software testing at home. The internship of my classmates has just ended. I have become a 12K monthly salary testing e
![[pumpkin Book ml] (task3) decision tree (updating)](/img/4c/fc7157518ad729400d605b811323de.png)
[pumpkin Book ml] (task3) decision tree (updating)

Loadrunner12 installation, recording the first script and the proxy server did not respond to the solution

以科技传递温度,vivo守护生物多样性之美

【MySQL】字符集utf8mb4无法存储表情踩坑记录

Mysql database authorization learning

Ora-12899 error caused by nchar character

ASP.NET CORE写一个缓存Attribute工具
随机推荐
Use of component El scrollbar
Hospital network security architecture
One year after graduation, I gave up the internship opportunity and taught myself software testing at home. The internship of my classmates has just ended. I have become a 12K monthly salary testing e
STM32 installation tutorial and j-link burning driver installation tutorial [the next day]
College degree want to 0 basic programming after looking for a job feasible?
About rapidssl certificate
How to install, download and use the latest version of IDM software
Where is the safest place to open a futures account now with the lowest handling fee?
文心大模型扬起新“帆”,产业应用大潮已至
jenkins多任务并发构建
1000个Okaleido Tiger首发上线Binance NFT,引发抢购热潮
canvas-绘图(鼠标按下 绘制 抬起 结束)
Express operates mysql. What is wrong with the SQL?
暑假第三周
浅谈元宇宙中DeFi的可能性和局限性
C - structure
Topological sorting & critical path
浅谈领域驱动设计
WordPress website SEO complete tutorial
Is software testing still popular in 2022?