Course contentsShow
← Computer Science
Lesson 1476 of 2,87234. Internet Protocol SuiteFree lesson

TCP Reliability: Retransmission

How TCP detects lost segments using timeouts and retransmits unacknowledged data to ensure delivery.

TCP Reliability: Retransmission

What You'll Learn

You'll learn how TCP guarantees every segment reaches its destination, even when packets are lost or delayed in transit.


The Core Problem

TCP promises reliable delivery, but the underlying network (IP) doesn't guarantee packets arrive. Segments can be lost due to congestion, hardware failures, or routing errors. How does TCP know when data is missing? It uses timeouts and retransmission.

How It Works

Remember how TCP uses sequence numbers and acknowledgments? The sender transmits a segment and starts a retransmission timer. If an acknowledgment (ACK) arrives before the timer expires, great—the data got through. If the timer expires without receiving the expected ACK, TCP assumes the segment was lost and retransmits it.

The Analogy

Imagine mailing a package with a tracking number. You check after a few days (your timeout). If the recipient hasn't confirmed delivery, you send another package. TCP does exactly this, but automatically and much faster.

Key Mechanisms

  • Timeout Value: TCP dynamically calculates how long to wait based on network conditions (round-trip time)
  • Unacknowledged Data: TCP tracks which segments haven't been ACKed yet
  • Retransmission: Lost segments are sent again, preserving the same sequence numbers
  • Duplicate Detection: The receiver uses sequence numbers to ignore duplicate segments if both the original and retransmitted copy arrive

This ensures every byte eventually reaches the destination, even if the network drops packets along the way.


Key Takeaway:
TCP achieves reliability by starting a timer when sending data and automatically retransmitting any segment whose acknowledgment doesn't arrive before the timeout expires.