Monthly Archives: March 2009

Error checking (kind of)

If you want to know the character (for error control purposes) of a Spanish identification document, just perform the modulo 23 operation over the DNI number. Then use the next table. That’s it.

0 T 12 N
1 R 13 J
2 W 14 Z
3 A 15 S
4 G 16 Q
5 M 17 V
6 Y 18 H
7 F 19 L
8 P 20 C
9 D 21 K
10 X 22 E
11 B

And if you want to get a better idea about how CRC works you can visit this old post. There is a detailed Wikipedia article too.

Chapter #5 slides

Oops, I’ve almost forgot to post it here. You can click on the title to get the file.

Lab#8

Just click on the title.

IPv6 survey result

It was published recently on NetworkWorld site. ISP’s are not seeing a big business drive for IPv6.

Sample implementation of assignment#3

You’ll need it if you’re planning to do assignment#4 but you did not do #3. Source code is available here. It consists of a main class and three additional classes one for each server (peer, query and file server).

Better late than never

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 ./ 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.


$ 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 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 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!!

Interesting video

Last assignment is out


Fourth and last assignment completes the P2P software you started building on #3. Therefore you’ll need to add the #4 code to the one you wrote for #3. If you did not do third assignment but you’d like to attempt the fourth, please contact me for a reference implementation for third assignment (once #3 due time has expired).

This last assignment takes care of the user interface of the peer to peer program, that allows the user to search for files on the network of peers and to download a file from a peer. It also takes care of maintaining a “live” list of active peers (pruning it when a peer is found not responsive).

Due date is April 30th, 2009.

Assume command line information is correct.

Lab #7 available only in Spanish

Just click on the title to get the file.