No Login Data Private Local Save

TCP State Machine Visualizer - Online Animated Diagram

7
0
0
0

TCP State Machine Visualizer – Online Animated Diagram

Interactive step-by-step animation of TCP connection states. Explore the three-way handshake, data transfer phase, and four-way termination. Perfect for learning TCP protocol behavior.

Speed: Step: 0 / 12
🖥️ Client State Machine
CLOSED SYN_SENT ESTABLISHED FIN_WAIT_1 FIN_WAIT_2 TIME_WAIT CLOSED
🖥️ Server State Machine
CLOSED LISTEN SYN_RCVD ESTABLISHED CLOSE_WAIT LAST_ACK CLOSED
Event Log
Initial state. Click Next to start handshake.

Frequently Asked Questions

The TCP state machine defines all possible states of a TCP connection during its lifecycle. It covers connection establishment (three-way handshake), data transfer, and connection termination (four-way handshake). Each state represents a specific stage of the protocol, helping developers debug and understand TCP behavior.

The three-way handshake involves: CLOSEDSYN_SENT (client), LISTENSYN_RCVD (server), and finally ESTABLISHED on both sides. This exchange synchronizes sequence numbers and establishes a reliable connection.

When a host wants to close, it sends a FIN and moves to FIN_WAIT_1. The peer acknowledges and enters CLOSE_WAIT. After the peer also sends FIN, it goes to LAST_ACK. Finally, the initiator receives the FIN, sends ACK, and enters TIME_WAIT for 2MSL before returning to CLOSED.

TIME_WAIT ensures that any delayed segments are discarded and the remote peer has received the final ACK. It lasts 2 * MSL (Maximum Segment Lifetime), typically 60 seconds. This prevents old duplicates from being accepted in new connections.

The client application performs an active open (e.g., calling connect()). The TCP stack sends a SYN packet and moves to the SYN_SENT state, waiting for a SYN+ACK reply.

The LISTEN state indicates the server is passively waiting for incoming connection requests. It is entered after a passive open (e.g., listen()). Only in this state can a server accept new SYN packets.

Active close is initiated by one host (e.g., client) sending the first FIN. Passive close occurs when a host receives a FIN and responds gracefully. The states differ: active closer goes through FIN_WAIT_1 → FIN_WAIT_2 → TIME_WAIT, while passive closer goes through CLOSE_WAIT → LAST_ACK.