Thanks for the suggestion.  However, I am already prepending the
message size on the C++ side in the line:
coded_output->WriteVarint64(snap1.ByteSize());

is there anything else that stands out to you?

thanks for any further help.

On Oct 13, 12:56 pm, Evan Jones <ev...@mit.edu> wrote:
> On Oct 13, 2010, at 15:13 , Paul wrote:
>
> > On the client side (in C++), I open a TCP socket connection on the
> > same port with the server's IP address.  I serialize the message using
> > SerializeToCodedStream into an array using ArrayOutputStream.  After
> > serializing it, I send it over the TCP connection using my sendTCP
> > method which uses C++ sockets.
>
> SerializeToCodedStream does *not* prepend the message size. The Java  
> side is expecting that the message will start with the message length,  
> so that is probably why you are getting parse errors. You need to do  
> something like:
>
> codedOutput.WriteVarint32(msg.ByteSize());
> msg.SerializeToCodedStream(codedOutput);
> codedOutput.flush();
>
> ...
>
> Hope this helps,
>
> Evan
>
> (as an aside: the C++ API really should have an equivalent to  
> writeDelimitedTo and parseDelimited on the Java side).
>
> --
> Evan Joneshttp://evanjones.ca/

-- 
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