DuplicateAddressDetectionState Sabit listesi
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Bir IP adresinin geçerli durumunu belirtir.
public enum class DuplicateAddressDetectionState
public enum DuplicateAddressDetectionState
type DuplicateAddressDetectionState =
Public Enum DuplicateAddressDetectionState
- Devralma
Alanlar
| Name | Değer | Description |
|---|---|---|
| Invalid | 0 | Adres geçerli değil. Geçersiz bir adresin süresi doldu ve artık bir arabirime atanmadı; uygulamalar veri paketleri göndermemelidir. |
| Tentative | 1 | Yinelenen adres algılama yordamının adres değerlendirmesi başarıyla tamamlanmadı. Henüz geçerli olmadığından ve bu adrese gönderilen paketler atıldığından uygulamalar adresi kullanmamalıdır. |
| Duplicate | 2 | Adres benzersiz değil. Bu adres ağ arabirimine atanmamalıdır. |
| Deprecated | 3 | Adres geçerli, ancak kira ömrü yaklaşıyor ve uygulamalar tarafından kullanılmamalıdır. |
| Preferred | 4 | Adres geçerli ve kullanımı kısıtlanmamış. |
Örnekler
Aşağıdaki kod örneği, tek noktaya yayın adres bilgilerini belirler.
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)
{
Console.WriteLine(adapter.Description);
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}",
uni.DuplicateAddressDetectionState);
// 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.ToString(lifeTimeFormat,System.Globalization.CultureInfo.CurrentCulture)
);
when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressPreferredLifetime);
when = when.ToLocalTime();
Console.WriteLine(" Preferred life time .................. : {0}",
when.ToString(lifeTimeFormat,System.Globalization.CultureInfo.CurrentCulture)
);
when = DateTime.UtcNow + TimeSpan.FromSeconds(uni.DhcpLeaseLifetime);
when = when.ToLocalTime();
Console.WriteLine(" DHCP Leased Life Time ................ : {0}",
when.ToString(lifeTimeFormat,System.Globalization.CultureInfo.CurrentCulture)
);
}
Console.WriteLine();
}
}
}
Public Shared Sub DisplayUnicastAddresses()
Console.WriteLine("Unicast Addresses")
Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Dim adapter As NetworkInterface
For Each adapter In adapters
Dim adapterProperties As IPInterfaceProperties = adapter.GetIPProperties()
Dim uniCast As UnicastIPAddressInformationCollection = adapterProperties.UnicastAddresses
If uniCast.Count > 0 Then
Console.WriteLine(adapter.Description)
Dim lifeTimeFormat As String = "dddd, MMMM dd, yyyy hh:mm:ss tt"
Dim uni As UnicastIPAddressInformation
For Each uni In uniCast
Dim [when] As DateTime
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}", uni.DuplicateAddressDetectionState)
' 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].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture))
[when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressPreferredLifetime)
[when] = [when].ToLocalTime()
Console.WriteLine(" Preferred life time .................. : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture))
[when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.DhcpLeaseLifetime)
[when] = [when].ToLocalTime()
Console.WriteLine(" DHCP Leased Life Time ................ : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture))
Next uni
Console.WriteLine()
End If
Next adapter
End Sub
Açıklamalar
Bir ağdaki tüm arabirimlerin benzersiz bir adrese sahip olduğundan emin olmak için, arabirim konağı tek noktaya yayın adreslerinde "yinelenen adres algılama" algoritması çalıştırmakla sorumludur. Bu algoritmanın amacı, ağda benzersiz olmayan adresleri engellemeye çalışmaktır. Bu işlem IETF RFC 1971'de tanımlanır.
Bu numaralandırma ve UnicastIPAddressInformation sınıfları tarafından MulticastIPAddressInformation kullanılır. Bir nesnenin tek noktaya yayın adres bilgilerini NetworkInterface aldığınızda bu sınıfın örnekleri döndürülür.