Computer Networks · TEE · papers
Q4B · TCP connection lifecycle
Re-exam · 4 February 2026
TEE · Actual TEE paper · all questions · current syllabus 702AI0C023
Actual PYQ · Q4B. What is the TCP three-way handshaking mechanism? Describe connection establishment, data transfer and connection termination in detail with the help of a diagram. [10 marks]
Answer
A TCP connection establishes each endpoint’s initial sequence number and confirms that both can receive. Use client initial sequence x=1000 and server initial sequence y=5000; assume no payload in the handshake.
| Step | Segment | Meaning |
|---|---|---|
| 1 Client → server | SYN, Seq=1000 | Client proposes its starting sequence |
| 2 Server → client | SYN+ACK, Seq=5000, Ack=1001 | Server acknowledges client SYN and supplies its own start |
| 3 Client → server | ACK, Seq=1001, Ack=5001 | Client acknowledges server SYN; connection is established |
Data transfer
Client sends 200 bytes beginning at Seq=1001, so byte numbers are 1001…1200. The receiver acknowledges Ack=1201, the next byte expected. If bytes starting at 1201 are missing but later bytes arrive, the cumulative ACK remains 1201 until the gap is repaired. TCP may buffer out-of-order bytes; it delivers the byte stream in order. Each direction counts independently.
Orderly termination
- Assume client’s next data sequence is 1201. It sends FIN with Seq=1201, meaning it has finished sending.
- Server sends ACK=1202. The connection is half closed: the server can still send data until its application finishes.
- Assume server has sent no data since the handshake. It sends FIN with Seq=5001.
- Client responds with ACK=5002. In a common active-close path the client enters TIME-WAIT so delayed segments and retransmitted FINs can be handled before the tuple is reused.
- These are commonly four segments, but ACK and FIN can be combined and simultaneous close is possible. RST is an abort, not the same as the orderly FIN exchange.
Source: Re-exam · 4 February 2026, original question paper page 2. Original marks retained; solution independently authored.