当前位置:网站首页>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 .
边栏推荐
- Which is the higher priority of V-IF or V-for?
- Task management of embedded development foundation (thread management)
- Mysql database DQL exercise
- [GWCTF 2019]mypassword XSS
- 欧洲的龙之城|国家地理全球最浪漫最安全的目的地
- Atcoder abc256 full problem solution (interval merging template, matrix fast power optimization DP, line segment tree...)
- 2021-01-29
- [recommended by Zhihu knowledge master] castle in UAV - focusing on the application of UAV in different technical fields
- AutoCAD - five annotation shortcuts
- Uniapp applet mall develops thinkphp6 points mall, group purchase and seckill packaged app
猜你喜欢

2021-08-22

Eureka service registration and discovery

Rapideye, spot satellite remote sensing image data

The link added in the bottom menu cannot jump to the secondary page
![[Li mu] how to read papers [intensive reading of papers]](/img/86/4894bdef31d47d3f9bf3206b997eed.jpg)
[Li mu] how to read papers [intensive reading of papers]

2021-04-14

The required reading for candidates | PMP the test on June 25 is approaching. What should we pay attention to?

2021-05-02

There are 15 necessary knowledge points for the second level cost engineer before the exam! I wish you success!

Experiment 4 operation comparison between NoSQL and relational database
随机推荐
Developing salary management system based on C language course paper + source code and executable EXE file
There are 15 necessary knowledge points for the second level cost engineer before the exam! I wish you success!
A case of 94 SQL optimization (the writing method used is often rejected)
c语言---17 函数简介
Next permutation [give play to subjective initiative to discover laws]
Generate detailed API and parameters of QR code using qrcodejs2
Cryptography series: certificate format representation of PKI X.509
2020-12-04
How to manage tasks in note taking software such as flowus and notation?
Zynq ultrascale + rfsoc zcu111 RF clock tree learning 1
Core and semiconductor "RF eda/ filter design platform" shines ims2022
Wechat applet batch submission for review
Redis distributed lock
Redis big key problem
What are the methods of software stress testing and how to select a software stress testing organization?
Greedy distribution problem (1)
Greedy interval problem (2)
2021-04-14
[GWCTF 2019]mypassword XSS
2021-04-16