• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Check connected to internet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can someone suggest the best way of checking if I'm connected to the internet, or a specific web server?
Is it just a case of trying to get a response from a given web server and checking it's equal to 200 so I just need to use the URLConnection class? I'm just concerned with having to wait for a response if the server is down or a route is unavailable.
Ideally, I want to write a servlet that supplies a working route to a caller.
Thanks.
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, there is no easy way to do this. One of the things you can do is by pinging remote servers. I suggest to create a simple class that does socket connection, and ping more than one server, since a site could be downed.
reply
    Bookmark Topic Watch Topic
  • New Topic