What this TCP connection termination question tests
This is a medium-difficulty networking question that probes your understanding of the TCP state machine and the protocol's graceful shutdown process. It appears in systems and infrastructure interviews where candidates need to reason about how connections close cleanly and handle partial shutdowns.
Strong answers demonstrate familiarity with the sequence of states and flags involved in the termination handshake, the distinction between initiating and responding sides, and why the protocol requires multiple steps rather than an immediate close. Interviewers often follow up by asking about edge cases such as lingering connections, simultaneous closes, or how applications can enforce timeouts.
- TCP state machine and state transitions
- FIN and ACK flags in the close sequence
- Half-close semantics and asymmetric shutdown
- TIME_WAIT state and its purpose