I'm encoding, sending and decoding data using sockets/networkStream. But how can I effectively separate messages from each other ?
For example, when I use a 1024 byte buffer, then receive stuff via networkStream. Then I wanna pass that buffer on to my decoder class, but I'm not sure if part of the next message is already lurking in the buffer. If my message has only 50 bytes, how do I know that there are not 20 messages in that buffer ? Or worse, could there be partial messages in my buffer ?
Let's say my message has 3000 bytes, could there be a message and the start of a second message in a buffer? Or does networkStream automatically receive messages in packages as they were sent ?
\n\nas a terminator in your question. - jgauffin