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
edgeNAT sent a promotional plan for this year'...
As the number of global IoT deployments continues...
Routers are important network devices that realiz...
"Talented people emerge in every generation,...
The 2021 Mobile World Congress (MWC) Shanghai Exh...
As a non-rich person, have you ever applied for v...
With the continuous extension of network technolo...
In 2017, the application of 5G technology has bec...
Megalayer has launched a Christmas and 2024 New Y...
RAKsmart's product line has been further enri...
[[402875]] Railways are the backbone of sustainab...
1. Development History: 2. Wireless network class...
[51CTO.com original article] As an indispensable ...
Linode is a VPS cloud hosting company that has be...
[[387481]] Editor's note: The operators who p...