Katkat

Analyze TCP three-way handshake states

BitkernelSoftware Engineer · Online Assessment

Last 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_SENT state after waiting $2,\text{MSL}$ upon receiving the client's SYN segment.
  • B. The server enters the SYN_RCVD state after receiving the client's ACK segment.
  • C. When the client is already in the ESTABLISHED state, the server may still be in the SYN_RCVD state.
  • D. If the server does not receive the client's final ACK segment, 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 (LISTEN state).
  • MSL = Maximum Segment Lifetime; 2MSL is 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?