Decoding the Three-Way Handshake: A Simple Guide to Networking Basics

6 min read
Decoding the Three-Way Handshake: A Simple Guide to Networking Basics

In the vast realm of computer networking, communication between devices is a fundamental aspect. Imagine sending a message to a friend, before you start exchanging thoughts, you need to establish a connection. The same principle applies to computer networks, and that's where the 3-Way Handshake comes into play. In this blog, we'll unravel the mystery behind this essential process in the simplest terms possible, making it accessible even for beginners.

Understanding the Basics

Before delving into the 3-Way Handshake, let's understand the two key players in any network communication: the client and the server.

  • Client: This is your computer or device, requesting some information or service.
  • Server: This is the computer or system that provides the requested information or service.

Now, imagine you want to visit a website (server) using your browser (client). How does your browser and the server establish a reliable connection? That's where the 3-Way Handshake enters the scene.

32a22723-1153-4f1b-a172-0080e2dbf007.png

3-Way Handshake Process

Step 1: SYN (Synchronize)

Imagine your computer, let's call it the "client," wants to talk to another computer or server. To start this conversation, the client sends a special message, like saying, "Hello, can we chat?" This special message is called a SYN packet. Inside this message, the client also includes a kind of secret code, called a sequence number, to keep things organized for future talks. This first step is like the client raising its hand to get the server's attention and say, "Hey, I'd like to connect with you!"

What is Sequence number ?

Now, what's this sequence number? It's like putting numbers on your messages so that the other side knows in what order you're sending them. This helps avoid any confusion during the chat. Each message gets a unique number, and it's used to check if all messages arrive in the right order. Think of it like numbering your text messages to a friend so they know which one came first.

Okay, moving on to...

Step 2: SYN-ACK (Synchronize-Acknowledge)

When the server gets the client's "Hello" message (SYN packet), it gives a friendly wave back. The server acknowledges the client's message and says, "Yes, I got your request to chat! Let's do it." The server also shares its own secret code (sequence number) with the client. This second step is like the server responding, "Hey, I heard you! I'm ready to connect too."

Step 3: ACK (Acknowledge)

Now, the client, having received the server's friendly wave (SYN-ACK packet), gives a virtual high-five back. It says, "Great! I'm ready to chat too." The client also includes its own secret code, increasing it by one. When the server gets this high-five (ACK packet), it also increases its secret code. This third step is like both sides saying, "We're good to go! Let's start our conversation."

So, after these three friendly steps, the client and server are now connected and ready to share information like good pals chatting away! This whole process is called the 3-Way Handshake because it involves three steps, kind of like a friendly greeting before diving into a conversation. Easy, right?

b80d06df-cae4-4121-b768-085bc818f1a4.png

What is TCP ?

TCP, or Transmission Control Protocol, is a crucial part of the Internet Protocol (IP) suite. It operates in the transport layer and is responsible for establishing, maintaining, and completing connections between devices. TCP ensures reliable and connection-oriented communication, making sure that data reaches its destination accurately and in the right order.

TCP is widely used in applications that require dependable and accurate data delivery, such as web browsing, email, file transfer (FTP), and remote terminal access like SSH.

Now, let's break down a term we used "Transport Layer". You might be wondering, what is this transport layer?

No worries, let me explain. The Transport Layer is a part of the OSI model. OSI model consists of a total of 7 layers:

  1. Physical Layer

  2. Data Link Layer

  3. Network Layer

  4. Transport Layer

  5. Session Layer

  6. Presentation Layer

  7. Application Layer

The Transport Layer is a crucial layer in network architecture, managing the communication process. This layer transmits data from the source (where the data is coming from) to the destination (where the data is going).

TCP (Transmission Control Protocol) also operates in the transport layer, playing a significant role in ensuring stable, reliable, and orderly data transfer. This makes it a foundational protocol for various applications and services.

TCP Flags

Breaking Down the Concept of TCP Flags from SYN-ACK:

Alright, let's simplify the concept of TCP flags. These are special flags that help control communication between the sender and receiver. These flags provide specific information about the communication.

Right now, let's focus on four important flags:

  1. SYN (Synchronize):

Used to start a connection. When a client wants to establish a connection with a server, it sends a TCP packet with the SYN flag set. The server responds with a SYN-ACK packet.

  1. ACK (Acknowledge):

Indicates the acknowledgment field. It confirms that data has been received correctly.

  1. FIN (Finish):

Signals the sender to close the connection. Both the client and server use this flag to end the connection.

  1. RST (Reset):

Resets the connection. This flag is used when there's an error or an unknown condition, and the connection needs to be terminated immediately.

These flags exist as bits in the TCP header and are set or unset to convey specific information. They play a role in indicating the state of the connection. For example, in the TCP handshake, SYN and ACK flags are used, while in connection termination, the FIN flag is utilized. Together, these flags allow TCP to effectively manage and control communication between devices.

Why is 3-Way Handshake Important ?

  • Reliability: It ensures that both the client and server are ready to communicate before sharing data.

  • Security: The handshake helps prevent unauthorized access and ensures a secure connection.

  • Error Handling: If any step fails, the connection isn't established, preventing potential issues.

Deep Dive into 3-Way Handshake

For a more in-depth exploration, check out Mr. PsyChotic's YouTube video on the TCP 3-Way Handshake. In this video, he breaks down the concept in an entertaining and educational manner, making it a valuable resource for learners seeking a deeper understanding of this foundational networking concept.

Conclusion

The 3-Way Handshake might sound complex, but it's essentially a digital greeting that ensures a smooth and secure conversation between your device and the server. Just like introducing yourself before starting a chat with a friend, the handshake establishes a reliable connection, making the vast world of computer networking a little less mysterious for beginners. So, the next time you browse a website or send a message, remember the friendly 3-Way Handshake that makes it all possible!

Want to write a blog?

Unfold your thoughts and let your ideas take flight in the limitless realm of cyberspace. Whether you're a seasoned writer or just starting, our platform offers you the space to share your voice, connect with a creative community and explore new perspectives. Join us and make your mark!

Follow us on social media

Cyber Unfolded Light Logo
Copyright © 2024 CYUN. All rights reserved.