Skip to content

Implementation of Automatic Repeat reQuest (ARQ) protocols in python

License

Notifications You must be signed in to change notification settings

vdesmond/arq-protocols

Repository files navigation

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 <PORT> <LOSS_PROB> <ACK_TIMEOUT> <MESSAGE>
      Receiver: python sw_receiver.py <PORT> <LOSS_PROB>

    2. 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>

    3. 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>

    4. 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>

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

Go Back N ARQ Go Back N ARQ

Selective Repeat ARQ Selective Repeat ARQ

CSMA/CA Simulation CSMA/CA Simulation

UEC1604 - Communication Networks, SSN College of Engineering

About

Implementation of Automatic Repeat reQuest (ARQ) protocols in python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •