Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to identify internet connection

 
sachin kataria
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
in my application, i have to identify that system (computer) is connected to internet or not..

i try URL class but that is giving my exception:

java.net.UnknownHostException: www.google.com

i also give proxy settings using command,
java -Dhttp.proxyHost=linuxserver test

but that is giving me exception...

so, how i can identify that internet connection is there or not ....??

pls help me.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out these codes.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic