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

边栏推荐
- Errno and PERROR
- 深度融合云平台,对象存储界的“学霸”ObjectScale来了
- Create thread in callable mode
- 知识点滴 - 如何用3个简单的技巧在销售中建立融洽的关系
- Five methods to clear floating and their advantages and disadvantages
- Differences between beanfactory and factorybean
- Matlab reads fig file and restores signal
- 进程间通信之匿名管道
- idea灰屏问题
- Slam mapping, automatic navigation and obstacle avoidance based on ROS (bingda robot)
猜你喜欢

FortiGate configures multiple server IPS as link monitor monitoring objects on the same interface

I get n offers in two months. I don't have any difficult interviewers here

Anonymous pipeline for interprocess communication

Junior students summarize JS advanced interview questions

技术分享| 融合调度中的广播功能设计

I spent three years in a big factory outsourcing, which subverted my understanding!

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

进程间通信之匿名管道

How to use div boxes to simulate line triangles

Junior students summarize JS basic interview questions
随机推荐
输入输出及中断技术——微机第六章学习笔记
How the FortiGate firewall rejects a port by using the local in policy policy
El upload Upload file (Manual upload, Automatic upload, upload progress)
SQLyog导入数据库时报错,求帮解决!
Implementation steps of dynamic proxy
Threadlocal
Error Nova missingauthplugin: an auth plugin is required to determine endpoint URL
Ananagrams(UVA156)
FortiGate firewall configuration link detection link monitor and status query
Input / output and interrupt technology -- microcomputer Chapter 6 learning notes
QT 6.3.1conan software package release
Myrpc version 1
internship:接口案例实现
基于servlet+jsp+mysql实现的工资管理系统【源码+数据库】
Mongodb learning
网络层详解
Junior students summarize JS advanced interview questions
SQL追加字段
Qt 6.3.1Conan软件包发布
Five methods to clear floating and their advantages and disadvantages