Some protocols, e.g. TCP, do not not guarantee to keep message boundaries. One common approach to distinguish such messages is Length Prefixing, which prepends each message with its length.