On Fri, Apr 15, 2011 at 9:48 AM, platzhirsch
<konrad.rei...@googlemail.com>wrote:

> Right! I think I refactored the whole writing and reading, still I am
> stuck. However by this I get this Exception:
> com.google.protobuf.UninitializedMessageException: Message missing
> required fields: name
>
> In C++:
>
> Name name;
> name.set_name("platzhirsch");
>
> boost::asio::streambuf b;
> std::ostream os(&b);
>
> ZeroCopyOutputStream *raw_output = new OstreamOutputStream(&os);
> CodedOutputStream *coded_output = new CodedOutputStream(raw_output);
>
> coded_output->WriteLittleEndian32(name.ByteSize());
> name.SerializeToCodedStream(coded_output);
>

You'll need to destroy the CodedOutputStream, which will flush data that's
been buffered internally. We should probably make this clearer in the docs.

socket.send(b);
>
> In Java:
>
> NameProtos.Name name =
> NameProtos.Name.parseDelimitedFrom(socket.getInputStream());
> System.out.println(name.newBuilder().build().toString());
>
>
> ---
>
> I can't find out where the problem might be.
>
> --
> 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
> 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 protobuf@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