×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    16

    QNetworkReply::ConnectionRefusedError

    I am getting a QNetworkReply::ConnectionRefusedError when i try to request QNetworkAccessManager::get(QNetworkRequest(QUrl("http://qt.nokia.com"))). Plz help.

  2. #2
    Super Contributor
    Join Date
    Jan 2007
    Location
    Bhubaneswar, India
    Posts
    1,189

    Re: QNetworkReply::ConnectionRefusedError

    Quote Originally Posted by NishaElsa View Post
    I am getting a QNetworkReply::ConnectionRefusedError when i try to request QNetworkAccessManager::get(QNetworkRequest(QUrl("http://qt.nokia.com"))). Plz help.
    It will be good to give little bit more details information about your problem.
    Anyway you may check this link and you can get some idea.
    http://qt.nokia.com/doc/qtjambi-4.4/...workError.html
    -------------------------------------
    Thanks & Regards
    Ram
    Symbian OS 9.2/9.3,S60 3rd FP1/FP2,Carbide.c++v2.0

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    16

    Re: QNetworkReply::ConnectionRefusedError

    I was trying the googlesuggest example given with QT 4.6.0 SDK.
    In that there is a QNetworkAccessManager::get(QNetworkRequest(QUrl("Your required Url"))) method call. I have implemented a slot_fun(QNetworkReply *nR) for the finished() signal by the QNetworkAccessManager class. But the nR->error() method gives a ConnectionRefusedError (meaning - the remote server refused the connection (the server is not accepting requests)). Is that a problem with the remote server or my proxy server?

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    16

    Re: QNetworkReply::ConnectionRefusedError

    Hi all
    I have ultimatly found a solution to this problem with the help of a collegue of mine.
    Setting the proxy address and port number in the emulator is not enough. The problem was that the Qt Framework was unaware of the proxy settings. The Qt framework should know the proxy that you are using while connecting to the server for any request.

    Just do the following in the code

    // include this header file
    #include <QNetworkProxy>


    // include this code snippet before you start doing any network
    // connection related call in your application

    QString httpProxy = // add your proxy server address here
    QString httpPort = // add your proxy server port number here

    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName(httpProxy);
    proxy.setPort(httpPort.toInt());

    QNetworkProxy::setApplicationProxy(proxy);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×