In: Computer Science
Hosts A and B are communicating over a TCP
connection and Host B has already received from A all bytes up
through byte 126.
Suppose Host A then sends two segments to Host B back-to-back (See the figure below). The first and second segments contain 80 and 40 bytes of data respectively. In the first segment, the sequence number is 127, the source port number is 302, and the destination port number is 80. Host B sends an acknowledgment whenever it receives a segment from Host A.
1) In the second segment from Host A to B, the sequence number is [ Select ] ["208", "207", "80", "206"] , the source port number is [ Select ] ["302", "80"] and the destination port number is [ Select ] ["", "80", "302"] .
2) If the first segment arrives before the second, in the acknowledgment of the first arriving segment, the acknowledgment number is [ Select ] ["80", "207", "127", "302"] , the source port number is [ Select ] ["80", "302"] and the destination port number is [ Select ] ["80", "302"] .
The sequence number of a segment is the sequence number of the first byte in the data field.
The acknowledgment number is the sequence number of the next byte of data that the host is waiting for.
Given initial sequence number = 127 for first segment from Host A to B.
First and Second segments from Host A to B contain 80 and 40 bytes of data, respectively.
In the first segment from Host A to B, the sequence number is 127, the source port number is 302, and the destination port number is 80 as seen from Host A perspective
1) In the second segment from Host A to B, the sequence number is 207 , the source port number is 302 and the destination port number is 80.
Required Sequence number = Initial sequence number + Total bytes of data sent = 127+ 80 = 207
In the first segment, the sequence number is 127, the source port number is 302, and the destination port number is 80 as seen from Host A perspective.
2) If the first segment arrives before the second, in the acknowledgment of the first arriving segment, the acknowledgment number is 207 , the source port number is 80 and the destination port number is 302.
The acknowledgment number is the sequence number of the next byte of data that the host is waiting for. So ACK (sent by Host B to A)number = Sequence number of second segment from Host A to B = 207
In the first segment, the sequence number is 127, the source port number is 302, and the destination port number is 80 as seen from Host A perspective
So, from Host B perspective, source port number = destination number (from Host A perspective) = 80
and destination port number = source port number (from Host A perspective) = 302