Coder Social home page Coder Social logo

domidzitac / nanotcp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from finnthedawg/nanotcp

0.0 1.0 0.0 16.39 MB

A open-source TCP/IP implementation in C. Simulated using mininet

Makefile 2.22% C 13.24% Perl 2.17% Shell 2.69% C++ 66.92% OpenEdge ABL 2.47% Python 10.29%

nanotcp's Introduction

TCP-Jia-Komiljon

TCP/IP implementation in C. Simulated using Mininet.

Sample throughput of TCP with near 0 loss.

Base features

  • The sender sends packets based on a window.
  • The receiver sending cumulative acks to server.
  • When a sent packet is acked, the window slides and a new packet is transmitted from the sender.
  • All reading and writing operations are done directly to file using fseek

Buffering out of order packets

  • If the receiver receives an out of packet, the packet is buffered by writing to the location in disk.
  • A circular array is used to track the packets that have been acked.
  • On arrival of a new packet, if it completes a buffered sequence, then send cumulative ack.
  • If sender did not recieve ack within timeout window, it will re-send the packets.

Congestion mechanisms

  1. Slow start:
  • The initial ssthresh is set to 64 segments.
  • During slow start, the window_size doubles each time a full window has been acked
  • Slow start continues until the window_size reaches ssthresh at which point we move to congestion avoidance
  1. Congestion avoidance:
  • In this phase, window_size will increase by 1 each time a full window has been acked
  1. Fast retransmit:
  • If the sender receives 3 duplicate_ack then ssthresh is set to half the window_size and window size is set to 1.

Plot of throughput and congestion window with a loss of 0.1%. The gray background is the current throughput of the network.

Run instructions

To run the above simulation, first build from the source by navigating to /rdt2.0/src and running make.

Then, navigate to the root directory and run sudo ./run.sh. Make sure to place a file named FILE in the root directory. This will transfer to a new file named FILE_RCVD.

If you wish to run a checksum, ensure that the FILE is small enough or has enough time to fully be sent by the network. Then simply run cksum FILE FILE_RCVD in the root directory.


How to run mininet.

sudo mn --link tc,bw=10,delay=10ms,loss=2
mininet> xterm h1 h2

Terminal node h1

./rdt2.0/obj/rdt_receiver 60001 FILE_RCVD

Terminal node h2

./rdt2.0/obj/rdt_sender 10.0.0.1 60001 small_file.bin

Verifying checksum of the two files

cksum FILE_RCVD small_file.bin


nanotcp's People

Contributors

finnthedawg avatar kokostos1673 avatar

Watchers

James Cloos 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.