[Solved]problem using Qftp
hello, I'm working on an graphical application who use an FTP connection to synchronize data with a Web server.
I previously develop the "ftp part" without graphical interface and it worked fine, but now the commands are scheduled but never executed. I can't find out why.
there is the part of the code where I use the Qftp:
this->_connectCmd = this->_ftp->connectToHost("ftp.qt.nokia.com");
qDebug() << this->_connectCmd;
and i connect the commandFinished and commandStarted to slots who just print with qDebug() the status of the command, but nothing is never printed after the "qDebug() << this->_connectCmd;"
here is some additional stuff:
my ftp class:
class myFtp : public QObject
explicit myFtp(QString host, QString login, QString pass, QString dir, int port, QObject *parent = 0); void run();
void connected(bool statut);
void cmd_end(int i, bool j); void cmd_start(int i);
QString _host; QString _login; QString _pass; QString _dir; int _port; bool _connected; int _connectCmd; int _logCmd; QFtp* _ftp;
and where it is used in my app:
this->lockAll(); // this is locking the interface during the connexion, i try to remove it but no change
myFtp ftp(this->_ftpServeur, this->_login, this->_pass, this->_ftpDir, this->_ftpPort);
thanks for your help and don't hesitate to give me advice if I you see some ... improbable code style.
connectToHost is asynchronous, so you may want to create your ftp object (in doConnect method) on the heap using new...
ho that's right thanks. It's working now.