$ java P2P 7123 ./ 158.42.53.17:7777
| | |
port | |
folder |
initial peer
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.
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).
$ java P2Tester 7777
>>> CONNECT OK
158.42.53.17:7777
158.42.53.17:8899
1.1.1.1:1234
P2P.class
QueryServer.class
ListManagement.class
Peers.class
FileServer.class
>>> READ FROM FILE (first ten bytes): FileServer.class
ca fe ba be 00 00 00 32 00 72
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 1.1.1.1: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!!
No comments:
Post a Comment