So for those of you who, like me, didn't know what Bencode is, here's the description from wikipedia[0]:
Bencode (pronounced like B encode) is the encoding used by the peer-to-peer file sharing system BitTorrent for storing and transmitting loosely structured data.
It supports four different types of values: byte strings, integers, lists, and dictionaries (associative arrays).
...
While less efficient than a pure binary encoding, bencoding is simple and (because numbers are encoded as text in decimal notation) is unaffected by endianness, which is important for a cross-platform application like BitTorrent. It is also fairly flexible, as long as applications ignore unexpected dictionary keys, so that new ones can be added without creating incompatibilities.
2 comments
[ 3.1 ms ] story [ 16.1 ms ] threadBencode (pronounced like B encode) is the encoding used by the peer-to-peer file sharing system BitTorrent for storing and transmitting loosely structured data.
It supports four different types of values: byte strings, integers, lists, and dictionaries (associative arrays).
...
While less efficient than a pure binary encoding, bencoding is simple and (because numbers are encoded as text in decimal notation) is unaffected by endianness, which is important for a cross-platform application like BitTorrent. It is also fairly flexible, as long as applications ignore unexpected dictionary keys, so that new ones can be added without creating incompatibilities.
[0] https://en.wikipedia.org/wiki/Bencode
Oh, and it doesn't guarantee that your message will fit in a single line. JSON can be encoded to a line.