Solution of Home Work 7
1) There are two computers, called S (Source) and D (Destination). 
They are connected by a 20 km long link (full duplex, used only 
between S and D). The link has a data rate of 100 Mbit/sec and the 
speed of the signal on the link is (2/3)*c .
Practically speaking, we have only 1500 Byte dataframes from S to D, 
and only 50 Byte ACKframes from D to S. This includes headers, 
trailers, ``wrappers'', etc. D acknowledges every dataframe it 
receives as soon as the whole frame is in.
If S and D use a ``Sliding Window'' protocol, what window size (in 
frames) would you recommend? WHY?
(The ``why'' is much more important than the actual answer, so 
try to be simultanously concise and very clear!)





Serialization delay of a data frame is:


                 1500 * 8

            ------------------  = .12msec

             100, 000, 000


Propagation delay is:        20

                                    ------------------  = .1msec



Serialization delay of an ACK frame is:     400

                                                                 --------------- = .004msec



At time t, when S starts sending a data frame, the tail of the frame leaves S at (t + .12) msec. The same frame arrives at D after the time (t + .12 + .1) msec.


Assume an ACK is generated in D at the same time it receives a data frame. Then the ACK will leave D at the time, (t + .12 + .1 + .004) msec.


So, the ACK for the data frame will arrive at S after (t + .12 + .1 + .004 + .1) msec, which is (t + 0.324) msec.


So, S needs to have data frames to send at t, (t + .12) and (t + .324). So, the window size must be 3 to prevent the bandwidth from remaining unused.


2) In a bit-oriented protocol, we use the flag  01111110 , to 
indicate beginning and end of a frame.
(I usually would write this as  0111 1110 , for readability).
A. Bitstuff the following pattern:
                    ^                ^
                    |                  |
 The answer is:
B. ``Unstuff'' the following pattern:
                     -           -                  -
Answer is:
C. What is your reaction if asked to unstuff the following pattern?
The pattern 0111 1110 is a flag used to indicate the beginning and end of a message. If it is received in the destination, it will be assumed as a flag and will not be unstuffed.
D. What is your reaction if asked to unstuff the following pattern?
Unstuffing this pattern might result in an error as it was not bit stuffed. It might also be a special protocol between source and destination.