Hi Alex,

Kenton Varda wrote:
> On Mon, Sep 8, 2008 at 9:11 PM, Alex Loddengaard 
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
>
>     I have a follow-up question:
>
>     Will using
>     /messageInstance.newBuilderForType().mergeFrom(input).build();/
>     work for a stream that contains trailing binary information?
>
>
> No, it won't work.  Protocol buffers are not self-delimiting.  They 
> assume that the input you provide is supposed to be one complete 
> message, not a message possibly followed by other stuff.
>
> You will need to somehow communicate the size of the message and make 
> sure to limit the input to that size.
Aha.  This <binary>message<binary> case is one of the heretofore 
hypothetical use cases I am discussing in the adjacent thread on this 
mailing list / group.  The thread is online at

http://groups.google.com/group/protobuf/browse_thread/thread/b0ce2c7d8b05896e?hl=en
and was spawned from
http://groups.google.com/group/protobuf/browse_thread/thread/b0ce2c7d8b05896e?hl=en#

This is mainly myself, Jon, and Kenton slowly forming a consensus on the 
right API for delimited messages.  I had proposed simply adding the 
length (varint) before the message, and Kenton demonstrated c++ code for 
this.  Jon proposed adding a field number / wiretype tag before the 
length and message, which makes it look much more like a protocol-buffer 
field on the wire.

What do you need Alex?

-- 
Chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to