There's nothing wrong with the read() in the code you show us. It reads two blocks of 256k and the remainder of the file is 182276 bytes assuming the file you have opened contains 706564 bytes.QFile::read failed after n bytes already read
The "QAbstractSocket::waitForBytesWritten() is not allowed in UnconnectedState" indicates that the TCP connection to the other end has been closed, possibly deliberately by the other end, possibly some other error condition. Nothing in the code we can see would help diagnose this. Try looking at QTcpSocket::error() or connecting to the error() signal.
Bookmarks