/coen366_p2p

Simple File Transfer Service

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

READ ME- Final Project

Luca Tomassi

for COEN366: Networking & Protocols

Simple File Transfer Service

The content of the application reside on two seperate folders as can be seen below.

image

Each folder can hold distinct files of any type, .pdf, .png, .txt, pptx as seen below.

image

Contents of /client folder

image

Contents of /server folder

Folders in the /client folder, can be transfered to the server side via the put command, and clients in the /server folder, can be transfered to the client side via the get command. Additionally, any file can be renamed using the change command.

Server-Side

The /server folder holds s.py, which is the server program,

In order to start the program, and start the server, in the CLI, you must first cd into the appropriate directory, once there, one can simply run the following command:

python s.py 2000 0

This command will run the program, giving it the parameters below:

  • Port: 2000
  • Debug Flag: 0

Note that the debug flag is initially set to 0, if the program is ran with the same line, but a 1 instead of a 0, this will enter debug mode, where each request/response will have a message associated to it, as per the rescode/mnemonic given in the tables.

Once initialized, the server will listen for any incoming connections, and only accept the connection when the appropriate IP address/Port Number have been entered by a Client.

Client-Side

The /client folder holds c.py which is the client program,

In order to start the program in the CLI, you must first cd into the appropriate directory,

once there, one can simply run the following command:

python c.py 127.0.0.1 2000 0

This command will run the program, giving it the parameters below:

  • IP: 127.0.0.1
  • Port: 2000
  • Debug Flag: 0

Note that the debug flag is initially set to 0, if the program is ran with the same line, but a 1 instead of a 0, this will enter debug mode, where each request/response will have a message associated to it, as per the rescode/mnemonic given in the tables.

Running this command will start the Client, connecting it to the server which has the matching IP address/ Port Number.

Once both sides have been initialized, the Client side will be waiting for the user to input commands, where the user commands are listed as below:

  • put filename : Transfers a file, from the client to the server.
  • get filename : Fetches a file, from the server to the client.
  • change oldfilename newfilename : Renames an existant file to a new given name
  • help : Lists all available commands (listed above)
  • bye : Exits the Client/Server

Debug-Mode ( debug flag set to 1 )

In the case that a user wants to debug the application, the debug flag parameter can be initially set to 1.

Doing so will allow the Request Messages to look as follow:

image

And the Response Messages will be as:

image