Internet Addresses

Every computer on the Internet is identified by a unique, four-byte IP address. This is typically written in dotted quad format like where each byte is an unsigned value between 0 and 255.

Since humans have trouble remembering numbers like this, these addresses are mapped to names like "" or "". However it's the numeric address that's fundamental, not the name.

Java's class represents such an address. Among others it contains methods to convert numeric addresses to host names and host names to numeric addresses.

 public static InetAddress   getByName(String host) 
 throws UnknownHostException
 public static InetAddress[] getAllByName(String host) 
  throws UnknownHostException
 public static InetAddress   getLocalHost() 
  throws UnknownHostException
 public boolean isMulticastAddress()
 public String  getHostName()
 public byte[]  getAddress()
 public String  getHostAddress()
 public int     hashCode()
 public boolean equals(Object obj)
 public String  toString()

Previous | Next | Top | Cafe au Lait

Copyright 1997 Elliotte Rusty Harold
Last Modified April 17, 1997