How can i get the LAN IP-address of a computer using Java? I want the IP-address which is connected to the router and the rest of the network.
I\'ve tried something like
try { InetAddress addr = InetAddress.getLocalHost(); // Get IP Address byte[] ipAddr = addr.getAddress(); // Get hostname String hostname = addr.getHostName(); } catch (UnknownHostException e) { }