Peer-to-Peer (P2P) is a type of distributed systems, in which every peer is both a client to request services from other peers and a server to provide services to other peers. Chapter 10 of the textbook focuses on P2P systems and there are a lot of published academic articles about P2P systems such as:

Rodrigues, R., Druschel, P., 2010. Peer-to-Peer Systems, Communications of the ACM. 53(10), 72-82. (available at http://zoo.cs.yale.edu/classes/cs426/2012/bib/rodrigues10peer-to- peer.pdf on 8 th May 2017).

You may need to access the above resources for conceptual understanding of P2P. However, the knowledge and programming skills that you need for this assignment are the TCP streaming and UDP datagram communication between client/server. The unit lab has practised a number of projects for TCP and UDP for client/server communication; in this assignment you will need integrate both the client and the server components into a peer. To complete this assignment, you need to complete the following 2 parts.

Part 1: Peer Programming

Among many P2P applications, file sharing is a typical application to share available files across all peers of an overlay. In this part, you are to develop a simplified P2P file sharing system. The assumptions on the system are specified as follows.

1. Peers form a networking overlay by IP multicast (reference to Chapter 4.4 of the textbook, Week 5 lecture slides, Week 6 lab projects, and search for other academic articles about IP multicast if necessary).

2. Each peer has a unique ID.

3. Each peer possesses a number of files that can be shared by other peers.

4. Each peer multicasts a file sharing request to all other peers in the overlay. The requested file can always be found but can be found from a single peer only.

5. Once the file is found, the peer, which requests the file, will download the file from the peer, which possesses the file.

6. The shared files are just in plain text format only.

The following screenshots show an implementation of the above file sharing system.

1. 3 peers (with ID of PPP1, PPP2 and PPP3) joined the same IP multicast group. Note: 228.5.6.7 and 8888 are the IP multicast address and port number that were used in this example.

Figure: see image.

2. At the beginning, PPP1 possessed file1, PPP2 possessed file2 and PPP3 possessed file3.

Figure: see image.

Figure: see image.

3. PPP1 requests file2, which was found in PPP2 and then downloaded from PPP2 into PPP1.

Figure: see image.

4. PPP2 requests file3, which was found in PPP3 and then downloaded from PPP3 into PPP2.

Figure: see image.

5. PPP3 requests file1, which was found in PPP1 and then downloaded from PPP1 into PPP3.

Figure: see image.

The above example shows the equity between peers, that is, every peer is both a client and a server to share files.

To implement the framework, you need to implement. The peers main thread for starting the application. The main thread will create at least two independent threads, of which one is responsible for sending a request to all other peers by IP multicast and downloading the found file from a peer, and the other thread is responsible for sending a file once it is requested by other peers. In addition, it is required to use UDP protocol for IP multicast of requests and to use TCP protocol for file sending/downloading. Note: a good practice is to implement the 3 threads by 3 Java classes like Peer.class, PeerService1.class and PeerService2.class in the above screenshots.

Part 2: Documentation

After the implementation of the framework, prepare a document to include:

1. An end user instruction about how to use your system.

2. Any suggestions about possible improvement of the proposed system.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.