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.

適用対象