preface

Fat toward today and we talk about a platitude of a problem, TCP why three handshakes. Why do you suddenly think of this topic?

According to fat toward the style before, a search on the net a big article, fat toward generally do not want to mention. In fact, every tech person has had the idea of writing a blog at one point or another, but then they find that everything they want to write about seems to be available online, and finally give up the idea.

Therefore, fat toward the positioning of two, one is a system of source code analysis class article (similar to 17 years of Dubbo source code analysis and 19 years of graphic SpringBoot source code), a real scene source code combat, since it is a real scene, then the probability of the same is almost ignored.

So why mention TCP’s three-way handshake? These don’t say online, college textbooks are abundant, but also authoritative.

Some thoughts on learning

In the computer principle, network, compilation principle, data structure and algorithm and other standard computer knowledge, we often encounter the problem is that after learning the interview, forget, the next interview and then have to “memorize” the question, so that will lead to too much time cost. So during this time He was thinking about how to learn. Because these standard knowledge points, often difficult to understand, need a certain skill and working years to achieve understanding memory. I wonder if the process of learning knowledge could be the same as the evolution of architecture, from 0 to 1, from 1 to 10, from 10 to 100. What exactly does that mean?

Just like architecture evolution, we started with the simplest stand-alone applications to quickly build businesses and seize the market, rather than directly distributed, highly available and containerized.

Similarly, when we understand a knowledge point, is it not necessary to be so authoritative at the beginning? Instead, we should have a rough understanding of its basic ideas first, and then go back to further study after our work experience and knowledge system are gradually developed and perfected?

Back to the topic

The reason why TCP is a three-way handshake is to prove that two is not enough and four is not necessary.

What is the nature of the so-called three-way handshake? TCP is a reliable transmission protocol, its essence is to ensure that the client and server, their ability to send and receive is no problem. That is, the client needs to examine the sending and receiving capabilities of the server, and the server also needs to examine the sending and receiving capabilities of the client.

First handshake

After the first handshake, the server received the packet and confirmed that there was no problem with the sending ability of the client (as shown in the picture).

Second handshake

Fat toward the whisper force: the second handshake client received the packet, this time, can prove that the server’s ability to send is not a problem. But is there a problem with reception on the server side? The first time we shook hands, the question we asked was “How do I find fat Chao’s official account?” “, received the answer is “the public number search name fat face can, you try can tell me”. The answer is exactly what we just asked, which means that there is no problem with the reception capability of the server (see figure)

So, back to the original question, why doesn’t the double handshake work? Because at this point, the client has already made sure that there is no problem with the server’s ability to send and receive, but the server hasn’t made sure that there is no problem with the client’s ability to receive.

Third handshake

Fat toward small voice force force: shake hands for the third time, the server received the packet, found that it is indeed the answer to the question just now, so, to determine the client receiving ability is no problem.

To go back to the question, 3 times is the minimum number of times that both sides have completed the inspection of sending and receiving capabilities. That’s why it’s not two, it’s not four.

Write in the last

Of course, you want to see more professional KNOWLEDGE of TCP, university and postgraduate teaching information is also a good choice.