August 25, 2011

Azr79 Azr79
Lab Rat
33 posts

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 “google.com” 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.

 Signature 

Azr79

3 replies

August 26, 2011

peppe peppe
Ant Farmer
1026 posts

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.

 Signature 

Software Engineer
KDAB (UK) Ltd., a KDAB Group company

August 26, 2011

Azr79 Azr79
Lab Rat
33 posts

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?

 Signature 

Azr79

August 28, 2011

Volker Volker
Robot Herder
5428 posts

QNetworkAccessManager::head() [doc.qt.nokia.com] is your friend. Use it just like a get request.

 
  ‹‹ Error Message - Could Not Decode [Solved]      Integrating QGLWidget in QGraphicsScene ››

You must log in to post a reply. Not a member yet? Register here!