Determines the IP address of a host @param name The hostname to look up @return The first matching IP address @exception UnknownHostException The hostname does not have any addresses
(String name)
| 277 | * @exception UnknownHostException The hostname does not have any addresses |
| 278 | */ |
| 279 | public static InetAddress |
| 280 | getByName(String name) throws UnknownHostException { |
| 281 | try { |
| 282 | return getByAddress(name); |
| 283 | } catch (UnknownHostException e) { |
| 284 | Record [] records = lookupHostName(name, false); |
| 285 | return addrFromRecord(name, records[0]); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Determines all IP address of a host |