On Tuesday, March 26, 2013 7:05:21 PM UTC+1, Feng Xiao wrote:
>
>
>
>
> On Tue, Mar 26, 2013 at 2:06 AM, Benoît Seutin
> <[email protected]<javascript:>
> > wrote:
>
>> Hello,
>>
>> I have to implement a TCP server which receives messages from another
>> entity.
>> The structure of these messages is well specified in a document.
>>
>> As there is a well-structured bunch of messages types, I envisage to use
>> Protocol Buffers.
>>
>> But I am facing two problems:
>> - The fields have fixed sizes and therefore are not encoded with the
>> method of Protocol Buffers.
>>
> You can implement the decoding/encoding logic for this new wire format
> using message reflections, just like how the TextFormat class is
> encoding/decoding protobuf messages into/from text data.
>
Unfortunately the packets are not encoded on client-side with Protocol
Buffers, that is the problem !
I plan to test Thrift instead.
>
>
>> - There are some fields of 8-bits and 16-bits length. I do not know how
>> to handle this except with bytes .proto type but how to master the size ?
>>
> Using int32 field for them should be more efficient. You can annotate the
> length information with custom options, e.g.:
> extend proto2.FieldOptions {
> optional int32 bits = 1;
> }
> message SomeMessage {
> optional int32 a = 1 [(bits) = 8];
> optional int32 b = 2 [(bits) = 16];
> optional int32 c = 3;
> }
> and make use of this length info when serializing.
>
>
>>
>> Thanks for your support
>>
>> Benoît
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/protobuf?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.