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


  • Lifetime Qt Champion

    Hi,

    Looks like you are missing a scheme in your url. You can set one using QUrl::setScheme.



  • 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.


  • Lifetime Qt Champion

    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 code

    void 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)


  • Lifetime Qt Champion

    @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 :(


  • Lifetime Qt Champion

    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 ?



  • I do not want to do anything special; I just want to check with my Qt library whether the user's virtual server and password are correct or wrong.
    0_1504824010247_b74a338c-9e1e-41a3-b1c3-6f65f0e8f741-image.png



  • It's as if the Qt do not have a module for working with the RDP protocol



  • @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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.