Share via


InetAddress.GetByName(String) Method

Definition

Determines the IP address of a host, given the host's name.

[Android.Runtime.Register("getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;", "")]
public static Java.Net.InetAddress GetByName (string? host);
[<Android.Runtime.Register("getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;", "")>]
static member GetByName : string -> Java.Net.InetAddress

Parameters

host
String

the specified host, or null.

Returns

an IP address for the given host name.

Attributes

Exceptions

if the address lookup fails.

Remarks

Determines the IP address of a host, given the host's name.

The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address. If a literal IP address is supplied, only the validity of the address format is checked.

For host specified in literal IPv6 address, either the form defined in RFC 2732 or the literal IPv6 address format defined in RFC 2373 is accepted. IPv6 scoped addresses are also supported. See here for a description of IPv6 scoped addresses.

If the host is null then an InetAddress representing an address of the loopback interface is returned. See RFC 3330 section&nbsp;2 and RFC 2373 section&nbsp;2.5.3.

Java documentation for java.net.InetAddress.getByName(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to