TCP Transmission, Retransmission, and How it Works

  • IP default Maximum Transmission Unit (MTU) is 576 bytes. Anything over the size will be split.
  • IP header takes 20 bytes.
  • TCP header takes 20 bytes.

TCP Retransmission

  1. The receiver sends the acknowledgement (ACK) to the sender when receiving a message.
  2. The sender retransmits the message when it is lost.
  1. Initially, the sender maintains a timer after sending the message.
  2. The 1st ACK is received before the time expires. Then, the timer is reset for the 2nd message and repeats the process.
  3. The 2nd timer is expired, and no ACK is received. Retransmission starts.
  • This TCP segment length is 647 bytes.
  • The sender has sent 1461 bytes before this message.
  • The sender will send more bytes starting from 2108.
  1. During the process, 2nd byte (marked as #2) is lost. Based on the design, the #2 will be retransmitted at a later time.
  2. We continue sending more bytes until the sequence number starts from #1 again. At his moment, the retransmitted #2 is sent.
  3. The receiver doesn’t know if this is an old #2 or a new one. This could mess things up.

TCP Fast Retransmission

  1. After the first 2 segment transmission, segment 3 is lost.
  2. When receiving segment 4, the receiver sends ACK3 instead of ACK4 based on the rules. This is the 1st duplicated out-of-order ACK.
  3. Again, when receiving segment 5, the server still expects the retransmission of segment 3. Accordingly, the 2nd duplicated ACK3 is sent.
  4. Then, the 3rd duplicated ACK3 is sent.
  5. At this moment, the sender enters the fast retransmission and retransmits segment 3.
  6. After receiving the lost segment, the receiver’s ACK is back to order and expects segment 7 in the upcoming message.

TCP Selective Acknowledgement

Takeaways

  • Maximum Segment Size (MSS) defines the length of TCP segments.
  • A timer helps TCP retransmits a lost segment.
  • After receiving 3 duplicated ACKs, fast retransmission starts before a timer expires.
  • Selective Acknowledgment (SACK) provides information on received out-of-order bytes to facilitate the fast retransmission process.

--

--

--

a coder 🧑🏻‍💻

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Spring IoC Container

JET UI Shell with Dynamic Tabs Implementation

SwiftUI: What you need to know for your next technical interview

CS373 Spring 2022: John Powers

Learnings from code review

Arth_task_15

Top 5 Programming Languages to Learn in 2019

Build Angry Birds Game Using Unity 2D

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Carson

Carson

a coder 🧑🏻‍💻

More from Medium

Where should you store your application secrets, you wonder?

From Request For Change to Merge Request : a GitOps journey

How to run Docker inside Docker?

NGINX: How does split_client works?