Good implementation (with duck typed programming languages) will permit to send and receive (flat) arrays.
In most text protocols, we receive a chunk of network bytes and check for ending valuee (like CR, CR-LF, empty lines or a 'dot only' lines (like in SMTP).
If the received chunk is not yet complete, we need to store it (bufferring) and wait for more data.
In general, it's more interesting to know about how many data we will receive, and to let the low level socket part wait for the right amount of data before continuing the 'normal' execution. It's the goal of this protocol.
This encoding is perfect for all message/block passing applications.
The LLenc will code in the first byte, the length of the length of the successive datum (except for case 1).
ASCII Values:| 1 | 49 ('1') to 57 ('9') | Base 1 (values from 1 to 9) |
| 2 | 65 ('A')- 90 ('Z') | Base 10 (values from 10 to 10^26-1) |
The choice of the base, depend of the length we must encode. When the first choice is no more possible, we skip to the next one. The goal is to be short and easily readable (in base 256, things are no more readable).
If we need to encode a datum of a length < 10, we use: