An open API service indexing awesome lists of open source software.

https://github.com/vdesmond/arq-protocols

Implementation of Automatic Repeat reQuest (ARQ) protocols in python
https://github.com/vdesmond/arq-protocols

arq arq-protocols simulation

Last synced: 5 months ago
JSON representation

Implementation of Automatic Repeat reQuest (ARQ) protocols in python

Awesome Lists containing this project

README

          

# arq-protocols (and other stuff)

This repository contains implementation of 3 protocols:

- Stop and Wait ARQ
- Go Back N ARQ
- Selective Repeat ARQ

And also some bonus stuff including:

- CSMA/CA Simulation

### How to run

1. Clone this repository
2. *(optional)* Create a virtual environment before running.
1. Install some additional python packages: ```pip install coloredlogs verboselogs```
2. If you want to use the logging module only, you can modify the code under ```# Configure Logging``` for every file.
3. Run sender and receiver in seperate tabs/windows.
4. The command line arguments are as follows:

1. **Stop and Wait ARQ**
Sender: ```python sw_sender.py ```Receiver: ```python sw_receiver.py ```

2. **Go Back N ARQ**
Sender: ```python gbn_sender.py ```Receiver: ```python gbn_receiver.py ```

3. **Selective Repeat ARQ**
Sender: ```python sr_sender.py ```Receiver: ```python sr_receiver.py ```

4. **CSMA/CA Simulation**
CSMA/CA has been implemented on top of Stop and Wait ARQ
Sender station: ```python sender_station.py ```Base Station: ```python base_station.py ```

### Additional Notes

- Make sure ```PORT``` and ```SEQ_NO_BIT_WIDTH``` is same for both sender and receiver
- ```ACK_TIMEOUT``` is in milliseconds.
- The window length for Go Back N and Selective Repeat ARQ is calculated as ```(2 ** SEQ_NO_BIT_WIDTH) - 1``` and ```2 ** (SEQ_NO_BIT_WIDTH - 1)``` respectively
- For CSMA/CA, ```IFS``` is in milliseconds.

### Additional Notes (Ubuntu)

- Added single script to run all files. Use ```./arq.sh -h``` for help.
- If you use zsh, change ```-- bash``` to ```-- zsh``` in lines 71, 74, 77. If you use any other terminal, make appropriate changes

### Examples

Stop and Wait ARQ
![Stop and Wait ARQ](./output_imgs/sw.png)

Go Back N ARQ
![Go Back N ARQ](./output_imgs/gbn.png)

Selective Repeat ARQ
![Selective Repeat ARQ](./output_imgs/sr.png)

CSMA/CA Simulation
![CSMA/CA Simulation](./output_imgs/csma-ca.png)

*UEC1604 - Communication Networks, SSN College of Engineering*