|
Boost : |
From: Scott Woods (scottw_at_[hidden])
Date: 2004-12-30 16:29:01
From: "Robert Ramey" <ramey_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, December 30, 2004 4:02 PM
Subject: [boost] Re: Re: Re: Serialization and async messaging
> Recieve
> =====
> {
> //open and input socket stream
> socket_istream is(???);
> // all current archves classes use basic stream interface - so
> {
> xml_iarchive ia(is)
> ia >> ...
> ...
> // done
> }
> }
>
> Let us know when you've got this working.
>
> Good Luck
Thanks :-) You will be the first to know.
ps:
While I dont think its significant anymore the code sketch you
give for receive still reflects file-based thinking. Heres another
sketch. Its not intended to keep things bouncing just a "view
from the other side". This is the type of code I have running
with my own "serialization" except no envelope layer (and
basic serialization ;-).
// Called by async framework
poll_or_FD_READ_handler( envelope_istream &is )
{
application_message am;
envelope_istream::iterator i, e;
// Following loop may run 0 or more times
e = is.end();
for( i = is.begin(); i != e; ++i)
{
// We have a completed envelope
xml_iarchive ia( i->payload );
ia >> am; // Requires complete input data
am(); // Application stuff
}
// Fall through here either because there are no more
// complete envelopes available on the connection *at this moment*.
// The envelope_istream may at this point be holding an incomplete
// parse, the assumption being that more data will arrive over the
// network and this routine will be called again.
}
Happy New Year!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk