Boost logo

Boost Users :

Subject: Re: [Boost-users] Sockets and structures?
From: Nat Goodspeed (nat_at_[hidden])
Date: 2009-09-25 12:14:11


OvermindDL1 wrote:

> On Fri, Sep 25, 2009 at 4:56 AM, pedro chaparro <pdro07_at_[hidden]> wrote:
>> hi, i'm wondreing if using asio library can i send a structure and not just
>> string messages using the boost::asiio:write command? or how could i do to
>> send a structure which have many information fields?
>> thanks

> As long as it is a POD without pointers, just give it the pointer to
> the beginning of it and the size. If it is not POD and/or has
> pointers, then send each element individually.

Or use Boost.Serialization to serialize your struct/class to a text
archive and stream that with asio.


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