How to check if an IP address is reachable or not?
I have a list of links in my database which consists of the IP address and the service name. When the user wants to search by the name, I want to see if the IP address is reachable so that I can display only them. Is there any simple way of doing t开发者_C百科his?
When you say "active" do you mean the service is responsive? And do you mean services that are not ones you control or own?
If you mean just general services on the internet then try this:
Ping the services and see if you get a status code of 200 or some other "valid" response back or not? You could even limit the invalid codes to the 400s and 500s that map to whether you're concerned about user authorization, etc. Here's a quick list of the codes
If you don't mean this, then ignore my answer and accept my apologies...
精彩评论