Answer the question
In order to leave comments, you need to log in
How to accept an object of unknown type using protobuf?
I have such a task - two applications will exchange data over the network using protobuf. Protobuf has the ability to save/restore an object from a network stream using the ParseFromIstream / SerializeToOstream function. The problem is that it is a member of the object class - i.e. I must know in advance what class the object will come to me. I don't know, they come randomly. I need to be able to read the stream, understand what object has now arrived and create the appropriate class. I used to do this using my own protocol, but this seems to be not good, it would be necessary to do it through some standard one like protobuf. I can't think of a way to do this with protobuf yet, and I'm already thinking of using JSON instead, although otherwise protobuf fits a lot better than JSON. I would be grateful for help.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question