Computer Networks · TEE · mocks

Q4B · Transport-layer mechanism

TEE mock A · full paper

TEE · 100 attempted marks · solutions for every choice · current syllabus 702AI0C023

TEE practice mock · Q4B. What is TCP three-way handshaking? Explain establishment, data transfer and termination with labelled diagrams. [10 mock 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.

Swipe across the diagram to read its labels ↔
TCP: handshake, data and orderly close
Diagram: TCP: handshake, data and orderly close. Labels: TCP: handshake, data and orderly close | TCP: handshake, data and orderly close | Client | Server | SYN Seq=1000 | SYN+ACK Seq=5000, Ack=1001 | ACK Seq=1001, Ack=5001 | 200 data bytes: Seq=1001, last=1200 | ACK=1201 (next expected byte) | FIN Seq=1201 | ACK=1202; server may still send | FIN Seq=5001 (no server data here) | ACK=5002; common active-close TIME-WAIT | Pure ACK uses no sequence space. SYN and FIN each use one.
SYN and FIN each consume one sequence number; pure ACK consumes none.
StepSegmentMeaning
1 Client → serverSYN, Seq=1000Client proposes its starting sequence
2 Server → clientSYN+ACK, Seq=5000, Ack=1001Server acknowledges client SYN and supplies its own start
3 Client → serverACK, Seq=1001, Ack=5001Client 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

  1. Assume client’s next data sequence is 1201. It sends FIN with Seq=1201, meaning it has finished sending.
  2. Server sends ACK=1202. The connection is half closed: the server can still send data until its application finishes.
  3. Assume server has sent no data since the handshake. It sends FIN with Seq=5001.
  4. 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.
  5. 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.