TCP implementation principle and why three-way handshake is needed? Two-way handshake is not possible? Four-way handshake is not possible? Readers can read the detailed explanation of this blog with questions. Ok, before explaining the reason, we still need to review the basic knowledge of TCP and the three-way handshake protocol: 1. What is TCP protocol?TCP: Transmission Control Protocol is a connection-oriented, reliable, byte-stream-based transport layer protocol. RFC 793 defines a TCP connection as follows: Connections:
The general meaning is that TCP connection is used to ensure reliability and flow control mechanism, including Socket, sequence number and window size. The socket is composed of IP and port, the sequence number is used to solve the disorder problem, and the window size is used for flow control. 2. Characteristics of TCP protocol
ps: The reliability of TCP transmission is due to the fact that TCP records the sending status of information. TCP will record which data is received and which data is not received. Then, in case of packet loss, that is, unsuccessful sending, TCP will resend the packet, so the reliability of TCP is guaranteed in this way. 3. TCP three-way handshake execution processThe TCP three-way handshake execution process is a very common question in interviews. Because this problem is also a very important foundation of computer science, it needs to be studied carefully. Keyword description:
TCP three-way handshake execution process:
4. Why does the TCP protocol require a three-way handshake?OK, now that we know the basic working principle of TCP's three-way handshake, we can explain why TCP needs three-way handshakes? Why not just design it as a two-way handshake? Reason: Avoid duplicate connectionsIn fact, the reason for the three-way handshake is pointed out in RFC 793 Transmission Control Protocol. The principle reason for the three-way handshake is to prevent old duplicate connection initiations from causing confusion. The main reason is to prevent old duplicate connections from causing connection confusion. For example, in a complex network environment, the client may send multiple requests in succession. If only two handshakes are designed, the server can only receive requests and return request information, and it does not know whether the client's request is successful. These expired requests will cause confusion in the network connection. Therefore, it is designed as a three-way handshake. After receiving the return message of SEQ+1 from the server, the client will know that this connection is a historical connection, so it will send a message to the server to tell the server. Therefore, the purpose of designing TCP into a three-way handshake is to avoid repeated connections. Then can it be designed as a four-way handshake? A five-way handshake? No? The answer is yes, but in order to save resources, three handshakes can meet the actual situation, so there is no need to design four handshakes, five handshakes, etc. |
<<: Outstanding Network Virtualization Solutions in 2021
SDN is more than 10 years old. When it first came...
GSA released a report that believes that the freq...
In the previous issue of "Route Policy"...
In 2019, 5G communication technology gradually be...
As the business tentacles of enterprises in vario...
With the development of science and technology, t...
If we choose the most used function of mobile pho...
This year, the prices of various video and music ...
[[386495]] This article is reprinted from the WeC...
DMIT.io also launched a promotion during Black Fr...
5G messaging, which is seen by the industry as We...
European regulators have been facing increasing p...
Enterprise campus networks are changing, just lik...
Recently, the 16th International Coal Expo was he...
The most frequently heard topic in the past two y...