My first thought is: what makes you think that you have read an entire
frame of data, and a *single* frame of data? socket read very rarely
conveniently forms itself into complete frames. Please see
My second thought is: you told it to use the *entire* buffer, not just the
"valo" bytes that you know are valid - in which case the message is
*basically* right - you have garbage at the end of your buffer. You should
use the MemoryStream constructor that lets you control this:

    new MemoryStream(buffer, 0, valo);

(note this should be after checking "valo" is positive, and you also need
to think about things like back-buffers if your messages turn out to be
larger than "buffer.Length")

Thirdly: how was the data serialized? Did it use the WithLengthPrefix and
the same PrefixStyle?

Marc (protobuf-net)

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 post to this group, send email to
Visit this group at
For more options, visit

Reply via email to