当前位置:网站首页>Summary of transport layer knowledge points
Summary of transport layer knowledge points
2022-06-22 22:54:00 【Foxconn quality inspector zhangquandan】
TCP What is the protocol

In fact, the traffic in the network , Most of them are generated by communication between applications . For example, the traffic of visiting the website , Movie traffic, etc . The performance of the program on the computer is the process , In fact, accessing the services on the network is the communication between processes .
The Internet is actually unreliable , For example, the sending of pictures is divided into data packets one by one , If there are many packets transmitted on the link , The router can't handle it , The router discards the packet directly , Then the picture received by the receiver is incomplete , This is not allowed .
The website should transfer the web page to the browser , Put the web page on the transport layer , Number the transport layer segments , After segmentation, add... To each segment IP Address , Source address destination address , This forms a packet . After receiving it, the receiver puts it into the cache , Then read... In order , If you lose your bag , Then the receiver has to wait , The sender has to resend the lost packet . Finally, the lost packets can only be read when they arrive .
Packets may not arrive at the same time , That is, they don't arrive in order , Because each packet is routed independently , The receiver will wait for the late packet , Wait for these late packets to start continuous packets .

Above is The transport layer provides reliable transport for our application layer , This agreement is TCP agreement .
TCP scene ( Multiple interactions are required , The transmitted data is relatively large , Segmented transmission )
TCP Provide reliable transmission for application layer protocol , The sender sends in sequence , The receiving end receives... In sequence , In the meantime, send packet loss 、 Disorder ,TCP Responsible for retransmission and sorting . Here is TCP Application scenarios of .
(1) The client program and the server program need to interact many times to realize the function of the application program . For example, receive e-mail using POP3 And email SMTP, How to transfer files FTP, The transport layer uses TCP.( The client and server need to communicate with each other many times )
(2) The files transferred by the application need to be transferred in segments , For example, a browser accesses a web page , Pictures and... In web pages HTML The file needs to be segmented and sent to the browser , or QQ Transfer files , In the transport layer is also selected TCP. ( It may take some time to transmit , It is necessary to divide the document into many paragraphs for transmission , Because the file is large , Packet loss may occur during transmission , Not arrived in order , Need to achieve reliable transmission )
TCP What are the main characteristics of ?
TCP yes ` Connection oriented ` Transport layer protocol . for instance TCP Three handshakes of , Four breakups , It's all about connections .
Every one of them TCP Connect ` There can only be two endpoints `, Every one of them TCP Connections are point-to-point .` in other words TCP Is the communication of processes between different computers `.
TCP Provide reliable delivery of services , No mistakes , No loss , No repetition , Arrive in order . So in summary ,` Reliable and orderly , No loss, no weight `.
TCP Provide ` Full duplex communication `. Full duplex means that both sides of the connection can send and receive data at the same time . There are send cache and receive cache at both sending and receiving ends , The send cache is a queue ready to send , The receive cache is a queue ready to receive .
TCP` Byte stream oriented `. Here's the picture , Let's explain what byte stream orientation is :

In the picture 1,2,3,4..... Data blocks , Each represents a byte .tcp Change the application layer data into such bytes for transmission , Like playing node classmate , Know one buffer,buffer It's a byte stream .
UDP Application scenarios
Another protocol at the transport layer is UDP agreement , User message protocol , and TCP It does not provide reliable transmission . Unreliability has the advantage of unreliability , It is relatively concise , Fast , No connection needed , There is no need to release the connection .
(1) The client program communicates with the server program , Sent by the application Packets do not need to be segmented . Such as domain name resolution ,DNS The protocol uses the transport layer UDP, Client to DNS The server Send a message analysis The domain name of a website ,DNS The server will parse the results Use a message to return to the client .
(2) real-time communication ( Delay as low as possible ), such as QQ Or wechat voice chat , Or video chat . This kind of application , The sender and receiver need real-time interaction , That is, long delays are not allowed , Even if a few words are not heard clearly because of network congestion , It is not allowed to use TCP Waiting for lost messages , The waiting time is too long , You can't chat happily .( I lost my bag , Bad network speed , Then say it again , If to TCP Also provides reliable transmission , I lost my bag , Said a word , Lost packet retransmission , Not in order. Wait a minute , In this way, it will take some time to receive what the other party said , This is not real-time communication )
UDP What are the main characteristics of ?
UDP yes ` No connection `, Reduce overhead and time delay before sending data . Everybody knows `TCP` Of ` Three handshakes and four breakups `, This will take time to spend , however UDP No such expenses .
UDP Use ` Best effort delivery `, That is, there is no guarantee of reliable delivery . Who will guarantee reliable delivery ? By UDP The upper layer protocol of , Application layer to ensure .
UDP yes ` Message oriented `, It is suitable for network applications that transmit a small amount of data at one time . What does that mean , Here's the picture ,UDP This floor , Take the entire content of the application layer as its own datagram part , stay IP The layer is only added IP The first one , We know , In Ethernet , If the data on the link layer exceeds 1500 byte , It will be divided into pieces , So the network layer found that the upper transport layer gave ` Too much data will be fragmented `, add UDP It's an unreliable protocol , This increases UDP Of ` Unreliability `, Easy to lose , therefore UDP Suitable for those with less data .

