Peer-to-Peer file sharing system
Project Background
This P2P file sharing system project is the first project for the University of Melbourne’s COMP90015 Distributed System Subject. This system is using a hybrid client/server and peer-to-peer architecture. In this architecture there are two components:
- Index Server : a process that acts as a server, to manage an index of files and IP addresses of file sharers
- Peer : a process that acts as both a client to an Index Server, and as a server for sharing file data with other Peers
Key technologies
- Java
- Concurrency
- TCP/IP Connection
- Distributed System
Server
The Server accepts TCP connections and uses a request-per-connection session protocol as defined in Server.java. The session consists of a welcome message, an authentication step, and then a single request using a request-reply protocol.
WelcomeMsg: sent by the server as the first message on any new connectionAuthenticateRequest: sent by the client to request authenticationAuthenticateReply: sent by the server in response to aAuthenticateRequest
Following the handshake, a single request can be made, using one of the following messages:
ShareRequest: allows the Peer to provide the Index Server with details of a file to indexDropShareRequest: allows the Peer to request the Index Server to remove the details of a file that it previously indexedSearchRequest: allows the Peer to search for files on the Index ServerLookupRequest: allows the Peer to obtain a list of Peers that are sharing a given file
Each of the requests above has an accompanying reply message from the Server.
The server can be run locally or deployed to run on a cloud server. You can specify the IP address and port number of the server when you start the server. If you don’t, the default IP address is localhost and the port number is 3200.
Peer
The Peer uses a terminal text GUI that is best run in a UNIX/Linux terminal. When the application runs the h key can be pressed for help on using the application.
In the peer GUI, there are range of features that users can operate:
File Share: allows the Peer to share a file in the local computerSearch: allows the Peer to search files that have been shared by other peersConfig: allows the Peer to config the server’s IP address that they want to connectDownload: allows the Peer to download the files that was searched
Key achievement
The final score for this project was 9.5/10. The system was able to successfully share a one or two gigabyte sized video while successfully downloading and playing it within the allotted time.