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 ?