Network Engineering

TCP Segment, Flow Control & Congestion Control

brian | Published: Feb. 18, 2024, 8:42 p.m. | Updated: May 25, 2025, 8:50 p.m.

Profile Picture

What is a TCP Segment?

TCP segment is a unit of data exchanged between devices over a TCP/IP network. A TCP segment contains a header, and a payload which is the data

 

What is Flow Control?

Flow control is a mechanism used in computer networking to manage the rate of data transmission between two devices in order to prevent overwhelming the receiving device with more data than it can handle.

 Here is what is happening during Flow Control:

   1.Computer A initiates a TCP connection with Computer B (3 way handshake)

   2. Computer B sends an initial window size to Computer A, that value is the receiver buffer(how much data the receiver is willing to accept at a given time, meaning it can change.)

   3. Now that Computer A knows how much it can send, Computer A will follow its rules and start sending data.

   4. If computer B realizes it has more available buffer space, it will notify Computer A and it will send more data. At the same time, if Computer B feels congested, it will notify Computer A to calm down, and send less. 

 

What is Congestion Control?

Congestion control manages network congestion to ensure optimal performance and prevent network collapse. While Flow control worries more about preventing the overflow of the receiving device, Congestion Control is more about the entire network, including all the routers the tcp segment has to go through to reach the receiving device.

In Congestion control the senders will adjust the transmission rate based on the congestion signals that are received by the network. Algorithms are used to alleviate the congestion. Most common tecnhiques that use used are "Slow Start" and "Congestion Avoidance"

 

TCP Slow Start:

TCP Slow Start is a congestion control algorithm that is used in TCP. In TCP Slow start, once the connection is established, the client and the server agree on an initial congestion window size (cwnd). Here commences the slow start phase in which the sender sends a very small amount of segments, typically one or two, to the reciever. Next after each acknowledgement from the reciever, the sender will start increasing the amount of packets that are being sent exponentially, until the first packet loss.

 

Congestion Avoidance:

Continuing from what we said above, the packets increase exponentially until it reaches the Slow Start Threshhold (ssthresh), and here the TCP sender transitions from Slow Start to Congestion Avoidance. In Congesiton Avoidance, the sender will increase its congestion window linearly instead of exponentially.