I want to use tcp to catch BERT-encoded messages, and I'm confused a little. binary_to_term(X) decodes only first term, without giving me back the rest of binary, nor saying how much did it use. Encode back with term_to_binary(X) to see it's size is not an option, because BERT-encoding methods differs(for example, it encodes all ints as long ints).
So, how do I decode the messages? The only valid option is passing the binary size too?
Send size of the encoded term before the term itself. You can even use {packet, 2} option to read packets like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With