Interview surprise: Why does TCP need a three-way handshake?

Interview surprise: Why does TCP need a three-way handshake?

The TCP three-way handshake is a classic interview question. It means that before TCP transmits data, it needs to interact three times to formally establish a connection and transmit data. The reason why TCP needs three handshakes is that both sides of TCP are full-duplex. The so-called full-duplex means that either end of TCP is both the sender and the receiver of data. Therefore, this requires both sides of TCP communication to ensure their own sending capabilities and receiving capabilities. This is like when making a phone call, both parties must ensure that their microphones (transmitting sound) and headphones (receiving sound) are normal, so that effective communication can be carried out. Usually, when making a phone call, it starts like this:

  • Me: Hello, can you hear me?
  • Other person: I can hear you, can you hear me?
  • Me: I can hear you, so let’s get down to business.

The same is true for TCP three-way handshake. The capabilities of the three-way handshake are as follows:

TCP three-way handshake process

The TCP three-way handshake process is as follows:

  • The client sends SYN to the server, indicating that it wishes to establish a connection;
  • After receiving the message, the server responds with a SYN and ACK (confirmation response) to the client;
  • After receiving the SYN message from the server, the client responds with an ACK message.

The specific execution process is shown in the following figure:

Summarize

The reason why TCP needs three handshakes is that both parties of TCP communication are full-duplex, so three interactions are required to confirm the sending and receiving capabilities of both parties, and the TCP handshake must be three times. If it is a two-way handshake, it cannot prove the sending capability of the server and the receiving capability of the client; it cannot be a four-way handshake either, because if three handshakes can already prove something, there is no need for another interactive handshake.

References & Acknowledgements

"Code Efficiently: Java Development Manual"

《Offer is coming》

<<:  AI identification and root cause location of 5G wireless problems help improve network quality

>>:  5G and its impact on the Internet of Things

Recommend

How can the chip industry survive in the era of the Internet of Things?

After the industrial revolution, the computer age...

[Christmas] DMIT: $100/year-2GB/40G SSD/2TB@2Gbps/Los Angeles CN2 GIA

DMIT has released two special Christmas packages,...

How to quickly master the HTTP protocol (HD mind map)

The HTTP protocol is extremely complex. It affect...

The 5G era is coming. How do the three major operators plan their layout?

With the continuous development of science and te...

How to choose the best flash storage for your data center?

The all-flash data center is a futuristic concept...

The turning point has arrived, and operators will face major changes in 2019

According to the financial report, China Telecom&...

Outlook for Nine Technology Trends in the Digital Economy from 2021 to 2025

[[361322]] The digital economy is divided into th...

5G and manufacturing advantages: optimism tempered

5G-enabled factories will have the ability to mai...

Kuroit: £12/year KVM-1GB/10G SSD/5TB/UK & US data centers

Kuroit also released a promotion during the Chris...