Skip to content

Python application allowing a client to upload & download files to & from server

Notifications You must be signed in to change notification settings

dguido1/cpsc471-ftp-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FTP Server & FTP Client

Python application allowing a client to upload & download files to & from server


    For CPSC 471 - Computer Communication at California State University Fullerton

    Spring 21'




Table of contents



Overview

  • This application allows a client to connect to an FTP server
  • The FTP server will then allow the client to:
    • Upload a file to the server
    • Download an existing file from the server
    • Close the FTP connection and exit program
  • SPECIAL NOTE: When running through Tuffix, socket functions that retrieved addresses would be different (127.0.0.1 and 127.0.1.1). This caused connectivity issues and would recommend running on any another OS.
      Please read the instructions section below before proceeding.


Instructions

    1.   Download this repository and locate the folder on your computer

    2.   Before proceeding, ensure you have all the following files:

           serv.py cli.py client-data.txt and the uploads subfolder containing server-data.txt

    3.   Open two terminals in your OS. One of these servers will be the server, and the other will be the client.

    4.   In one of your terminals run the serv.py script using the following command:

           python3 serv.py <PORT_NUMBER>

           The server name will be printed to the terminal. Copy this, you will need it for the next step

    5.   In the other terminal, run your cli.py script using the following command:

           python3 cli.py <server_name> <PORT_NUMBER>

    6.   Once both scripts are running, your client terminal will prompt you to enter one of four ftp commands:

           ls - the server will send a string of file names to the client
           get <file_name> - the server will send a file name to the client
           put <file_name> - the server will recieve the specified filename from the client
           close - the server will close the FTP connection after receiving this command from the client
  • Once a command is entered, the server will listen for the file name, open the data channel and finally respond accordingly to the command inputted by the client.

  • As noted above, when you are ready to close the session, simply type "close" in the ftp prompt of your client terminal.



File Structure

  • CPSC471-ftp-project
    • serv.py - Handles server-side communication with FTP connection
    • cli.py - Handles client-side communication with FTP connection
    • client-data.txt - This represents the default client data
    • uploads - This represents the server directory location


Demo

    LS Command

      ezgif com-optimize

       As expected, the server only returns server-data.txt, the default server data

    PUT Command

      ezgif com-optimize

       Here we upload client-data.txt to the server
       i.e. client-data.txt can now be found in uploads

    LS Command

      ezgif com-optimize

       Now the server returns server-data.txt and also client-data.txt since we just sent it to the server in the step above

    GET Command

      ezgif com-optimize

       Here we request and download server-data.txt from the server to the clients computer



Thanks for reading!

If you like what you see give this repo
a star and share it with your friends.

Your support is greatly appreciated!



About

Python application allowing a client to upload & download files to & from server

Resources

Stars

Watchers

Forks

Languages