This project simulates a small congestion detection pipeline. It continuously checks the network path to a target machine and measures:
- ICMP RTT to estimate basic reachability and latency
- UDP RTT to check delay under UDP probing
- TCP RTT to check response delay over TCP
- Throughput using
iperf3to measure bandwidth
The idea is simple:
- If delay is low and throughput is healthy, the network is likely normal
- If delay increases and throughput drops, the network may be congested
This makes the project a good example of real-time network performance monitoring.
- ICMP latency measurement
- UDP latency measurement
- TCP latency measurement
- Throughput measurement with
iperf3 - Congestion state detection
- Live console output
- Graph output for results
- Works in both:
- single-laptop testing
- two-laptop demonstration
The project repeatedly:
- Pings a target laptop and collects RTT samples.
- Tries UDP and TCP probe measurements as fallback.
- Smooths RTT values.
- Extracts features such as mean RTT, standard deviation, and elevation.
- Predicts congestion using a trained SVM model.
- Measures throughput using iPerf3.
- Saves everything into
network_log.csv. - Optionally plots the logs.
Install these before running the project:
- Python 3.10+ on Windows
pipmatplotlibnumpypandasscikit-learn- iPerf3 (
iperf3.exe)
Install the Python packages with:
pip install matplotlib numpy pandas scikit-learnDownload iPerf3 for Windows, extract it, and keep iperf3.exe somewhere easy to find.
You will need the full path to iperf3.exe in throughput.py.
Example:
r"C:\Users\YourName\Desktop\iperf-3.21-win64\iperf3.exe"Use this mode when the client and server are on the same laptop.
Set targets to your laptopβs Wi-Fi IP address:
targets = ["<YOUR_LAPTOP_IP>"]Example:
targets = ["192.168.0.3"]Set the iPerf target to localhost:
def measure_throughput(server="127.0.0.1"):And inside the subprocess command, keep:
"-c", "127.0.0.1",192.168.0.3(example) is your real network IP for ping/RTT checks.127.0.0.1is localhost, so iPerf client connects to iPerf server on the same laptop.
Use this mode when you want to demonstrate the project across two laptops.
This is the monitoring laptop. It runs main.py.
This is the server laptop. It runs:
iperf3.exe -sSet targets to Laptop Bβs IP address:
targets = ["<LAPTOP_B_IP>"]Example:
targets = ["192.168.0.10"]Set the iPerf server value to Laptop Bβs IP:
def measure_throughput(server="192.168.0.10"):And inside the subprocess command, use:
"-c", "192.168.0.10",Run the server on Laptop B:
iperf3.exe -sIf Windows Firewall asks for permission, allow access.
Unzip the project folder.
Open the extracted folder in Visual Studio Code.
Use VS Code Terminal or CMD/PowerShell.
Run:
pip install matplotlib numpy pandas scikit-learnUpdate the following files:
main.pyβtargets = [...]throughput.pyβserver="..."throughput.pyβ"-c", "..."
Choose either:
- single-laptop mode: use
127.0.0.1inthroughput.py - two-laptop mode: use Laptop Bβs real IP in both files
Open a second terminal and run:
iperf3.exe -sor, from the folder that contains iperf3.exe:
.\iperf3.exe -sRun the same command on Laptop B.
In the project terminal, run:
python main.pyAfter the run creates network_log.csv, plot it with:
python plot_graph.pypip install matplotlib numpy pandas scikit-learn.\iperf3.exe -spython main.pypython plot_graph.pyDuring execution, you should see lines like:
project-folder/
β
βββ main.py
βββ throughput.py
βββ congestion.py
βββ utils.py
βββ requirements.txt
βββ 6th.png
βββ image61.png
βββ README.md
