Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
TCP's TIME_WAIT will pin sockets for 60–120 seconds and silently exhaust ephemeral ports under load — a class of outage that looks like "the database is fine, but new connections fail." UDP gives you raw speed but no delivery guarantees, so anything built on it (DNS, QUIC, video) reinvents reliability at the app layer.
Inspect TCP connection states and ephemeral port pressure on a running cloud VM.
ab -n 200 -c 1 http://example.com/ then count TIME_WAIT sockets — explain why it spikes.net.ipv4.tcp_tw_reuse — flip it from 0 to 1 in a sandbox and document one risk of doing so in production.dig +stats — note the difference.Use these three in order. Each builds on the one before.
In one paragraph, explain TCP vs UDP like I'm new to networking — what guarantees does each one give and at what cost?
Walk me through the TCP three-way handshake and four-way close, naming every state both endpoints pass through.
Given a service that hits 28,000 concurrent outbound HTTP requests and starts failing with `EADDRNOTAVAIL`, diagnose what's happening and propose three fixes ranked by safety.
# SSH to an EC2 instance, then inspect TCP states
ssh ec2-user@<public-ip>
# Connection state distribution
ss -tan | awk 'NR>1 {print $1}' | sort | uniq -c
# Count sockets stuck in TIME_WAIT
ss -tan state time-wait | wc -l
# Ephemeral port range (default 32768-60999 on Linux)
sysctl net.ipv4.ip_local_port_range
# Test UDP: send a DNS query without a connection
dig @1.1.1.1 +notcp example.com