Am 2018-02-20 um 12:21 schrieb [email protected]:
> 
> Many thanks for the answer. I read the documentation several times, But I did 
> not understand how to compose the header of the package. As a result, I 
> figured out that the last byte is the length of the package. Everything worked

The header consists of *all four* bytes.  Using only the last byte only works 
for very short messages.

In Python, I’m using a struct to create the header from the actual 
message length:

Header = struct.Struct('!L')  # ! = big-endian, L = unsigned long
header_bytes = Header.pack(msg_len)

https://gitlab.com/sscherfke/aiomas/blob/master/src/aiomas/channel.py#L205
https://docs.python.org/3/library/struct.html

Reply via email to