IPAddress.ScopeId IPAddress.ScopeId IPAddress.ScopeId IPAddress.ScopeId Property

定义

获取或设置 IPv6 地址范围标识符。Gets or sets the IPv6 address scope identifier.

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

属性值

指定地址范围的长整数。A long integer that specifies the scope of the address.

异常

AddressFamily = InterNetworkAddressFamily = InterNetwork.

scopeId < 0scopeId < 0 -or-

  • scopeId > 0x00000000FFFFFFFF
  • scopeId > 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: {0}", curAdd->AddressFamily );
    
    // Display the ScopeId property in case of IPV6 addresses.
    if ( curAdd->AddressFamily.ToString() == ProtocolFamily::InterNetworkV6.ToString() )
             Console::WriteLine( "Scope Id: {0}", curAdd->ScopeId );
    
    
    // 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更改的含义取决于使用它的上下文。The meaning of ScopeId changes depending on the context in which it is used.

    • 链接-本地地址。Link-local address. 在多个接口连接到不同链接的主机上,可以将同一链接本地地址分配给多个接口。On a host with multiple interfaces connected to separate links, the same link-local address can be assigned to multiple interfaces. 为了消除这种不明确性,范围标识符用于指定交换消息所使用的接口。To eliminate this ambiguity, a scope identifier is used to specify the interface over which messages are exchanged.

    备注

    链接本地地址(由格式前缀(FP) FE80 标识)在与同一链接上的相邻节点通信时由节点使用。Link-local addresses, identified by the Format Prefix (FP) FE80, are used by nodes when communicating with neighboring nodes on the same link.

    • 站点本地地址。Site-local addresses. 主机可以连接到多个站点。A host can be connected to multiple sites. 在这种情况下,作用域标识符用于指示要与之通信的特定站点。In this case, a scope identifier is used to indicate a specific site to communicate with.

    备注

    在专用 intranet 上通信时,节点会使用由格式前缀(FP) FEC0 标识的站点本地地址。Site-local addresses, identified by the Format Prefix (FP) FEC0, are used by nodes when communicating on private intranets.

    用于指定地址的ScopeId符号为。 Address%ScopeIdThe notation that is used to specify the ScopeId with an address is Address%ScopeId. 例如,FE80::5EFE:192.168.41.30%2.For example, FE80::5EFE:192.168.41.30%2.

    适用于