# Handshake

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1736853809418/91c575af-f9e4-4139-bd46-0125845350f4.png?auto=compress,format&format=webp align="left")

A **handshake** is a process that occurs at the beginning of a communication session between two devices (such as a client and a server) to establish a connection and ensure that both parties are ready to exchange data

The most common example is the **three-way handshake** used by TCP to establish a connection between a client and a server. Here’s how it works:

1. **SYN** (Synchronize):
    
    * The client sends a **SYN** message to the server, indicating it wants to start a connection.
        
2. **SYN-ACK** (Synchronize-Acknowledge):
    
    * The server responds with a **SYN-ACK** message, acknowledging the client's request and indicating that it's ready to communicate.
        
3. **ACK** (Acknowledge):
    
    * The client sends an **ACK** message to the server, confirming that the connection is now established.
