Skip to content

Simplified BitTorrent-style file sharing protocol. Each peer stores and exchanges file chunks.

Notifications You must be signed in to change notification settings

blazingSummerSun/P2P-BitTorrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Peer-to-Peer File Sharing System

Project for Innopolis University Distributed Network Programming Course with realization of the Peer-to-Peer file sharing system using DHT.


A simple peer-to-peer (P2P) file sharing system implemented in Python, allowing users to share files directly between connected peers without a central server.

Features

  • Decentralized Architecture: No central server required - peers communicate directly
  • File Sharing: Share and download files from connected peers
  • Peer Discovery: Automatically discover other peers on the same network
  • Multi-threaded: Handles multiple connections simultaneously
  • Simple CLI: Easy-to-use command line interface

Requirements

  • Python 3.6+
  • Additional Library progress to show the progress bar:
    #Run the following command to download needed library
    pip install progress

Installation

  1. Make sure that all Requirements are met.

  2. Clone the repository:

    git clone https://github.com/WorriedSeat/Peer-to-Peer.git
    cd Peer-to-Peer

Usage

Project Structure

  1. DHT_node.py - code of the DHT-Node
  2. peer.py - code of the Peer
  3. Folders with the name of peer address IP:PORT (ex: 0.0.0.0:5000) represent the Peer Storage which store all files that Peer have and able to share.

Starting a Peer Node

python peer.py [peer_port PORT] [dht_port PORT] [--file NAME]

Options:

  • peer_port: Port of the peer
  • dht_port: Port of the corresponding DHT-Node
  • --file: Name of the file to download. Note! if --file not stated than the peer able only to send packets

Example of Usage

Note! You need to run these commands in the different terminals

python peer.py 5000 6883
python peer.py 5001 6884
python peer.py 5002 6885 --file image.png

Result A folder '0.0.0.0:5002' will be created in the project directory and the downloaded 'image.png' file will appear in it.

How It Works

  1. Peer Discovery:

    • Peers broadcast their presence on the local network
    • Maintain a list of known peers
  2. File Sharing:

    • Each peer shares files from a designated folder
    • File lists are exchanged between peers
    • Files are transferred directly between peers when requested
  3. Network Communication:

    • Uses TCP sockets for reliable communication
    • Simple custom protocol for commands and file transfers

About

Simplified BitTorrent-style file sharing protocol. Each peer stores and exchanges file chunks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages