当前位置:网站首页>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 .

边栏推荐
- 【WEBRTC】ADM: rtc_include_internal_audio_device 触发 RTC_DCHECK(adm) 断言
- Machine learning notes
- Redis sentry, persistence, master-slave, hand tear LRU
- FortiGate firewall quick initialization administrator password
- Educoder group purchase suspension box page production
- Internship: interface case implementation
- What is an optocoupler circuit and what should be paid attention to in actual use?
- Input / output and interrupt technology -- microcomputer Chapter 6 learning notes
- 基于servlet+jsp+mysql实现的工资管理系统【源码+数据库】
- 什么是光耦电路,实际使用中应该注意些什么?
猜你喜欢

Mongodb learning
![Blue Bridge Cup: magic cube rotation [Vocational group]](/img/ba/aeae2744f3aaa1052b5af452f990e2.jpg)
Blue Bridge Cup: magic cube rotation [Vocational group]

Junior students summarize JS advanced interview questions

El upload Upload file (Manual upload, Automatic upload, upload progress)

OneNote software

Introduction to system programming

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

Explain the underlying principles of JVM garbage collection in simple terms

Use of thread pool
随机推荐
Educoder group purchase suspension box page production
[从零开始学习FPGA编程-52]:高阶篇 - 基于IP核的FPGA开发 - IP核使用的基本框架(以锁相环PLL为例)
Unity when entering a string in the editor, escape the input of characters
Equity interest [non DP]
QT 6.3.1conan software package release
Maya Calendar(POJ1008)
iMile 利用 Zadig 多云环境周部署千次,跨云跨地域持续交付全球业务
An error occurs when sqlyog imports the database. Please help solve it!
OneNote production schedule
Qt6 QML Book/Qt Quick 3D/Qt Quick 3D
JS proxy
7-3 single source shortest circuit for strange play upgrade
Detailed explanation of network layer
lego_ Reading and summary of loam code
Troubleshoot abnormal video playback problems in public network deployment based on Haikang ehomedemo tool
internship:接口案例实现
Explain the underlying principles of JVM garbage collection in simple terms
Cloud native -- websocket of Web real-time communication technology
FortiGate performs DNAT mapping, and intranet users cannot normally access the mapping
Day 10 data saving and loading