------------------------------------------------------------------------- Mohamed G. Gouda CS 356 Spring 2017 Midterm 2 ------------------------------------------------------------------------- 1. Consider an application server aps that is deployed on top of TCP port i in host sh. What are the steps that aps needs to execute before it starts to receive TCP segments from any application client. ------------------------------------------------------------------------- 2. In a version of the TCP sliding window protocol, 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, ns, w. 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|, nd, nr, and wr. Consider a state of this protocol where w = 89, nd = 81, and nr = 92. Compute the size of buffer bff. --------------------------------------------------------------------------- 3. Consider a data byte stream from one side S to another side R in a sliding window protocol in TCP. Assume that the initial seq# for the stream is 14. Also assume that the values of variables na and ns in S are 15 and 17, respectively. Which of the data bytes, whose seq#'s are 14, 16, or 18, have already been sent by S and which of them have already been acknowledged by R. ---------------------------------------------------------------------------- 4. Consider a data byte stream from one side S to another side R in a sliding window protocol in TCP. Assume that the initial seq# for the stream is 14. Also assume that the values of variables nd and nr in R are 15 and 16, respectively. Which of the data bytes, whose seq#'s are 15, 16, or 17, have already been read by the application and which of them have already been received by R. ----------------------------------------------------------------------------- Solutions ----------------------------------------------------------------------------- 1. Server aps needs to execute the following steps before it starts to receive TCP segments from any application clients: 1. aps allocates TCP port i in sh. 2. aps allocates any TCP "welcome socket" ss in sh. 3. aps binds socket ss to port i in sh. 4. aps adds the following entry to TCP socket table in sh: (src = any, dst(sh, i), ss) ------------------------------------------------------------------------------ 2. wr = w provided w >= 1 wr = 89 wr = (|bff| - (nr - nd)) 89 = (|bff| - (92 - 81)) 89 = (|bff| - 11) Therefore |bff| equals 89+11 which equals 100 ------------------------------------------------------------------------------- 3. Only the data bytes whose seq#'s are 14 or 16 have already been sent by S Only the data byte whose seq# is 14 has already been acknowledged by R. ------------------------------------------------------------------------------- 4. None of the data bytes whose seq#'s are 15, 16, and 17 have already been read by the application. Only the data byte whose seq# is 15 has been received by R. -------------------------------------------------------------------------------