I am using Qt and what I should do is given a QString
containing my URL, before opening the page, I want to know if this is reachable.
I read the documentation of QNetworkReply
and I saw that there are different codes for the different types of error (eg: the remote content was not found at the server -> code 203).
The question is: starting from my QString
, how can I get those code values?
How to know if this is reachable, before opening the page?
It is not something you could know in advance, but a trial and error:
How can I do this?
Let's take the example from the documentation:
Now in the implementation of
MyClass::slotError
, write:This should print the error code, if any.