This is a protobuf question and would be better served on that project's 
lists.

Having said that, unless you're having trouble deserializing the message to 
retrieve the original bytes, I wouldn't fret over the serialized size of 
`msg` itself (assuming that's what you were referring to when you said 'msg 
have two more bytes') being a smidgen larger than its contents. If you're 
using protobuf 3.x (the major version family that gRPC uses), your fields 
will be automatically 'optional' (in protobuf 2.x parlance), for example, 
and their presence/absence thus needs to be noted in the serialization 
*somehow*.

On Thursday, December 22, 2016 at 10:34:10 AM UTC-8, [email protected] 
wrote:
>
> I defined a simple message below
> message MfStream {
>   bytes message=1;
> }
>
> After calling msg.set_message(), code shown below, I serialized msg and 
> noticed the msg have two more bytes than the (buf and len). What is the API 
> I can use to serialize to the original buf and len? Look forward to your 
> reply. Thanks.
>
>
> char* buf;
> int len;
> ...
> ...
> MfStream msg;
> msg.set_message(buf, len);
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" 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 https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/ecb33809-206a-43ed-9b74-67e6befdac8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to