Title: Tutorial 2 Solution
1Tutorial 2 Solution
2- Q1. Consider a channel that can lose packets but
has a maximum delay that is known. Modify
protocol rdt2.1 to include sender timeout and
retransmit. Argue why the protocol can work
correctly.
3(No Transcript)
4(No Transcript)
5rdt2.1 in action no error
sender
receiver
wait for call 0
pkt 0
wait for pkt 0
ACK
wait for ACK/NAK
wait for call 1
pkt 1
wait for pkt 1
ACK
wait for ACK/NAK
6rdt 2.1 in action corrupt packet
sender
receiver
wait for call 0
corrupt
pkt 0
wait for pkt 0
NAK
re-transmision
wait for ACK/NAK
pkt 0
ACK
wait for call 1
pkt 1
wait for pkt 1
ACK
wait for ACK/NAK
7rdt 2.1 in action corrupt ACK
sender
receiver
wait for call 0
pkt 0
wait for pkt 0
corrupt
ACK
re-transmission
wait for ACK/NAK
pkt 0
wait for pkt 1
discard pkt
ACK
wait for call 1
pkt 1
ACK
wait for ACK/NAK
8rdt 2.1 in action data packet is lost
sender
receiver
wait for call 0
lost
pkt 0
wait for pkt 0
?
wait for ACK/NAK
?
9rdt 2.1 in action ACK/NAK is lost
sender
receiver
wait for call 0
pkt 0
wait for pkt 0
ACK
lost
wait for ACK/NAK
?
wait for pkt 1
?
10Modifications
- Changes of the sender
- Timer events
- When to start the timer
- How long is the timeout?
- What will the sender do for a timeout event
- Changes of the receiver?
- Check how the original receiver responds to new
events (i.e., lost packets or ACKs)
11timer gt 2 maximum delay
Start timer
Stop timer
Start timer
Stop timer
Stop timer
Stop timer
Start timer
Start timer
12- How the Receiver Responds
- Suppose the timeout is caused by a lost data
packet, i.e., a packet on the sender-to-receiver
channel. The receiver never received the previous
transmission and, if the timeout retransmission
is received, it look exactly the same as if the
original transmission is being received. - Suppose an ACK is lost. The sender will
eventually retransmit the packet on a timeout.
But a retransmission is exactly the same action
that is take if an ACK is garbled. Thus the
sender's reaction is the same with a loss, as
with a garbled ACK.
No changes are needed!
13timer in action data packet is lost
sender
receiver
wait for call 0
lost
pkt 0
start timer
wait for ACK/NAK
timeout
start timer
pkt 0
re-tranmission
wait for pkt 0
ACK
stop timer
14timer in action ACK/NAK is lost
sender
receiver
wait for call 0
pkt 0
start timer
wait for pkt 0
ACK
lost
wait for ACK/NAK
timeout
start timer
pkt 0
re-tranmission
stop timer
wait for pkt 1
discard pkt
15- Q2. Redesign rdt2.1 without using NAK packets. In
other words, the receiver in the new protocol can
only use ACK packets. Draw the FSM of the new
protocol.
16rdt2.2 a NAK-free protocol
- same functionality as rdt2.1, using ACKs only
- instead of NAK, receiver sends ACK for last pkt
received OK - receiver must explicitly include seq of pkt
being ACKed - duplicate ACK at sender results in same action as
NAK retransmit current pkt
17rdt2.2 sender, receiver fragments
rdt_send(data)
sndpkt make_pkt(0, data, checksum) udt_send(sndp
kt)
rdt_rcv(rcvpkt) ( corrupt(rcvpkt)
isACK(rcvpkt,1) )
udt_send(sndpkt)
sender FSM fragment
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
isACK(rcvpkt,0)
rdt_rcv(rcvpkt) (corrupt(rcvpkt)
has_seq1(rcvpkt))
L
receiver FSM fragment
udt_send(sndpkt)
rdt_rcv(rcvpkt) notcorrupt(rcvpkt)
has_seq1(rcvpkt)
extract(rcvpkt,data) deliver_data(data) sndpkt
make_pkt(ACK1, chksum) udt_send(sndpkt)