Giter VIP home page Giter VIP logo

go_back_n_udp's Introduction

UDP Server/Client - File Transfer Protocol (FTP)

Using UDP protocol to implement the reliable transfer process between server and client. In this projcet, we implemented the Go-Back-N protocol based on UDP protocol.

Requirements

Python 2.7+

Usage

Run server.py whitin the folder with the following commands:

python server.py port# file-name p

In details:

port# is the number of port you want to use, it should be the same as the port number client using.

file-name is the file you used to receive the data transfered from client.

p is the nunber of probability of drop packet, which used to simulate the packet lose condition in real-life condition. P should be in the duration: 0 < p < 1.

Output:

Listening port...

And if the server receiver the packet sent from client, it will display:

message:
0000000000000000000000000000001001111001010000110101010101010101001100010011001000110011

And this displayed message is in binary format.

Now run client.py on the same port

python client.py server-host-name server-port# file-name N MSS

In details: server-host-name is the hostname of your computer, you can use command hostname in MacOS and Linux operation system.

server-port# is the number of port you want to use in transfer process.

file-name is the file you want to transfer. you need to specify it in absolute path if this file is not in the same folder of python file.

N is the size of window size, you need to set this window size in advance, the N can be: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024.

MSS means the maximum segment size, it will form a segment that includea header and MSS bytes of data. as a result, all segments sent, except possibly for the very last one, will have exactly MSS bytes of data.

If the transfer process work correctly, there will be a display:

File has already transfered.
Total time cost:0.0177121162415
Exiting from process...

The file will be received by the server through a socket connection.

Tasks

Task 1: Effect of Window size N

In this task, select a file at least 1MB, set the MSS to 500 bytes and the loss probability p = 0.05. Run the Go-back-N protocol to transfer the file you selected, and vary the value of the window size N = 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024.

For N = 1, p = 0.05, MSS = 500 bytes:

image

For N = 2, p = 0.05, MSS = 500 bytes:

image

For N = 4, p = 0.05, MSS = 500 bytes:

image

For N = 8, p = 0.05, MSS = 500 bytes:

image

For N = 16, p = 0.05, MSS = 500 bytes:

image

For N = 32, p = 0.05, MSS = 500 bytes:

image

For N = 64, p = 0.05, MSS = 500 bytes:

image

For N = 128, p = 0.05, MSS = 500 bytes:

image

For N = 256, p = 0.05, MSS = 500 bytes:

image

For N = 512, p = 0.05, MSS = 500 bytes:

image

For N = 1024, p = 0.05, MSS = 500 bytes:

image

The conclusion image is:

image

Task 2: Effect of MSS

In this task, let the window size N = 64 and the loss probability p = 0.05. Run the Go-back-N protocol to transfer the same file, and vary the MSS from 100 bytes to 1000 bytes in increments of 100 bytes.

For N = 64, P = 0.05, MSS = 100 bytes:

image

For N = 64, P = 0.05, MSS = 200 bytes:

image

For N = 64, P = 0.05, MSS = 300 bytes:

image

For N = 64, P = 0.05, MSS = 400 bytes:

image

For N = 64, P = 0.05, MSS = 500 bytes:

image

For N = 64, P = 0.05, MSS = 600 bytes:

image

For N = 64, P = 0.05, MSS = 700 bytes:

image

For N = 64, P = 0.05, MSS = 800 bytes:

image

For N = 64, P = 0.05, MSS = 900 bytes:

image

For N = 64, P = 0.05, MSS = 1000 bytes:

image

The conclusion image is:

image

Task 3: Effect of Loss Probability p

For this task, set the MSS to 500 bytes and the window size N = 64. Run the Go-back-N protocol to transfer the same file, and vary the loss probability from p = 0.01 to p = 0.10 in increments of 0.01.

For N = 64, p = 0.01, MSS = 500 bytes:

image

For N = 64, p = 0.02, MSS = 500 bytes:

image

For N = 64, p = 0.03, MSS = 500 bytes:

image

For N = 64, p = 0.04, MSS = 500 bytes:

image

For N = 64, p = 0.05, MSS = 500 bytes:

image

For N = 64, p = 0.06, MSS = 500 bytes:

image

For N = 64, p = 0.07, MSS = 500 bytes:

image

For N = 64, p = 0.08, MSS = 500 bytes:

image

For N = 64, p = 0.09, MSS = 500 bytes:

image

For N = 64, p = 0.10, MSS = 500 bytes:

image

The conclusion image is:

image

go_back_n_udp's People

Contributors

rhxbupt avatar

Watchers

 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.