Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-03-23 23:12:35


This was reported and is fixed in the next release.

Robert Ramey

rodolfo_at_[hidden] wrote:
>> Hi,
>> I use boost::serialization a lot to marshall c++ structures to be
>> sent
>> to a socket, like this:
>>
>> void send_update(ostream &out, const data_t &data)
>> {
>> {
>> text_oarchive oa(out);
>> oa << data;
>> }
>> out << "220 OK" << endl;
>> }
>>
>> The problem is that text_oarchive doesn't append a blank character to
>> denote the end of its data. If the last member sent to the oarchive
>> is
>> an unsigned 123 number, in this example the data sent would be
>>
>> ... (begining of data)... 123220 OK<CR>
>>
>> When processing this with text_iarchive, the last member gets the
>> value 123220, instead of 123.
>>
>> By appending an space (or \n) to the end, in ~text_oarchive, this
>> problem
>> is solved. Another worst problem is if the receiver uses blocking
>> socket connection (and no 220 OK is sent). After reading the last
>> digit (3),
>> it would wait for the next one, which wouldn't arrive, blocking the
>> connection. By having an space after the last digit, it would know
>> that
>> the data stream has ended and it wouldn't block anymore.
>>
>> I've wasted the whole day figuring why my application was blocking :(
>>
>> Thanks,
>> Rodolfo Lima
>>
>>
>> _______________________________________________________
>> Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador
>> agora! http://br.acesso.yahoo.com
>>
>
>
>
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost


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