当前位置:网站首页>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 !
边栏推荐
- No one reads the series. Source code analysis of copyonwritearraylist
- [open source sharing] deeply study KVM, CEPH, fuse features, including open source projects, code cases, articles, videos, architecture brain maps, etc
- Report on strategic suggestions on investment direction and Prospect of global and Chinese marine biological industry (2022 Edition)
- Mongodb delete data
- Aiot project that is an introduction to the basics of the Internet of things and can be implemented in practice
- Leetcode sword finger offer question brushing - day 27
- Global and Chinese benzoic acid market competition strategy and demand scale forecast report 2022
- Research Report on brand strategic management and marketing trends in the global and Chinese preserved fruit market 2022
- SAP ui5 beginner tutorial 25 - using proxy server to solve the cross domain problem of SAP ui5 application accessing remote OData service trial version
- How to open an account online? Is it safe to open an account online?
猜你喜欢

Day21 performance test process
Summary of 6 common methods of visual deep learning model architecture
![[Suanli network] problems and challenges faced by the development of Suanli network](/img/90/1d537de057113e2b4754e76746f256.jpg)
[Suanli network] problems and challenges faced by the development of Suanli network
![[road of system analyst] collection of wrong questions in the chapters of Applied Mathematics and economic management](/img/62/dab2ac0526795f2040394acd9efdd3.jpg)
[road of system analyst] collection of wrong questions in the chapters of Applied Mathematics and economic management
![[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security](/img/52/7dedc5b6e213839fbf5cee3963ac99.jpg)
[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security

Lesson 9: workspace introduction
Configuration file ui5 local in SAP ui5 tools Configuration points of yaml
Introduction to sap ui5 tools

Getting started with Silverlight development 1

Digitalization, transformation?
随机推荐
Guess the size of the number
[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security
TFTP command – uploading and downloading files
Copying DNA
How the sap ui5 framework performs single step debugging of batch requests
MySQL uses the where condition to find strange results: solve
An easy problem
[kicad image] download and installation
Linus' speech recordings, which were lost in 1994, were made public
Count the grid
[kicad image] download and installation
DF command – displays disk space usage
Technology Review: what is the evolution route of container technology? What imagination space is there in the future?
Mount command - file system mount
Global and China chemical mechanical polishing abrasive materials market demand outlook and investment scale forecast report 2022 Edition
Data7202 statistical analysis
证券如何在线开户?在线开户是安全么?
Leetcode sword finger offer question brushing - day 27
SAP ui5 application development tutorial 32 - how to create a custom SAP ui5 control
Echo command – output a string or extract the value of a shell variable