CN_Project Report_G2_updated_wo_op (1)
CN_Project Report_G2_updated_wo_op (1)
Computer Networking
(CSE3034)
[ Peer-To-Peer (P2P)
Distributed File Sharing
System]
Submitted
by
Ipsita Senapati Reg. No.: 2141019242
Yaashi Majumdar Reg. No.: 2141013054
Ayush Kanta Jena Reg. No.: 2141010020
Shashank Sekhar Padhi Reg. No.: 2141016005
Subham Maharana Reg. No.: 2141013031
DATE: 11/01/2024
PLACE: Institute of Technical Education and Research
ii
Abstract
This project offers new solutions to problems caused by centralized data sharing through
the development of powerful peer-to-peer (P2P) data sharing applications (Java). Legacy
data sharing models rely on centralized servers and often experience capacity issues and
are vulnerable to a single failure.
To solve these limitations, the project is exploring the creation of P2P distribution that
would allow users to share and download files directly between computers.
The aim of the project is to provide connectivity and efficiency between users through a
console-based interface. Users are asked to interact with the system by accessing a
variety of things, such as shared route information, IP addresses for mapping, and
filenames for downloading.
This project demonstrates real-time visualization of results from the console to enable
users to receive timely feedback on the success or failure of joint operations. This type
of interaction is important to create a good understanding and user-friendly
environment that facilitates the use of P2P information sharing.
Additionally, the system integrates core features such as peer discovery, socket-based
file transfer and management. Respect the unity of the thread. The user interface
provides information management experience by allowing users to share information,
collect information among friends, and initiate downloads.
Java was chosen as the main language for this project due to its extensive
communication and multi-threading support, which is necessary to facilitate seamless
communication, compatibility, and concurrent work in a P2P environment.
iii
Contents
1. 1 Introduction
2. 2 Problem Statement
3. 3 Methodology
4. 4 Implementation
6. 6 Conclusion
7. References
iv
Introduction
The primary goal of this project is to empower users to share and download files
directly from one another's machines, bypassing the need for a central server. Built
using Java, a versatile and robust programming language, the system leverages key
principles of networking, file I/O, and multithreading to create a seamless and
efficient peer-to-peer communication environment.
1
Problem Statement
I. Explanation of problem with identification of element/object to be entered through console by
the user and the result to be reflected in the form of file content/database/in the console.
The primary challenge addressed by this project lies in the development of a Peer-to-Peer(P2P)
Distributed File Sharing using Java, where users can seamlessly share and download files directly
between their machines without relying on a central server. The core problem involves establishing
an intuitive console-based user interface that prompts user to enter various elements or objects,
such as file paths for sharing, IP addresses for peer connection, and file names for downloads.
These inputs are crucial for initiating and managing file transfers within the P2P network.
Furthermore, the system is designed to reflect results in real-time through the console, providing
users with feedback on the success or failure of their file- sharing actions. This includes notifications
on shared files, active downloads/uploads, and the status of the P2P connections. The challenge
extends to ensuring that the console-based interaction is clear, user-friendly, and effectively
captures and communicates the system’s actions and outcomes.
3. Error Handling: The system needs to implement robust error-handling mechanisms to gracefully
manage unexpected situations, such as file not found, connection failures, or data corruption
during transfers.
4. User Experience: The console-based user interface should be designed to provide clear
instructions and feedback to users. It should accommodate users of varying technical proficiency
and guide them through the file-sharing process seamlessly.
5. Cross-Platform Compatibility: The system should be designed with consideration for cross-
platform compatibility, ensuring that it operates consistently across different operating systems and
environments.
By addressing these constraints, the P2P Distributed File Sharing System aims to provide a reliable,
secure, and user-friendly solution for decentralized file sharing.
2
Methodology
Entire project is designed using Java where I have used the concepts of Socket
Programming and Multi-threading. For establishing the connections between the Server
and the
Clients, I have used TCP/IP protocol using the sockets.
Major Components of the Project:
Server and
Client
Server (Central Index Server):
This server indexes the content of all the peers (i.e., Clients) that register with it. It also
provides
search facility to peers.
Server Functionalities:
Registry and
Search
Client:
As a client, the user specifies a file name with the indexing server using "lookup". The
indexing
server returns a list of all other peers that hold the file. The user can pick one such peer and
the
client then connects to this peer and downloads the file.
Major function of the peer:
Download
As a server, the peer waits for requests from other peers and sends the requested file when
receiving
a request. The Peers (i.e., Clients) here, act as both the client and the server. This server is
different
from the central index server which only indexes the files. But, the server functionality of
the peer
can be used to download the files from its directory. The peer acts a client to download the
files
from other peers into its directory.
The peers provide the following interface to the users:
1. Register – registers the file into the server
2. Search – searches the server for a file and returns the list of Clients
3. Download – downloads the file from another Client
3
Implementation
I. Program
4
5
6
Results & Interpretation
I. Output screenshots with respect to inputs justifying the
outcomes alongwith small explanations.
Server:
We Start our execution by executing the Server –
Now Server will open its Socket and waits for the Clients to get connected
Client:
We will register 3 clients(Peers) on to the Server as per the project requirement
For Client1 -
For Client2-
Now, we will enter the directory of the files for each client along with the port number and the
peerid
For Client1 –
For Client2 –
7
Once all the clients have registered on to the server, the total available filenames at each of the
clients will be registered in the Server –
8
Conclusion
Peer-to-Peer is a decentralized version of the simplest form of network architecture.
Computer systems can communicate with all other computer systems.
Systems using heterogeneous systems do not treat all connected peers equally, but
peers with higher bandwidth and network connectivity are served with higher
bandwidth.
Priority.
Peer-to-peer network architectures are not very secure, and data and other shared
resources are easily discovered and used by unauthorized users.
Because each computer system functions as an independent server and client, each
computer system user must be trained to perform administrative tasks.
1
References
[3] https://www.geeksforgeeks.org/p2p-peer-to-peer-file-sharing/
[4] https://en.wikipedia.org/wiki/Peer-to-peer_file_sharing
[5] https://www.scaler.com/topics/p2p-file-sharing/