Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2004-12-29 10:10:17


On Wed, 29 Dec 2004 00:27:23 -0500, Jody Hagins
<jody-boost-011304_at_[hidden]> wrote:

> I think Scott is saying that operator>> is insufficient because it can
> not do a partial read of what is there... it wants to snarf all 4K.

I think at least one person here is mixing pickles and milk, as my old
Latin teacher used to say.

Firstly, the serialization library doesn't use operator>> or
operator<< at all. If you're using these operators on some sort of
socket iostream and you don't want blocking to occur, thats your first
mistake.

When reading/writing data with sockets, its up to you to use an
appropriate protocol that can detect "message" boundaries so you know
when you have a complete block of data to work with. See for example
the BEEP protocol (http://beepcore.org/) for a nice specification and
implementation.

Don't tightly couple this communications layer to the application
layer. The two layers should just pass "complete" blocks of data
(e.g. serialized objects) between each other.

-- 
Caleb Epstein
caleb dot epstein at gmail dot com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk