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 e

[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 an"official" answer. If you want to use the fieldNumber argument in your SerializeWithLengthPrefix/TryDeserializeWithLengthPrefix for message type i

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 gr

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 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 you use PrefixStyle

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 PM

Re: Serialize with Length Prefix

2009-08-24 Thread Peter Keen
On Mon, Aug 24, 2009 at 4:17 PM, Jay Thomas 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# environment on a window

Re: Serialize with Length Prefix

2009-08-24 Thread Jay Thomas
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# environment on a windows PC. Why doesn't C++ support the same methods as C#? The o

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 examp

Re: Serialize with Length Prefix

2009-08-24 Thread Jay Thomas
Some things I forgot to mention: -working on Slackware Linux platform -did text search for DeserializeWithLengthPrefix() and haven't found any header or code files with this method -was able to find lots of serializing methods in message.h but that same header file doesn't contain any methods star

Serialize with Length Prefix

2009-08-24 Thread Jay Thomas
Hello I am looking for a way to serialize/deserialize with length prefix under c++. The serialized bytes will sent to a TCP socket. I am aware that C# has a method SerializeWithLengthPrefix() and DeserializeWithLengthPrefix(). Are there any such analogous methods for C++? Please point out any