0xPunt
0xPunt

Reputation: 321

Serialize with Qt, deserialize without Qt?

If I serialize a struct using QDataStream and send this via UDP,

is it possible to then deserialize it without Qt ?

Upvotes: 0

Views: 603

Answers (1)

Mike
Mike

Reputation: 8355

if you want to deserialize without using the Qt library, you would have to read the Qt serialization format which is described briefly here, and write the deserialization code yourself. And since this format is likely to change, you should use setVersion in the serializing application and stick into some version that you can implement deserialization code for it in the receiver.

I don't recommend doing this, as it may take you long time, and you may run into a lot of errors when implementing deserialization for primitives such as the standard IEEE 754 format used in serializing float numbers or maybe errors that are caused by different endianness across devices, etc. . .

So, why reinventing the wheel? if you don't want to use Qt in your receiver, you can use a common serialization format. JSON for instance is widely supported in many programming languages, and it is supported in Qt. If you don't like something about JSON there are lots of data serialization formats to choose from.

Upvotes: 3

Related Questions