My problem is to serialize protobuf data in C++ and deserialize the
data in Java probably. In fact I get **InvalidProtobufferException**
in Java.

Here is my minimal example:

My protobuf file looks like this:

    option java_outer_classname = "NameProtos";

    message Name {

       required string name = 1;

Which I compile with:

    protoc -I=. --cpp_out=../cpp/ name.proto


    protoc -I=. --java_out=../java/ name.proto

In C++ I create the name object this way:

    Name name;

In Java I read from the socket, until the socket is closed
(socket.send closes the connection, after it entirely wrote the string
passed, so I guess here is no when stop reading issue, isn't there?).

In Java I make the following call in order to deserialize:

`NameProtos.Name name =

However I always get **InvalidProtocolBufferException**

I have no idea, the received strings are not empty though, they look
like this:
[SPACE]platzhirsch[A Character which cannot be displayed probably]

These character which I cannot read, I also get, when using other
fields like int32. I guess there are just encoded into the string.

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to