Condividi tramite


InetAddress.HostName Property

Definition

Gets the host name for this IP address.

public virtual string HostName { [Android.Runtime.Register("getHostName", "()Ljava/lang/String;", "GetGetHostNameHandler")] get; }
[<get: Android.Runtime.Register("getHostName", "()Ljava/lang/String;", "GetGetHostNameHandler")>]
member this.HostName : string

Property Value

the host name for this IP address, or if the operation is not allowed by the security check, the textual representation of the IP address.

Attributes

Remarks

Gets the host name for this IP address.

If this InetAddress was created with a host name, this host name will be remembered and returned; otherwise, a reverse name lookup will be performed and the result will be returned based on the system configured name lookup service. If a lookup of the name service is required, call #getCanonicalHostName() getCanonicalHostName.

If there is a security manager, its checkConnect method is first called with the hostname and -1 as its arguments to see if the operation is allowed. If the operation is not allowed, it will return the textual representation of the IP address.

Java documentation for java.net.InetAddress.getHostName().

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