I'm using qt5.9.0 MinGW 32bit running under windows
I have a program that receives data from a tcp socket and then writes it to a file. I used to have no problem with it, but recently suddenly the data written to the file may be incorrect, and the logic for writing it is very simple:
QCryptographicHash n_hash(QCryptographicHash::Md5);
while (bytesReceived < totalBytes){
.....
if (m_sockfd->waitForReadyRead(10000)){
QByteArray data = m_sockfd->readAll();
write_data = chunkFile.write(data);
......
}
n_hash.addData(data);
....
}
Of course I've left out some of the logic, the file close and flush I have called
In order to verify the data from the tcp, I specifically on the data stream md5 checksum, every time the checksum is the correct md5, but write the file will always appear to have a small part of the data is wrong!
And the strangest thing is, if I write another file at the same time to compare, then when the first file is wrong, the second file is right, but of course both are wrong, which is very strange to me!
Then I used beyond compare to compare the correct and incorrect file data and didn't find any pattern, so I hope I can get some help!
And it seems to work fine for me to receive files using other machines, only one win10 machine has this problem
err.jpg
Bookmarks