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.

適用於