Hello everybody...
ive a problem with getting an ip-address from my computer
i tried a little code:
but the problem is... i get the LAN ip (192.168.1.x)Code:try { InetAddress addr = InetAddress.getLocalHost(); hostAddress = addr.getHostAddress(); hostName = addr.getHostName(); // hostAddress and hostName are defined as: // private static String hostAddress // and: private static String hostName; // for showing data JOptionPane.showMessageDialog(null, hostName + "\n" + hostAddress, "IP-Address", JOptionPane.ERROR_MESSAGE); } catch (UnknownHostException e) { }
but i want the WAN ip.
in PHP is it very easy, because it gives the WAN back, but JAVA not...![]()
Im just a beginner and i tried a several things, but it all doesnt work
thanx for help,
Koos


Reply With Quote


Bookmarks