You are on page 1of 4

Ahmet BODUR

2473023

IS 504 – HW 2
1.
a. The stop and wait protocol, time-space diagram:

X Y
X time
t=0 s, send time
pkt a pkt a t=1 s, receives pkt
ack0 a, sends ack0
t=2 s, receives
pkt b
ack0 and send x
pkt b
Timeout,t=7 s,
pkt b
resend pkt b
t=8 s, receives pkt
t=9 s, receives ack1 b, sends ack1
ack1 and sends pkt c
pkt c t=10 s, receives
x ack2 pkt c, sends ack2

Timeout,t=14 s,
pkt c
resend pkt c t=15 s, ignore
duplicate pkt c ,
t=15 s, receives ack2
sends ack2
ack2

b. Time-space diagram of Go Back-N protocol;


X Y
t=0 s, send pkt a time X time
t=0 s, send pkt b pkt a
t=0 s, send pkt c pkt b
pkt c t=1 s, receives pkt a, send ack0
t=1 s, receives pkt b, send ack1
t=1 s, receives pkt c, send ack2
ack0 ack1
ack2
t=2 s, rcv ack0, send pkt d
t=2 s, rcv ack1, send pkt e
t=2 s, rcv ack2 pkt d
pkt e t=3 s, receives pkt d, send ack3
t=3 s, receives pkt e, send ack4
ack3
ack4
t=4 s, rcv ack3
t=4 s, rcv ack4
Ahmet BODUR
2473023

c. i. Go-Back-N protocol, window size=3,

X Y
[a,?,?], send pkt a time X time
[a,b,?], send pkt b pkt a, sq=0
t=0
[a,b,c], send pkt c pkt b, sq=1
pkt c, sq=2 t=1 s, rcv pkt a, send ack0
t=1 s, rcv pkt b, send ack1
t=1 s, rcv pkt c, send ack2
[b,c,d], rcv ack0, send pkt d, ack0 ack1 x
ack2
Timer starts
t=2 s, rcv ack2, send pkt e pkt d, sq=3
x
(X knows that up to ack2 pkt e, sq=4
including ack2, all packets are
t=3 s, discard pkt e, send ack2
received by Y.
ack2
t=4 s, rcv ack2

t=7 s, timeout occurs, send pkt d


pkt d, sq=3
t=7 s, send pkt e
pkt e, sq=4 t=8 s, rcv pkt d, send ack3
t=8 s, rcv pkt e, send ack4
ack3 ack4
t=9 s, rcv ack3
t=9 s, rcv ack4
Ahmet BODUR
2473023

ii. Selective repeat protocol, window size=3

X Y
[a,?,?], send pkt a time X time
[a,b,?], send pkt b pkt a, sq=0
t=0
[a,b,c], send pkt c pkt b, sq=1
pkt c, sq=2 t=1 s, rcv pkt a, send ack0
t=1 s, rcv pkt b, send ack1
t=1 s, rcv pkt c, send ack2
ack0 ack1 x
[b,c,d], rcv ack0, send pkt d ack2

t=2 s, rcv ack2 pkt d, sq=3


x

t=5 s, timeout for pkt b, send pkt b


pkt b, sq=1

t=6 s, duplicate pkt b, send ack1


Ack1
t=7 s, receive ack1,
Timeout for pkt d, send pkt d,
Send pkt e pkt d, sq=3
pkt e, sq=4 t=8 s, rcv pkt d, send ack3
t=8 s, rcv pkt e, send ack4
ack3
ack4
t=9 s, rcv ack3
t=9 s, rcv ack4
Ahmet BODUR
2473023

2. a.
x1= 100000 m, r1= 1*10^6 bps, c=2*10^8 m/sec
LA= 100 bytes = 800 bits
LB= 25 bytes = 200 bits
n= number of packets = 10000

A B
t=0 s,send pkt 1 time X time

receives pkt 1, send ack0

rcv ack0, send pkt 2

receives pkt 2, send ack1

rcv ack1, send pkt 3


..
.

𝑥1 𝐿𝐴 𝑥1 𝐿𝐵
d=( + )+( + ) delay time of transmission of one packet from A to
𝑐 𝑟1 𝑐 𝑟1
B and transmission of one acknowledge packet from B to A.

𝑥1 𝐿𝐴 𝑥1 𝐿𝐵 100000 800 100000 200


d=( + )+( + ) =( + ) + ( 2∗108 + 106 ) = 2 msec
𝑐 𝑟1 𝑐 𝑟1 2∗108 106

and 9999 packets will be delivered= 9999*2 = 19998 msec and the last packet
100000 800
delay time is ( + 6 )= 1.3 msec. Then total time is 19998+1.3=19999,3
2∗108 10
msec.
b. The minimum window size should be:
𝑑 800
Wmin = ( ) where d=2 msec and d_trans= = 0.8 𝑚𝑠𝑒𝑐
𝑑_𝑡𝑟𝑎𝑛𝑠 106

2/0.8=2.5 then Wmin= 2

You might also like