Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-01-28 12:08:46


Seweryn Habdank-Wojewódzki wrote:

> The following works fine. This is just a small suggestion. IMHO it is
> very nice if I can serialize object (as binary, text or xml) through
> the socket, isn't it?

This is indeed an important application. But the serialization library
is not the place to implement it !!! The serialization library
depends upon the underlying streambuf (member of ?stream)
to implement any actual i/o - it is here that the connection
to sockets or special buffering should be made. In short

?socket_ostream os("name of socket, pipe or whatever")"

{
    xml_archive oa(os);
    for(;;){
        oa << ....;
        os.flush(); // send object to socket
    }
}

> Using additional buffers, just for creating "end of stream" sequence
> could make code buggy. Just one function as Pauld said eg. close() or
> send() will be nice.

Look in to makeing a custom stream buffer for your purposes.

Investigate the iostreams library for this purpose.

Robert Ramey


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