Java 6 offers isUp() method to check whether a network interface is up and running.
http://docs.oracle.com/javase/6/docs/api/java/net/NetworkInterface.html#isUp()
Is there any way to check the same in Java 5?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The best way to see whether any resource is available, from an NIC to a database to a Web server on the other side of the world, or the Moon, is to try to use it. Any other technique is liable to the timing problem that it was up when you tested and down when you used it, or the other way around. And when you try to use it you have to deal with the failure cases anyway, because they are generally checked exceptions: why write the same code twice?