Solved problem with qftp
-
hi,
i'm just testing around with qtftp in qt5.7. I've downloaded the sources and just included them into my project for testing. Everything builds fine but when i'm trying connectToHost(..) this error appears:
"QIODevice::write (QTcpSocket, "QFtpPI_socket"): device not open"
The ftp object is only used in the qt event loop.
Any ideas what the problem is?
Thanks in advance.
-
@ck_ee Can you show your code?
-
First of all QFtp is deprecated. The source is only for compatibility of application based on previous version. The better is approach is using directly QNetworkAccessManager
IMHO the message "device not open" is clear.
Did you open the device?
If so, did you check the response and the device has been really opened? -
-
@J.Hilk said in problem with qftp:
@ck_ee qftp is also incompatible with some ftp-severs, I run into that trying to connect to a WinCE FTP server
I would suggest a 3-Party cross plattform FTP-lib, libcurl comes to mind
Interesting. Out of curiosity, did you do some investigations on this or simply switch to another lib?
-
@koahnig Ower supplier changed some of it's hardware, and told me proudly : "Everything is better, plus a new OS. WinCE".... :-(
It was an old project, and I spend about a day trying to make it work with qftp. Than I switch to
QNetworkAccessManager
. The rudimentary push/get function that class offeres was enough in that particular case -
@ck_ee
I just got the same error message "QIODevice::write (QTcpSocket, "QFtpPI_socket"): device not open", and search with Bing to find your post.
not sure if you solved your problem already?
as for me, after a struggle i finally solved mine.
I use qt5.7.1 mingw, and download the QFtp src from github(qt5.7.1 doesn't intergrate with QFtp due to some bugs i guess), and build the ftp project, resulting in some .a,.dll,*.prl.
I put the .dll into bin folder,.a and *.prl into lib folder.
like, Qt5Ftp.dll and Qt5Ftpd.dll(debug version) in bin folder, libQt5Ftp.a and libQt5Ftpd.a(debug version) and Qt5Ftp.prl and Qt5Ftpd.prl in lib.I create a demo project, add QT += network in my .pro file and include the necessary <QFtp> in header file...
things happen like this, I also add "LIBS+= d:\somepath\mingwfoler\lib\libQt5Ftp.a" in .pro file as for the project to link the qftp library.
and when run my compiled demo project, it shows the error message "QIODevice::write (QTcpSocket, "QFtpPI_socket"): device not open".i finally figure out what happend. because I use Debug Build to build the project first, which the LIBS should be added with "libQt5Ftpd.a"(Debug version) not "libQt5Ftp.a"(Release version), when change to libQtFtp5d.a, it works fine from now on.The other hand, when bulid release version, just change back to "libQt5Ftp.a"
this is how my situation looks like, hope it can help someone .
-
Hi and welcome to devnet forum
QFtp has been deprecated. What you are using is some sort of replacement based on QNetworkAccessManager.
The question you might want to ask yourself is, if it is not better to go straight for QNetworkAccessManager. -
@koahnig
I know it's deprecated, and QNetWorkAccessManeger is more efficient and more secure ,but QNetworkAccessManager doesn't have function like list,cd,remove,mkdir,rmdir,rename which Qftp can do after login into ftp server(or maybe I'm so dumb that i dont know QNetworkAccessManager can do).