Check Server Stats (online/offline)

  • Hey everyone,
    So my deal is pretty simple (or maybe not), I just wanted to know, how can I check the status of a server/domain (offline/online) with QtNetwork.

    For example I want to check if "" is online, how do I do to check his stats, pinging it? or is there any other solutions, preferably using QtNetwork

    PS - I never used QtNetwork before.

  • All it depends on your definition of "online". If it's "it responds to an ICMP ping", then you can't do that with QtNetwork (but you can simply invoke the ping utility on your system by using QProcess). If it is "it responds to HTTP on port 80" you can try to issue a HEAD request using QNetworkAccessManager.

  • I see, I already tried several things with accessmanager, but didn't work, still, I dind't tried HEAD request yet, can you explain me in detais how it could be used?

  • "QNetworkAccessManager::head() ": is your friend. Use it just like a get request.

Log in to reply