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 which belongs to the Transfer Layer too. But Tcp is differ from UDP as it’s reliable. So, what makes it so reliable? The answer is a 3-way handshake. It makes tcp reliable. You may wonder why it needs 3-way, not 2 or 4 or others? To answer this question, Let’s discuss it more in depth.

二、3-Way Handshake

To make TCP reliable, means that both 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 the message from C, but it doesn’t know whether C can receive its message so that the 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 the message to S and receive the message from S correctly.

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


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

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值