Monday, April 30, 2012

Second test has been marked

Mark shown [column X7] is the number of correct answers, remember the test contained a total of 15 questions.

Monday, April 23, 2012

And the 8th and last lab

Is available now.

But remember we will have next week a lab exam and the other a public presentation of assignments. So this one is the last one adding more stuff to study only.

Friday, April 20, 2012

Exercise 4 CRC-16 calculation

Mask represents the generator polynomial
(A001 == x^16 + x^15 + x^2 + 1 where x^16 is gone and LSB represents x^15).

Data bits are fed from LSB to MSB
At each iteration CRC is shifted to the right one bit
If data bit and LSB in CRC do not match, then crc ^= mask

So for data = 0x41
initial crc = 0x0000
first bit = 1
does not match crc's LSB so shift + xor
crc=0xa001
second bit = 0
does not match crc's LSB so shift + xor
crc=0xf001
third bit = 0
does not match crc's LSB so shift + xor
crc=0xd801
fourth bit = 0
does not match crc's LSB so shift + xor
crc=0xcc01
fifth bit = 0
does not match crc's LSB so shift + xor
crc=0xc601
sixth bit = 0
does not match crc's LSB so shift + xor
crc=0xc301
seventh bit = 1
shift only
crc=0x6180
eighth bit = 0
shift only
crc=0x30c0

Optional assignment

This assignment will be based on a peer-to-peer protocol invented for the occasion. The so-called "P+2" protocol has been created to be one of the simplest P2P protocols (but not any simpler). You need to read and to understand the protocol specification.

Your job is to create a basic peer that will consist of a server and of a client part. Only the client part interacts with the user.

For helping you out in the developing process I have created both a sample peer and a test tool.

The test program is intended to be run in the same computer as your server code, 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

To run the sample peer you have to type:

java -jar P2P.jar folder port known_listserver:port

You can also find interesting the following implementation guide:



p_2

Please ignore any dates mentioned in the documents above, as it belongs to last year's dates.

The day assignments can be shown and presented in the lab is May 9th. Turning it in at a later date is possible but then public show won't be possible. At any rate, the assignment won't be accepted after May 31st.

Wednesday, April 4, 2012

Easter fun

Once you're fed up of looking for hidden eggs this Easter you can do some exercises. I have added these three sets. Some of them are solved some are not.