Link to home
Start Free TrialLog in
Avatar of dshrenik
dshrenikFlag for United States of America

asked on

Check internet access

Please let me know what is the simplest way to check if the machine has internet access through Java code.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just try to open HTTPcopnnection to www.google.com


You can use this example to open connection (but can use even some more reliable site, like Google):
http://www.java2s.com/Code/JavaAPI/javax.net/URLopenConnection.htm
Avatar of dshrenik

ASKER

Can you tell me how I can turn of DNS caching in the Java runtime.
The solution here says that I must do that to be on the safer side:
http://stackoverflow.com/questions/1139547/detect-internet-connection-using-java

Thanks!