Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTcpSocket write/send entire class?
MrNoway last edited by
Is it possible to write via QTcpSocket an entire class?
myinstance = instance_of_any_class)@
Sofar I am just able to send and receive strings.
t3685 last edited by
You can write anything on a socket as you want. All the socket sees are bytes. So if you want to send an instance of a class, you would need to think of some way to represent the whole class as bytes so that the receiver knows how to construct the instance again.
Also remember that tcp sockets work as streams so that not all the data you sent will arrive at the same time.
smooph last edited by
I am currently working on a simular project. I was looking at json and class serialization. Maybe check it out, it might be for you.