Protocol documentation

From Insane

Jump to: navigation, search

if you ar interested in developing your own application using paircoding here is a protocol documentation of TooFree to make it easier to create a TooFree compatible program..



The protocol uses UTF-8 encoding of characters. It uses java classes for this so if you program in java please note that modified UTF-8 is not UTF-8. Normalization form in Java should be the same as in C.

Messages are separated by the "new Line" character.

Usually the protocol should run like this:

Both send a "DownloadMessage" which determines who will download and who upload

Then the Downloader sends a BlockRequestMessage in which he specifies what blocks he wants.

The uploader answers with a BlockAffirmMessage in which he tells what block he is willing to upload

Then the downloader answers with the same BlockAffirmMessage if he aggrees with the uploader that the proposed block is useful

after this the streams are flushed.. then the uploader will start sending data on the stream.


DOW lottery id supports

lottery is a random positive (java.lang.Integer) as string. if a client has finished his file he must send -1 the client with the higher lottery number will be the downloader, the other is the uploader

id is a locally(on his computer) unique identifier the peer sends to diffrentiate multiple instances of the program running under the same ip

supports supports is an optional string to announce new protocol features and changes...


BRM noEncoding blocks

noEncoding is a boolean value as a string usually false ... if set to true the peer signals that he doesn't want to use networkcoding and will only take unencoded blocks

blocks is a bitmask over all blocks for each block stand 2 Bits - 00 means "no need for that block" - 01 means "already have one component of that block" - 10 means "have nothing of that block" - 11 is reserved for requesting the block on high priority

the bitmask is encoded in Base-64 afterwards and the newline chars in Base-64 are replaced with "space chars"

Block Affirm Message

BAF BlockIDa BlockIDb mula mulb

BlockID stands for the number of the block one linear component represents

mul stands for the linear factor of that component

Personal tools