To parse individual messages out of a stream of them there needs to be a start message flag that signals the beginning of a message. Just pick a unique character or pattern of characters and put that at the beginning of each message. Pick a different flag and put it at the end to identify where each message stops.