共用方式為


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.

scopeId < 0

-或-

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

  • 連結本機位址。 在連線至個別連結之多個介面的主機上,可以將相同的連結本機位址指派給多個介面。 為了消除這種模棱兩可的情況,範圍標識符是用來指定交換訊息的介面。

注意

連結本機位址是由格式前置詞 (FP) FE80 所識別,由節點在與相同連結上的鄰近節點通訊時使用。

  • 網站-本機位址。 主機可以連線到多個月臺。 在此情況下,會使用範圍標識符來指出要與其通訊的特定網站。

注意

月臺本機位址是由格式前置詞 (FP) FEC0 所識別,會在私人內部網路上通訊時由節點使用。

用來指定 ScopeId 的表示法為 Address%ScopeId。 例如, FE80::5EFE:192.168.41.30%2.

適用於