Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

DuplicateAddressDetectionState Enumeration

Specifies the current state of an IP address.

Namespace:  System.Net.NetworkInformation
Assembly:  System (in System.dll)
public enum DuplicateAddressDetectionState
Member nameDescription
DeprecatedThe address is valid, but it is nearing its lease lifetime and should not be used by applications.
DuplicateThe address is not unique. This address should not be assigned to the network interface.
InvalidThe address is not valid. A nonvalid address is expired and no longer assigned to an interface; applications should not send data packets to it.
PreferredThe address is valid and its use is unrestricted.
TentativeThe duplicate address detection procedure's evaluation of the address has not completed successfully. Applications should not use the address because it is not yet valid and packets sent to it are discarded.

To help ensure that all interfaces on a network have a unique address, the interface host is responsible for running a "duplicate address detection" algorithm on unicast addresses. The purpose of this algorithm is to attempt to prevent non-unique addresses on the network. This process is defined in IETF RFC 1971.

This enumeration is used by the UnicastIPAddressInformation and MulticastIPAddressInformation classes. Instances of this class are returned when you retrieve the unicast address information for a NetworkInterface object.

The following code example determines unicast address information.

public static void DisplayUnicastAddresses()
    Console.WriteLine("Unicast Addresses");
    NetworkInterface[] adapters  = NetworkInterface.GetAllNetworkInterfaces();
    foreach (NetworkInterface adapter in adapters)
        IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
        UnicastIPAddressInformationCollection uniCast = adapterProperties.UnicastAddresses;
        if (uniCast.Count >0)
            string lifeTimeFormat = "dddd, MMMM dd, yyyy  hh:mm:ss tt";
            foreach (UnicastIPAddressInformation uni in uniCast)
                DateTime when;

                Console.WriteLine("  Unicast Address ......................... : {0}", uni.Address);
                Console.WriteLine("     Prefix Origin ........................ : {0}", uni.PrefixOrigin);
                Console.WriteLine("     Suffix Origin ........................ : {0}", uni.SuffixOrigin);
                Console.WriteLine("     Duplicate Address Detection .......... : {0}", 

                // Format the lifetimes as Sunday, February 16, 2003 11:33:44 PM 
                // if en-us is the current culture. 

                // Calculate the date and time at the end of the lifetimes.    
                when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressValidLifetime);
                when = when.ToLocalTime();    
                Console.WriteLine("     Valid Life Time ...................... : {0}", 
                when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressPreferredLifetime);   
                when = when.ToLocalTime();
                Console.WriteLine("     Preferred life time .................. : {0}", 

                when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.DhcpLeaseLifetime);
                when = when.ToLocalTime(); 
                Console.WriteLine("     DHCP Leased Life Time ................ : {0}", 

.NET Framework


.NET Framework Client Profile

Supported in: 4, 3.5 SP1



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.