What protocol uses a threeway handshake?

0 views
Answering what protocol uses a three way handshake points directly to Transmission Control Protocol, which establishes a reliable connection before data transfer. The process exchanges three specific control messages between a client and server to synchronize sequence numbers. First, the client sends a SYN packet, the server replies with SYN-ACK, and the client confirms with ACK.
Feedback 0 likes

What Protocol Uses a Three Way Handshake? TCP Explained

Understanding what protocol uses a three way handshake is essential for anyone learning how devices establish stable network sessions. Without this structured verification process, data packets risk getting lost or arriving out of order during transmission. Explore how this foundational networking mechanism ensures reliable communication between clients and servers.

What Protocol Uses a Three-Way Handshake?

Transmission Control Protocol (TCP) is the core networking protocol that uses a three-way handshake to establish a reliable connection between a client and a server. Operating at the Transport Layer of the TCP/IP model, TCP exchanges three control packets - SYN, SYN-ACK, and ACK - to synchronize sequence numbers before any actual application data moves across the network.

When first studying networking, it can seem unusual that two computers need three separate back-and-forth messages just to establish a connection. That initial setup adds one round-trip time (RTT) of delay before a single byte of webpage data transfers, yet TCP carries a large share of mobile internet traffic because reliability matters more than raw speed for most applications. Think of it like calling a friend on a noisy phone line and verifying that both of you can hear each other clearly before starting a conversation. Without this agreement, packets could be lost without either side noticing.

How Does TCP Three-Way Handshake Work Step by Step?

The TCP three-way handshake establishes a two-way communication session through three sequential steps: SYN (Synchronize), SYN-ACK (Synchronize-Acknowledgment), and ACK (Acknowledgment). During this exchange, both the client and server verify that the other device is online, ready to receive data, and synchronized on starting sequence numbers.

Each TCP segment carries a header of at least 20 bytes containing source ports, destination ports, control flags, and 32-bit tracking numbers. One subtle detail in these packet headers often trips up networking beginners: how tracking numbers increment during the handshake, which is detailed in the sequence section below. Misunderstanding the direction of these control flags is also a common cause of misconfigured firewall rules that accidentally block return packets.

Step 1: SYN (Synchronize)

The client initiates the connection by sending a TCP segment with the SYN flag set to 1 to the destination server. This packet contains a randomly generated Initial Sequence Number (ISN) - for example, 1000 - which tells the server where the client will begin counting its outgoing bytes. At this point, the client enters the SYN-SENT state and waits for a reply.

Step 2: SYN-ACK (Synchronize-Acknowledgment)

Upon receiving the SYN packet, the server allocates buffer memory and responds with a segment that has both the SYN and ACK flags activated. The server sets its own random Initial Sequence Number (say, 5000) and sets the Acknowledgment Number to the clients sequence number plus one (1001). This confirms receipt of the clients request while simultaneously asking the client to synchronize with the servers counter.

Step 3: ACK (Acknowledgment)

Finally, the client receives the servers SYN-ACK packet and replies with a segment containing only the ACK flag set to 1. The client sets its Sequence Number to 1001 and its Acknowledgment Number to the servers sequence number plus one (5001). Once the server receives this final packet, both devices transition to the ESTABLISHED state and begin transferring application data.

Why Does TCP Use a Three-Way Handshake Instead of Two?

TCP requires three steps rather than two because full-duplex communication demands that both the client and server confirm they can both send and receive data independently. A two-way exchange only proves that the client can send and the server can reply, leaving the server with zero confirmation that its own response actually reached the client.

Skipping that third step would create problems on congested networks where delayed duplicate packets from old sessions can still float around. Internet routers can hold onto stray packets for seconds before delivering them late. If a server accepted connections after just two packets, a delayed SYN packet from an expired session could trick the server into opening a phantom connection and wasting memory. By forcing the client to send a final ACK, the server verifies that the client genuinely initiated a fresh session.

Sequence Numbers and Termination: Clearing Up Common Confusion

Beginners frequently confuse how sequence numbers increment during connection setup and often mix up the three-way handshake with TCPs four-way termination process. Even though SYN and SYN-ACK packets carry zero bytes of application payload, TCP treats each control flag as a single phantom byte so both sides can verify exact packet delivery.

Here is the tracking detail I mentioned earlier: because the SYN flag consumes one logical sequence number, the acknowledgment number always increases by 1 during the handshake even when no data travels inside the packet. Many textbook diagrams gloss over this detail, leaving students confused when they inspect live traffic in Wireshark.

And here is another common mix-up - opening a TCP connection takes three packets, whereas closing one gracefully requires a four-way handshake using FIN (Finish) and ACK flags. Why four steps to close? Because TCP connections are full-duplex, meaning each side must shut down its outgoing data stream independently while still listening for incoming bytes from the other end. Totally different.

Security Implications: SYN Flood Attacks and Mitigations

