Hello,
I'm a newbie to QT . Can anyone give me some hints on how I can send my own memory buffer which contains a rather complicated data structure via QTcpSocket or QTcpServer?
Here is what I'm trying. But it seems not work.
Thank you for your help in advance!
//QBuffer buffer;
QByteArray buffer;
QDataStream out(&buffer, QIODevice::WriteOnly);
char *to =(char*) buffer.data().data();
memcpy(to,&myOwnBufffer, myOwnBufferSize);
out.device()->seek(0);
out << (quint16)(buffer.size() - sizeof(quint16));
tcpSocket->write(buffer);
myOwnBuffer is a structure<-structures<-structures (contains several data type).
Bookmarks