So I have a socket , I send some data on it using protobuf CodedOutputStream like this:
int size = myMessage.getSerializedBytes();
out.writeRawVarint32(size) ; // out = CodedOutputStream created from a java.io.OutputStream
myMessage.writeTo(out);
out.flush();
Client code compiles and writes. How do i read this correctly on server side? If i use DataInputStream readByte() to read size I get a negative value for size... If I use CodedInputStream to read size via readRawVarint32 I get a large value 10x the size of the serialized message i sent.
How do I read a protobuf message from an InputStream in java??
CodedInputStream ?
DataInputStream ?
I read the docs cannot find this documented anywhere. Do i need to drop down to protocol level and start debugging bytes ?