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?