Boost logo

Boost Users :

From: Richard Dingwall (rdingwall_at_[hidden])
Date: 2007-05-22 19:14:01


On 5/22/07, bringiton bringiton <kneeride_at_[hidden]> wrote:
> 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 <aaronrabiddog51_at_[hidden]> 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_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net