IPAddress.ScopeId 属性

定义

获取或设置 IPv6 地址范围标识符。

public:
 property long ScopeId { long get(); void set(long value); };
public long ScopeId { get; set; }
member this.ScopeId : int64 with get, set
Public Property ScopeId As Long

属性值

一个指定地址范围的长整数。

例外

AddressFamily = InterNetwork.

范围标识符为 < 0

-或-

范围标识符0x00000000FFFFFFFF >

示例


// Display the type of address family supported by the server. If the
// server is IPv6-enabled this value is: InterNetworkV6. If the server
// is also IPv4-enabled there will be an additional value of InterNetwork.
Console.WriteLine("AddressFamily: " + curAdd.AddressFamily.ToString());

// Display the ScopeId property in case of IPV6 addresses.
if(curAdd.AddressFamily.ToString() == ProtocolFamily.InterNetworkV6.ToString())
  Console.WriteLine("Scope Id: " + curAdd.ScopeId.ToString());
' Display the type of address family supported by the server. If the
' server is IPv6-enabled this value is: InterNetworkV6. If the server
' is also IPv4-enabled there will be an additional value of InterNetwork.
Console.WriteLine(("AddressFamily: " + curAdd.AddressFamily.ToString()))

' Display the ScopeId property in case of IPV6 addresses.
If curAdd.AddressFamily.ToString() = ProtocolFamily.InterNetworkV6.ToString() Then
  Console.WriteLine(("Scope Id: " + curAdd.ScopeId.ToString()))
End If

注解

更改的含义 ScopeId ,具体取决于所使用的上下文。

  • 链接本地地址。 在连接到单独链接的多个接口的主机上,可以将同一个链接本地地址分配给多个接口。 为了消除这种歧义,范围标识符用于指定交换消息的接口。

注释

链接本地地址(由格式前缀 (FP) FE80 标识,在与同一链接上的相邻节点通信时,节点使用。

  • 站点本地地址。 主机可以连接到多个站点。 在这种情况下,范围标识符用于指示要与之通信的特定站点。

注释

站点本地地址,由格式前缀 (FP) FEC0 标识,在专用 Intranet 上通信时由节点使用。

用于指定具有地址的 ScopeId 表示法为 Address%ScopeId。 例如: FE80::5EFE:192.168.41.30%2.

适用于