can i check through java program on a personal computer wheather computer is connected to internet or not. can some one tell me about code to be use and java package to be use.
posted 14 years ago
The only way I can think to do this is to try and establish a connection to a well known port/hostname. If you get a timeout when trying to establish the connection then more than likely they are not connected. Note: The timeout for a Socket connection is fairly long so you may want to write a class which throws an Exception if it cannot establish a connection within a given period of time (1-2 seconds).