
What "Connected" Means in TCP
What "Connected" Means in TCP The Three-Packet Handshake Between Two Kernels Who've Never Met Reading time: ~13 minutes You called connect() . Your code moved on. You're "connected." Nothing physical connected. No wire was plugged in. No circuit was closed. Three packets flew across the network and landed in two kernel data structures — a hash table entry on your machine and a hash table entry on the server — and that's it. That's the whole "connection." A gentleman's agreement between two kernels who've never met, maintained by nothing more than both sides keeping their word. The moment either kernel loses that state — crash, memory pressure, a firewall that forgets to tell anyone — your "connection" evaporates. The wire is still there. The bytes stop flowing. Most of us debug socket code for years without understanding what connect() actually does. Every mysterious hang is a debt being collected. Let's fix it. The State Machine Behind connect() The kernel maintains a state machine fo
Continue reading on Dev.to Tutorial
Opens in a new tab


