On 5/22/07, bringiton bringiton
Thanks for tip aaron.
I'm planning on using a message length byte at the start of the packet. Therefore the reader reads the byte and then waits until there are X bytes in the stream before it reads.
Check out the Chat example in the Asio docs, it covers exactly this sort of scenario. Richard
I asssume you are talking about << and >> operators for parsing. My concern here is that if the message has not been completely sent, then the reader will be blocked. I'm using TCP asynchronously.
On 5/22/07, Aaron W. LaFramboise
wrote: bringiton bringiton wrote:
Are there any solutions to this? ie building messages as they come in through the TCP stream.
Parse data from a socket stream the same way you'd parse data from any other sort of stream, such as a file. That is, design the protocol such that end-points can parse the message using its own contents, rather than meta-data such as 'messages.'
Possibilities: 1) Use delimiters. A. Use text and use CRLF for a delimiter. B. Use a special octet as a delimiter, such as the null character. 2) Use message content-length _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users