Starting with v100, each message exchanged between client and server is prefixed with a 4-byte header containing the big-endian (network order) binary representation of the length of the message string.
Refer to the official IB API implementations for the exact steps to encode and decode the messages.