Re: [protobuf] Re: Protocol Buffers and asynchronous sockets

2009-11-24 Thread Kenton Varda
Yes, use std::string. The only potential problem is if your messages are very large -- allocating large contiguous blocks of memory (as std::string does) could lead to memory fragmentation. But for small and medium-sized messages, there's no reason not to use std::string as the buffer. Parsing f

Re: [protobuf] Re: Protocol Buffers and asynchronous sockets

2009-11-24 Thread Evan Jones
Gilad Ben-Ami wrote: > Do you think that using std::iostream in the following scenario would > work / be a good choice? > 1. read message_length > 2. buffer message_length bytes into iostream variable. > 3. when all data is received, use IstreamInputStream to wrap the > iostream and have it parsed

Re: [protobuf] Re: Protocol Buffers and asynchronous sockets

2009-11-24 Thread Evan Jones
Gilad Ben-Ami wrote: > So in this case, what is the best method to use PB? > Should i use SerializeToArray and ParseFromArray instead of using the > protobuf::io streams? To use protocol buffers with an asynchronous library, you need to collect the data for the message is some data structure unti