Networking & Protocols (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is TCP TIME_WAIT state and why does it last for 2MSL?
senior Levelnetworking-protocolsAdvanced Internals
In Simple Words:
After sending the final ACK during connection close, the client enters TIME_WAIT for 2 Maximum Segment Lifetimes (2MSL, typically 60 seconds):
- Purposes:
- Ensures the final
ACKarrived safely; if lost, the server retransmitsFIN, and the client can re-ACK. - Prevents delayed duplicate packets from an old closed connection from accidentally corrupting a newly established connection reusing the same port pair!
- Ensures the final