With the supplied network data and example proto schemas: the error message
is correct. Firstly, note that you need to indicate (to
DeserializeWithLengthPrefix) that we aren't using spoof field-numbers along
with the headers; basically - tell it to use field-number zero:
Command comando =
Serializer.DeserializeWithLengthPrefix<Command>(streamR,
PrefixStyle.Base128, 0);
ChannelInfo chInfo =
Serializer.DeserializeWithLengthPrefix<ChannelInfo>(streamR,
PrefixStyle.Base128, 0);
(note the final 0 at the end)
With this, the first message deserializes fine - the name is "ChannelInfo".
The second message, however, fails. It fails because the second message
starts: 0x0a, 0x14 - meaning "field 1, length prefixed, 20 bytes" -
however, field 1 on ChannelInfo is "fixed32 serialNr = 1". This is *not* a
valid match for a length-prefix wire-type. So; I can only conclude that
either the .proto is wrong, or the second message is not actually a
ChannelInfo. It does not match the definition.
Marc
--
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.
For more options, visit https://groups.google.com/d/optout.