Why TCP needs 3 handshakes
TCP, the Transmission Control Protocol, is the backbone of reliable communication over the internet. It ensures data gets delivered accurately and in the correct order, a crucial feat considering the chaotic nature of the network. But how does TCP achieve this? One key mechanism is the three-way handshake.
Imagine two friends trying to start a conversation. They need to make sure they are both on the same page, ready to talk. The three-way handshake is similar, establishing a secure and reliable connection between two devices.
Here’s how it works:
1.SYN (synchronization): The first device, let’s say a computer, sends a SYN packet to the other device, a server, saying, “Hey, I want to talk to you.”
2.SYN-ACK (synchronization-acknowledgement): The server receives the SYN packet and responds with a SYN-ACK packet, saying, “Okay, I’m ready to talk, let’s start.”
3.ACK (acknowledgement): The computer receives the SYN-ACK packet and sends an ACK packet, signifying, “Great, we’re connected, let’s begin the conversation.”
This three-step process ensures:
Confirmation of readiness: Both devices are actively engaged and ready to communicate.
Avoidance of wasted resources: No data is sent until a reliable connection is established.
Reliable communication: By acknowledging each other’s messages, they prevent data loss and guarantee correct order of delivery.
While it might seem like an extra step, the three-way handshake is fundamental to TCP’s reliability. It guarantees a smooth and secure communication channel, preventing errors and lost data, making your internet experience reliable and seamless.