TCP Retransmission | TCP Duplicate ACK

Three Way Handshake-

 

Before you go through this article, make sure that you have gone through the previous article on Three Way Handshake.

 

We have discussed-

  • TCP uses Three Way Handshake to establish a connection between the sender and receiver.
  • Connection establishment using Three Way Handshake involves the steps as shown-

 

 

In this article, we will discuss how a lost TCP segment is retransmitted.

 

TCP Retransmission-

 

After establishing the connection,

  • Sender starts transmitting TCP segments to the receiver.
  • A TCP segment sent by the sender may get lost on the way before reaching the receiver.
  • This causes the receiver to send the acknowledgement with same ACK number to the sender.
  • As a result, sender retransmits the same segment to the receiver.
  • This is called as TCP retransmission.

 

When TCP Retransmission Occurs?

 

When sender discovers that the segment sent by it is lost,

it retransmits the same segment to the receiver.

 

Sender discovers that the TCP segment is lost when-

  1. Either Time Out Timer expires
  2. Or it receives three duplicate acknowledgements

 

1. Retransmission After Time Out Timer Expiry-

 

Each time sender transmits a TCP segment to the receiver, it starts a Time Out Timer.

Now, following two cases are possible-

 

Case-01:

 

  • Sender receives an acknowledgement for the sent segment before the timer goes off.
  • In this case, sender stops the timer.

 

Case-02:

 

  • Sender does not receives any acknowledgement for the sent segment and the timer goes off.
  • In this case, sender assumes that the sent segment is lost.
  • Sender retransmits the same segment to the receiver and resets the timer.

 

Also Read- Time Out Timer

 

Example-

 

 

2. Retransmission After Receiving 3 Duplicate Acknowledgements-

 

  • Consider sender receives three duplicate acknowledgements for a TCP segment sent by it.
  • Then, sender assumes that the corresponding segment is lost.
  • So, sender retransmits the same segment without waiting for its time out timer to expire.
  • This is known as Early retransmission or Fast retransmission.

 

Example-

 

Consider-

  • Sender sends 5 TCP segments to the receiver.
  • The second TCP segment gets lost before reaching the receiver.

 

The sequence of steps taking place are-

 

  • On receiving segment-1, receiver sends acknowledgement asking for segment-2 next.

(Original ACK)

  • On receiving segment-3, receiver sends acknowledgement asking for segment-2 next.

(1st duplicate ACK)

  • On receiving segment-4, receiver sends acknowledgement asking for segment-2 next.

(2nd duplicate ACK)

  • On receiving segment-5, receiver sends acknowledgement asking for segment-2 next.

(3rd duplicate ACK)

 

Now,

  • Sender receives 3 duplicate acknowledgements for segment-2 in total.
  • So, sender assumes that the segment-2 is lost.
  • So, it retransmits segment-2 without waiting for its timer to go off.

 

 

NOTE

After receiving the retransmitted segment-2,

  • Receiver does not send the acknowledgement asking for segment-3 or 4 or 5.
  • Receiver sends the acknowledgement asking for segment-6 directly from the sender.
  • This is because previous segments have been already received and acknowledgements for them have been already sent (although wasted in asking for segment-2).

 

Important Points-

 

Point-01:

 

  • Consider time out timer expires before receiving the acknowledgement for a TCP segment.
  • This case suggests the stronger possibility of congestion in the network.

 

Point-02:

 

  • Consider sender receives 3 duplicate acknowledgements for the same TCP segment.
  • This case suggests the weaker possibility of congestion in the network.

 

Point-03:

 

  • Consider receiver does not receives 3 duplicate acknowledgements for the lost TCP segment.
  • In such a case, retransmission occurs only after time out timer goes off.

 

Point-04:

 

  • Retransmission on receiving 3 duplicate acknowledgements is a way to improve the performance over retransmission on time out.

 

Also Read- TCP Congestion Control

 

PRACTICE PROBLEM BASED ON TCP RETRANSMISSION-

 

Problem-

 

Consider a TCP connection in a state where there are no outstanding ACKs. The sender sends two segments back to back. The sequence numbers of the first and second segments are 230 and 290 respectively. The first segment was lost but the second segment was received correctly by the receiver.

Let X be the amount of data carried in the first segment (in bytes) and Y be the ACK number sent by the receiver.

The values of X and Y are-

  1. 60 and 290
  2. 230 and 291
  3. 60 and 231
  4. 60 and 230

 

Solution-

 

It is given that sender sends two segments where-

  • 1st segment contains the sequence number 230 and gets lost.
  • 2nd segment contains the sequence number 290 and is received correctly.

 

Amount Of Data Sent In First Segment-

 

Given-

  • Sequence number of 1st segment = 230
  • Sequence number of 2nd segment = 290

 

From here, range of sequence numbers contained in the 1st segment = [230,289].

 

Now,

  • Total number of sequence numbers contained in the 1st segment = 289 – 230 + 1 = 60.
  • TCP assigns one sequence number to each byte of data.
  • Thus, Amount of data contained in the first segment = 60 bytes.

 

ACK Number Sent By Receiver-

 

On receiving the 2nd segment,

  • Receiver sends the acknowledgement asking for the first segment only.
  • This is because it expects the 1st segment first.
  • Receiver keeps sending this ACK number until it receives the first segment correctly.
  • Thus, Acknowledgement number = Sequence number of the 1st segment = 230.

 

Thus, Option (D) is correct.

 

Next Article- TCP Connection Termination

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

Summary
TCP Retransmission | TCP Duplicate ACK
Article Name
TCP Retransmission | TCP Duplicate ACK
Description
TCP Retransmission is a process of retransmitting a TCP segment. TCP Retransmission occurs when time out timer expires before receiving the acknowledgement or 3 duplicate acknowledgements are received from the receiver for the same segment.
Author
Publisher Name
Gate Vidyalay
Publisher Logo
Liked this article? Share it with your friends and classmates now-