Trouble checking virtual server(vps) connection with qt
-
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.
-
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.
-
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 ?
-
@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 ?
-
@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