I experimented a bit with asynchronous TCP socket messages between two programs to transfer data, numbers, and / or text. I did this to use the keyword at the beginning of each post, and then divide the values by "|" character. Therefore, the message may look like this:
"DATA | 490 | +40517.9328222222 | 1 | 6 | 11345 | 11347 | 11344 | 11345 | 106 | +40517.8494212963"
I set the read buffer size to 1024, since most messages will be within this length. However, sometimes I can quickly send many short messages, where several of them are less than 1024 characters, and it looks like it will be read at a time. And if I send a message longer than 1024 characters, it will be split. So I'm looking for tips on how to handle this. Should I use some special characters to start and / or end each message? Would get some tips on how you do it.
source
share