Condividi tramite


Inet6Address Class

Definition

This class represents an Internet Protocol version 6 (IPv6) address.

[Android.Runtime.Register("java/net/Inet6Address", DoNotGenerateAcw=true)]
public sealed class Inet6Address : Java.Net.InetAddress
[<Android.Runtime.Register("java/net/Inet6Address", DoNotGenerateAcw=true)>]
type Inet6Address = class
    inherit InetAddress
Inheritance
Inet6Address
Attributes

Remarks

This class represents an Internet Protocol version 6 (IPv6) address. Defined by RFC&nbsp;2373: IP Version 6 Addressing Architecturehttp://www.ietf.org/rfc/rfc2373.txt.

<h3> "format">Textual representation of IP addresses</h3>

Textual representation of IPv6 address used as input to methods takes one of the following forms:

<ol> <li>

"lform">The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the hexadecimal values of the eight 16-bit pieces of the address. This is the full form. For example,

<blockquote><table cellpadding=0 cellspacing=0 summary="layout"> <tr><td>1080:0:0:0:8:800:200C:417A<td></tr> </table></blockquote>

Note that it is not necessary to write the leading zeros in an individual field. However, there must be at least one numeral in every field, except as described below.</li>

<li>

Due to some methods of allocating certain styles of IPv6 addresses, it will be common for addresses to contain long strings of zero bits. In order to make writing addresses containing zero bits easier, a special syntax is available to compress the zeros. The use of "::" indicates multiple groups of 16-bits of zeros. The "::" can only appear once in an address. The "::" can also be used to compress the leading and/or trailing zeros in an address. For example,

<blockquote><table cellpadding=0 cellspacing=0 summary="layout"> <tr><td>1080::8:800:200C:417A<td></tr> </table></blockquote>

<li>

An alternative form that is sometimes more convenient when dealing with a mixed environment of IPv4 and IPv6 nodes is x:x:x:x:x:x:d.d.d.d, where the 'x's are the hexadecimal values of the six high-order 16-bit pieces of the address, and the 'd's are the decimal values of the four low-order 8-bit pieces of the standard IPv4 representation address, for example,

<blockquote><table cellpadding=0 cellspacing=0 summary="layout"> <tr><td>::FFFF:129.144.52.38<td></tr> <tr><td>::129.144.52.38<td></tr> </table></blockquote>

where "::FFFF:d.d.d.d" and "::d.d.d.d" are, respectively, the general forms of an IPv4-mapped IPv6 address and an IPv4-compatible IPv6 address. Note that the IPv4 portion must be in the "d.d.d.d" form. The following forms are invalid:

<blockquote><table cellpadding=0 cellspacing=0 summary="layout"> <tr><td>::FFFF:d.d.d<td></tr> <tr><td>::FFFF:d.d<td></tr> <tr><td>::d.d.d<td></tr> <tr><td>::d.d<td></tr> </table></blockquote>

The following form:

<blockquote><table cellpadding=0 cellspacing=0 summary="layout"> <tr><td>::FFFF:d<td></tr> </table></blockquote>

is valid, however it is an unconventional representation of the IPv4-compatible IPv6 address,

<blockquote><table cellpadding=0 cellspacing=0 summary="layout"> <tr><td>::255.255.0.d<td></tr> </table></blockquote>

while "::d" corresponds to the general IPv6 address "0:0:0:0:0:0:0:d".</li> </ol>

For methods that return a textual representation as output value, the full form is used. Inet6Address will return the full form because it is unambiguous when used in combination with other textual data.

<h4> Special IPv6 address </h4>

<blockquote> <table cellspacing=2 summary="Description of IPv4-mapped address"> <tr><th valign=top>IPv4-mapped address</th> <td>Of the form::ffff:w.x.y.z, this IPv6 address is used to represent an IPv4 address. It allows the native program to use the same address data structure and also the same socket when communicating with both IPv4 and IPv6 nodes.

In InetAddress and Inet6Address, it is used for internal representation; it has no functional role. Java will never return an IPv4-mapped address. These classes can take an IPv4-mapped address as input, both in byte array and text representation. However, it will be converted into an IPv4 address.</td></tr> </table></blockquote>

