General discussion

Locked

Java - detect internet connection

By carlbernardi ·
Hi,

I have a Java program that uses the internet but if when there is no longer an internet connection, it ends up create a lot of errors. I was wondering if there are any methods to detect a constant internet connection using Java?

Thanks,


Carl

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

All you can really do is get some sort of hearbeat going

by Tony Hopkinson In reply to Java - detect internet co ...

ping something external for instance. Hit ms of google with a web request, possibly both in case\one of them has gone nipples up.

You can do a bit more if you are communicating with two units you control through the internet. Establish a socket connection and do a send and wait for acknowledge every minute for instance.

Keep it simple though, the reasons why you don't have access to the internet, can be from some eejit unplugged you, to being blocked on third party firewall, even if you cover most bases, there will still be faults that you misreport.

Collapse -

detect modem ip

by carlbernardi In reply to All you can really do is ...

I thought about doing it that way but I also came to the same conclusion. I was hoping that maybe the ip address assigned to the modem (dialup, adsl, cable) from the internet provider could be detected maybe via a trace route or something along those lines.

Thanks,

Carl

Collapse -

That might be blocked as well

by Tony Hopkinson In reply to detect modem ip

Even if you got there, it says nothing about anything on the ISP's side of the box.

Back to Software Forum
3 total posts (Page 1 of 1)  

Software Forums