Adding the delete operator was good, now actually data it send, as the
socket.send function now returns a value > 0.

I did not read the message length prior to calling parse, but I
changed it:

                                CodedInputStream cis =
CodedInputStream.newInstance(socket.getInputStream());
                                cis.readRawLittleEndian32();
                                NameProtos.Name name = 
NameProtos.Name.parseFrom(cis);

Sadly, I keep getting:
com.google.protobuf.UninitializedMessageException: Message missing
required fields: name



On Apr 15, 7:03 pm, Jason Hsueh <jas...@google.com> wrote:
> yup, that's what I meant. Can you check that you are writing data to the
> stream? Also, I didn't notice that you are writing the message length as a
> header. Did you read that value from the socket prior to calling parse? The
> Java-side parseFrom call should only be reading the data read by
> SerializeToCodedStream(); you need to consume the WriteLittleEndian32 data
> separately.
>
> On Fri, Apr 15, 2011 at 10:01 AM, platzhirsch
> <konrad.rei...@googlemail.com>wrote:
>
>
>
>
>
>
>
> > I am sorry, could you clarify this? With destroy you mean call the
> > delete operator? The changes:
>
> > 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);
>
> > delete coded_output;
> > delete raw_output;
>
> > socket.send(b);
>
> > ---
>
> > This changes nothing, sadly.
>
> > --
> > 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