当前位置:网站首页>Talk about TCP and UDP
Talk about TCP and UDP
2022-06-25 06:17:00 【Programmer community】
Speaking of tcp/ip One of the most complex protocols , I don't think so tcp The agreement belongs to ,tcp The protocol is on the transport layer , It's one of the two transport layer protocols , The other is udp agreement
The transport layer lies between the application layer and the network layer , It's where applications send and receive data , If you know the port number of the transport layer , I must be familiar with how to give data to real application , We don't make too many statements here
Now let's talk about how the two applications transmit data , This involves tcp and udp Different
tcp It's like a couple separating two hills , When they want to give their things to each other , Because you can't see each other , They need to shout to make sure they're ready :
male : I'll throw you an apple
Woman : well , I'll throw you a pear
male : received , I'll throw you a second apple
…
So they started the process of delivering food to each other . This is a tcp The process of communicating after three handshakes , Every piece of data sent is marked , The other party should confirm and reply after receiving it
If the fruit falls into the valley in the process of throwing , What do I do ?
male : I'll throw you an apple
Woman :…
male :( I didn't reply for such a long time , I didn't get it ?) I'll throw you another apple
Woman : good , I got the first apple you threw
Even if data is lost in transit , As long as there is a timeout retransmission mechanism , It can realize the timeout retransmission of data
If one side throws too fast , What if the other party can't get it ?
male : I'll throw you an apple
Woman : well , I'll throw you a pear
male : received , I'll throw you three more apples
Woman : Slow down , It hit me on the head , I can only take two at a time
male : good , received , I'll throw you two
tcp In the process of communication, they will constantly inform each other of their maximum receiving capacity , stay tcp In the head window size Express , According to window size To adjust the size of the data you send
If their stuff is all gone , You need to tell each other , Or they don't know , Still waiting
male : I'm done with my stuff
Woman : understand , Let me see if I have anything else for you ?
Woman : I don't have either , Then I can withdraw
male : well , received , I also withdrew
tcp After the data is sent , Need to disconnect , By four waves , Like above
Smart you may ask , After one party completes the transmission , Initiated an active shutdown request , But what if the other party's data is not sent out ?
male : I'm done with my stuff
Woman : understand , Let me see if I have anything else for you ?
Woman : You wait , I still have fruit left to throw , I'll throw you one
Woman : I'll throw you another one
…
Woman : Okay , I don't have , I quit
male : received , Let's go.
When the host A After sending data , Initiate a request to close the connection , At this time, the host B Received a request to close the connection , First reply a confirmation message to A, meanwhile B This side no longer receives data ,A After receiving the confirmation message , And no longer have the ability to send data , It's a half closed state
host A Although it doesn't have the ability to send , But it has the ability to receive , host B Though not capable of receiving , But the ability to send , At this point, if the host B There is still data not sent , Will continue to send , Until it's sent
After sending, the host B Will passively send a disconnect request to A,A After receipt of , Reply a confirmation message to B, This is a complete process of closing the connection
That's it , They each ate sweetly from each other , As both sides have a process of continuous shouting and confirmation , They didn't wait and miss each other's wishes
But one day , They had a fight , Ignore each other , But also concerned about each other , So they still throw their fruit to each other
male : I throw an apple
male : I'll throw it again
Woman : I throw two pears
Woman : I'll throw it again
male : I'll throw two more
…
male : It's over , Back , I don't know if she received it
Woman : There are a few left , Throw them all over
…
Woman : It's over , go , hum , Whether you get it or not , Hungry or not
This is it. udp The transmission process of , As long as you have data , Know where they are , You just throw , You don't ask if the other person is there , I don't care if my things fall off , I don't care if the other party will hit the head
udp It's like a setter , Responsible for transferring data from application layer to network layer , As for the others , It doesn't care , It only cares about itself , Bah !
边栏推荐
- MySQL tuning -- 02 -- slow query log
- Part 34 of SAP ui5 application development tutorial - device adaptation of SAP ui5 application based on device type
- Echo command – output a string or extract the value of a shell variable
- [kicad image] download and installation
- Technology Review: what is the evolution route of container technology? What imagination space is there in the future?
- The sum problem
- Research Report on marketing channel analysis and competitive strategy of China's polycarbonate industry 2022
- How the sap ui5 framework performs single step debugging of batch requests
- Click to send text messages without response is a common problem for many users in building the elegant grass Dragonfly Q system - solve the problem of clicking to send text messages without response
- Socket, network model notes
猜你喜欢

Uni app wechat applet customer service chat function
Interviewer: what is an iterator? What is the relationship between async await and iterators?

Notes on dashboard & kuboard installation in kubernetes cluster
SAP ui5 application development tutorial 32 - how to create a custom SAP ui5 control
Websocket in the promotion of vegetable farmers
[kicad image] download and installation

What happens when redis runs out of memory

Location object

Mongodb basic concept learning - Documentation
Summary of 6 common methods of visual deep learning model architecture
随机推荐
What changes have taken place in the project file after SAP ui5 tools ran the Fiori add deploy config command
Soft exam information system project manager_ Management Science (Operations Research) 2--- senior information system project manager of soft test 034
Tablespace free space
Optimal Parking
Various errors and solutions encountered when deploying SAP ui5 application to ABAP server with SAP Fiori tools
Go microservice development toolkit
Pre knowledge of asynchronous operation
Digitalization, transformation?
The e-book "action guide for large organizations to further promote zero code application platform" was officially released!
You can't specify target table for update in from clause error in MySQL
Trial version of routing history and routing back and history of SAP ui5
[data visualization application] draw spatial map (with R language code)
Data7202 statistical analysis
Guess the size of the number
Laravel8 fill data
Aiot project that is an introduction to the basics of the Internet of things and can be implemented in practice
Report on the application prospect and investment potential of global and Chinese cell therapy industry 2022-2028
Gavin's insight on transformer live class - line by line analysis and field experiment analysis of insurance BOT microservice code of insurance industry in the actual combat of Rasa dialogue robot pro
How to open an account online? Is it safe to open an account online?
Kyma application connectivity feature introduction