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 Jones
http://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