In: Computer Science
Host A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 120. Suppose Host A then sends two segments to Host B back-to-back. The first and second segments contain 80 and 50 bytes of data, respectively. In the first segment, the sequence number is 121, the source port number is 30058, and the destination port number is 80. Host B sends an acknowledgment whenever it receives a segment from Host A.
In the second segment sent from Host A to B, what are the sequence number, source port number, and destination port number?
If the first segment arrives before the second segment, in the acknowledgment of the first arriving segment, what is the acknowledgment number, the source port number, and the destination port number?
If the second segment arrives before the first segment, in the acknowledgment of the first arriving segment, what is the acknowledgment number?
[A]. Recall that, in TCP, the
sequence number for a segment is the byte-stream number of the
first byte in that segment.As the first segment sent had 80 bytes
and a sequence number of 121, the sequence number of
the second segment will be 121 + 80 = 201. The source port will be
the same used in the connection which is 30058. The destination
port will be 80.
[B] In TCP, the ACK number is the next byte expected. If the first
segment arrives before the second, this means that the next byte
expected is the first byte of the second segment, so the ACK number
will be 201. Since we are now in the server side, the source and
destination ports are swapped, source port is 80 and destination
port is 30058.
[C] If the second segment arrives before the first, this means that
the server has received the segment with sequence number 201, but
hasn’t received the segment with sequence number 121, which is
actually the segment that it was expecting to receive.In this case,
the server indicates in the ACK number of the response that it has
the first 120 bytes,but still expects to receive the one with
sequence number 121, so the ACK number would be 121.