GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER NETWORKS

Trace sequence numbers and flags in TCP handshake

3 questions solved the same way, newest first. Back to Computer Networks

How these are solved

Trace SYN, SYN+ACK, ACK. Each SYN consumes one sequence number, so the response acknowledgment is initial sequence plus one.

1 mark · MSQ
Report issue

Reading flags in the TCP handshake

Transport, Congestion Control & Traffic Shaping

Question 22, GATE 2025: Let P1,P2,P3 be the three successive packets of the ordinary TCP connection-establishment handshake. Select true claims: A P3 has SYN=1,ACK=1; B P2 has SYN=1,ACK=1; C P2 has SYN=0,ACK=1; D P1 has SYN=1.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Approach: Separate the request to synchronize sequence numbers from the acknowledgment of the peer’s request.
P1 is the initiating SYN: it starts synchronization with SYN=1 and, in the ordinary initial handshake, ACK=0. Hence D is true.
P2 both acknowledges the first SYN and announces the responding endpoint’s own initial sequence number. Its flags are SYN=1 and ACK=1. This makes B true and C false.
P3 acknowledges the responder’s SYN. It is an ACK with SYN=0,ACK=1, so A is false. The correct selection is B and D.
The ACK flag indicates that the acknowledgment-number field is valid; it is not merely a generic statement that a packet arrived. This question is about the standard three-way establishment sequence, not simultaneous open or later connection teardown.

Original paper, page 22 · Answer key

1 mark · MSQ
Report issue

TCP SYN sequence-space accounting

Transport, Congestion Control & Traffic Shaping

Question 29, GATE 2024: Client P successfully connects to TCP server Q. NP is the sequence number in P's SYN; NQ is the acknowledgment number in Q's SYN-ACK. Which claims are correct? A NP is randomly chosen by P. B NP is always 0 for a new connection. C NQ=NP. D NQ=NP+1.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, D

Approach: Separate the choice of the initial sequence number from the rule for acknowledging a SYN.
1. A new TCP connection does not always begin at sequence number zero. The initial sequence number is chosen by the endpoint using a scheme intended to make it difficult to predict and to separate old connection traffic from new traffic. This is the randomized or pseudorandom selection described by A; B is false.
2. TCP acknowledgment numbers identify the next sequence number expected from the peer. A SYN consumes one position in sequence space even though it is not an ordinary payload byte.
3. After receiving a SYN with sequence NP, Q therefore acknowledges NP+1, with arithmetic modulo 2³². This makes D true and C false.
Answer: A and D. Actual initial-sequence algorithms may combine a clock with a keyed pseudorandom function; the key's “randomly” should not be read as requiring a fresh independent uniform draw.

Original paper, page 19 · Answer key

1 mark · MCQ
Report issue

Transport, Congestion Control & Traffic Shaping

Question 7, GATE 2021: TCP hosts P,Q choose initial sequence numbers X,Y. P sends SYN=1,SEQ=X,ACK=0; Q accepts. Select Q's response (SYN,SEQ,ACK,ACKnumber,FIN): A (1,X+1,0,Y,0); B (0,X+1,0,Y,1); C (1,Y,1,X+1,0); D (1,Y,1,X,0).
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Q sends SYN+ACK using its own initial sequence Y and acknowledging X+1 because SYN consumes one sequence number. Thus SYN=1, SEQ=Y, ACK=1, ACKnumber=X+1, FIN=0, C; sequence arithmetic is modulo 2³².

TCP sequence spaces are independent in the two directions. Q must announce Y, not X+1, as its own sequence number. The acknowledgment X+1 says that P's SYN was consumed and the next expected sequence is X+1. FIN is zero because the response establishes rather than closes the connection.

Original paper, page 58 · Answer key