UDP no congestion control , Suitable for many real-time applications . In other words, if the network is blocked ,UDP No matter how much , Send data at your own rate , Then some people will say , This agreement is not a bit of a hole B, The road is blocked , I still send out data , But on the other hand , This is also UDP The advantages of , It allows packet loss , If you have a good network ,UDP It is very suitable for real-time applications , For example, video conference .
UDP Small head , Only 8 byte , and TCP from 20 byte . This is also ` Reduce network transmission overhead ` On the one hand .
边栏推荐
- Phantomjs实用代码段(持续更新中……)
- Codeup longest palindrome substring
- The xinjietu x70s has been listed for 87900 times and has leapfrogged the class in space safety. It is worthy of being a 7-seat SUV of the National University of China
- 2020-12-20
- 5 minutes to quickly launch web applications and APIs (vercel)
- Task management of embedded development foundation (thread management)
- pycharm 配置远程连接服务器开发环境
- 新捷途X70S上市8.79万起,空间安全越级,不愧是网红国民大7座SUV
- Rendu stéréo
- Redis big key problem
猜你喜欢
![[recommended by Zhihu knowledge master] castle in UAV - focusing on the application of UAV in different technical fields](/img/3b/8916c543c149292221ce500209df0d.png)
[recommended by Zhihu knowledge master] castle in UAV - focusing on the application of UAV in different technical fields

Huawei cloud recruits partners in the field of industrial intelligence to provide strong support + commercial realization

redis 报错解决与常用配置

The method of making videos of knowledge payment system support m3u8 format playback

2020-12-04
![[Li mu] how to read papers [intensive reading of papers]](/img/86/4894bdef31d47d3f9bf3206b997eed.jpg)
[Li mu] how to read papers [intensive reading of papers]

The xinjietu x70s has been listed for 87900 times and has leapfrogged the class in space safety. It is worthy of being a 7-seat SUV of the National University of China

Why is yuancosmos so popular? Is the 10trillion yuan shouted by the market boasting or the truth?

NFT can only be viewed from afar, but not blatantly played
![[ongoing update...] 2021 National Electronic Design Competition for college students (III) interpretation of the anonymous four axis space developer flight control system design](/img/5d/71c75a3622f7814f385d04b6148074.png)
[ongoing update...] 2021 National Electronic Design Competition for college students (III) interpretation of the anonymous four axis space developer flight control system design
随机推荐
What are the methods of software stress testing and how to select a software stress testing organization?
欧洲的龙之城|国家地理全球最浪漫最安全的目的地
leetcode. 11 --- container with the most water
General trend wisdom to create inclined model and cut monomer
Relationship between adau1452 development system interface and code data
2021-04-14
2020-12-20
Explain the startup process of opengauss multithreading architecture in detail
Mysql database DML operation exercise
AutoCAD - five annotation shortcuts
Cryptography series: certificate format representation of PKI X.509
使用HBuilder X编辑器安装终端窗口插件未响应的解决方案
Why do you perform performance tests before the software goes online? How to find a software performance testing organization
[geometric vision] 4.2 piecewise linear transformation
Is it bad for NFT that the market starts to cool down?
组合总数[标准回溯 + 回溯技巧--降低栈深度]
pycharm 配置远程连接服务器开发环境
Mysql database DQL query operation
Live broadcast forecast the sixth issue of the webinfo lecture hall of the China Information Association will be broadcast on June 24
What if the SQL execution plan of the production system suddenly becomes worse?