IPInterfaceProperties::AnycastAddresses Property
.NET Framework (current version)
Gets the anycast IP addresses assigned to this interface.
Assembly: System (in System.dll)
public: property IPAddressInformationCollection^ AnycastAddresses { virtual IPAddressInformationCollection^ get() abstract; }
Property Value
Type: System.Net.NetworkInformation::IPAddressInformationCollection^An IPAddressInformationCollection that contains the anycast addresses for this interface.
An anycast address identifies multiple computers. Packets sent to an anycast address are sent to one of the computers identified by the address. Anycast addressing is an IPv6 feature used to update router tables for a group of hosts.
The following code example displays the anycast addresses for the network interfaces on the local computer.
void DisplayAnycastAddresses() { int count = 0; Console::WriteLine( "Anycast Addresses" ); array<NetworkInterface^>^adapters = NetworkInterface::GetAllNetworkInterfaces(); System::Collections::IEnumerator^ myEnum13 = adapters->GetEnumerator(); while ( myEnum13->MoveNext() ) { NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum13->Current); IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); IPAddressInformationCollection ^ anyCast = adapterProperties->AnycastAddresses; if ( anyCast->Count > 0 ) { Console::WriteLine( adapter->Description ); System::Collections::IEnumerator^ myEnum14 = anyCast->GetEnumerator(); while ( myEnum14->MoveNext() ) { IPAddressInformation ^ any = safe_cast<IPAddressInformation ^>(myEnum14->Current); Console::WriteLine( " Anycast Address .......................... : {0} {1} {2}", any->Address, any->IsTransient ? "Transient" : "", any->IsDnsEligible ? "DNS Eligible" : "" ); count++; } Console::WriteLine(); } } if (count == 0) { Console::WriteLine(" No anycast addresses were found."); Console::WriteLine(); } }
.NET Framework
Available since 2.0
Available since 2.0
Show: