Installation Copy the Peer.class, RequestListener.class

Compilation The program consists of,, and The main driver of the program is which is to be compiled using the javac command: >javac Installation Copy the Peer.class, RequestListener.class, and RequestSender.class into a folder in multiple computers that are on the same network, then run the Peer program using the java command: > java Peer [group IP] [port] [peer ID] Where [group IP] is an IP address for group of peers to communicate, [port] is a number where to communicate, and [peer ID] which is a unique ID for each peer to be executed that will join a group. To terminate the running program, press CTRL+C multiple times from the keyboard. Screenshot of Execution 1. 3 peers (with ID of Peer1, Peer2 and Peer3) joins the same IP multicast group. The IP address used is and port number 5555. 2. At the beginning, Peer1 possesses peer1file.txt, Peer2 possesses peer2file.txt, and Peer3 possesses peer3file.txt. 3. Peer2 requests peer3file.txt, which was found in Peer3 and then downloaded from Peer3 into Peer2. 4. Peer3 requests peer1file.txt, which was found in Peer1 then downloaded from Peer1 into Peer3. The above demonstration showed that a peer is both a client and a server to share files. Suggestions for Improvement The program has flaws because it assumes that all files being transferred are text files which is where an improvement can happen, such that the peers should be able to send any kind of files including binary file. The program also assumes that the file being requested exists in one of the peers. This can be improved by further adding fail-safe checks if in case none of the peers has the file. It also assumes that the file exists in one and only peer and there is no check on the possibility if the file exists on multiple peers which is another improvement for the program.

Leave a Reply

Your email address will not be published.