nowire75
3rd July 2007, 21:42
Hi at all!,
I want to write (an after read) an bytes array to the TCP socket.
I try with this code:
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
QString variable="CIAO";
out << quint16(0) << variable;
out.device()->seek(0);
out << quint16(block.size() - sizeof(quint16));
tcpSocket.write(block);
this code work, but the problem is that I not read only "CIAO" on my receiver program.
I'm waiting to receive 6 bytes... "04CIAO"
I must change the variable type?
nowire
I want to write (an after read) an bytes array to the TCP socket.
I try with this code:
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
QString variable="CIAO";
out << quint16(0) << variable;
out.device()->seek(0);
out << quint16(block.size() - sizeof(quint16));
tcpSocket.write(block);
this code work, but the problem is that I not read only "CIAO" on my receiver program.
I'm waiting to receive 6 bytes... "04CIAO"
I must change the variable type?
nowire