Course overviewTopic 17 / 31
Computer Networks • Deep Lesson 10 min Transport Layer: TCP & UDP

Animated TCP Three-Way Handshake & Connection Teardown

TCP begins with a three-way handshake that establishes both directions of the connection and synchronizes initial sequence numbers. Connection teardown is different: it typically uses FIN/ACK exchanges because each direction of a TCP connection can close independently.

LEARNING LOOPWatch→Read→Inspect→Retrieve→Teach back
Animated TCP Three-Way Handshake & Connection Teardown
Week 3–4 · Topic 17 / 31
Visual model

Watch the structure first. Then read the technical details.

C → S SYN Seq=100
S → C SYN-ACK Seq=900 Ack=101
C → S ACK Ack=901
C ↔ S DATA
FIN / ACK teardown
Article companion· Week 3–4

TCP begins with a three-way handshake that establishes both directions of the connection and synchronizes initial sequence numbers. Connection teardown is different: it typically uses FIN/ACK exchanges because each direction of a TCP connection can close independently.

01

SYN

The client sends a SYN with an initial sequence number. The server creates connection state and acknowledges it.

02

SYN-ACK

The server replies with its own initial sequence number and an acknowledgement for the client's SYN.

03

ACK

The client acknowledges the server's SYN. Both sides now have synchronized sequence-number state and can proceed.

DUAL CODING

See the mechanism before you memorize it

One diagram, one causal story, one reconstruction task.

VISUAL RECONSTRUCTION

Animated 3-way handshake + teardown — causal map

4 stages
01

Client → Server

SYN, Seq=x

02

Server → Client

SYN-ACK, Seq=y, Ack=x+1

03

Client → Server

ACK, Ack=y+1

04

Data

Application bytes can now flow according to TCP state.

Trace the mechanism from left to right. On smaller screens, follow the numbered sequence. Then redraw the same flow without looking.
ACTIVE RECONSTRUCTION

Draw the idea yourself

Rebuild the core flow on a real canvas before moving to the worked walkthrough.

SKETCHFLOW

Animated 3-way handshake + teardown — practice canvas

Sketch the Animated 3-way handshake + teardown mechanism from memory. Label the input, transformation, observation, and transfer.

Practice canvas ready

The canvas loads when you reach this section.

Draw first. Compare second.Touch + mouse friendly
STEP BY STEP

Walk the system

01

Client → Server

SYN, Seq=x

02

Server → Client

SYN-ACK, Seq=y, Ack=x+1

03

Client → Server

ACK, Ack=y+1

04

Data

Application bytes can now flow according to TCP state.

05

Close

FIN/ACK sequences independently close each direction.

CONCRETE ARTIFACT

Handshake on the wire

The +1 matters because SYN consumes one sequence number. This is a favorite detail in packet-analysis questions.

textcopy → rebuild → modify
C → S  SYN      Seq=100
S → C  SYN-ACK  Seq=900 Ack=101
C → S  ACK      Ack=901
MISCONCEPTIONS

What usually goes wrong

Call SYN-ACK the second 'connection' rather than the server's response.

Forget that SYN consumes one sequence number.

Assume FIN immediately destroys both directions of a TCP connection.

RETRIEVAL PRACTICE

Close the tab. Rebuild it from memory.

Read the question, answer aloud, then reveal.

Why three messages instead of two?Reveal answer

Both endpoints need to establish and acknowledge their sequence-number state so each side knows the other side received the information.

What does the +1 represent?Reveal answer

SYN occupies one sequence-number position, so the acknowledgement advances by one.

Why can TCP close in more than one exchange?Reveal answer

The connection is full-duplex; each direction can close independently.

FEYNMAN

Teach it back in plain English

Hide the labels and reconstruct SYN, SYN-ACK and ACK from the sequence/acknowledgement numbers alone.

EXAM / INTERVIEW

What a strong answer sounds like

Common questions: state transitions, sequence-number increments, SYN backlog and FIN/ACK teardown behavior.

NEXT CONNECTION

Make this idea travel.

Connect it next to: tcp-reliability • tcp-flow-congestion • udp-quic.

COURSE CONTENTS

Animated 3-way handshake + teardown

01How the Internet Works + OSI ModelWeek 1 · 4 topics0/4
02Physical & Data Link LayersWeek 1–2 · 5 topics0/5
03Network Layer: IP & RoutingWeek 2–3 · 6 topics0/6
04Transport Layer: TCP & UDPWeek 3–4 · 5 topics0/5
05Application Layer: HTTP, DNS & FriendsWeek 4–5 · 6 topics0/6
06Security & Troubleshooting ToolkitWeek 5 · 5 topics0/5