Boost logo

Boost Users :

From: Gerd Ritter (gerd.ritter_at_[hidden])
Date: 2007-01-09 03:56:00


Hi Christian,

I have looked at the boost::asio implementation. From what I can see it does
use boost::serialization but it wraps each object into it's own archive
object inside for every time you call async write (from
/example/serialization/connection.hpp):

void async_write(const T& t, Handler handler)
{
    // Serialize the data first so we know how large it is.
    std::ostringstream archive_stream;
    boost::archive::text_oarchive archive(archive_stream);
    archive << t;

This works fine but has a couple major drawbacks: a) for each object to be
sent a new archive is created and destroyed (performance) b) none of the
pointer tracking and other boost::serialization features are available and
c) especially for small objects this will create serious bandwith "bloat"
since each archive contains at least a 27byte header.
What I want to achieve is to keep the archive open for the duration of the
life time of the connection or logical session which may allow for socket
reconnects. I will look into using asio for socket handling though. If I can
make it work I'll share the code, maybe it can be included in asio which
would be good because I wouldn't have to maintain it ;-)

Regards,

Gerd

> Date: Mon, 8 Jan 2007 15:02:34 -0500
> From: "Christian Henning" <chhenning_at_[hidden]>
> Subject: Re: [Boost-users] boost::serialization fundamental question
> about "block read/write"
> To: boost-users_at_[hidden]
> Message-ID:
> <949801310701081202n5533ba61n41e96dd48945817c_at_[hidden]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi Gerd, I'm sure you know that already. But, have you taken a look at
> boost::asio? There is even an example for using the serialization lib
> when sending objects over a socket.
>
> Here a link:
>
http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/examples/index.html
>
> Just scroll down a bit to the Serialization section.
>
> Christian
>
>
> On 1/8/07, Gerd Ritter <gerd.ritter_at_[hidden]> wrote:
> >
> > Hi,
> >
> > I have a more fundamental question/inquiry about the serialization
library.



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