다음을 통해 공유


InetAddress.GetAllByName(String) Method

Definition

Given the name of a host, returns an array of its IP addresses, based on the configured name service on the system.

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

Parameters

host
String

the name of the host, or null.

Returns

an array of all the IP addresses for a given host name.

Attributes

Exceptions

if the address lookup fails.

Remarks

Given the name of a host, returns an array of its IP addresses, based on the configured name service on the system.

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. A literal IPv6 address may also be qualified by appending a scoped zone identifier or scope_id. The syntax and usage of scope_ids is described here.

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.

If there is a security manager and host is not null and host.length() is not equal to zero, the security manager's checkConnect method is called with the hostname and -1 as its arguments to see if the operation is allowed.

Java documentation for java.net.InetAddress.getAllByName(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