Skip to content

Szpilman2/FTPSERVER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FTP SERVER

FTP, or File Transfer Protocol, is a standard network protocol used to transfer files from one host to another over a TCP-based network, such as the internet or an intranet. An FTP server is a software application or service running on a server that provides the functionality for clients to connect and perform file-related operations like uploading, downloading, renaming, and deleting files.

FTP operates on a client-server model, where the client initiates a connection to the server to perform file transfer operations. The server manages access to files and directories, and it authenticates users who connect to it. FTP uses two separate channels for communication:

  • Control Channel: This channel is used for sending commands from the client to the server and receiving responses. (implemented ✅)

  • Data Channel: This channel is used for the actual transfer of files. (implemented ✅)

This project is a basic FTP server implemented in C++ that utilizes a JSON configuration file to configure both the server and client. Note that certain sections of this file have been omitted in my implementation, but customization can be easily performed if desired.

Prerequisites

To compile this project, you require the jsonCpp library. You can obtain jsonCpp by using the command sudo apt install libjson-cpp-dev. Please note that this command specifically applies to Debian-based Linux distributions. For other distributions, alternative commands can be found easily through online search.

For experienced users, you may refer to the instructions provided on the official jsonCpp GitHub repository Link.

Getting Started

After installing the prerequisites, you can compile the code using the following commands.

To compile the server, use the command:

g++ -std=c++17 FTPServer.cpp -o server -ljsoncpp

To compile the client, use the command:

g++ -std=c++17 client.cpp -o client

Once the code is compiled, open two separate terminals. In one terminal, type ./server, and in the other, type ./client.

Upon execution, the program prompts you to enter your username (format: User user_name) and password (format: Pass your_pass). If the password is correct, you gain access to send commands to the server. All commands follow a similar format.

==========================================HELP==================================================
                you can enter following commands:
                    PWD  : prints working directory.
                    LS   : list all files in the current path.
                    MKD directory_name : creates directory_name in current path.
                    DELE [-d] [-f] dir/file_name : deletes directory or file in current path.
                    RENAME oldfile newfile : renames oldfile to newfile.
                    RETR file_name : downloads file_name from FTP server if the file exists in the current path. 
                    quit : for closing the program.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • I employed ChatGPT (version 3.5) to rephrase this README file.

About

Simple FTP Server Implemented in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages