nbkhwjm
1st September 2007, 01:51
I have this to write some data to a socket.
QByteArray data;
QDataStream out(&data, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
out << int(0x02) << QString("text");
tcpSocket->write(data);
The Socket connects perfectly, and the data is sent however the results seen at the receiving end are not what i expected... I know there is a simple fundamental problem with the way I am defining the data to send.. i just cant see it..
I want to see this on the other end. It can only be this since this is a tool to integrate to an existing protocol.
0x02 74 65 78 74 0A
Which is [0x02]text[0x0A]
But I keep getting this..
0x00 00 00 02 00 00 00 08 00 74 00 65 00 78 00 74
[0x00 00 00 02 00 00 00 08 00]t[0x00]e[0x00]x[0x00]t
QByteArray data;
QDataStream out(&data, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
out << int(0x02) << QString("text");
tcpSocket->write(data);
The Socket connects perfectly, and the data is sent however the results seen at the receiving end are not what i expected... I know there is a simple fundamental problem with the way I am defining the data to send.. i just cant see it..
I want to see this on the other end. It can only be this since this is a tool to integrate to an existing protocol.
0x02 74 65 78 74 0A
Which is [0x02]text[0x0A]
But I keep getting this..
0x00 00 00 02 00 00 00 08 00 74 00 65 00 78 00 74
[0x00 00 00 02 00 00 00 08 00]t[0x00]e[0x00]x[0x00]t