Fixed, it was because I was using tcpSocket->waitForReadyRead() inside readyread signal, in docs it says not to do that, and read inside if (tcpSocket->bytesAvailable() > 0)
Hi,
I am getting strange behavior from QTcpSocket.
I am using a threaded server. Occasionally when the client requests data (15mb) it transfers fine, but this only works VERY occasionally and it is completely random if it transfers it all or not. 99% of the time it reads 99% of the data (reads 14795240 bytes out of 14836010 bytes).
Client:
Qt Code:
... QByteArray byteArray; void Client::readyReadSignal() { if (tcpSocket->waitForReadyRead()) { byteArray.append(tcpSocket->readAll()); } if (byteArray.size() == fileSize) { updateFile->write(byteArray); } tcpSocket->close(); } ...To copy to clipboard, switch view to plain text mode
Output at end:
"Read: 14802704 should read: 14836010
Has anyone else had this behaviour?
Thankyou
Bookmarks