Trouble checking virtual server(vps) connection with qt
-
wrote on 7 Sept 2017, 19:23 last edited by
I want to enter in the program, ip, username and password of a virtual server(vps), and the program checks that the username and password are correct or not.
I used the following code
void MainWindow::test(){ QLoggingCategory::setFilterRules("qt.network.ssl.warning=false"); QNetworkAccessManager* manager = new QNetworkAccessManager(this); QUrl url; url.setHost("xx.xxx.xx.xx"); url.setPort(3389); url.setUserName("administrator"); url.setPassword("xxxx"); manager->get(QNetworkRequest(url)); connect(manager,&QNetworkAccessManager::finished, this, &MainWindow::connFinished); }
output: QNetworkReply::NetworkError(ProtocolUnknownError)
please guide me
-
Hi,
Looks like you are missing a scheme in your url. You can set one using QUrl::setScheme.
-
wrote on 7 Sept 2017, 20:45 last edited by MrErfan 9 Jul 2017, 20:53
tnx my bro ,
I'm really confused , This is for the FTP protocol.
I want to give ip a virtual server, username, password to the program and if the username or password is incorrect, the program will display an error message. -
Then set the scheme to ftp. An URL to be complete needs a scheme otherwise you are basically asking QNAM to guess how it should communicate with a remote computer.
-
wrote on 7 Sept 2017, 21:07 last edited by MrErfan 9 Jul 2017, 21:10
I tested a virtual server with RemoteDesktopConnection without a connection problem.
I am modifying the IP address and username and password in the following codevoid MainWindow::test() { QLoggingCategory::setFilterRules("qt.network.ssl.warning=false"); QNetworkAccessManager* manager = new QNetworkAccessManager(this); QUrl url; url.setScheme("ftp"); url.setHost("37.143.xx.xx"); url.setPort(3389); url.setUserName("administrator"); url.setPassword("xx"); manager->get(QNetworkRequest(url)); connect(manager,&QNetworkAccessManager::finished, this, &MainWindow::connFinished); } void MainWindow::connFinished(QNetworkReply *reply) { qDebug() << reply->error(); }
outpute : QNetworkReply::NetworkError(ContentOperationNotPermittedError)
-
@MrErfan said in Trouble checking virtual server(vps) connection with qt:
ContentOperationNotPermittedError
Having remote desktop running and having a FTP server running is not the same thing.
What are you expecting to get from that request ?
Can you connect a FTP client on that exact URL ? If so what do you get ?
-
wrote on 7 Sept 2017, 21:15 last edited by MrErfan 9 Jul 2017, 21:16
@SGaist said in Trouble checking virtual server(vps) connection with qt:
Having remote desktop running and having a FTP server running is not the same thing.
What are you expecting to get from that request ?
Can you connect a FTP client on that exact URL ? If so what do you get ?What I want to do does not have to do with FTP :D
I just want to check if the username and password of the server(VPS) I'm logging in are correct.
Sorry i am a beginner :( -
If you want to log into something you have access that something through a service that allows that so just connecting to a box won't give you that.
What exactly is running on your remote box ?
-
wrote on 7 Sept 2017, 22:40 last edited by MrErfan 9 Jul 2017, 22:40
-
wrote on 7 Sept 2017, 23:27 last edited by
It's as if the Qt do not have a module for working with the RDP protocol
-
wrote on 8 Sept 2017, 07:46 last edited by
@MrErfan said in Trouble checking virtual server(vps) connection with qt:
It's as if the Qt do not have a module for working with the RDP protocol
BINGO!
RDP is a Microsoft proprietary system and the API is not libre. On top of that it's Windows only so it's out of scope for this library.
There APIs provided by Microsoft for dealing with that service here: https://msdn.microsoft.com/en-us/library/aa383494(v=vs.85).aspx
1/11