Java - How to detect that the internet connection has got disconnected through a java desktop applic
Posted
by Yatendra Goel
on Stack Overflow
See other posts from Stack Overflow
or by Yatendra Goel
Published on 2010-04-16T11:11:14Z
Indexed on
2010/04/16
11:23 UTC
Read the original article
Hit count: 338
I am developing a Java Desktop Application that access internet. It is a multi-threaded application, each thread do the same work (means each thread is an instance of same Thread class).
Now, as all the threads need internet connection to be active, there should be some mechanism that detects whether an internet connection is active or not.
Q1. How to detect whether the internet connection is active or not?
Q2. Where to implement this internet-status-check-mechanism code? Should I start a separate thread for checking internet status regularly and notifies all the threads when the status changes from one state to another? Or should I let each thread check for the internet-status itself?
Q3. This issue should be a very common issue as every application accessing an internet should deal with this problem. So how other developers usually deal with this problem?
Q4. If you could give me a reference to a good demo application that addresses this issue then it would greatly help me.
© Stack Overflow or respective owner