Giter Site home page Giter Site logo

reliable-udp-transfer's Introduction

Author: Kai Drumm CSCI5273 Spring 2022 Programming Assignment 1: UDP Socket Programming

This program implements reliable file transfer between a client and server using unconnected UDP (datagram) sockets.

Usage: make ./server <port number above 5000> ./client

Run the two programs on different machines. Identify the server's IP address using the command "hostname -I".

In the client, you can type:

  • get [file_name]
  • put [file_name]
  • delete [file_name]
  • ls
  • exit

Starting files should be stored in the client/files/ folder. All files received by the server are saved to server/files/. Files received by the client with a "get" command are saved to client/files/received/.

The 'ls' command only lists files in the server/files/ folder, excluding hidden files that start with a dot. The 'exit' command only causes the server to exit. The client will remain running. The 'delete' command only deletes files on the server, not the client.

This program has been tested on files up to 285 MB in size. It uses packet IDs which go up to a maximum of 4,294,967,293 (the last two are reserved for flags), and each packet can hold 1020 bytes, so the maximum file size it can transfer might be 4.38 terabytes. I don't recommend sending such a large file because my program is slow. You could remove some of the progress printouts to make it run faster. Also, the packet contents are written to file via fseek() calls that move to various locations within the file, and I don't know if this would break with larger files that don't fit into memory.

This code is my own work. Credit: I copied the macros for bit setting and testing from an Emory CS class website (http://www.mathcs.emory.edu/~cheung/Courses/255/Syllabus/1-C-intro/bit-array.html) and some boilerplate code from Beej's guide (http://beej.us/guide/bgnet/pdf/bgnet_usl_c_2.pdf). This program has not been optimized for speed, readability, memory leaks, code organization, or aesthetic user interface; but the files sent and received have matching Md5 hashes. Sorry for the disorganized code!

reliable-udp-transfer's People

Contributors

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