An interactive, real-time visualisation of the Go-Back-N Automatic Repeat reQuest (ARQ) protocol, the sliding-window error-control mechanism used in reliable data link layer communication.
GBN Lab turns protocol internals into a live animation: watch packets fly across the channel, ACKs return, timers fire, and windows slide as you introduce bit errors and packet loss. Built for students, instructors, and anyone who learns better by seeing.
- Real-time packet animation: sender, channel, and receiver on a single canvas, with packets, ACKs, timeouts, and window slides all visible as they happen
- Configurable channel impairments: live sliders for window size, bit error rate (BER), packet loss, packet count, and simulation speed
- Scenario presets: one-click environments including Low Errors, Moderate Noise, High BER Nightmare, and Packet Loss Hell
- Adaptive timeout: auto-calibrates to 3x RTT, so you can focus on the protocol rather than tuning timers
- Step-by-step mode: pauses automatically at anomalies (timeouts, corruption, loss) for classroom-style walkthroughs
- Post-run replay: scrub through the whole session with a timeline slider and step controls
- Live performance metrics: efficiency over time, packets lost or corrupted, and completion stats updated in real time
- Event log: timestamped, colour-coded trail of every protocol event
Go-Back-N is a sliding-window ARQ scheme:
- The sender transmits up to N frames without waiting for an ACK (a window of in-flight frames).
- The receiver accepts only in-order frames and returns a cumulative ACK for the highest consecutive frame received.
- On a timeout for the oldest unacknowledged frame, the sender retransmits all frames from that point onward ("going back N").
- Damaged or lost frames trigger the same retransmission; the receiver silently discards anything out of order.
GBN Lab simulates this loop frame-by-frame over a noisy channel, letting you watch exactly how window size and error rate trade off against throughput and efficiency.
- Python 3.9+
- A display (the app is GUI-based; no headless mode)
Install everything and launch in one command:
# macOS / Linux
./setup.sh run
# Windows
setup.bat runInstall only (launch later):
# macOS / Linux
./setup.sh
# Windows
setup.batpython3 -m venv venv
source venv/bin/activate # macOS / Linux
# OR
venv\Scripts\activate # Windows
pip install -r requirements.txt
python app.py- Pick a scenario from the dropdown, or tune the sliders yourself (window size
N, BER, packet loss, packet count, speed). - Run the simulation and watch packets animate across the channel.
- Toggle Step-by-Step mode to pause at each anomaly and examine the protocol's response.
- After completion, use the Replay scrubber to re-walk the session frame-by-frame and inspect the event log.
- Read the final efficiency and channel statistics in the metrics panel.
├── app.py # Entry point: window, splash, event loop
├── config.py # Constants, colour scheme, scenario presets
├── simulation.py # Go-Back-N protocol engine
├── ui_builder.py # UI construction (panels, sliders, metrics)
├── sim_control.py # Run / stop / step simulation control
├── replay_control.py # Replay capture, seek, and playback
├── event_log.py # Event tracking and log rendering
├── canvas_render.py # Animation canvas and all drawing
├── splash.py # Startup splash screen
├── setup.sh # macOS / Linux installer
├── setup.bat # Windows installer
├── requirements.txt # Python dependencies
└── CHANGELOG.md # Version history
Contributions are welcome. See CONTRIBUTING.md for the full guide.
- Fork the repository and create a feature branch.
- Keep changes focused and well-tested.
- Update the README and CHANGELOG where relevant.
- Open a pull request with a clear description.