×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    34

    Host Not Found!!

    Hi,

    I am developing an application where I am doing a http->request() to a host en.wikipedia.org by calling http->setHost("en.wikipedia.org");

    It works fine in the emulator but when I installed the .sisx on phone, it throws and error "Host Not Found".
    Please help me!

    My code snippet.

    //constructor
    void myApp::myApp(QWidget *parent)
    : QMainWindow(parent)
    {
    connect(ui.btnSearch , SIGNAL(released()), this, SLOT(on_btnSearch_released()));
    connect(http, SIGNAL(done(bool)), this, SLOT(done(bool)));
    }

    //Button press slot impl
    void myApp:n_btnSearch_released()
    {
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    QHttpRequestHeader header("POST", "/w/api.php?");
    header.setValue("Host", "en.wikipedia.org");
    header.setContentType("application/x-www-form-urlencoded");
    QString encodedTopic = ui.lnEdtSearchTxt->text();
    encodedTopic.squeeze();
    QUrl::toPercentEncoding(encodedTopic);
    QString searchString = "action=opensearch&format=json&search=" + encodedTopic;
    http->setHost("en.wikipedia.org");
    http->request(header, searchString.toUtf8());
    }

    //http request done slot impl
    void myApp::done(bool error)
    {
    if (error)
    {
    //Error.. lets tell the user.
    QMessageBox::information(this, "Debug Message", http->errorString().toLatin1());
    }
    else
    {
    QString result(http->readAll());
    //Fetched some result.. lets parse it
    QString searchTopic = ui.lnEdtSearchTxt->text();
    searchTopic.squeeze();
    resultParser *parser = new resultParser(searchTopic);
    QStringList list = parser->parse(result);
    ui.lstPromt->setModel(new QStringListModel(list));
    QMessageBox::information(this, "Debug Message", result);
    }
    QApplication::restoreOverrideCursor();
    }

  2. #2
    Regular Contributor
    Join Date
    May 2007
    Posts
    468

    Re: Host Not Found!!

    Does the app succeed in opening the network connection i.e do the network indicators show the connection to be successful?

    Assuming you have networkservices capability stated in .pro file.

    Cheers,
    Jack

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Re: Host Not Found!!

    Hi,

    there is a QT Bug : http://bugreports.qt.nokia.com/browse/QTBUG-8687

    I had the same problem, so waiting for fix I wrote a class ( S60QHttp ) to tackle the problem.

    http://api.witinside.net/mobile/qt/s...FoundError.php

Similar Threads

  1. J2ME Bluetooth - more then one host prolem
    By mat12345_1 in forum Bluetooth Technology
    Replies: 1
    Last Post: 2008-06-04, 11:09
  2. Trojan horse in S60 2nd ed FP3 SDK?
    By mrtj in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2008-01-15, 12:12
  3. Replies: 2
    Last Post: 2004-11-17, 10:20
  4. 6310 IR Modem.inf not found under W2000
    By Nokia_Archived in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-05-24, 13:21

Posting Permissions

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