TCP/IP (three-way handshake and four-way disconnection) and UDP
1. First knowledge:
We have been studying communication for a while, but we were initially engaged in TCP/IP-based communication. That is, before transmitting data, we must establish a connection between the two parties. Therefore, we usually call it connection-oriented. I thought that as long as one party sends the data, the other party must receive the data. Later we came up with another UDP, and it still does not need to establish a connection, as long as it knows a certain IP address and port number, it can send data. However, it is not reliable. It only sends messages, regardless of whether the recipient accepts or even whether the recipient exists. But I still don't understand what the real difference is between them.
2. The book says that TCP is a transmission control protocol, which is reliable and connection-oriented, but with low transmission efficiency. However, UDP is a User Datagram Protocol, which is unreliable and has no connection services, resulting in high transmission efficiency. The specific differences are as follows:
|
TCP |
UDP |
Traffic control and Window Mechanism |
Yes |
No |
Connection-oriented |
Yes |
No |
Error Recovery |
Yes |
No |
Data sharding and restructuring |
Yes |
No |
Orderly distribution of data |
Yes |
No |
Identify an application by using the port number |
Yes |
Yes |
3. TCP three-way handshake and four-way disconnection
This is a classic TCP connection-oriented
(ACK confirms that the serial number is valid.
The SYN synchronization sequence number is used to initiate a connection.
The fin sender completes the sending task.
SEQ serial number
)
Confirm that the serial number is the received serial number plus 1
Three-way handshake:
The basic flowchart can be expressed as follows:
I remember a teacher who once described it as follows:
A boy likes a beautiful girl, so he confessed to her (step 1). After hearing this, she thought about his performance and thought it was okay. Then she agreed to him (step 2 ), the boys said with great excitement that you will be my girlfriend in the future! (Step 3)
I personally think that although I don't understand the specific steps, I feel like I have an impression, and I will know more about them later.
Four disconnections:
The three-way handshake can be understood in that way, and it is not hard to imagine four-way disconnection.
The original couple said to the boys, "let's break up !" (Step 1)
As soon as the boys heard it, their temper came and said, "Break up when you break up" (step 2 ). The more I think about it, the more I think about it. Why did you break up first ?! Are you jealous of me ?! No face! It should be because I broke up! Then I said, "let's break up "! (Step 3) as a girl with a new relationship, she said, "mental illness !" (Step 4)
Basic Flowchart