This project is a BitTorrent protocol simulation, demonstrating how peer-to-peer (P2P) file sharing works. It models key aspects of the BitTorrent protocol, such as peer communication, seeding, leeching, and tracker coordination to efficiently distribute files across multiple peers.
- P2P File Sharing: Simulates peer-to-peer distributed file sharing.
- Seeder & Leecher Roles: Implements file distribution and downloading processes.
- Tracker Server: Coordinates peers and manages metadata for shared files.
- Chunk-Based File Transfer: Files are split into pieces for parallel downloading.
- Simulated Network Latency: Adds realistic network delays to improve accuracy.
📂 CN_NetApp
│── peer.py # Peer node implementation (Seeder & Leecher)
│── tracker.py # Tracker server managing peers
│── torrent_file.py # Handles metadata about shared files
│── utils.py # Helper functions for network communication
│── config.py # Configuration settings (IP, Port, Chunk size)
│── README.md # Project documentation
- Tracker Server Initialization:
- The tracker server registers active peers and provides file metadata.
- Peer Connection Establishment:
- Peers connect to the tracker and request file chunks.
- File Piece Exchange:
- Peers download and upload pieces in a distributed manner.
- Seeding & Completion:
- Once a peer completes the file, it becomes a seeder and shares pieces with others.
- Python 3.x
- Basic understanding of networking and P2P communication
- Clone the repository:
git clone https://github.com/KoderuNoKo/CN_NetApp cd CN_NetApp - Start the Tracker Server:
python tracker.py
- Run Peer Nodes (Seeder/Leecher):
python peer.py --role seeder --file sample.txt python peer.py --role leecher --file sample.txt
- Modify
config.pyto change IP addresses, ports, and chunk sizes. - Enhance
peer.pyto support multiple file sharing. - Implement encryption for secure peer communication.
- Support DHT (Distributed Hash Table) for decentralized tracking.
- Implement peer reputation system to prioritize fast uploaders.
- Add choking/unchoking mechanisms for bandwidth optimization.
- BitTorrent Protocol Specification
- Peer-to-Peer Networking Concepts