Reputation: 19
I have two machine M1 and M2. Both are running parallel. Also both have same code. Except GUI which is on M1 side. both are communicating through TCP(client server). Now i want to serialize the c++ objects from M2 to M1 and vice versa. I dont want to use any other librery such as boost, google buffer etc. Is it possible in c++ to serialize ? can XML do, i can use XML ?
Upvotes: 0
Views: 318
Reputation: 182743
Yes, absolutely. You can do it however you want. You can use XML, X.690, text, binary, or whatever format you like. Just write code to convert your objects to and from the serialization format you choose. It will be tedious without a library, but if you want to do it all by yourself, nobody's going to stop you.
One possible gotcha -- TCP is a byte-stream protocol that doesn't preserve application message boundaries. So you'll need to mark the ends of objects somehow, possibly by prefixing each object with its length, possibly by using some kind of "end of object" marker.
Upvotes: 1