Unsolved Update function with timer
-
no no . I am making console app
-
Your code snippet shows a QMainWindow based class using a designer based UI with a slot connected to a QPushButton named pushButton.
That doesn't look like a console application code.
-
@SGaist but this app for console
-
Then why are you using GUI classes ?
-
just sample above codes
-
#include "networkprocess.h" NetworkProcess::NetworkProcess(QObject *parent) : QObject(parent) { nam = new QNetworkAccessManager(); timer=new QTimer(this); url2.setUrl("ftp://myserver"); url2.setPassword("xxx"); url2.setUserName("xxx"); url2.setPort(21); req.setUrl(url2); reply = nam->get(req); connect(reply, SIGNAL(readyRead()),this, SLOT(downloadReadyRead())); connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); timer->setInterval(500); timer->start(); connect(timer,SIGNAL(timeout()),this,SLOT(updatet())); } void NetworkProcess::updatet() { updatereply=reply; } void NetworkProcess::downloadReadyRead() { if(updatereply->error() == QNetworkReply::NoError){ buf = updatereply->readAll(); if(buf=="Kapat") { qDebug()<<"tako"; } if(buf=="Ac") { qDebug()<<"vural"; } } } void NetworkProcess::requestFinished() { }
this is
-
That update function doesn't really make sense. The reply is automatically updated while the request is being processed.
Why not use the downloadProgress signal if you want information about the downloading state of your query ?
On a side note there's the QtFTP module that you can use to access a FTP server.
-
I used QT5.5 . There is no qtftp.
-
Please, take the time to do a bit of search: http://code.qt.io/cgit/qt/qtftp.git/
-
@SGaist how to I install this ?
-
git clone https://code.qt.io/qt/qtftp.git cd qtftp qmake make make install