Selective Repeat and Go-Back-N with SACK Protocol Implementation
Project Overview
This project involved implementing and testing two reliable data transfer protocols: Selective Repeat (SR) and Go-Back-N with Selective Acknowledgment (GBN+SACK). The goal was to simulate robust data transmission over an unreliable network, correctly handling packet loss and corruption while optimizing throughput and delay. Both protocols were designed with sliding window mechanisms, and their performance was evaluated under various network conditions, including different retransmission timeout (RTO) configurations.
Performance Plots

Go Back N

Selective Repeat
Project Documentation
Click to enlarge
CS455 Programming Assignment 2 - Click to view full screen
Key Findings
- Lower RTO values resulted in faster detection and retransmission of lost packets, leading to higher throughput but at the cost of more frequent (and sometimes unnecessary) retransmissions.
- Higher RTO values reduced unnecessary retransmissions but caused longer delays in recovering from packet loss, increasing the average communication time.
- SR's buffering of out-of-order packets proved efficient in minimizing redundant retransmissions, while GBN+SACK's selective acknowledgment provided a hybrid approach that improved over traditional Go-Back-N by avoiding full-window retransmissions.
- Under identical network conditions (10% loss and 10% corruption), both protocols demonstrated similar throughput (~0.013 packets/ms) and goodput (~0.005 packets/ms), with GBN+SACK exhibiting slightly lower average RTT (11.2 ms vs. 12.4 ms for SR).
- Both protocols reliably delivered 1000 packets in all test cases, with performance differences primarily observable in retransmission behavior and delay under error conditions.
Technical Approach
- Selective Repeat (SR): Implemented with a configurable sliding window, the receiver buffers out-of-order packets and acknowledges each individually, ensuring sequential delivery once missing packets arrive.
- GBN+SACK: Extended the traditional Go-Back-N protocol by incorporating selective acknowledgments, allowing the sender to avoid unnecessary retransmissions of packets already received out of order. The design combined cumulative ACKs with SACK to balance reliability and network efficiency.
Experimental Setup and Analysis
I conducted multiple tests with RTO values of 20, 30, 50, 100, 200, and 500 milliseconds to explore the trade-offs between responsiveness and efficiency. For each configuration, three test runs with different seeds were performed to introduce variability and ensure statistical robustness. Metrics such as throughput, goodput, average packet delay, and RTT were recorded and analyzed using 90% confidence intervals.
Results were visualized with Matplotlib, and manual tests were conducted in controlled CSA1 and CSA2 environments to simulate real-world networking conditions.
Challenges and Insights
A critical takeaway was the importance of tuning timeout values to balance network efficiency and responsiveness. Lower timeouts improved responsiveness but increased bandwidth consumption, while higher timeouts reduced overhead but risked slower recovery from errors. Additionally, the project highlighted subtle differences in protocol behavior under various error conditions, offering insight into practical trade-offs in reliable transport protocol design.
A potential extension identified was improving sequence number wrap-around handling to ensure robustness in long-running or high-volume transmissions, a feature essential in production-grade transport protocols like TCP.
Code Samples
Due to course policy, code samples are not available for public sharing.
Technologies Used
- Python (socket programming, time module)
- Matplotlib (for visualizing RTT, throughput, and goodput metrics)
- Manual testing across CSA1 and CSA2 environments