Protobufs are pretty much designed to be read all at once. The normal
thing would be to define a stream format that prefixes the serialized
protobufs with their length and buffer the data until a whole protobuf
has been read.

In other words: you should not describe the whole stream as a single
protobuf (like you often would with, say, XML) but instead use a
different format for framing a stream of protobufs.

Regards,
   Mika

2009/11/24 Gilad Ben-Ami <gilad...@gmail.com>:
> Hey,
>
> I'm using ACE library for C++ and it's reactor pattern for handling
> asynchronous read from  / write to sockets.
> I'm trying to integrate Protocol buffers into my solution in order to
> exchange data with another process developed in Java.
>
> The way asynchronous work, forces me to know in advance what is the
> expected message size and only after i have all the data try to parse
> it with PB.
> What is the best way to use PB in this scenario? Is there any Stream i
> can use to hold the data arrived? and i can i recover from trying to
> parse a message that has failed because of not enough data arrived?
>
> Your help is appreciated.
> Thanks.
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to 
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/protobuf?hl=en.
>
>
>

--

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


Reply via email to