What is the best way to test/check if a server is online & responsive? I can't just ping it because a server can be set to not respond to ping requests.
So is there another way to do this? I have the url for the server(s) I want to check. Thanks...
Printable View
What is the best way to test/check if a server is online & responsive? I can't just ping it because a server can be set to not respond to ping requests.
So is there another way to do this? I have the url for the server(s) I want to check. Thanks...
I would say that tbe best solution depends to some extent on what options you have. For example, if you have a service that you wrote, running on the server, then you could add some meaningless function. You could then call that function and deal with the response. Of course, if the server wasn't running, it would timeout...eventually, so you'd have to make sure you set the timeout interval to something tolerable.
If you can't do that, then is there some other throwaway method you can call for? You'd want something that wouldn't tax the server, as you likely would be simply throwing out the result, unless you choose something that you have a use for.
Ultimately, though, there's no sure-fire way to know if a computer is off. Even if you get no response, it could be caused by something else between the two endpoints. Furthermore, there's an inherent race condition in any such test. It would be mighty rare, but it would be possible to ask the server, get a response, and then have the server go down before you can make the actual request. For this reason, you pretty much have to be prepared for no response on any request.
Thanks SH. What I have is an old'ish list of servers that I want to clean up. I would like to iterate through the list & check if I get any response. If no response then it gets removed. I understand that there is no sure-fire way due to circumstances beyond my control, but I would at least like to try something. I just know I can't rely on pinging because I know that some of the servers don't respond to a ping even though they are up...
Maybe a Web API hosted as a service to each server but if you go on about on every server to install it you would already know if they are running.
https://www.c-sharpcorner.com/Upload...ndows-service/
Out of the box and without doing any installation on the servers I don't think you can do much more than a ping.
Also an idea could be to let the firewall somehow do a request but that, I have never touched or know if it's a viable idea.