Code Monkey home page Code Monkey logo

tcp-protocol's Introduction

TCP Reliable Data Transport Protocol

Here's our own implementation for Reliable Transport Protocol which used in transport layers.

Reliable transport protocol runs on top of an unreliable delivery mechanism.

RDT methods

Stop and Wait

Simply, the server sends only one packet until it receives the successful acknowledgement from the client.

Selective Repeat

Implementation for one of the most common pipelining methods, where the server sends up to N packets with associated timers for each individual packet.
This method is practical as it doesn't work by cumulative acknowledgements like GBN, mentioned later. Otherwise, it only sends unacknowledged packets.

Go-Back-N (GBN)

It works like the previous method, except that the whole window has only one timer because it works by cumulative acknowledgements, so in case of packet loss, it retransmits the whole window again.

Error Detection By Checksum

We provide error correction methodology by using checksum to detect most of packet transmission errors.
We choose to make the checksum of 16 bits as in Internet checksum to make undetected errors very rare, but we can not guarantee completely error-free delivery because of checksumming’s limitation.

Congestion Control

TCP is well-known for it's congestion control process as shown in the state diagram shown below.

The state diagram shows how the server window size is dynamically changed based on the congestion of the network by using Additive increase Multiplicative decrease.

Packet Loss Simulation

Since we can't modify the local machines with OS, we simualted the packet loss by the following process :

  • The system is given a packet loss propability in the configuration file. This PLP ranges from 0 to 1, where PLP% of the packets are considered lost.
  • In addition, a seed value for the random generator is also given to the server to select the indices of lost packets.
  • Then simulating packet loss by not calling send method on these selected lost datagrams but start their timers, So these timers will timeout later and a loss will be detected as a result.

Features

  • Reliable Data Transfer Protocol
  • Stop and Wait Method
  • Selective Repeat Method
  • GBN Method
  • Supporting all file types (HTML, TXT, Images, Videos)
  • Error Detection Using Checksum
  • Congestion Control Handling
  • Loss Simulation to test real scenarios

Prerequisite installed

  • C++11 or higher compiler.

How to run

  1. Clone the project git clone https://github.com/AmrHendy/tcp-protocol.git.

  2. Update the configuration files of both server and client.

  • For Server you can find the configuration file here
    Server Configuration File contains the following:
  • Server port number.
  • Maximum sending sliding-window size (in datagram units).
  • Random generator seed value (to be used in simulating packet loss).
  • Probability p of datagram loss (to be used also in simulating packet loss)
  • For Client you can find the configuration file here
    Client Configuration File contains the following:
  • IP address of server.
  • Server port number.
  • Client port number.
  • Filename to be transferred.
  • Initial receiving sliding-window size (in datagram units).
  1. You can now start transfering the file by running the server main and the client main.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

tcp-protocol's People

Contributors

amrhendy avatar arsanuos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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