Exceptions when reading protobuf messages in Java which were created in C++
platzhirsch <konrad.reiche <at> googlemail.com>
2011-07-02 15:36:14 GMT
I am using **protobuf** now for some weeks, but I still keep getting
exceptions when parsing protobuf messages in **Java**.
I use **C++** to create my protobuf messages and send them with
**boost sockets** to a server socket where the Java client ist
listening. The C++ code for transmitting the message is this:
ZeroCopyOutputStream *raw_output = new OstreamOutputStream(&os);
CodedOutputStream *coded_output = new CodedOutputStream(raw_output);
boost::asio::async_write(socket, b.data(), boost::bind(
As you can see I write with `WriteVarint32` the length of the message,
thus the Java side should know by using `parseDelimitedFrom` how far
it should read:
AgentMessage agentMessage = AgentMessageProtos.AgentMessage
But it's no help, I keep getting these kind of Exceptions:
Protocol message contained an invalid tag (zero).
Message missing required fields: ...
It is **important** to know, that these exceptions are not thrown on
every message. This is only a fraction of the messages I receive the
most work out just fine - still I would like to fix this since I do
not want to omit the messages.
I would be really gratful if someone could help me out or spent his
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to protobuf <at> googlegroups.com.
To unsubscribe from this group, send email to protobuf+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.