The P2P-file-share-system is a peer-to-peer (P2P) file sharing system built in Python. This project aims to provide a simple and effective way for users to share files over a network without needing a centralized server. The system is designed to work efficiently in a distributed environment, allowing multiple users to share and download files simultaneously.
- Peer-to-Peer Architecture: No central server required, making the system resilient and scalable.
- File Sharing: Users can upload and download files from other peers in the network.
- Search Functionality: Search for specific files available across connected peers.
- Concurrent Connections: Supports multiple users sharing and downloading files simultaneously.
- Logging and Monitoring: Detailed logs for file transactions and peer activities.
- Cross-Platform Compatibility: Works on Windows, Linux, and macOS.
Before running the project, make sure you have the following installed:
- Python 3.7+
socketlibrary (default in Python standard library)threadinglibrary (default in Python standard library)os,time, andjson(default in Python standard library)
-
Clone the Repository:
git clone https://github.com/AhmetNSHN/P2P-file-share-system.git cd P2P-file-share-system -
Run the Server and Peer Nodes:
Start the main server node using:
python server.py
Then, start peer nodes using:
python peer.py --port <PORT_NUMBER> --dir <SHARE_DIRECTORY>
-
Configuration:
Modify the
config.pyfile to change server IP, port, or other settings if required.
The peer.py script supports several command-line options:
--port: Specify the port number for the peer node.--dir: Specify the directory path for shared files.
Example:
python peer.py --port 5001 --dir /path/to/shared/filesOnce peers are connected to the network, you can use the following command to search for files:
search <FILENAME>To download a file from a connected peer, use:
download <FILENAME>The file will be saved to the shared directory specified when starting the peer node.