<h4>"scoped">Textual representation of IPv6 scoped addresses</h4>

The textual representation of IPv6 addresses as described above can be extended to specify IPv6 scoped addresses. This extension to the basic addressing architecture is described in [draft-ietf-ipngwg-scoping-arch-04.txt].

Because link-local and site-local addresses are non-global, it is possible that different hosts may have the same destination address and may be reachable through different interfaces on the same originating system. In this case, the originating system is said to be connected to multiple zones of the same scope. In order to disambiguate which is the intended destination zone, it is possible to append a zone identifier (or scope_id) to an IPv6 address.

The general format for specifying the scope_id is the following:

<blockquote>IPv6-address%scope_id</blockquote>

The IPv6-address is a literal IPv6 address as described above. The scope_id refers to an interface on the local system, and it can be specified in two ways. <ol><li>As a numeric identifier. This must be a positive integer that identifies the particular interface and scope as understood by the system. Usually, the numeric values can be determined through administration tools on the system. Each interface may have multiple values, one for each scope. If the scope is unspecified, then the default value used is zero.</li> <li>As a string. This must be the exact string that is returned by java.net.NetworkInterface#getName() for the particular interface in question. When an Inet6Address is created in this way, the numeric scope-id is determined at the time the object is created by querying the relevant NetworkInterface.</li></ol>

Note also, that the numeric scope_id can be retrieved from Inet6Address instances returned from the NetworkInterface class. This can be used to find out the current scope ids configured on the system.

Added in 1.4.

Java documentation for java.net.Inet6Address.

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.

Properties

CanonicalHostName

Gets the fully qualified domain name for this IP address.

(Inherited from InetAddress)
Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
HostAddress

Returns the IP address string in textual presentation.

(Inherited from InetAddress)
HostName

Gets the host name for this IP address.

(Inherited from InetAddress)
IsAnyLocalAddress

Utility routine to check if the InetAddress in a wildcard address.

(Inherited from InetAddress)
IsIPv4CompatibleAddress

Utility routine to check if the InetAddress is an IPv4 compatible IPv6 address.

IsLinkLocalAddress

Utility routine to check if the InetAddress is an link local address.

(Inherited from InetAddress)
IsLoopbackAddress

Utility routine to check if the InetAddress is a loopback address.

(Inherited from InetAddress)
IsMCGlobal

Utility routine to check if the multicast address has global scope.

(Inherited from InetAddress)
IsMCLinkLocal

Utility routine to check if the multicast address has link scope.

(Inherited from InetAddress)
IsMCNodeLocal

Utility routine to check if the multicast address has node scope.

(Inherited from InetAddress)
IsMCOrgLocal

Utility routine to check if the multicast address has organization scope.

(Inherited from InetAddress)
IsMCSiteLocal

Utility routine to check if the multicast address has site scope.

(Inherited from InetAddress)
IsMulticastAddress

Utility routine to check if the InetAddress is an IP multicast address.

(Inherited from InetAddress)
IsSiteLocalAddress

Utility routine to check if the InetAddress is a site local address.

(Inherited from InetAddress)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ScopedInterface

Returns the scoped interface, if this instance was created with with a scoped interface.

ScopeId

Returns the numeric scopeId, if this instance is associated with an interface.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from InetAddress)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from InetAddress)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetAddress()

Returns the raw IP address of this InetAddress object.

(Inherited from InetAddress)
GetByAddress(String, Byte[], Int32)

Create an Inet6Address in the exact manner of InetAddress#getByAddress(String,byte[]) except that the IPv6 scope_id is set to the given numeric value.

GetByAddress(String, Byte[], NetworkInterface)

Create an Inet6Address in the exact manner of InetAddress#getByAddress(String,byte[]) except that the IPv6 scope_id is set to the value corresponding to the given interface for the address type specified in addr.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsReachable(Int32)

Test whether that address is reachable.

(Inherited from InetAddress)
IsReachable(NetworkInterface, Int32, Int32)

Test whether that address is reachable.

(Inherited from InetAddress)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to