dumbstreaming /

Filename Size Date modified Message
29 B
282 B
598 B
1.0 KB
107 B
3.2 KB
4.4 KB
561 B
23 B
6.3 KB
423 B
5.1 KB
2.3 KB
This library packs/unpacks string messages in byte stream.

Protocol description:

Int = '0' | '1'..'9' ['0'..'9']*

  decimal representation of integers without leading zeroes.


Stream = Message* End-of-stream

Message = (Int as len) \x0A
          User-message \x0A

  where len is User-message length in bytes.  One should not
  generate messages with length more than 10 digits.

End-of-stream = \x0A


Stream = Message* End-of-stream

Piece_len = \x20 (Int as piece_len)

Piece_data = User-message \x0A

Message = (Int as total_len) \x20 (Int as pieces_count) Piece_len* \x0A

  total_len is the length of all piece_len's (i.e. length of all
  Piece_data elements excluding their \x0A).
  One should not generate messages with total_len more than 10 digits.

  pieces_count is the count of Piece_len and Piece_data elements, it must
  be non-negative.

  Every piece_len must be the length of corresponding User-message
  in bytes.