When I send multiple messages, I should delimit them, and parse the buffer.
What is the best way delimitting it that you can recommend me ? On Jan 13, 8:18 am, Kenton Varda <[email protected]> wrote: > Read all the bytes into a buffer, then parse the buffer once you have the > whole thing. > > On Mon, Jan 12, 2009 at 4:11 PM, chongyc <[email protected]> wrote: > > > Thank you very much for your help. > > > I want parsing string 's' by reading each a byte from s. > > > What is alternative way that you can recommend to me. > > > On Jan 12, 11:28 am, chongyc <[email protected]> wrote: > > > I write test code following below. > > > > t2r::prot::Request msg0, msg2, msg3, msg4; > > > std::string s; > > > > // set all fields of msg. > > > ..... > > > ..... > > > > bool b; > > > b = msg0.SerializeToString(&s); // OK > > > msg0.PrintDebugString(); > > > > b = msg2.ParseFromString(s); // OK > > > b = msg2.IsInitialized(); // OK > > > msg0.PrintDebugString(); > > > > for(int i= 0; i < s.size(); ++i) > > > { > > > char c = s[i]; > > > > std::cout << "============== " << i << " > > =====================" << > > > std::endl; > > > > google::protobuf::io::ArrayInputStream inp(&c, 1); > > > google::protobuf::io::CodedInputStream decoder(&inp); > > > b = msg3.MergeFromCodedStream(&decoder); // > > FAILED > > > msg3.PrintDebugString(); > > > > std::cout << "********************************" << > > std::endl; > > > > b = msg4.MergePartialFromCodedStream > > > (&decoder); // OK > > > msg4.PrintDebugString(); > > > b = msg4.IsInitialized(); // FAILED > > > } > > > > b = msg3.IsInitialized(); // FAILED > > > b = msg4.IsInitialized(); // FAILED > > > > I want parsing string 's' by reading each a byte from s. > > > What is wrong. > > > Please help me. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---
