Tutorial 6

Tutorial 6
1 WINDOW SIZE (To be solved In Assignment 1)
Consider an error-free 1024 kbps channel used to send data frames of size 512 bytes each in
one direction, with very short acknowledgments coming back the other way.
Assume a propagation delay of 50 msec.
a. What is the maximum throughput for a window size of 1, 7, 15, 127, and 255?
b. At what minimum window size can the protocol run at the full rate of the channel?
2 a WINDOW SIZE
Consider the cross-country example shown in figure 3.17 on page 217 of the book.
How big would the window size have to be for the channel utilization to be greater than 98
percent?
Suppose that the size of a packet is 1,500 bytes, including both header fields and data.
SOLUTION
By referring to the example in the book, R =10^9 bps and RTT = 30 msec.
Size of packet = 1500 bytes = 12000 bits.
Transmission delay of a single data frame = = L / R = 12000 / = 0.012 msec.
Channel utilization = (N) (dtrans ) / (RTT +drans ), where N is the given window size.
0.98 = (N) (0.012) / (30 + 0.012)
Window size = N = ceil ((0.98) (30.012) / (0.012)) ≃ 2451.
2 b GO-BACK-N PROTOCOL
Consider the Go-Back-N protocol with a send window size of 4 and a sequence number range of
1024. Suppose that at time t, the next in-order packet that the receiver is expecting has a
sequence number of k. Assume that the medium does not reorder messages.
a. What are the possible sets of sequence number inside the sender’s window at time t? Justify
your answer.
b. What are all possible values of the ACK field in the message currently propagating back to the
sender at time t? Justify your answer.
c. With the Go-Back-N protocol, is it possible for the sender to receive an ACK for a packet that
falls outside of its current window? Justify your answer with an example.
SOLUTION
a. Since the receiver is now expecting a packet with sequence number k, this means that the
receiver has received up to packet k – 1 and has acknowledged all of the previous packets.
Denote the sender’s window size by N = 4.
Argument 1: If the sender has received all of the receiver’s ACK messages, then the sender’s
window slides to start at base k, and can be represented as [k, k + N – 1] = [k, k + 3].
Argument 2: On the other hand, if none of the receiver’s ACK messages have been received by
the sender, then the window can be represented as [k – N, k – 1] = [k – 4, k – 1].
Based on these arguments, the sender’s window begins somewhere in the range of [k – 4, k].
b. Since the receiver is waiting for packet k, then it has received and ACKed packet k – 1 and the
N packets before that.
If none of those N ACKs have been received by the sender yet, then ACK messages with values
[k – N, k – 1] may still be propagating back.
Because the sender has sent packets [k – N, k – 1], it must be the case that the sender has
already received an ACK for k – N – 1. Once the receiver has sent an ACK for k – N – 1, it will
never send an ACK that is less than k – N – 1.
Thus, the range of in-flight ACK values can range from [k – N, k – 1] = [k – 4, k – 1].
c. Yes, it is possible. Consider the following example scenario.
Suppose the sender has a window size of 3 and sends packets 1, 2 and 3 at time t0 . At t1, the
receiver ACKs packets 1, 2 and 3. At t2 , the sender times out and resends 1, 2 and 3. At t3, the
receiver receives the duplicates and re-acknowledges 1, 2 and 3. At t4 , the sender receives the
ACKs that the receiver sent at and advances its window to packets 4, 5 and 6. Finally, at t5, the
sender receives the ACKs that the receiver sent at t2 . These ACKs are outside its window.
2 c SELECTIVE REPEAT (SR) PROTOCOL
Consider the sliding window algorithm with SWS = RWS = 5 and NumSeqNumbers = 9. The Nth
packet DATA [N] contains N mod 9 in its sequence number field.
Show an example in which the algorithm becomes confused. No packets may arrive out of
order. Notice that this implies that NumSeqNumbers > 9 is necessary and sufficient.
SOLUTION
NumSeqNumbers = 9 means that sequence numbers range from 0 to 8.
Sender transmits DATA [0 … 4] first with sequence numbers 0 … 4. Receiver receives all frames
and sends a cumulative ACK, which is lost. In this case, the sender retransmits DATA [0 … 4].
Now, receiver is waiting for frames with sequence numbers 5, 6, 7, 8, 0, so the receiver thinks it
has received frame 0 (DATA [9]) while it has received DATA [0]. Hence, the receiver makes an
error.
3 TCP RELIABLE DATA TRANSFER
TASK A
Consider transferring an enormous file of L bytes from Host A to Host B. Assume an MSS
(Maximum Segment Size) of 536 bytes.
a. What is the maximum value of L such that TCP sequence numbers are not exhausted?
Recall that the TCP sequence number field has 4 bytes.
b. For the L you obtain in (a), find how long it takes to transmit the file. Assume that a total
of 66 bytes of transport, network, and data-link header are added to each segment before
the resulting packet is sent out over a 155 Mbps link. Ignore flow control and congestion
control so A can pump out segments back to back and continuously.
SOLUTION
a. Length of TCP sequence number field = 4 bytes = 32 bits.
There are 2^32 possible sequence numbers.
Recall that, in TCP, the sequence number does not increment by one with each segment. Rather,
it increments by the number of bytes of data sent.
As such, the maximum size file that can be sent from A to B is simply the number of bytes
representable by 2^32 , so L = bytes = 4,294,967,296 bytes ≃ 4.29 Gbytes.
b. Maximum size file = L = 4,294,967,296 bytes.
Maximum Segment size = MSS = 536 bytes.
Number of segments = ceil (L / MSS) = ceil ( 2^32/ 536) ≃ 8,012,999 segments.
66 bytes of header get added to each segment, giving a total of (66) (8,012,999) = 528,857,934
bytes of header.
Total number of bytes transmitted = Ltotal= total number of data bytes + total number of
header bytes = 4,294,967,296 + 528,857,934 ≃ 4.824 Gbytes.
Total time taken to transmit file = Ltotal/ R = (4.824 x10^9x 8) / (155 x10^6 ) ≃ 249 seconds.
TASK B
Host 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. The first and second
segments contain 70 and 50 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.
a. In the second segment sent from Host A to B, what are the sequence number, source port
number, and destination port number?
b. If the first segment arrives before the second segment, in the acknowledgment of the first
arriving segment, what is the ACK number, the source port number, and the destination port
number?
c. If the second segment arrives before the first segment, in the acknowledgment of the first
arriving segment, what is the ACK number?
d. Suppose the two segments sent by A arrive in order at B. The first acknowledgment is lost
and the second acknowledgment arrives after the first timeout interval. Draw a timing diagram,
showing these segments and all other segments and acknowledgments sent. (Assume there is
no additional packet loss.) For each segment in your figure, provide the sequence number and
the number of bytes of data; for each acknowledgment that you add, provide the ACK number.
SOLUTION
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 70 bytes and a sequence number of 127, the sequence number of
the second segment will be 127 + 70 = 197.
The source port will be the same used in the connection, which is 302.
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 197.
Since we are now in the server side, the source and destination ports are swapped; source port
is 80 and destination port is 302.
c. If the second segment arrives before the first, this means that the server has received the
segment with sequence number 197, but hasn’t received the segment with sequence number
127, 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 126 bytes, but still expects to
receive the one with sequence number 127, so the ACK number would be 127.
d. Although the server retransmits the segment with sequence number 127, the server tells the
sender that it has everything OK until byte 246, and that it is expecting the segment with sequence
number 197 + 50 = 247 next.