--------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Spring 2017 Homework 2 --------------------------------------------------------------------------- 1. Explain how can one deduce that a given TCP segment is part of an HTTP request message or part of an HTTP response message. --------------------------------------------------------------------------- 2. Consider a version of the TCP sliding window protocol where one side S sends DATA segments and receives ACK segments and the other side R receives the sent DATA segments and sends back the ACK segments. Side S maintains three variables: na seq# of the next data byte to be acknowledged by R ns seq# of the next data byte to be sent by S w length of the sending window in S Side R maintains a buffer bff for storing the received data bytes until they are read by the application. Side R also maintains four variables: |bff| length of buffer bff in R nd seq# of the next data byte to be read by the application nr Seq# of the next data byte to be received by R wr length of receiving window in R Consider a state of this protocol where |bff| = 9, nd = 15, and nr = 24. Compute the value of wr in R and the value of w in S at this state of the protocol. --------------------------------------------------------------------------- 3. Consider a version of the TCP sliding window protocol where one side S sends DATA segments and receives ACK segments and the other side R receives the sent DATA segments and sends back the ACK segments. The objective of congestion control in this protocol version is to increase the rate with which S sends DATA segments to R without (as much as possible) causing some sent DATA segments due to congestion in the channels between S and R. The objective of flow control in this protocol version is to increase the rate with which S sends DATA segments to R without (as much as possible) ... Complete the previous paragraph. -------------------------------------------------------------------------- 4. Consider a RED processing queue that can store up to 300 bytes. Assume that the value of "min" for this queue is 101 bytes and the value of "max" for this queue is 200 bytes. Is the following scenario possible? Or is it impossible? Initially the queue is empty An attempt to add 10 bytes to the queue succeeds An attempt to add 100 bytes to the queue succeeds An attempt to remove 1 byte from the queue succeeds An attempt to add 1 byte to the queue fails Explain your answer. -------------------------------------------------------------------------- Solution: -------------------------------------------------------------------------- 1. If the destination port in the given TCP segment is 80, then the given TCP segment is part of an HTTP request message. If the source port in the given TCP segment is 80, then the given TCP segment is part of an HTTP response message. -------------------------------------------------------------------------- 2. wr = |bff| - (nr - nd) = 9 - (24 - 15) = 9 - 9 = 0 w = max (wr, 1) = 1 ------------------------------------------------------------------------- 3. The objective of flow control in this protocol version is to increase the rate with which S sends DATA segments to R without (as much as possible) sending DATA segments that can't be stored in the receiving buffer in R when this buffer is full. -------------------------------------------------------------------------- 4. The given scenario is possible based on the following explanations: Initially the queue is empty. Clearly this is possible. An attempt to add 10 bytes to the queue succeeds. This is possible because the number of bytes in the queue (0) is less than "min", which is 101. Now the queue has 10 bytes. An attempt to add 100 bytes to the queue succeeds. This is possible because the number of bytes in the queue (10) is less than "min", which is 101. Now the queue has 110 bytes. An attempt to remove 1 byte from the queue succeeds. This is possible because the number of bytes in the queue (110) is larger than the number of bytes to be removed from the queue. Now the queue has 109 bytes. An attempt to add 1 byte to the queue fails. This is possible because the number of bytes in the queue (109) is larger than "min" and smaller than "max" and so adding bytes to the queue can fail with non-zero probability. Now the queue has 109 bytes. --------------------------------------------------------------------------