NetwNETW
Curriculum
CHAPTER 06

Transport Layer

TCP, UDP, ports, and reliability

14 min read6 sections
In this chapter
RoleTCPTCP state machineUDPPortsTCP vs UDP

01Role

L4 provides process-to-process delivery via ports. It multiplexes many applications over one IP address. The socket (IP + port) is the endpoint.

02TCP

Connection-oriented, reliable, ordered, flow- and congestion-controlled. Three-way handshake establishes state; four-way teardown closes it.

  • ▸SYN → SYN-ACK → ACK
  • ▸Sequence & ack numbers track bytes
  • ▸Sliding window for flow control
  • ▸Slow start, congestion avoidance, fast retransmit

TCP Three-Way Handshake

1. Client opens connection. seq = 100
2. Server accepts. seq = 300, ack = 101
3. Client confirms. ack = 301. Connected.

03TCP state machine

A connection moves through states. Understanding them explains TIME_WAIT, half-open connections, and port exhaustion.

TCP Connection State Machine

CLOSED
SYN-SENT
SYN-RECEIVED
ESTABLISHED
FIN-WAIT
CLOSED

No connection.

04UDP

Connectionless, best-effort, low overhead. No handshake, no ordering, no retransmission. Used where latency matters: DNS, VoIP, gaming, QUIC/HTTP3, video streaming.

05Ports

Well-known (0–1023), registered (1024–49151), ephemeral (49152–65535). A socket = IP + port. Port 80 HTTP, 443 HTTPS, 53 DNS, 22 SSH, 25 SMTP.

06TCP vs UDP

TCP: reliability, ordering, congestion control, higher latency. UDP: speed, no guarantees, app handles reliability. HTTP/3 moved to QUIC (UDP) to get both speed and reliability.

Check your understanding
0 / 1 correct
Which is connectionless?