Recent Question/Assignment
The Assignment-2 Specification and Marking Criteria
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-topeer.pdf on 8th 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.
2. At the beginning, PPP1 possessed file1, PPP2 possessed file2 and PPP3 possessed file3.
3. PPP1 requests file2, which was found in PPP2 and then downloaded from PPP2 into PPP1.
4. PPP2 requests file3, which was found in PPP3 and then downloaded from PPP3 into PPP2.
5. PPP3 requests file1, which was found in PPP1 and then downloaded from PPP1 into PPP3.
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 peer’s 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. Submission
You need to provide the following files in your submission.
1. Files of Java source code of the implementation. The in-line comments on the data structure and program structure in the programs are required. These source code files must be able to be compiled by the standard JDK (Java Development Kit) or NetBeans from Oracle (http://www.oracle.com/technetwork/java/index.html).
2. The compiled Java class files of the source code. These Java classes must be runnable on the standard Java Runtime Environment (JRE) or NetBeans from Oracle
(http://www.oracle.com/technetwork/java/index.html).
3. A Microsoft Word document to address the issues as specified in Part 2 above.
All the required files must be compressed into a zip file for submission. You must submit your assignment via the online submission system from the unit web site. Any hardcopy or email submission will not be accepted. After the marked assignments are returned, any late submissions will not be accepted.
The Marking Criteria
Marking Criteria Available Marks
Part 1: Peer Programming (compilable Java source code file with necessary in-line comments, runnable Java class files) 27.0
1. The peer’s main application 4.0
• Create and join the multicast group 2.0
• Create service threads 2.0
2. Requests multicasting (UDP protocol) 7.0
• Continuously accept a user’s input file name 2.0
• Construct a request to include enough information for file sharing 3.0
• Use UDP to multicast the request 2.0
3. Request process 7.0
• Only process the multicast requests from other peers 2.0
• Check whether the peer has the requested file 3.0
• Send the requested file (if applicable) 2.0
4. File download (TCP Protocol) 9.0
• Use TCP to create a data stream 4.0
• Receive the file from the date stream 3.0
• Save the file into the permanent storage 2.0
Part 2: Documentation 8.0
1. Program use and test instruction 6.0
• Compiling and installation instruction are clear 2.0
• Test instruction covers the application scenario 2.0
• Necessary screenshots are provided 2.0
2. Suggestions for improvement 2.0
Sub Total for Assignment-2 35.0
Late Penalty -1.75 (5% each calendar day)
Plagiarism Penalty
Total for Assignment-2