Why protobuf only read the last message as input result?
问题 Usually, we use protobuf to communicate a message, for multiple times, each with different message content. But I found seems the reader side process the whole message, and only the last one is used, like below: $cat 30.proto message hello { required int32 f1=1; required int32 f2=2; optional int32 f3=3; } $cat 30.cpp #include "30.pb.h" #include<fstream> #include<iostream> using namespace std; int main() { fstream fo("./log30.data",ios::binary|ios::out); hello p1,p2,p3; p1.set_f1(1); p1.set_f2