NetAddress CLASS

The Internet Protocol address.

The instantiation of this class is always done by the engine. A user usually provides an IP address, or a host name to one of static resolver methods on this class to get an instance of the resolved address.

Parent Class

All Members


TypeNameSignature
methodgetAddresspublic String getAddress()
method SgetLocalpublic static NetAddress getLocal()
method SgetLoopbackpublic static NetAddress getLoopback()
methodgetNamepublic String getName()
methodgetTypepublic AddressType getType()
methodisLoopbackpublic bool isLoopback()
method Sresolvepublic static NetAddress resolve(string)
method SresolveAllpublic static NetAddress[] resolveAll(string)

Methods


public String getAddress()

Get host address as either specified or resolved from the host name. If the address was created by a host name but turned out to be unresolvable, returns null.

Returns

  • The host name or host address.

public static NetAddress getLocal()

Get the local address. The address is resolved from local host name.

Returns

  • A network address representative of the local host.

public static NetAddress getLoopback()

Get an IPv4 loopback address.

Returns

  • An IPv4 loopback address.

public String getName()

Get the host name if this instance is resolved from it. If it is created by an address literal this method returns the same string value.

Returns

  • The host name or host address.

public AddressType getType()

Get the type of this IP address.

Returns

  • The type of this IP address. Note it could be unresolved.

public bool isLoopback()

Whether this address is a local loopback. Such address is backed by a virtual loopback network device provided by the OS. Data coming from and to this address doesn't incur traffic on data link layer.

Returns

  • True if the address is loopback.

public static NetAddress resolve(string name)

Try to resolve the host name to an address.

If the name is an address itself no resolution will occur and the argument will be directly converted to an address object.

Required Policies

  • System.Network/resolve

Parameters

  • name The host name to resolve.

Returns

  • A network address resolved from the given host name. Null if the name is unresolvable or illegal.

public static NetAddress[] resolveAll(string name)

Try to resolve the host name to as many addresses as possible.

If the name is an address itself no resolution will occur and the resultant array will only contain one address from the given name.

Required Policies

  • System.Network/resolve

Parameters

  • name The host name to resolve.

Returns

  • An array of network addresses that are resolved from the given host name. If the name is unresolvable or illegal the array will be empty.