What is retransmission in TCP? Describing how it works for error control and duplicate acknowledgement.


In other articles, we have covered how the TCP setup and terminate a connection. A user’s data transfer begins once the connection is established. During data transfer, there may be packet losses or garbles due to a variety of factors.

As a reliable protocol, TCP provides a retransmission mechanism for error recovery. In this tutorial, we will explain why and when packets are retransmitted over an active connection.

What are the reasons for packet loss?

A communication network is built upon transfering nodes such as routers and physical wires called links. When a frame traverses from the source to the next hop, it may be errored due to noise. The receiver recognizes the error and drops the frame.

Most of the errors at the frame level are handled and recovered by the data link layer. But still, it’s optimization as TCP anyway has error control.

Another primary reason for IP packet drop is congestion. When a transit router detects congestion on the outgoing link, it drops the packets and informs the sender node of the current capacity. TCP retransmission occurs for a dropped message once the retransmission timer times out.

How frequently does packet loss occur in a network?

There is no fixed pattern. These days the network becomes much faster with very high bandwidth. But still, there are packet losses. The major reason is when the traffic arrives in bursts and network capacity is exhausted.

TCP Retransmission and error recovery.

Data in TCP flows in a byte stream. Each bye in the stream has a sequence number. After receiving a message, the receiver sends the acknowledgment for the last accepted sequence number. The sender removes messages from the retransmission queue till the sequence number received in acknowledegement.

What is TCP Duplicate and Selective Acknowledgment (ACK)?

Both are optimizations of the retransmission mechanism. In the first case, the sender sends a lost packet earlier than the normal retransmission time, whereas in the second case, the sender sends only selected packets.

What is duplicate TCP Ack?

While analyzing a TCP capture, an analyzer may show duplicate acknowledgment where two ACK will have the same sequence numbers. Following is an example sequence;

  • The sender sends six segments.
  • Segment number 3 is lost. When the receiver receives packet 4. it sends ACK with sequence number 3 (Expecting the next packet).
  • When the receiver receives packet 5, it sends ACK with sequence number 3 (Expecting the next packet).
  • When the receiver receives packet 6. it sends ACK with sequence number 3 (Expecting the next packet).
  • After seeing duplicate ACK, the sender knows that packet with sequence number 3 is lost and sends packet three again immediately.
  • The receiver receives ACK with sequence number 7.

What is selective ACK or SACK?

With SACK, the receiver is able to send an acknowledgment with a range (block) of sequence numbers over the network.

There could be multiple ranges in a SACK message. Left edge is the first sequence number in each range, and right edge is the last sequence number in each range.

TCP-SACK

Following is an example step that illustrates a selective acknowledgement scenario.

  • The sender sends six segments.
  • Segment number 3 is lost.
  • When the receiver receives packets 4, 5, and 6.
  • The receiver sends selective acknowledgment with a range having sequence numbers 4, 5, and 6.
  • The sender retransmits third packet only.