Results 1 to 2 of 2

Thread: connect error 203

  1. #1
    Join Date
    Apr 2013
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default connect error 203

    I am trying to fetch something from internet.

    Here is the sample code

    Qt Code:
    1. #ifndef TWIT_H
    2. #define TWIT_H
    3.  
    4. #include <QObject>
    5. #include <QString>
    6. #include <QtNetwork/QNetworkAccessManager>
    7. #include <QtNetwork/QNetworkReply>
    8.  
    9. class QTwitterClient : public QObject
    10. {
    11. Q_OBJECT
    12. private:
    13. QNetworkAccessManager *m_nam;
    14. private slots:
    15. void replyFinished(QNetworkReply *reply);
    16. void replyError(QNetworkReply::NetworkError code);
    17. public:
    18. QTwitterClient(QObject *parent=0);
    19. void Fetch(const QString& url);
    20.  
    21. public slots:
    22. void print(QString response);
    23. signals:
    24. void finished(QString url);
    25. void failed(QString errorString);
    26. };
    27. #endif // TWIT_H
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include "twit.h"
    2.  
    3. //#include <QtNetwork>
    4. #include <QUrl>
    5. #include <QDebug>
    6.  
    7. QTwitterClient::QTwitterClient(QObject *parent)
    8. : QObject(parent)
    9. {
    10. m_nam = new QNetworkAccessManager(this);
    11. m_nam->connect(m_nam, SIGNAL( finished(QNetworkReply*) ),
    12. this, SLOT( replyFinished(QNetworkReply*)) );
    13. connect(this, SIGNAL(finished(QString)), this, SLOT(print(QString)));
    14. }
    15.  
    16. void QTwitterClient::Fetch(const QString &url) {
    17. QNetworkRequest request;
    18. request.setUrl(QUrl(url));
    19. m_nam->get(request);
    20. }
    21.  
    22. void QTwitterClient::replyFinished(QNetworkReply *reply) {
    23. qDebug() << "Error code:" << reply->error();
    24. finished("Network result code: " + QString::number(reply->error()));
    25. reply->deleteLater();
    26. }
    27.  
    28. void QTwitterClient::replyError(QNetworkReply::NetworkError code) {
    29. QString errorString(((QNetworkReply *)sender())->errorString());
    30. qDebug() << "Premature Error:" << code << errorString;
    31. failed(errorString);
    32. }
    33.  
    34. void QTwitterClient::print(QString response)
    35. {
    36. qDebug()<<response;
    37. }
    To copy to clipboard, switch view to plain text mode 


    When I build and run this, this is giving me some kind of connect() error

    Qt Code:
    1. Starting /home/asit/qt/twit1-build-desktop/twit1...
    2. Error code: 203
    3. "Network result code: 203"
    To copy to clipboard, switch view to plain text mode 

    Can anyone tell me how to fix this ?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: connect error 203

    The error is, QNetworkReply::ContentNotFoundError(203)-the remote content was not found at the server (similar to HTTP error 404)

    Here is the Link

    Check the Url and make sure the server is reachable. Is the Url reachable using a browser?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Connect MS SQL Server is Error...
    By thaihoangluu in forum Newbie
    Replies: 4
    Last Post: 3rd June 2012, 05:07
  2. error calling method using connect
    By jeffmetal in forum Newbie
    Replies: 4
    Last Post: 22nd April 2010, 18:09
  3. QScreenLinuxFb::connect error
    By vien64 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 6th November 2009, 23:09
  4. VS2005+Qt4.2.2:Get a Mysql connect error.HELP!!
    By fengtian.we in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2007, 12:23
  5. strange error in connect()
    By quickNitin in forum Newbie
    Replies: 4
    Last Post: 21st June 2006, 12:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.