Because the three-way handshake forces a server to allocate memory after receiving a single SYN packet, attackers exploit this design through SYN flood Denial-of-Service (DoS) attacks. In a SYN flood, malicious traffic overwhelms a server with spoofed SYN requests while intentionally withholding the final ACK packet, leaving thousands of half-open connections stuck in memory.

SYN floods remain a persistent threat on the modern web. Simply increasing a servers connection backlog often fails to solve the issue when high-volume traffic saturates network links quickly. Instead of relying solely on larger memory queues, modern operating systems use SYN cookies. When a server detects heavy connection pressure, it avoids storing state in memory altogether, encoding the initial sequence details directly into a cryptographic timestamp inside the SYN-ACK response and only allocating resources once a legitimate client returns the matching ACK.

TCP vs UDP: Connection-Oriented Handshake vs Connectionless Speed

While TCP uses a three-way handshake to guarantee delivery, User Datagram Protocol (UDP) skips handshakes entirely to prioritize low latency.

Transmission Control Protocol (TCP)

• Minimum 20-byte header (expandable up to 60 bytes with options) to track sequence and acknowledgment numbers

• Web browsing (HTTP/HTTPS), file transfers, email, and database queries where missing data breaks functionality

• Uses a mandatory three-way handshake (SYN, SYN-ACK, ACK) before transmitting any application data

• Guarantees ordered, error-checked delivery with automatic retransmission of lost packets

User Datagram Protocol (UDP)

• Fixed 8-byte header containing only source port, destination port, length, and checksum

• Live video streaming, online gaming, Voice over IP (VoIP), and DNS lookups where speed beats perfection

• Connectionless transmission - fires packets immediately with zero handshake or session state

• Best-effort delivery with no acknowledgments, ordering guarantees, or built-in retransmissions

Choose TCP whenever data integrity is non-negotiable, as its three-way handshake and retransmission rules ensure every byte arrives intact. UDP works better for real-time applications where waiting 100 milliseconds to resend a dropped audio frame causes worse user experience than simply skipping it.

Troubleshooting High Latency on an International E-Commerce Checkout

Minh, a backend developer in Ho Chi Minh City, noticed that mobile shoppers connecting to his company's Singapore server experienced frustrating 400ms delays before checkout pages even began loading. He initially assumed his database queries were running too slowly.

He spent two days optimizing SQL indexes and compressing images, only to see zero improvement in initial connection times. Frustrated, Minh finally captured live network packets using Wireshark.

The packet trace revealed the real culprit: his API client was opening a brand-new TCP connection for every single microservice request, forcing mobile users on cellular networks to complete repeated three-way handshakes across international routes.

Minh enabled HTTP keep-alive connection pooling so clients reused existing TCP sessions instead of handshaking repeatedly. Checkout load times dropped by 65% within a week, cutting cart abandonment noticeably.

Same Topic

Which protocol uses a three-way handshake, TCP or UDP?

Transmission Control Protocol (TCP) is the protocol that uses a three-way handshake. User Datagram Protocol (UDP) is connectionless, meaning it sends data packets immediately without performing any handshake or verifying whether the receiving device is ready.

What are the three steps of the TCP three-way handshake?

The three steps are SYN, SYN-ACK, and ACK. First, the client sends a SYN packet to request a connection. Second, the server replies with a SYN-ACK packet to acknowledge the request and share its own sequence number. Third, the client sends an ACK packet to confirm receipt, establishing the session.

If you ever run into connectivity issues after configuring your network settings, learn how to get your network back online.

Why does TCP use a three-way handshake instead of four?

TCP combines the server's acknowledgment and synchronization into a single SYN-ACK packet, reducing four potential messages down to three. Closing a TCP connection, however, requires a four-way handshake (FIN, ACK, FIN, ACK) because each side must terminate its data stream independently.

Does HTTPS or TLS use the TCP three-way handshake?

Yes, traditional HTTPS runs on top of TCP, meaning the client and server must complete the TCP three-way handshake first before performing the TLS cryptographic handshake. Newer HTTP/3 connections bypass TCP by using QUIC over UDP to combine transport and encryption handshakes.

Strategy Summary

TCP is the Three-Way Handshake Protocol

Transmission Control Protocol (TCP) uses the three-way handshake at the Transport Layer to establish reliable, connection-oriented sessions before transferring data.

Three Control Flags Drive Connection Setup

The handshake exchanges SYN, SYN-ACK, and ACK segments, incrementing sequence and acknowledgment numbers by 1 to synchronize both devices.

Reliability Costs One Round-Trip Time

Completing the three-way handshake adds one full round-trip time (RTT) of latency upfront, which is why connection reuse and HTTP keep-alive are vital for web performance.

UDP Skips Handshakes for Raw Speed

Unlike TCP's 20-byte minimum header and session setup, UDP uses an 8-byte header with zero handshake, making it ideal for gaming and live streaming.