[protobuf] Re: Serialize with Length Prefix

2013-02-20 Thread Paul Shafer
First time poster and new to protobuf/protobuf-net so forgive me if this has already been addressed. But I've searched quite a bit and cant find anofficial answer. If you want to use the fieldNumber argument in your SerializeWithLengthPrefix/TryDeserializeWithLengthPrefix for message type

Re: [protobuf] Re: Serialize with Length Prefix

2013-02-20 Thread Marc Gravell
this seems to be a resurrection of a protobuf-net specific discussion, so let me jump in... The SerializeWithLengthPrefix method, by default, aims to represent data in a way that is a valid protobuf stream - in particular, as though it were simply a member of a parent object or list. As such, it

Re: Serialize with Length Prefix

2009-08-25 Thread Marc Gravell
Just to offer my thanks as well, since I was offline at the time and unable to help. Regards, Marc Gravell (protobuf-net) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this

Re: Serialize with Length Prefix

2009-08-24 Thread Peter Keen
You sort of have to roll your own. In my project I'm doing something like this: coded_output-WriteVarint32(message-ByteSize()); message-SerializeToCodedStream(coded_output); And then on the reading side: uint32_t size; if (! coded_input-ReadVarint32(size)) { return NULL; // just an example.

Re: Serialize with Length Prefix

2009-08-24 Thread Peter Keen
On Mon, Aug 24, 2009 at 4:17 PM, Jay Thomasjaydianetho...@gmail.com wrote: This code ideally has to operate with C# code on the other side of the socket that uses the DeserializeWithLengthPrefix() method call.  The message originates in C++ environment on a linux box and terminates in C#

Re: Serialize with Length Prefix

2009-08-24 Thread Peter Keen
I looked at the protobuf-net source a little bit and it looks like if you write the length with WriteLittleEndian32 instead of WriteVarint32 you should be good to go, as long as you use PrefixStyle.Fixed32 within the C# call to DeserialzeWithLengthPrefix(). --Pete On Mon, Aug 24, 2009 at 4:17

Re: Serialize with Length Prefix

2009-08-24 Thread Jay Thomas
cool. thanks Pete. your help is greatly appreciated! On Aug 24, 4:33 pm, Peter Keen peter.k...@gmail.com wrote: I looked at the protobuf-net source a little bit and it looks like if you write the length with WriteLittleEndian32 instead of WriteVarint32 you should be good to go, as long as