|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.net.InetAddress
An InetAddress represents a host name and IP address. Since a host may have more than one IP address there may be multiple InetAddresses with the same host but with different addresses.
There is no public constructor for InetAddress, you must get one by looking up a host by name or by address.
Note that InetAddresses are not necessary for using sockets but they provide more control for connections and listening (for ServerSockets).
| Field Summary | |
static String |
INFRA_RED
|
| Method Summary | |
boolean |
equals(Object other)
Two InetAddresses are equal if getAddress() called on each one returns precisely the same sequence of bytes. |
byte[] |
getAddress()
Returns the raw IP address of this InetAddress object. |
static InetAddress[] |
getAllByName(String hostName)
Return an array of InetAddress objects associated with the host name. |
static IOHandle |
getAllByName(String name,
IOHandle h)
This attempts to get all the InetAddresses for a particular host. |
static InetAddress |
getByName(String name)
This gets one address associated with a name. |
String |
getHostAddress()
Return the address in the dotted form. |
String |
getHostName()
Return the host name. |
static InetAddress |
getLocalHost()
Return an address for the local host. |
static String |
getLocalHostName()
This returns the local host name. |
int |
hashCode()
Returns a hashCode for the object. |
static boolean |
isANetAddress(String name)
|
String |
toString()
Return a String representation of this object. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass |
| Field Detail |
public static final String INFRA_RED
| Method Detail |
public static IOHandle getAllByName(String name,
IOHandle h)
If the IOHandle reports success then the returnValue member of the handle will be an array of InetAddress objects representing all host-ip pairings for the specified name/address. See the doc on getByName(String name) to see how you should use it.
public static InetAddress[] getAllByName(String hostName)
throws UnknownHostException
hostName - The name to look for.
UnknownHostException - if no addresses could be found.
public static InetAddress getByName(String name)
throws UnknownHostException
public static InetAddress getByName(String name){
IOHandle h = getAllByName(name,null);
if (!h.waitOnFlags(h.Success,TimeOut.Forever)) return null;
InetAddress [] ret = (InetAddress [])h.returnValue;
return ret[0];
}
name - The host name to look for.
UnknownHostException - if no IP address could be found.public static boolean isANetAddress(String name)
public static String getLocalHostName()
public static InetAddress getLocalHost()
throws UnknownHostException
UnknownHostException - If an address for the local host could not be found.public String toString()
Object
toString in class Objectpublic String getHostName()
public String getHostAddress()
public byte[] getAddress()
public boolean equals(Object other)
equals in class Objectother - another InetAddress
public int hashCode()
Object
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||