Hi,
(new to java) I want to be notified when my box has no longer access to internet. The below test code works but it only returns a variable when I can ping a site, otherwise, it doesn't return anything.
How can I get the "false" feedback from said code?
TIA
HTML Code:package ping; import java.io.IOException; import java.net.InetAddress; public class Ping { public static void main(String[] args) { InetAddress address; String test = ""; try { address = InetAddress.getByName("www.google.com"); boolean reachable = address.isReachable(5000); test = String.valueOf(reachable); System.out.println(test); } catch (IOException e) { System.out.println(test); } } }