We have a website on our server,开发者_开发问答 When the website is not coming up I need to know whether the url has been moved or the server is down. Is there any way I can check to see the server is down or not?
Even if the URL changes I assume that that hostname would stay the same? So you should just be able to connect to the host in some way (otherwise, if even the hostname might change, does it have a static IP, if so you could connect to that instead). Exactly how you'd connect would depend on where the server is (is it on a local network or on the public internet), are there any firewalls or similar between your machine and the server and what services the server support (if you ping it, would it respond).
If it's on a local network with no firewalls etc in between and it is ping enabled, the easiest way might be to ping it using the Ping class. If that doesn't work you'd have to post more information about your circumstances.
精彩评论