Tcp and Three-Way handshake

一、The TCP Protocol

TCP is a protocol which belongs to the Transfer Layer of the four protocol layers. UDP is another protocol belongs to Transfer Layer too. But Tcp is differ from UDP as it’s reliable. So, What makes it so reliable? The answer is 3-way handshake. It makes tcp be reliable. You may wonder why it needs 3-way, not 2 or 4 or others? To answer this question, Let’s discuss it deeply.

二、3-Way Handshake

To make Tcp reliable, means both the server and client should know They can normally send and receive data to each other respectively. To achieve this goal, Let’s see these steps.(S: Server for short. C: Client for short)

1-way: C sends a sign[x] to S to tell S that I want to establish a connection with you, let me know if you can receive it.

2-way: (S already received a sign[x] ) S sends a sign[x+1] to C to tell C that I can receive your message correctly, Let me know if you can receive my message correctly too. So far, S can make sure it can receive message from C, but It doesn’t know whether C can receive its message so that 2-way handshake doesn’t work for this goal.

3-way: (C already received a sign[x+1]) C sends a sign[x+2] to S to tell S that I can receive your message correctly too. Till now, C knows that It can send message to S and receive message from S correctly.

When S received the sign[x+2], It knows that It can send message to C and receive message from C correctly, and vice versa. So, It can establish a reliable connection now. Because 3-ways can make sure this connection is reliable, So you don’t need to confirm anything anymore. If you force to do 4-way handshake, Yes, It can be but it’s not efficient. 3-way handshake is necessary and efficiently for a reliable connection.


Let’s see a picture to help you understand these 3 ways.

Tcp and Three-Way handshake