PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Bitkernel

Analyze TCP three-way handshake states

Last updated: Jun 24, 2026

Quick Overview

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.

  • medium
  • Bitkernel
  • Software Engineering Fundamentals
  • Software Engineer

Analyze TCP three-way handshake states

Company: Bitkernel

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Take-home Project

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}$. ```hint 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 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 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. ``` ### 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. ### What a Strong Answer Covers - The correct option (**C**), with the precise state each endpoint occupies after each of the three segments. - The full state sequence: client `CLOSED` → `SYN_SENT` → `ESTABLISHED`; server `LISTEN` → `SYN_RCVD` → `ESTABLISHED`. - Why the client reaches `ESTABLISHED` *before* the server does (the asymmetry that makes C true). - A correct rebuttal of each wrong option: A swaps client/server state and misuses $2\,\text{MSL}$; B confuses the trigger for `SYN_RCVD`; D misattributes the $2\,\text{MSL}$/`TIME_WAIT` mechanism and ignores `SYN+ACK` retransmission. - Where $2\,\text{MSL}$ genuinely applies (the `TIME_WAIT` state of the active closer during teardown). ### Follow-up Questions 1. 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. 2. Why does the active closer wait `2MSL` in `TIME_WAIT`, and what two problems does that wait prevent? 3. How does a SYN flood exploit the `SYN_RCVD` state, and how do SYN cookies defend against it without keeping per-connection state? 4. In a *simultaneous open* (both peers send `SYN` first), what state path do the endpoints follow, and which option's premise would change?

Quick Answer: 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.

Related Interview Questions

  • Evaluate C for-loop execution count - Bitkernel (medium)
  • Trace first pass of heap sort - Bitkernel (medium)
  • Find minimum two’s-complement value with three ones - Bitkernel (medium)
  • Identify incorrect statement about sockets - Bitkernel (medium)
  • Solve cups logic puzzle with one true statement - Bitkernel (medium)
|Home/Software Engineering Fundamentals/Bitkernel

Analyze TCP three-way handshake states

Bitkernel logo
Bitkernel
Oct 24, 2025, 12:00 AM
mediumSoftware EngineerTake-home ProjectSoftware Engineering Fundamentals
2
0

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 MSL2\,\text{MSL}2MSL 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 MSL2\,\text{MSL}2MSL .

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.

What a Strong Answer Covers

  • The correct option ( C ), with the precise state each endpoint occupies after each of the three segments.
  • The full state sequence: client CLOSED → SYN_SENT → ESTABLISHED ; server LISTEN → SYN_RCVD → ESTABLISHED .
  • Why the client reaches ESTABLISHED before the server does (the asymmetry that makes C true).
  • A correct rebuttal of each wrong option: A swaps client/server state and misuses 2 MSL2\,\text{MSL}2MSL ; B confuses the trigger for SYN_RCVD ; D misattributes the 2 MSL2\,\text{MSL}2MSL / TIME_WAIT mechanism and ignores SYN+ACK retransmission.
  • Where 2 MSL2\,\text{MSL}2MSL genuinely applies (the TIME_WAIT state of the active closer during teardown).

Follow-up Questions

  1. 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.
  2. Why does the active closer wait 2MSL in TIME_WAIT , and what two problems does that wait prevent?
  3. How does a SYN flood exploit the SYN_RCVD state, and how do SYN cookies defend against it without keeping per-connection state?
  4. In a simultaneous open (both peers send SYN first), what state path do the endpoints follow, and which option's premise would change?
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Bitkernel•More Software Engineer•Bitkernel Software Engineer•Bitkernel Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.