Fundamentals 4 min read

Understanding TCP Connections: Three‑Way Handshake and Four‑Way Termination

The article explains TCP as a connection‑oriented protocol, contrasts it with UDP, details the three‑way handshake and four‑way termination processes using clear steps and analogies, and includes illustrative diagrams to aid comprehension.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Understanding TCP Connections: Three‑Way Handshake and Four‑Way Termination

TCP is a connection‑oriented protocol, meaning a communication channel must be established before data is sent, similar to a phone call where the receiver must answer before conversation can begin.

In contrast, UDP is connectionless; it sends data without prior negotiation, akin to sending a text message regardless of the recipient’s status.

Three‑way handshake:

First, the client sends a SYN packet (seq=100) and waits for the server’s response.

Second, the server replies with SYN+ACK (ACK=101) and its own SYN (seq=300).

Third, the client acknowledges with ACK=301, after which data exchange can start.

The handshake can be illustrated with a metaphor of a boy proposing to a girl, the girl responding positively, and the boy confirming the relationship.

Four‑way termination:

After the client finishes sending data, it sends a FIN packet.

The server acknowledges with ACK, then when ready, sends its own FIN.

The client acknowledges the server’s FIN with ACK, completing the connection closure.

This termination process can be likened to a breakup scenario, with each side sending and acknowledging termination messages.

TCPnetworkingProtocolconnectionhandshaketermination
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.