Re: How to ping a server ?
"ping" uses the ICMP protocol and not TCP and there are no "ports" in ICMP. The simplest way would be to call the system tool ping, because creating ICMP packets requires superuser priviledges, so there is a good chance you won't be able to forge it in a user application. Also beware of the fact that the modern policy (mainly in Windows) says that pings should be blocked, so you might not get any result back. I would suggest trying to connect to a different service (like http) instead.
Re: How to ping a server ?
Thanks for the tip :).
Here is my situation :
- server A : provides acces to external services (Web), through a proxy
- server B : provides some internal services, like FTP, HTTP, ...
- server C : provides some internal servicies, like IMAP messagery, DNS, ...
So, what I will test is :
- if the IMAP service is running on server C, with an IMAP request
- if the DNS service is running on server C, with a QHttp request targetting an intranet web site (HTTP service provided by server B, but DNS resolved on server C)
- if the B server is running, testing an intranet HTTP request with the server IP (in order not to use the DNS service on server C)
- if the server A is running, testing an external QHTTP request
That's a good idea !
I was on my "ping" solution snce this morning, for nothing :)