Analyze TCP three-way handshake states
BitkernelSoftware Engineer · Online AssessmentLast updated
This question evaluates understanding of TCP connection establishment and the TCP state machine, testing recognition of correct state transitions during the three-way handshake and related transport-layer behavior.
During TCP connection establishment (the three-way handshake), exactly one of the following statements is correct. Identify which one, and be prepared to explain why each of the other three is wrong.
Options:
- A. The server enters the
SYN_SENTstate after waiting $2,\text{MSL}$ upon receiving the client'sSYNsegment. - B. The server enters the
SYN_RCVDstate after receiving the client'sACKsegment. - C. When the client is already in the
ESTABLISHEDstate, the server may still be in theSYN_RCVDstate. - D. If the server does not receive the client's final
ACKsegment, it directly closes the connection after waiting $2,\text{MSL}$.
Constraints & Assumptions
- Standard TCP per RFC 793 / RFC 9293; no
TCP_DEFER_ACCEPT, no TCP Fast Open, no simultaneous-open scenario. - Exactly one option is correct (single-answer multiple choice).
- "Client" is the active opener; "server" is the passive opener listening on a port (
LISTENstate). MSL= Maximum Segment Lifetime;2MSLis twice that value.
Hints
Hint 1
Where to start: Walk the handshake one segment at a time and write down the state each endpoint is in *after* each segment is sent or received. The two endpoints do **not** change state simultaneously.
Hint 2
State ownership: `SYN_SENT` belongs to the side that *initiates* (the client); `SYN_RCVD` belongs to the side that *responds* (the server). Watch for options that swap these.
Hint 3
Where 2MSL actually lives: $2\,\text{MSL}$ and the `TIME_WAIT` timer appear during connection **teardown** by the active closer, not during establishment. Any setup-phase option that invokes $2\,\text{MSL}$ is a distractor.
Follow-up questions
- What actually happens on the server if the client's final `ACK` is lost? Describe the retransmission behaviour and the eventual outcome of the half-open connection.
- Why does the active closer wait `2MSL` in `TIME_WAIT`, and what two problems does that wait prevent?
- How does a SYN flood exploit the `SYN_RCVD` state, and how do SYN cookies defend against it without keeping per-connection state?
- In a *simultaneous open* (both peers send `SYN` first), what state path do the endpoints follow, and which option's premise would change?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.