Breyta

Deila með


IPGlobalProperties.GetUnicastAddressesAsync Method

Definition

Retrieves the stable unicast IP address table on the local computer as an asynchronous operation.

public:
 virtual System::Threading::Tasks::Task<System::Net::NetworkInformation::UnicastIPAddressInformationCollection ^> ^ GetUnicastAddressesAsync();
public virtual System.Threading.Tasks.Task<System.Net.NetworkInformation.UnicastIPAddressInformationCollection> GetUnicastAddressesAsync ();
abstract member GetUnicastAddressesAsync : unit -> System.Threading.Tasks.Task<System.Net.NetworkInformation.UnicastIPAddressInformationCollection>
override this.GetUnicastAddressesAsync : unit -> System.Threading.Tasks.Task<System.Net.NetworkInformation.UnicastIPAddressInformationCollection>
Public Overridable Function GetUnicastAddressesAsync () As Task(Of UnicastIPAddressInformationCollection)

Returns

The task object representing the asynchronous operation.

Exceptions

The call to the native GetAdaptersAddresses function failed.

The caller does not have necessary Read permission.

The call to the native NotifyStableUnicastIpAddressTable function failed.

Remarks

In order to support outbound connections or to accept incoming connections on a Teredo interface, applications need to ensure that the Teredo interface is up and ready for use. This is because Teredo can go into a dormant state when not used for some period of time.

The GetUnicastAddressesAsync method will allow an application to retrieve the list of stable unicast IP addresses as asynchronous operation. The IPAddress.IsIPv6Teredo property can be used to determine if an IP address is an IPv6 Teredo address with the prefix of 2001::/32.

The GetUnicastAddresses method also returns non-Teredo addresses and provides a more convenient way to obtain the unicast IP addresses for a system than enumerating all the System.Net.NetworkInformation.NetworkInterface objects on a local computer and querying the associated IP addresses.

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by GetUnicastAddresses().

Applies to

See also