Code Monkey home page Code Monkey logo

networks_filetransfer's Introduction

File Transfer

The project is to code a program which allows a client to upload file to a server by mimicking two transfer protocols: Multi-channel stop-and-wait protocol and Selective Repeat protocol over UDP. The programs are written completely in C.

Aim

  • Understand multi-channel stop and wait protocol and SR protocol and learn to implement the same
  • Understand TCP and UDP and their implementation in C (using various sys calls)
  • Understand loss of packets (both Data and Ack packets) and learn how to simulate it in C
  • Understand how buffering works, what are its advantages and how to simulate it in C
  • Understand how multiple channels or clients can be created in C (using fork() sys call)

Index

Directory structure [Index]

.
├── README.md
├── SR_Protocol
│   ├── Makefile
│   ├── SR-protocol.JPG
│   ├── client
│   ├── client.c
│   ├── getLog.sh
│   ├── input.txt
│   ├── log.txt
│   ├── log_client.txt
│   ├── log_relay1.txt
│   ├── log_relay2.txt
│   ├── log_server.txt
│   ├── output.txt
│   ├── packet.h
│   ├── readme.txt
│   ├── relay
│   ├── relay.c
│   ├── server
│   └── server.c
├── Specifications.pdf
└── Stop_Wait_Protocol
    ├── Makefile
    ├── Stop-and-wait.JPG
    ├── client
    ├── client.c
    ├── input.txt
    ├── output.txt
    ├── packet.h
    ├── readme.txt
    ├── server
    └── server.c

Architecture [Index]

  • Multi-channel stop-and-wait protocol Architecture of multi-channel stop-and-wait protocol

  • SR protocol over UDP Architecture of SR protocol over UDP

Tech used [Index]

  • C
  • gcc

Dev setup [Index]

  • If gcc isn't installed, you can install it using:
    sudo apt-get update
    sudo apt install gcc

How to run [Index]

The specific running instructions for both protocols can be referred from multi-channel stop-and-wait protocol and from SR protocol over UDP. Both these files also have detailed instructions explaining the architecture, the complete logic of the code, procedure to generate and read log files, comparing input and output files and various specific features. I highly recommend you to go through them for detailed understanding. Nevertheless, for sake of completeness I've also put the instructions to run the code below along with the demo video.

  • Multi-channel stop-and-wait protocol

    1. make
    2. ./server (In one instance of terminal)
    3. ./client (In another instance of terminal)

    Refer to the Note and Reading the log sections of multi-channel stop-and-wait protocol for more details.

  • SR protocol over UDP

    1. make
    2. ./server
    3. ./relay 1 (To run relay node 1)
    4. ./relay 2 (To run relay node 2)
    5. ./client

    Run (ii)-(v) on separate terminal instances.

    Refer to the Note and Reading the log sections of SR protocol over UDP for more details.

Tests [Index]

You can test the working of the programs by using the sample input.

  • For Stop-and-wait protocol, refer to input.txt for sample input and output.txt for the output. The logs would be visible to the user on the terminal screen when s/he runs the program.
  • For SR protocol, refer to input.txt for sample input and output.txt for the output. The complete log file sorted by time stamp is log.txt. Individual log files are also present in the same folder. Also, these individual logs can also be seen on the terminal screen when the user runs the program.

Note that user can change various setting like buffer size, timout, PDR (packet drop rate), etc in the file named packet.h. Do remeber to recompile your program once you change these settings.

networks_filetransfer's People

Contributors

vipbaswan103 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.