0% found this document useful (0 votes)
6 views5 pages

DSCC PBL

Uploaded by

harshit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

DSCC PBL

Uploaded by

harshit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Peer-to-Peer (P2P) File Sharing Network

Distributed system and cloud computing : Project Based Learning

Submitted in partial fulfilment of the requirements for the award of the degree

of

BACHELOR OF TECHNOLOGY

in

COMPUTER SCIENCE & ENGINEERING

by
Anukrit Goyal……………..(06711502721)
Ayush Goel………………..(08511502721)
Kanishk Kumar…………....(09411502721)

Guided by

Dr. Preeti Nagrath


Associate Professor and Director, Training and Placement Office

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


BHARATI VIDYAPEETH’S COLLEGE OF ENGINEERING
(AFFILIATED TO GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY, DELHI)
DELHI – 110063
1. Introduction
This Peer-to-Peer (P2P) File Sharing System allows users to share files directly with each other
without relying on a central server. Each user (or “peer”) in the network can upload and download files,
effectively becoming both a client and server. This system provides efficient file-sharing capabilities
and is particularly useful in environments where decentralization and direct user connectivity are
priorities.
2. Project Objective
The primary objective of this project is to create a decentralized file-sharing application that allows
users to:

 Discover and connect with other peers on the same network.


 Search for and download files directly from other peers.
 Share files with other users by making files available in a shared directory.
3. Features

 Decentralized Network: No central server; each peer communicates directly.


 File Discovery: Peers can search for files across other peers.
 File Transfer: Peers can download files directly from other peers.
 Fault Tolerance: Peers detect and handle network or peer connection failures.
4. Prerequisites

 Python 3.x: Make sure Python 3 is installed on your machine.


 Basic Network Setup:
o All devices should be on the same network (such as a local Wi-Fi).
o Network firewall settings should allow connections on the designated ports.
5. Project Structure
Create a project directory as follows:

6. Technology Stack

 Programming Language: Python 3


 Networking Library: socket for peer-to-peer communication
 Threading Library: threading for handling multiple connections
 Data Serialization: JSON for communication between peers (simple request format)
7. Implementation Details
7.1 Peer Script (peer.py)
Below is the main Python script peer.py that defines the peer’s operations, including server
setup, client requests, and file transfers.
8. Running the Project
Step 1: Set Up Peers

 On each device you want to act as a peer, place the peer.py script and shared_files/
folder.
 Update the HOST variable in peer.py with the device’s IP address and specify a unique
port for each device.

Step 2: Start Each Peer

 Run peer.py on each device:

Step 3: Add Files to Share

 Place any files you want to share in each device’s shared_files directory.
Step 4: Request a File

 In any peer’s terminal, use the command to download a file:

 Replace <filename> with the file you want, <peer_ip> with the IP of the peer that has the
file, and <peer_port> with the listening port of that peer.
9. Example Usage
Assume:

 Device 1 (Peer 1): IP 192.168.1.12, Port 5000


 Device 2 (Peer 2): IP 192.168.1.15, Port 5001
 Start Peer 1:

 Start Peer 2:

 Place a file, e.g., sample.txt, in Peer 1’s shared_files directory.


 In Peer 2, download the file by typing:

For local system:

 Successful file transfer in the local system:


10. Possible Enhancements

 File Integrity: Add hashing (like SHA-256) to ensure file integrity.


 Peer Discovery: Implement automatic peer discovery using multicast or broadcast
protocols.
 Encryption: Implement encryption for secure file transfer.
 GUI: Add a simple GUI to make the system more user-friendly.
11. Conclusion
This P2P File Sharing System demonstrates the core principles of a decentralized network,
allowing users to directly share files without a central server. It’s designed to be lightweight,
modular, and adaptable for more sophisticated peer-to-peer communication networks.

You might also like