Skip to content

manuchandel/Multi-Stream-File-Transfer-Agent

Repository files navigation

Multi-Stream-File-Transfer-Agent

  • This is a multistream file transfer program written in cpp using socket interface.
  • It was written by me in Nov 2015 as a part of mini-networks project.
  • The purpose of this program is to tranfer a file in multiple fragments (all in parallel) from one local computer to another connected over internet or intranet.
  • This project was successfully tested working on Ubuntu 14.04.
  • For better understanding checkout Blog on this project

Abstract

  • File can be transfered from one computer to another over the network using socket interface.
  • At the senders end file is divided into equal fragments and all fragments are sent in parallel.
  • At the receivers end every received fragment is stored in a separate file and after the file transfer is complete all the fragments are merged into single file.
  • All the fragments have .temp extension and can be found in hidden directory " .filetransfer ".
  • Fragments are not deleted for demonstration purpose.

Installation

  1. Make sure latest version of g++ is installed on your LINUX computer.
  2. If not installed run " sudo apt-get install g++ ".
  3. To transfer file make sure both computers are connected through LAN wire or to a router on a intranet or connected via internet.

To transfer a file from LINUX to another LINUX computer follow these steps

  1. Download all the files in this repository into one directory on your local LINUX computer. Make sure this directory has write and execute permissions.
  2. Know ipV4 (or inet) address of the sender by " ifconfig " or another unix command.
  3. Open " HEADERS_AND_CONSTANTS_H.h " file and edit the HOST to sender's ip address and PORT to any pre-decided port number. POST and HOST values for both sender and receiver should be same. If you are testing it on same computer set HOST to "127.0.0.1" .
  4. At sender's end compile sender file by following command g++ -o sender.out sender.cpp -std=c++11 -pthread .
  5. At receivers end compile receiver file by following command g++ -o receiver.out receiver.cpp -std=c++11 -pthread .
  6. At senders end pass an argument which denotes file path eg " sender.out file.pdf " .
  7. After running command at senders end run command at recivers end " receiver.out " .
  8. After file tranfer is complete program will terminate automatically and transfered file will be saved with the name "new" and extension will depend on the file transfered.
  9. Fragments will be in " .filetransfer/ " directory they are not deleted for demonstration purpose. you can delete them manually.

Constants & Variables

  • PORT denotes port number for server and client both.
  • HOST denotes ipV4 address of server (sender).
  • NEW_FILE denotes name by which file will be downloaded at recivers end.
  • TEMP_DIR denotes directory where file fragments are downloaded (do not change recommended).
  • TEMP_FILE denotes names of file fragments sequentially (do not change recommended).
  • MAX_STREAMS denotes maximum parallel connections to be made to the sender to download file. Also denotes number of fragments in which file will be downloaded.
  • SECONDS_TO_WAIT denotes integer seconds receiver should wait before starting to receive download header for slower connections typically less than 20kB/s value should be greater than 5.
  • FILE_NAME_LENGTH maximum characters in file name.
  • MAX_BYTES maximum size of buffer used for reading bytes from sockets.

LICENSE

About

A multistream file transfer program written in cpp using socket interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages