Hi,

I have seen this question raised on these forums and I feel I have done everything correctly so I was wondering if someone could help point out my fault.

So I have the following code that behaves as expected when there is a connection to the outside world, however when an error occurs errorString tells me there was an "unknown error". Why?

Qt Code:
  1. void myClass::checkInternetConnection()
  2. {
  3. qDebug() << "checking internet connection";
  4. QNetworkAccessManager* am = new QNetworkAccessManager;
  5. connect(am, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*)));
  6.  
  7. am->get(QNetworkRequest(QUrl("http://google.com")));
  8. }
To copy to clipboard, switch view to plain text mode 

the slot, I would expect this to always be a QNetwokReply::NoError condition.

Qt Code:
  1. void onFinished(QNetworkReply* r)
  2. {
  3. qDebug() << "Finished checking internet connection" << r->errorString();
  4. emit connectionVaild();
  5. }
To copy to clipboard, switch view to plain text mode 

All the best