当前位置:网站首页>Transport layer protocol tcp/udp
Transport layer protocol tcp/udp
2022-06-30 04:26:00 【Tra220123】
One 、UDP agreement
UDP Segment format :

The range of port numbers is 0-2^16-1, among 0-1023 It is occupied by many software .
1.ephemeral Port number
Many services have well-known Port number , Then the port number of the client program does not have to be well-known Of , Usually, the system automatically assigns an idle port number each time the client program , Use it and release it .
2.UDP The protocol is not connection oriented , Nor does it guarantee transmission reliability
① Sending end UDP The protocol only encapsulates the data transmitted from the application layer into segments and gives them to IP The protocol layer completes the task , If the segment cannot be sent to the other party due to network failure ,UDP The protocol layer does not return any error messages to the application layer .
② On the receiving end UDP The protocol layer just hands over the received data to the responding application according to the port number, which is regarded as the completion of the task , If the sender sends multiple packets and passes through different routes on the network , When arriving at the receiving end, the order is out of order ,UDP The protocol does not guarantee that it will be delivered to the application layer in the order in which it is sent .
③ Usually at the receiving end UDP The protocol layer puts the received data into a fixed size buffer and waits for the application to extract and process , If the application fetches and exits slowly , And the sending end is very fast , You'll lose your bag ,UDP The protocol layer does not report such an error as high .
So consider : Waiting for an answer , Timeout retransmission , Number the packet , Flow control, etc .
characteristic : Simple communication , Trust them , I'm so stupid , Do things differently .
Adaptive scene :
① Less resources are needed , In the intranet with good network conditions or applications that are not sensitive to packet loss .
② Don't communicate one-on-one , Establishing a connection , It's an application that can be broadcast .
③ It needs to be fast , Low latency , It can tolerate a few packet losses , But even if the network is congested , And never flinch , When you are indomitable .
Business case :
① Streaming protocol : Live delivery
② Real time games : Instant seckill
③loT The Internet of things : Embedded relatively dull
④ Mobile communication field : Mobile traffic Internet data face protocol GTP-U Is based on UDP Of
Two 、TCP agreement
TCP Segment format :

Source port number and target port number are indispensable , and UDP equally .
1. Why is the package numbered ?
In order to solve the disorder problem .
It should also determine the serial number . The bag sent out should have confirmation , Otherwise, it is impossible to know whether the other party has received . If you don't receive it, you should resend it , Know delivery . Solve the problem of no packet loss .
2. Status bit
Such as SYN Initiate a connection ,ACK Yes reply ,RST It's about reconnecting ,FIN Is to end the connection etc .
TCP It's connection-oriented , So both parties need to maintain the state of the connection , Sending of these packets with status bits , Will cause a change in the status of both parties .
3. Window size
TCP Do flow control , Each side of the communication declares a window , Indicate your current processing capability , Don't send too fast , Don't be too slow .
Through to TCP The analysis of the head , Focus on the following issues :
Sequence problem , Steady and steady
Packet loss problem , Promise is reliable
Connection maintenance , Have a beginning and an end
flow control , Grasp the measure
Congestion control , Know how to advance, know how to retreat
4. Three handshakes
TCP Connection and connection , It's called three handshakes .

边栏推荐
- JS file block to Base64 text
- 基于海康EhomeDemo工具排查公网部署出现的视频播放异常问题
- FortiGate firewall modifies the default timeout of a session
- Implementation steps of dynamic proxy
- Huawei cloud native - data development and datafactory
- MySQL updates JSON string in array form
- 基于ROS的SLAM建图、自动导航、避障(冰达机器人)
- thinkphp5实现导入功能
- 基于servlet+jsp+mysql实现的工资管理系统【源码+数据库】
- Sql语句遇到的错误,求解
猜你喜欢
![Tea mall system based on SSM framework [project source code + database script + report]](/img/d9/0a46c0da9839a7186bd3a9ae55f0a5.png)
Tea mall system based on SSM framework [project source code + database script + report]

Configure specific source IP in SLA detection of FortiGate sdwan

Threejs实现模拟河流,水面水流,水管水流,海面

Share an example of a simple MapReduce method using a virtual machine

AI落地的新范式,就“藏”在下一场软件基础设施的重大升级里

什么是光耦电路,实际使用中应该注意些什么?

Five methods to clear floating and their advantages and disadvantages

Imile uses Zadig's multi cloud environment to deploy thousands of times a week to continuously deliver global business across clouds and regions

Slam mapping, automatic navigation and obstacle avoidance based on ROS (bingda robot)

Interview topic of MySQL
随机推荐
Thinkphp5 implements import function
Qt 6.3.1Conan软件包发布
Introduction to system programming
SQL append field
The new paradigm of AI landing is "hidden" in the next major upgrade of software infrastructure
Read / write lock example
Modifier of JS regular expression
OneNote production schedule
Blue Bridge Cup: magic cube rotation [Vocational group]
Splicing strings with custom functions
小C的数组(array)
7-3 single source shortest circuit for strange play upgrade
Qt Creator 8 Beta2发布
Pig-Latin (UVA492)
JS reflect
Troubleshoot abnormal video playback problems in public network deployment based on Haikang ehomedemo tool
基于servlet+jsp+mysql实现的工资管理系统【源码+数据库】
什么是光耦电路,实际使用中应该注意些什么?
Qt6 QML Book/Qt Quick 3D/Qt Quick 3D
What is the difference between synchronized and lock