For example if the message is x bytes long then you first send 'x' then you send the x bytes of the message.
Or your messages have a defined header that contains the length of the message payload.
For example if the message is x bytes long then you first send 'x' then you send the x bytes of the message.
Or your messages have a defined header that contains the length of the message payload.