What is TCP reliable transmission?
I don't understand the basics of computer networks. Why does the TCP protocol require a three-way handshake, and how can it ensure "reliable transmission" after the three-way handshake? What does the so-called "connection" between the client and server mean? Isn't the bottom layer all a two-way transmission of data packets?
PS: I don't want to know the answer to why a three-way handshake is required instead of a four-way or two-way handshake. What I want to know is how can I guarantee "reliability" after a successful handshake?
The target audience of this article is computer enthusiasts.
"TCP connection" is a virtual noun. To fully understand this virtual noun, you need to understand why TCP needs a handshake. Let's look at a little story in life.
Xiaoming mailed a parcel to his girlfriend Xiaoli, the package number was 5201314, and the parcel arrived at Xiaoli. In order to let Xiaoming know that the package has arrived safely, Xiaoli immediately responded to an empty package with the confirmation number: 5201315. It means that the package before "5201315" number arrived.
If you are Xiaoming, seeing this confirmation number, can you think that the package has arrived at Xiaoli's place safely? This is the basic principle of reliability. Maybe you would be curious, how could Xiaoming's package be lost? There is nothing in this world that is 100% reliable. Xiaoming's package may be lost, but it does not matter. Xiaoming is fully prepared. Once he exceeds a certain waiting time and does not receive confirmation from Xiaoli, then he considers himself If the parcel is lost, retransmit another parcel.
You might think that the empty parcels that Xiao Li replied to may be lost! Yes, this possibility is also possible. The question comes. Will Xiaoli retransmit her empty parcel overtime? Will not. If Xiaoming does not receive his empty parcel, he will retransmit his parcel, and then Xiaoli will send another empty parcel for confirmation. In this way, Xiaoli may receive two parcels with the same serial number, and Xiaoli just needs to discard one of them.
But there is a problem with the above method, Xiaoli will never know, which package of Xiaoming is the first one! You may ask, is it important to know the first bag?
Right, very important! The cargo transmitted by TCP is usually HTTP. The goal of TCP is to ensure that data is submitted to the HTTP process for processing in order. I don't know what the number of the first packet is, how does TCP guarantee to submit in order?
So Xiaoming and Xiaoli agreed to use the handshake package first and exchange the number of their first package. Because the handshake message is particularly important, it is agreed that if the other party receives a handshake signal (SYN) message, they must reply to confirm that they have received the "first package number" of the other party. Both parties need to do this, so at least three message interactions can be completed, which is the meaning of a three-way handshake!
Maybe you will also say, why can't you put SYN + DATA in a parcel and transport it out, eliminating the trouble of three handshake!
This idea is very new! Network experts used to think this way, but considering that the network bandwidth at that time was very small.
Regardless of whether the network is connected or not, whether the server is running or not, recklessly sending data to the server is a harm to the network bandwidth. You think, if the server is not running, all these data will be lost, isn't it a waste of network resources?
In addition, if a malicious attacker uses a continuous stream of forged TCP + Data packets and the server receives and processes them, the server may be paralyzed for a while. After much consideration, TCP finally decided to use the empty packet carrying the handshake signal to perform handshake first. Once the probe network is connected, the server is up and running, and receives external connections, then send the data to the server. However, TCP has to endure the suffering of 1 RTT communication delay brought by the three-way handshake, so network experts re-examine whether it is possible to use 0 RTT communication mode without handshake before communication.
This technology has been widely used in reliable UDP-based transmission protocols, such as QUIC. But everything has two sides, and there are gains and losses. 0 RTT communication, can not completely repel the packet replay attack (Packet Replay). Therefore, for high-reliability and high-security data transmission, the communication mode is still 1 RTT.
The above is the news sharing from the PASSHOT. I hope it can be inspired you. If you think today' s content is not too bad, you are welcome to share it with other friends. There are more latest Linux dumps, CCNA 200-301 dumps and CCNP Written dumps waiting for you.