Question
How does TCP session termination work?
Answer
A four-way exchange: FIN → ACK → FIN → ACK. Each direction is closed independently, so it needs four segments (vs. three for setup); either host can initiate, and the two middle steps can sometimes combine into one FIN+ACK.
* FIN, ACK, FIN, ACK: each direction is closed independently, so teardown takes four segments. *
TCP Session Termination (Four-Way Handshake):
Host A Host B
│ │
│──────── FIN ─────────────────────→│ Step 1: A has no more data
│ │
│←─────── ACK ──────────────────────│ Step 2: B acknowledges FIN
│ │
│←─────── FIN ──────────────────────│ Step 3: B has no more data
│ │
│──────── ACK ─────────────────────→│ Step 4: A acknowledges FIN
│ │
│ Connection Closed │
Four Steps:
| Step | Action | Purpose |
|---|---|---|
| 1 | Client sends FIN | "I have no more data to send" |
| 2 | Server sends ACK | Acknowledges client's FIN |
| 3 | Server sends FIN | "I have no more data to send" |
| 4 | Client sends ACK | Acknowledges server's FIN |
Note: Steps 2 and 3 can occur in the same segment (FIN+ACK combined).
Key insight: Either host can initiate termination. Both directions must be closed independently.
Why four segments instead of three? During setup, the server can combine SYN+ACK because both sides agree to open at once. During teardown, when one side sends FIN the other may still have data to send, so its ACK and its own FIN are often separate - giving four steps: "I'm done" → "OK" → "Me too" → "OK".
Go deeper:
TCP Connection Termination — Four-Way Handshake — walks through the FIN / ACK / FIN / ACK exchange that closes each direction independently.
RFC 9293 §3.6 — Closing a Connection — the authoritative teardown sequence, including the TIME-WAIT state.
TCP — Connection termination — Wikipedia's four-way handshake summary for the carousel.
Note saved — thanks!
Question
What are the common protocols used in a small network, and what does each do?
Answer
Remote access: Telnet/SSH; web: HTTP/HTTPS; email: SMTP (send), POP3/IMAP (retrieve); file transfer: FTP/SFTP; addressing: DHCP; name resolution: DNS.
Common Protocols of a Small Network:
Network protocols support the applications and services employees use.
| Protocol | Purpose |
|---|---|
| Telnet / SSH | Remote access to network devices and servers (SSH is the secure option) |
| HTTP / HTTPS | Communication between web clients and web servers |
| SMTP | Sends email |
| POP3 / IMAP | Used by clients to retrieve email |
| FTP / SFTP | Downloads and uploads files between a client and an FTP server |
| DHCP | Lets clients acquire an IP configuration automatically from a DHCP server |
| DNS | Resolves domain names to IP addresses |
Key insight: A single server can provide several of these services at once (e.g. an email, FTP, and SSH server on one box), so a small network often needs only a handful of physical servers.
Go deeper:
Wikipedia — DHCP — how the DORA exchange auto-configures clients, the addressing service in this table.
Wikipedia — Domain Name System (DNS) — the name-resolution service that maps hostnames to IP addresses.
Note saved — thanks!