This project simulates TCP Congestion Control mechanisms, illustrating how the Congestion Window (cwnd) changes over time in response to network events such as timeouts, fast retransmissions, slow start, and congestion avoidance.
- Copy all the contents from this repository.
- Open a terminal and navigate to the folder containing
congestion.py
. - Run the program using:
python congestion.py
- The simulation will:
- Print log entries showing cwnd changes due to different congestion control mechanisms.
- Plot a graph showing how cwnd evolves over Round Trip Times (RTTs).
- Slow Start: Doubles
cwnd
until it reachesssthresh
. - Congestion Avoidance: Increases
cwnd
linearly afterssthresh
is reached. - Timeouts: Drops
cwnd
to1
and updatesssthresh
. - Fast Retransmit: Quickly reduces
cwnd
but avoids a full restart.
Slow start at RTT 0: cwnd=2, ssthresh=16
Slow start at RTT 1: cwnd=4, ssthresh=16
Congestion avoidance at RTT 5: cwnd=17, ssthresh=16
Timeout at RTT 10: cwnd=1, ssthresh=8
...
The simulation generates a graph plotting cwnd
over RTTs, illustrating how congestion control operates dynamically.
- The probability of timeouts and fast retransmits is configurable within the script.
- The initial
ssthresh
value can be modified to observe different behaviors. - The model follows the fundamental principles of TCP Tahoe & Reno congestion control.
- Implement Selective Acknowledgments (SACK) for a more advanced simulation.
- Add real-world network trace integration.
- Extend support for TCP Cubic.