Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
Send objects via QSocket
Hi there,
currently, I do send objects via QSocket by cutting them down and send each attribute. The receiver takes all incoming attributes and creates an object.
But sometimes writeBlock() sends more than an object, three or more in one package,
How can I force it to send when I want to?
Is there another possibility of sending objects?
Many thanks in advance.
Ciao
Tom
---
There are only 10 types of people in the world:
Those who understand binary and those who don't.
---
You can flush the socket, but I think you better design your protocol to allow merged blocks.
For example sending some kind of start and end marker.
Cheers,
_
Qt/KDE Developer
Debian User
Hi anda_skoa,
I'll try it with struct.
Think it's gonna work.
Ciao
Tom
---
There are only 10 types of people in the world:
Those who understand binary and those who don't.
---
Just in case you mean writing a struct as one block of memory I would advise against it.
This is really unportable, better use QDataStream to write each field.
Cheers,
_
Qt/KDE Developer
Debian User