This project implements a Distributed File System using C and socket programming. The system consists of three servers: Smain, Spdf, and Stext. It supports multiple client connections, allowing clients to upload, download, and manage files transparently. The Smain server handles communication and distributes specific file types to Spdf and Stext in the background.
- Upload:
.c
files (stored in Smain),.txt
files (stored in Stext), and.pdf
files (stored in Spdf). - Download: Retrieve any file via Smain, with Smain fetching files from Stext/Spdf in the background.
- Delete: Remove files from the respective servers.
- File Listing: View available files in specified directories.
- Archive Creation: Generate tar files for
.c
,.txt
, or.pdf
files.
- Smain.c: The main server that handles client interactions.
- Spdf.c: A server that manages
.pdf
files. - Stext.c: A server that manages
.txt
files. - client24s.c: Client-side program for interacting with the servers.
- Basic knowledge of socket programming in C.
- Linux environment.
- Clone the Repository:
git clone https://github.com/hetvishah1005/MultiServerFS.git cd MultiServerFS
-
Compile the
.c
files on different machines or terminals.gcc Smain.c -o Smain gcc Spdf.c -o Spdf gcc Stext.c -o Stext gcc client24s.c -o client24s
-
Run the servers and the client on different terminals:
./Smain ./Spdf ./Stext ./client24s
The client can now send commands to Smain and interact with the system.
Upload a file to the server.
- Description: Uploads the file specified by
filename
to thedestination_path
on the server. - Example:
client24s$ ufile sample.c ~smain/folder
Download a file from the server.
- Description: Downloads the file specified by
filename
from the server to your local machine. - Example:
client24s$ dfile ~smain/folder/sample.txt
Delete a file from the server.
- Description: Deletes the file specified by
filename
from the server. - Example:
client24s$ rmfile ~smain/folder/sample.pdf
Create a tar archive of files of a specific type.
- Description: Creates a tar archive of all files matching the specified
filetype
(e.g.,.c
,.txt
,.pdf
) on the server. - Example:
client24s$ dtar .c
List files in a specified directory.
- Description: Lists all files and directories under the specified
pathname
on the server. - Example:
client24s$ display ~smain/folder
This will list .c
, .pdf
, and .txt
files in the specified directory.
- The system provides appropriate error messages for invalid commands, incorrect paths, network issues, or failed file operations.
- Error messages guide users to correct their actions.
- Hetvi Shah (Team Member 1)
- Naiya Jani (Team Member 2)
Distributed under the MIT License.