TCP state machine: connection lifecycle
Every TCP socket has a state — a position in the connection lifecycle state machine. ss -tn or netstat -tn shows these states.
Understanding states helps diagnose: why are there thousands of TIME_WAIT sockets? Why does this server have CLOSE_WAIT connections that never close? Why can't I bind to this port after restarting?