Solved QNetworkAccessManager Check FTP Connection
-
Hello all.
I Create Project Which connects to the FTP and adds the files.
Can I Check one button clicked, My input username password and port is correct, Do I have access to it or no ? -
connect(reply, static_cast<void(QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), [=](QNetworkReply::NetworkError code){ qDebug() << code; });
-
Hi,
Yes you can.
What is exactly your problem ?
-
@SGaist
How can i :)The problem is the next when I specify the wrong password and the username of the file does not load on the server.
Then when I specify correctly password and username files loaded, then I'm specify wrong password again and files are loaded, why ? -
@SGaist
this problem i solved. when i upload file i use clearAccesCache
http://doc.qt.io/qt-5/qnetworkaccessmanager.html#clearAccessCachebut
@Taz742 said in QNetworkAccessManager Check FTP Connection:
Can I Check one button clicked, My input username password and port is correct, Do I have access to it or no ?
But I still need it
-
connect(reply, static_cast<void(QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), [=](QNetworkReply::NetworkError code){ qDebug() << code; });
-
There was only one problem. I can not call code.errorstring () from code.
Eerror: request for member 'errorString' in 'err', which is of non-class type 'QNetworkReply::NetworkError'
qDebug() << err.errorString();
^ -
@Taz742
code is just the enum
errorString() is not its member.
You must call errorString() on the QNetworkAccessManager class. -
Or from the reply that is passed in the context of the lambda.