Lecture 1

TODO:

Reliable Transmission: ARQ (Automatic Repeat reQuest)

Stop and Wait

Utilisation:

fracL/RL/R+RTT=frac8000/10008000/1000+0.0030=frac88+0.0030

!! Check math

Pipelining

Allows W segments to be outstanding
W can be sent every RTT

Utilisation:

fracWL/RL/R+RTT

Go-Back-N

The sender can send up to N frames before requiring an ACK
The permissible sequence numbers to be sent is a windows of size N in the range of the sequence numbers
I.e. textLastreceivedACK+N
If a frame is lost or corrupted, all subsequent frames (that have been received) are discarded
Out-of-order frames are NOT stored
Not stored, since there is assumed to be no buffer
Send cumulative ACKs for every packet up until that point (covers earlier lost ACKs)

Selective Repeat

Same as before, but accepts and buffers out-of-order frames
Sender only retransmits the lost/corrupted frames
Send ACKs for each individual packet, even if out-of-order

TCP Error Recovery

How does TCP handle problems?
What to do when segments are lost?
How do we determine when a segment is actually lost?

Retransmission

Use an adaptive retransmission algorithm to determine the timeout value
Based on Round Trip Time (RTT)
MSG sender -> receiver + ACK receiver -> sender
If timeout is shorter than RTT: re-send before ACK can even arrive (Premature timeout)
If timeout is (much) longer than RTT: wait around for ACK, even though packet is already lost

There are different ways to estimate RTT
SampleRTT: measured once per RTT
EstimatedRTT: exponential weighted moving average of the SampleRTT values collected

textEstimatedRTT=(1alpha)textEstimatedRTT+alphatextSampleRTT

Where alpha is a configurable constant, e.g. 1/8=0.125

DevRTT
Variation on the RTT, difference between SampleRTT and EstimatedRTT

DevRTT=(1beta)DevRTT+beta|SampleRTTEstimatedRTT|

beta=1/4=0.25

TimeoutInterval=EstimatedRTT+4DevRTT
(Estimated RTT + safety margin)

Fast Retransmit

If a packet is lost (i.e. you receive packets after it), keep sending ACKS for the last in-order packet
If the sender receives 3 duplicate ACKS, it will retransmit the missing segment before the timer even expires
!400

Selective Acknowledgement (SACK) vs No SACK

![[Pasted image 20260204104637.png]]
On the left, it keeps sending ACK for 123, indicating that the last seq it received was 123
On the right, it indicates the missing segment, and the ones that were actually received

TCP ACK generation

Event at receiver TCP Receiver action
Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK
Arrival of in-order segment with expected seq #. One other segment has ACK pending Immediately send single cumulative ACK, ACKing both in-order segments
Arrival of out-of-order segment higher-than-expect seq. # . Gap detected Immediately send duplicate ACK, indicating seq. # of next expected byte
Arrival of segment that partially or completely fills gap Immediate send ACK, provided that segment starts at lower end of gap