当前位置:网站首页>Differences and usage scenarios between TCP and UDP
Differences and usage scenarios between TCP and UDP
2022-07-06 02:32:00 【Xiao Wang's shell is quite hard】
difference :
1. Connect
TCP yes ⾯ The transport layer protocol for the connection , Before transmitting data, it is necessary to build ⽴ Connect .
UDP It doesn't need to be connected , Instant transmission of data .
2. service object
TCP yes ⼀ Yes ⼀ Our two services , namely ⼀ A connection has only two endpoints .
UDP ⽀ a ⼀ Yes ⼀、⼀ For more than 、 Many to many interactive communication
3. reliability
TCP Reliable delivery of data , Data can ⽆ A mistake 、 No loss 、 No repetition 、 On demand arrival .
UDP Is the most ⼤ No ⼒ deliver , Reliable delivery of data is not guaranteed .
4. Congestion control 、 flow control
TCP There are congestion control and flow control mechanisms , Ensure the security of data transmission .
UDP There is no , Even if ⽹ Collateral ⾮ It's often congested , It won't affect UDP The transmission rate of .
5. ⾸ Department expenses
TCP ⾸ Ministry ⻓ The degree is ⻓, There will be ⼀ Fixed expenses ,⾸ The Ministry did not make ⽤「 Options 」 Field is 20 Bytes , If so ⽤ 了 「 Options 」 The field will change ⻓ Of .
UDP ⾸ There are only 8 Bytes , And it's fixed , It costs more ⼩.
6. transmission ⽅ type
TCP It's streaming , There is no boundary , But ensure sequence and reliability .
UDP yes ⼀ A package ⼀ Sending packets , There are boundaries , But there may be packet loss and disorder .
7. branch ⽚ Different
TCP The data of ⼤⼩ If ⼤ On MSS ⼤⼩, It will enter... At the transport layer ⾏ branch ⽚,⽬ After the bid host receives it , It is also assembled at the transport layer TCP Data packets , If you lose it halfway ⼀ A minute ⽚, Only need to transmit the lost points ⽚.
UDP The data of ⼤⼩ If ⼤ On MTU ⼤⼩, Will be in IP Step into ⾏ branch ⽚,⽬ After the bid host receives it , stay IP Layer assembled data , Then it is transmitted to the transport layer , But if you lose it halfway ⼀ A minute ⽚, In order to realize reliable transmission UDP Then you need to transmit all data packets , In this way, the transmission efficiency ⾮ Constant difference , So usually UDP The newspaper ⽂ should ⼩ On MTU.
Use scenarios :
TCP
because TCP yes ⾯ Connect to , It can ensure the reliable delivery of data , So often ⽤ On :
FTP ⽂ Piece transmission
HTTP / HTTPS
UDP
because UDP ⾯ towards ⽆ Connect , It can send data at any time , Plus UDP The process itself is simple ⼜⾼ effect , So often ⽤ On :
Less total packets of communication , Such as DNS 、 SNMP etc. 、 video 、⾳ Frequency and other multimedia communication 、⼴ Broadcast communications
边栏推荐
- SSM 程序集
- GifCam v7.0 极简GIF动画录制工具中文单文件版
- Overview of spark RDD
- Easy to use js script
- 剑指 Offer 29. 顺时针打印矩阵
- The intelligent material transmission system of the 6th National Games of the Blue Bridge Cup
- 更改对象属性的方法
- MySQL winter vacation self-study 2022 11 (6)
- Multi function event recorder of the 5th National Games of the Blue Bridge Cup
- Bigder: I felt good about the 34/100 interview, but I didn't receive the admission
猜你喜欢
RDD conversion operator of spark
A doctor's 22 years in Huawei
2022年版图解网络PDF
一位博士在华为的22年
UE4 - how to make a simple TPS role (I) - create a basic role
Building the prototype of library functions -- refer to the manual of wildfire
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 17
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
随机推荐
Prepare for the autumn face-to-face test questions
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
怎么检查GBase 8c数据库中的锁信息?
Number conclusion LC skimming review - 1
Structural theme model (I) STM package workflow
RDD creation method of spark
SQL table name is passed as a parameter
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7
3D drawing ()
Method of changing object properties
2022 edition illustrated network pdf
数据准备工作
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
Minecraft 1.16.5 生化8 模组 2.0版本 故事书+更多枪械
Global and Chinese markets of screw rotor pumps 2022-2028: Research Report on technology, participants, trends, market size and share
A doctor's 22 years in Huawei
机器学习训练与参数优化的一般过程 (讨论)
Data preparation