Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IPGlobalProperties.GetUnicastAddresses Method

.NET Framework 4.6 and 4.5

Retrieves the stable unicast IP address table on the local computer.

Namespace:  System.Net.NetworkInformation
Assembly:  System (in System.dll)

public virtual UnicastIPAddressInformationCollection GetUnicastAddresses()

Return Value

Type: System.Net.NetworkInformation.UnicastIPAddressInformationCollection
A UnicastIPAddressInformationCollection that contains a list of stable unicast IP addresses on the local computer.

ExceptionCondition
NetworkInformationException

The call to the native GetAdaptersAddresses function failed.

NotImplementedException

This method is not implemented on the platform. This method uses the native NotifyStableUnicastIpAddressTable function that is supported on Windows Vista and later.

SecurityException

The caller does not have necessary Read permission.

Win32Exception

The call to the native NotifyStableUnicastIpAddressTable function failed.

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 GetUnicastAddresses method will allow an application to retrieve the list of stable unicast IP addresses. 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.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft