Reputation: 299
I'm trying to develop a client FTP in Qt. I've a problem when I try to download a file in the server.
In the slot corresponding to the readyRead() signal, I have a QByteArray resulting the readAll() method ; if the file is less than 3-4 kB, it's OK, else the result is not complete (I have just the beginning of the file)
I've tried to do :
while(_ftp->bytesAvailable() > 0)
QByteArray array = _ftp->readAll();
but it fails too ! Does someone know how to recover the entire file ?
Upvotes: 0
Views: 803
Reputation: 40512
From the documentation of QFtp::readyRead
:
This signal is useful if you want to process the data in chunks as soon as it becomes available. If you are only interested in the complete data, just connect to the commandFinished() signal and read the data then instead.
So you need to connect to commandFinished
signal and use readAll
in your slot.
Upvotes: 1