TCP’s 4-way handshake used to terminate connections does not guarantee that both sides of the connection will close. Explain why this is and what TCP does to try to maximise the chance that both sides of the connection close once a termination request is sent. You may use an example or diagram.
Try an answer before revealing the guidance below.
Key Concepts
- FIN / ACK exchange
- Lost final ACK
- Two generals problem
- TIME_WAIT
- Retransmission timer
Answer Approach
- Sketch FIN, ACK, FIN, ACK between the two hosts.
- Ask what happens if the last ACK is lost.
- Can the sender of the last ACK ever know it arrived?
- Recall the state TCP enters after sending the last ACK.
Full Answer
Answer status: Draft answer (unofficial). Revision notes, not an official marking scheme.
The final ACK is not itself acknowledged, so the side sending it can never be sure it arrived (any finite exchange over an unreliable channel has this problem). If that ACK is lost, the other side stays in LAST_ACK and retransmits its FIN. To handle this, the side that sends the final ACK enters TIME_WAIT for about 2 × MSL: if a retransmitted FIN arrives it re-sends the ACK. The other side retransmits its FIN on timeout, and after enough failed attempts it closes anyway, so both sides eventually close even if the handshake cannot be guaranteed.
Shortcuts: K concepts · A approach · F answer · R reviewed · B bookmark · ← / → previous / next