After some questions I’ve learned that I mention nowhere what the expected command-line parameters order for #3 and #4 is. Three are the parameters you need: port number, shared folder and initial peer, like this:
$ java P2P 7123 ./ 220.127.116.11:7777
| | |
port | |
I just thought this afternoon that a test tool might come in handy for you to test your assignment #3 servers. So here you have such a tool. Please remember a full implementation of a peer was also available (as another way to test that your server works nicely).
The test program is intended to be run in the same computer as #3, so you only need to provide the port information.
$ java P2Tester 7777
>>> CONNECT OK
>>> READ FROM FILE (first ten bytes): FileServer.class
ca fe ba be 00 00 00 32 00 72
Please note the output above shows the expected behaviour where you have three sections. On the top it is the peer list, after connect ok message that tells you the three server ports are open (p, p+1 and p+2). Next you have the list of filenames (only if your code reacts this way to an empty line query, something mine does) and in the third place you have the first 10 data bytes of the filename that appears last on your file list (FileServer.class).
Please note the file is not read from the filesystem but sending a file download request to your server listening on port P+2.
Also note that peer 18.104.22.168:1234 might not appear on the peer list till you run test program twice.
Do not use an empty folder for your P2P server: share some files!!