PDA

View Full Version : QFtp abort()



Talei
5th December 2012, 14:08
Hello,

After calling QFtp -> abort(), QFtp send ABOR to the server and operation is "aborted" but the problem with this is that the next command, it can be anything, don't work at all, and QFtp internal socket just "hangs" (no data is send to the server).

Strange part is that when using QFtp->abort() after the QFtp-> put() then signal commandFinished() is emitted with error = true for the id of the QFtp()->put().

Any idea why is this happening or how to bypass this problem? (excluding recreation of the QFtp() )

EDIT:
When using QFtp->abort() after the QFtp-> get() then signal commandFinished() is NOT emitted with error = true for the id of the QFtp()->get().

Qt: 4.8.4
MingW: 4.6.2 WinXP Sp3

anda_skoa
6th December 2012, 19:58
You could check if QNetworkAccessManager behaves better.
QFtp is one the classes that have been deprecated for a long time.

Cheers,
_

Talei
7th December 2012, 08:05
Yes I know that now, but currently it's to late to rewrite this program.

From the look at the QFtp prv. it seams like QFtp (not only on abort) call internal QTcpSOcket->abort(). After this code is executed QFtp stops to work. Inside abort occur delete connectionTimer (QTimer) and I think that's why QFtp (after this call) stops working - recreation occurs on host reconnection and one other condition.

wysota
8th December 2012, 09:31
QFtp is one the classes that have been deprecated for a long time.
Actually it is not deprecated (only QHttp is). However it is simply badly designed :)

gurpal2000
22nd May 2013, 01:48
I can confirm the issue as the OP. Even the example provided with Qt 4.8.x (qftp.pro) exhibits this issue. You start the download, hit abort. Then pick another file to download, it hangs. You have to reconnect (ie. disconnect and connect).

Any solutions using Qftp? Yes I can try to use qnam, but the API is a little incomplete IMHO.