I have a test.proto file having the code shown below. I am using code generated by this file in my client server program.
message Person {
required string user_name = 1;
optional int32 favourite_number = 2;
repeated string interests = 3;
}
Client side i have no problem to send data but at the server side i am getting protocol buffer parsing error(in the file:\protobuf\message_lite.cc(line123)) says "cant parse message of type 'person' because its missing required field:user_name"
Though i have checked my client side but couldnt find anything wrong but i might missing something at server side which is not reading string data ?
//Server side code for Protocol Buffers
Person filldata;
google::protobuf::uint32 size;
//here i might need google::protobuf::string stsize; Not sure ?
google::protobuf::io::ArrayInputStream ais(buffer,filldata.ByteSize());
CodedInputStream coded_input(&ais);
coded_input.ReadVarint32(&size);
//have tried here both coded_input.ReadString and coded_input.ReadRaw
filldata.ParseFromCodedStream(&coded_input);
cout<<"Message is "<<filldata.DebugString();
//still getting same error have no idea what to do exactly to fix it :(
Haved Looked Here but still couldnt got it from that explanation, Hope someone can fix it.
Thanks!