![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e146. Getting the IP Address and Hostname of the Local Machinetry { InetAddress addr = InetAddress.getLocalHost(); // Get IP Address byte[] ipAddr = addr.getAddress(); // Get hostname String hostname = addr.getHostName(); } catch (UnknownHostException e) { }
e145. Getting the Hostname of an IP Address
© 2002 Addison-Wesley. |