Skip to content

Peer-to-Peer File Sharing System that implements a Distributed Hash Table (DHT) with the Chord Protocol in C

License

Notifications You must be signed in to change notification settings

alessandrofoglia07/p2p-file-sharing-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Peer-to-Peer File Sharing System

Peer-to-Peer File Sharing System written in C

Key FeaturesHow To UseDemoLearn MoreLicense

Key Features

  • 🚀 Distributed Hash Table (DHT) Implementation: Utilizes the Chord protocol for efficient and scalable peer-to-peer file lookup and storage.

  • 🔄 Dynamic Ring Formation: Supports both the creation of new rings and joining existing ones, allowing nodes to connect and disconnect without disrupting the system.

  • 📁 File Storage and Retrieval: Enables decentralized file storage and retrieval with automatic assignment of files to responsible nodes based on their hashed identifiers.

  • 🔧 Efficient Successor and Predecessor Management: Periodic stabilization routines ensure consistent and correct successor and predecessor pointers, maintaining the integrity of the ring.

  • 🔒 Fault Tolerance: Nodes periodically send heartbeat messages to detect and handle node failures, ensuring high availability and reliability.

  • 🧵 Threaded Node Management: Utilizes multi-threading to manage node activities, such as handling incoming connections, stabilizing the ring, and processing user commands concurrently.

  • 💻 Command Line Interface: Provides a simple and intuitive command-line interface for node management, file operations, and network communication.

  • 🔑 SHA-1 Based Hashing: Uses SHA-1 hashing for generating unique file identifiers and node IDs, ensuring efficient and collision-resistant key distribution.

  • 🛑 Graceful Shutdown: Ensures all active threads and connections are properly terminated upon exit, preserving the system's stability and preventing data loss.

How To Use

To clone and run this application, you'll need Git and CMake installed on your computer. Also, you'll need to install the OpenSSL library. From your command line:

# Clone this repository
$ git clone https://github.com/alessandrofoglia07/p2p-file-sharing-system

# Go into the repository
$ cd p2p-file-sharing-system

# Build the program
$ cmake --build ./cmake-build-debug --target p2p_file_sharing_system -- -j 6

# Run the program (entry_ip and entry_port are optional, used for joining an existing ring)
$ ./build/p2p_file_sharing_system <ip> <port> <entry_ip> <entry_port>

Demo

Watch the video

Learn More

If you want to learn more about this project and my experience developing it, you can check out the blog post I wrote about it here.

License

MIT


GitHub @alessandrofoglia07  ·  StackOverflow @Alexxino  ·  NPM alessandrofoglia07

About

Peer-to-Peer File Sharing System that implements a Distributed Hash Table (DHT) with the Chord Protocol in C

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published