TCP Send Window, Receive Window, and How it Works

Send Window

  1. Bytes that sent and acknowledged (blue)
  2. Bytes that sent but not yet acknowledged (yellow)
  3. Bytes that not sent and the recipient ready to receive (green)
  4. Bytes that not sent and the recipient NOT prepared to receive (grey)
  • SND.WND, standing for Send Window
  • SND.UNA, standing for the Send Unacknowledged pointer, pointing to the first byte of the send window
  • SND.NXT, standing for the Send Next pointer, pointing to the first byte of the usable window

Receive Window

  1. Bytes that received and acknowledged
  2. Bytes that not yet received but the transmitter permitted to send
  3. Bytes that not yet received and the transmitter may NOT allow to send

A Simplified Example

  1. We ignore Maximum Segment Size (MSS). MSS varies depending on the selected network route.
  2. We make the receive window equals to the usable window, and both remain the same during the process.
  1. A 50-byte header
  2. An 80-byte body part 1
  3. A 100-byte body part 2
  • These 100 bytes are sent and not ACK yet. Therefore, SND.NXT slides 100 bytes to the right.
  • Other pointers stay.
  • When the server receives the request, RCV.NXT slides 100 bytes to the right.
  • Then it sends a 50-byte reply with ACK. These 50 bytes are sent and not ACK yet, so SND.NXT moves 50 bytes to the right.
  • SND.UNA stays.
  • When it receives the 50-byte reply, RCV.NXT moves 50 bytes to the right.
  • SND.UNA slides to the right when it receives the ACK for the previous sent 100 bytes.
  • SND.NXT stays as the client does not send any data.
  • SND.NXT slides 80 bytes to the right.
  • SND.UNA stays because the last 50-byte has not yet been acknowledged.
  • RCV.NXT stays since the server does receive any data.
  • When the client receives the 80-byte data, RCV.NXT moves to the right.
  • Other points stay.
  • SND.UNA moves 50 bytes to the right.
  • Other pointers stay.
  • SND.UNA moves 80 bytes to the right.
  • Other pointers stay.
  • SND.NXT moves 100 bytes to the right.
  • Other pointers remain the same.
  • RCV.NXT moves 100 bytes to the right when the client receives the 100-byte.
  • Other pointers stay.
  • SND.UNA moves 100 bytes to the right.
  • Other pointers stay.

When Window Changes

  • These 150 bytes are sent and not ACK yet.
  • The usable window shrinks to 150 bytes.
  • The send window remains at 300 bytes.

Takeaways

  • The usable window’s calculation is the key to understand the TCP sliding window.
  • To learn the usable window’s calculation, we need to understand 3 pointers — SND.UNA, SND.NXT, and RCV.NXT.
  • Assuming a never-change window size could help us understand the progress.

--

--

--

a coder 🧑🏻‍💻

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

Recommended from Medium

7 practices for Your Programming Career

Introduction to Python : An Iconic Programming Language

Optimizing MySQL and MariaDB for TEXT: A Guide

Optimizing MySQL and MariaDB for TEXT: A Guide

React to Flutter: One Developers Journey — Part 2

Github Actions — Mask Every secret

Designing and implementing flexible RESTful services

A look at MVVM and Data-binding with Simple-Stack

Trapping Rain Water

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

How to configure Qt Creator to build and transfer your application to the embedded device running…

Authentication for Dummies II

How to use Angel Broking Smart API Web Socket in Flutter || How to Decode Angel Broking Smart API…

Binary Tree Pre Order Traversal using Tail Recursion