Timeout

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Timeout

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. In ARQ, when does the sender start the timeout timer?
A When it sends the data
B When it receives an acknowledgement
2. The timeout ends and no acknowledgement has arrived. What does the sender do?
A Resends the data
B Assumes the data arrived safely
3. Which best describes a timeout?
A The time taken to type a message
B The set time a sender waits for an acknowledgement
4. The data arrives safely, but the acknowledgement is lost on the way back. What happens when the timeout ends?
A The sender resends the data
B The sender knows the data arrived and does nothing
5. An acknowledgement arrives before the timeout ends. What does the sender do?
A Waits for the timeout to end, then resends
B Stops waiting and does not resend

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1timeout = 5 Asend(packet) start_timer()
2IF no ACK within timeout THEN resend BA timeout also happens when the acknowledgement is lost. The sender cannot tell the difference, so it resends.
3The timer starts at the moment the data is sent CIf no reply arrives in time, the sender sends the data again
4The sender can stop resending after a set number of tries DIF tries = 3 THEN stop
5The sender resends the data as soon as it has sent it, without waiting for the timeout EThe sender will wait 5 seconds for an acknowledgement before it assumes the data was lost
6A timeout only happens when the data is lost, never when an acknowledgement is lost FThe sender must wait for the whole timeout period first. It only resends if no acknowledgement arrives in that time.

Definitions

timeout

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
SEND packet START _____
2.
IF timer > timeout THEN ______ packet ENDIF
3.
IF ack = FALSE ___ timer > timeout THEN RESEND packet ENDIF
4.
tries ← tries + 1 IF _____ = max_tries THEN STOP
5.
WAIT _______ seconds IF ack = FALSE THEN RESEND packet

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A SEND packet
B START timer
C WAIT for acknowledgement
D IF ack arrived THEN RESEND
Question 2
A timeout ← 5
B SEND packet
C WAIT forever for ACK
D IF no ACK THEN RESEND packet
Question 3
A tries ← 0
B SEND packet
C tries ← tries - 1
D IF no ACK AND tries<3 RESEND
Question 4
A Sender sends packet 7
B Receiver gets it, sends ACK
C The ACK is lost on the way
D Timeout ends, sender sends ACK
Question 5
A SEND packet AND STOP timer
B WAIT for ACK
C IF timer ends with no ACK
D RESEND packet

Answer Key

Timeout
Section A: Quick Questions
Q1
A — When it sends the data
Q2
A — Resends the data
Q3
B — The set time a sender waits for an acknowledgement
Q4
A — The sender resends the data
Q5
B — Stops waiting and does not resend
Section B: Match the Pairs
Q1
timeout = 5 → The sender will wait 5 seconds for an acknowledgement before it assumes the data was lost
Q2
IF no ACK within timeout THEN resend → If no reply arrives in time, the sender sends the data again
Q3
The timer starts at the moment the data is sent → send(packet) start_timer()
Q4
The sender can stop resending after a set number of tries → IF tries = 3 THEN stop
Q5
The sender resends the data as soon as it has sent it, without waiting for the timeout → The sender must wait for the whole timeout period first. It only resends if no acknowledgement arrives in that time.
Q6
A timeout only happens when the data is lost, never when an acknowledgement is lost → A timeout also happens when the acknowledgement is lost. The sender cannot tell the difference, so it resends.
Section C: Definitions
Q1
timeout — The set time a sender waits for an acknowledgement after sending data. If none arrives in time, it assumes the data was lost and resends it.
Section D: Fill in the Blanks
Q1
SEND packet START timer
Q2
IF timer > timeout THEN RESEND packet ENDIF
Q3
IF ack = FALSE AND timer > timeout THEN RESEND packet ENDIF
Q4
tries ← tries + 1 IF tries = max_tries THEN STOP
Q5
WAIT timeout seconds IF ack = FALSE THEN RESEND packet
Section E: Spot the Error
Q1
D — The sender only resends when the timer runs out with no acknowledgement. Resending after an ACK arrived is wrong. It should be IF timer expired THEN RESEND.
Q2
C — A timeout limits how long the sender waits. Waiting forever means the sender would never decide the data was lost. It should be WAIT up to timeout seconds.
Q3
C — The sender counts each attempt so it can stop after a set number of tries. Subtracting means tries never reaches the limit. It should be tries ← tries + 1.
Q4
D — The receiver sends the ACK, not the sender. When the ACK is lost, the timeout ends and the sender resends the packet. It should be Timeout ends, sender resends.
Q5
A — The timeout timer must start at the moment the data is sent. Stopping it means no waiting time is measured. It should be SEND packet AND START timer.