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
The fifth generation of cellular networks is gett...
The tribe often shares information about RAKsmart...
Before we dive into the ways drones can make the ...
5G will be put into large-scale commercial use as...
In the field of intelligent buildings and automat...
In order to do a good job in network security, SD...
Recently, International Data Corporation (IDC) re...
[[425392]] For more information, please visit: Ho...
Improving battery life has been a challenge for a...
TmhHost recently launched the Hong Kong CN2 high-...
[[418030]] 1. Can you have both high performance ...
[[354146]] This article is reprinted from the WeC...
Recently, user Mr. Wang revealed to a reporter fr...
If you have to ask when LPWAN entered the public ...