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
- Clone this repository
- (optional) Create a virtual environment before running.
- Install some additional python packages:
pip install coloredlogs verboselogs
- If you want to use the logging module only, you can modify the code under
# Configure Logging
for every file.
- Install some additional python packages:
- Run sender and receiver in seperate tabs/windows.
- The command line arguments are as follows:
- Stop and Wait ARQ
Sender:python sw_sender.py <PORT> <LOSS_PROB> <ACK_TIMEOUT> <MESSAGE>
Receiver:python sw_receiver.py <PORT> <LOSS_PROB>
- Go Back N ARQ
Sender:python gbn_sender.py <PORT> <SEQ_NO_BIT_WIDTH> <LOSS_PROB> <ACK_TIMEOUT> <MESSAGE>
Receiver:python gbn_receiver.py <PORT> <SEQ_NO_BIT_WIDTH> <LOSS_PROB>
- Selective Repeat ARQ
Sender:python sr_sender.py <PORT> <SEQ_NO_BIT_WIDTH> <LOSS_PROB> <ACK_TIMEOUT> <MESSAGE>
Receiver:python sr_receiver.py <PORT> <SEQ_NO_BIT_WIDTH> <LOSS_PROB>
- CSMA/CA Simulation
CSMA/CA has been implemented on top of Stop and Wait ARQ
Sender station:python sender_station.py <PORT> <LOSS_PROB> <ACK_TIMEOUT> <CHANNEL_BUSY_PROB> <IFS> <MAX_K> <MESSAGE>
Base Station:python base_station.py <PORT> <LOSS_PROB>
- Stop and Wait ARQ
- Make sure
PORT
andSEQ_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
and2 ** (SEQ_NO_BIT_WIDTH - 1)
respectively - For CSMA/CA,
IFS
is in milliseconds.
- 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
UEC1604 - Communication Networks, SSN College of Engineering