3,539 views

Consider the three-way handshake mechanism followed during $\text{TCP}$ connection establishment between hosts $P$ and $Q$. Let $X$ and $Y$ be two random $32$-bit starting sequence numbers chosen by $P$ and $Q$ respectively. Suppose $P$ sends a $\text{TCP}$ connection request message to $Q$ with a $\text{TCP}$ segment having $\text{SYN}$ bit $=1$, $\text{SEQ}$ number $=X$, and $\text{ACK}$ bit $=0$. Suppose $Q$ accepts the connection request. Which one of the following choices represents the information present in the $\text{TCP}$ segment header that is sent by $Q$ to $P$?

1. $\text{SYN}$ bit $=1$, $\text{SEQ}$ number $=X+1$, $\text{ACK}$ bit $=0$, $\text{ACK}$ number $=Y$, $\text{FIN}$ bit $=0$
2. $\text{SYN}$ bit $=0$, $\text{SEQ}$ number $=X+1$, $\text{ACK}$ bit $=0$, $\text{ACK}$ number $=Y$, $\text{FIN}$ bit $=1$
3. $\text{SYN}$ bit $=1$, $\text{SEQ}$ number $=Y$, $\text{ACK}$ bit $=1$, $\text{ACK}$ number $=X+1$, $\text{FIN}$ bit $=0$
4. $\text{SYN}$ bit $=1$, $\text{SEQ}$ number $=Y$, $\text{ACK}$ bit $=1$, $\text{ACK}$ number $=X$, $\text{FIN}$ bit $=0$

Since sender will send its sQno. x and reciver will send ACK no. x+1 to make sure the sender that i recieved x and send now x+1 Byte

SYN bit = 1 for synchronise

ACK bit = 1 because reciever giving ackonwledgement to sender,

FIN bit = 0 because it is used for termination connection
SYN and FIN consumes one sequence number whereas pure ACK not consumes any sequence number.

So by this conclusion we can easily derive that SYN segment sent by P to Q having sequence number X will be consumed and next sequence number of X+1 is expected by the receiver Q.

So Q will sent ACK number as X+1 with ACK flag set.

Also, it needs to SYN its sequence number so it sends it Y sequence number with its SYN flag set.

### Subscribe to GO Classes for GATE CSE 2022

Host $P$ sends the first SYN packet with $SEQ$ number $= X$,  $SYN$ flag $= 1$ and $ACK$ flag $=0$ as it’s a connection request.

Host $Q$ will reply back with a SYN packet and acknowledging the arrival of $P’s$  SYN packet.

Host $Q$ will send a packet with $\textbf{SYN flag =1}$$\textbf{SEQ number = Y}$ ,  to synchronize and establish the connection,

and $\textbf{ACK flag = 1}$ to acknowledge the $P’s$ SYN packet, with $\textbf{ACK number = X+1}$ because ACK number denotes the sequence number of next expecting Byte.

Then $P$ will reply back with an $ACK$ packet to complete the three-way handshake. (not asked here)

$FIN$ flag is used to terminate the connection, and will not be used here, $\textbf{FIN flag = 0}$.

Hence C is correct.

by
1 2 3

No. Still it's not necessary.

I suggest you read it from a good book. Refer fourozan.
okay Thankyou !! i will read it !

In Forouzan it is written that.

Sequence number. This 32-bit field defines the number assigned to the first byte of

data contained in this segment. As we said before, TCP is a stream transport protocol.

To ensure connectivity, each byte to be transmitted is numbered. The sequence number

tells the destination which byte in this sequence comprises the first byte in the segment.

During connection establishment, each party uses a random number generator to

create an initial sequence number (ISN), which is usually different in each direction.

that the sequence number's are usually different but nowhere I found that they can be same  except when an ACK segment without any data is sent then it doesn't contain any sequence number so it uses the same sequence number as that of the SYN segment.

Usually different right? not necessarily different.

What is the probability of 2 randomly chosen 32bit numbers being the same?
SYN bit is used for Synchronize Sequence Number.

FIN bit used for End of transmission.

ACK bit used whenever you’re sending Acknowledgement of received Data.

Q accepted the connection request of P, So Q should send the acknowledment.

P sent the Data with Sequence number X, So Q acknowledge it as X+1. i.e., My requirement is X+1 now.

ACK bit = 1, and ACK = X+1.

Since it is three way hand-shaking, when P sent as SYN=1, then Q need to sent SYN=1 and FIN=0.

after that, Whenever Someone wants to end the transmission, then they will send FIN=1.

Option C is correct.
by
35 104 555

There are three phase in TCP data transfer protocol

1. Connection Establishment
2. Data Transfer
3. Connection Termination

Connection Establishment phase look like this

There are more TCP/IP  which i not mention

by
1 2
Syn bit is Synchronization bit which will be 1 for the initial transmissions from both sides.

SEQ number:- Will be the number which Q wants to send to P so It will be Y.

ACK bit:- It will be 1 because Q received seq number X from P.

Ack number:- The number which Q expect from P in the next transmission so will be X+1.

FIN bit will be 0 Because there is no initiation for ending the connection.

by
1 2 6

### 1 comment

Thanks brother.

This is related to 3 way handshake where  in first handshake, sender send SYN bit.

In second handshake reciever sends to sender SYN + ACK bit ( remember here the connection gets established)

In third handshake, sender sends ACK bit

by
1