IPInterfaceProperties Sınıf
Ö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.
İnternet Protokolü sürüm 4 (IPv4) veya İnternet Protokolü sürüm 6(IPv6) destekleyen ağ arabirimleri hakkında bilgi sağlar.
public ref class IPInterfaceProperties abstract
public abstract class IPInterfaceProperties
type IPInterfaceProperties = class
Public MustInherit Class IPInterfaceProperties
- Devralma
-
IPInterfaceProperties
Aşağıdaki kod örneği adres bilgilerini görüntüler.
void ShowIPAddresses( IPInterfaceProperties ^ adapterProperties )
{
IPAddressCollection ^ dnsServers = adapterProperties->DnsAddresses;
if ( dnsServers != nullptr )
{
System::Collections::IEnumerator^ myEnum = dnsServers->GetEnumerator();
while ( myEnum->MoveNext() )
{
IPAddressInformation ^ dns = safe_cast<IPAddressInformation ^>(myEnum->Current);
Console::WriteLine( " DNS Servers ............................. : {0} ({1} {2})",
dns->Address, dns->IsTransient ? (String^)"Transient" : "", dns->IsDnsEligible ? (String^)"DNS Eligible" : "" );
}
}
IPAddressInformationCollection ^ anyCast = adapterProperties->AnycastAddresses;
if ( anyCast != nullptr )
{
System::Collections::IEnumerator^ myEnum1 = anyCast->GetEnumerator();
while ( myEnum1->MoveNext() )
{
IPAddressInformation ^ any = safe_cast<IPAddressInformation ^>(myEnum1->Current);
Console::WriteLine( " Anycast Address .......................... : {0} {1} {2}", any->Address, any->IsTransient ? (String^)"Transient" : "", any->IsDnsEligible ? (String^)"DNS Eligible" : "" );
}
Console::WriteLine();
}
MulticastIPAddressInformationCollection ^ multiCast = adapterProperties->MulticastAddresses;
if ( multiCast != nullptr )
{
System::Collections::IEnumerator^ myEnum2 = multiCast->GetEnumerator();
while ( myEnum2->MoveNext() )
{
IPAddressInformation ^ multi = safe_cast<IPAddressInformation ^>(myEnum2->Current);
Console::WriteLine( " Multicast Address ....................... : {0} {1} {2}", multi->Address, multi->IsTransient ? (String^)"Transient" : "", multi->IsDnsEligible ? (String^)"DNS Eligible" : "" );
}
Console::WriteLine();
}
UnicastIPAddressInformationCollection ^ uniCast = adapterProperties->UnicastAddresses;
if ( uniCast != nullptr )
{
String^ lifeTimeFormat = "dddd, MMMM dd, yyyy hh:mm:ss tt";
System::Collections::IEnumerator^ myEnum3 = uniCast->GetEnumerator();
while ( myEnum3->MoveNext() )
{
UnicastIPAddressInformation ^ uni = safe_cast<UnicastIPAddressInformation ^>(myEnum3->Current);
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( (double)uni->AddressValidLifetime );
when = when.ToLocalTime();
Console::WriteLine( " Valid Life Time ...................... : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) );
when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressPreferredLifetime );
when = when.ToLocalTime();
Console::WriteLine( " Preferred life time .................. : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) );
when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->DhcpLeaseLifetime );
when = when.ToLocalTime();
Console::WriteLine( " DHCP Leased Life Time ................ : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) );
}
Console::WriteLine();
}
}
public static void ShowIPAddresses(IPInterfaceProperties adapterProperties)
{
IPAddressCollection dnsServers = adapterProperties.DnsAddresses;
if (dnsServers != null)
{
foreach (IPAddress dns in dnsServers)
{
Console.WriteLine(" DNS Servers ............................. : {0}",
dns.ToString()
);
}
}
IPAddressInformationCollection anyCast = adapterProperties.AnycastAddresses;
if (anyCast != null)
{
foreach (IPAddressInformation any in anyCast)
{
Console.WriteLine(" Anycast Address .......................... : {0} {1} {2}",
any.Address,
any.IsTransient ? "Transient" : "",
any.IsDnsEligible ? "DNS Eligible" : ""
);
}
Console.WriteLine();
}
MulticastIPAddressInformationCollection multiCast = adapterProperties.MulticastAddresses;
if (multiCast != null)
{
foreach (IPAddressInformation multi in multiCast)
{
Console.WriteLine(" Multicast Address ....................... : {0} {1} {2}",
multi.Address,
multi.IsTransient ? "Transient" : "",
multi.IsDnsEligible ? "DNS Eligible" : ""
);
}
Console.WriteLine();
}
UnicastIPAddressInformationCollection uniCast = adapterProperties.UnicastAddresses;
if (uniCast != null)
{
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();
}
}
Bu sınıf, IPv4 veya IPv6 destekleyen ağ arabirimleri için yapılandırma ve adres bilgilerine erişim sağlar. Bu sınıfın örneklerini oluşturmazsınız; yöntemi tarafından GetIPProperties döndürülür.
IPv4'e özgü özelliklere erişmek için yöntemi tarafından GetIPv4Properties döndürülen nesneyi kullanın. IPv6'ya özgü özelliklere erişmek için yöntemi tarafından GetIPv6Properties döndürülen nesneyi kullanın.
IPInterface |
IPInterfaceProperties sınıfının yeni bir örneğini başlatır. |
Anycast |
Bu arabirime atanan her noktaya yayın IP adreslerini alır. |
Dhcp |
Bu arabirim için Dinamik Ana Bilgisayar Yapılandırma Protokolü (DHCP) sunucularının adreslerini alır. |
Dns |
Bu arabirim için Etki Alanı Adı Sistemi (DNS) sunucularının adreslerini alır. |
Dns |
Bu arabirimle ilişkili Etki Alanı Adı Sistemi (DNS) sonekini alır. |
Gateway |
Bu arabirim için IPv4 ağ geçidi adreslerini alır. |
Is |
NetBt'nin bu arabirimde DNS ad çözümlemesi kullanacak şekilde yapılandırılıp yapılandırılmadığını gösteren bir Boolean değer alır. |
Is |
Bu arabirimin IP adresi bilgilerini Etki Alanı Adı Sistemi'ne (DNS) otomatik olarak kaydedecek şekilde yapılandırılıp yapılandırılmadığını gösteren bir Boolean değer alır. |
Multicast |
Bu arabirime atanan çok noktaya yayın adreslerini alır. |
Unicast |
Bu arabirime atanan tek noktaya yayın adreslerini alır. |
Wins |
Windows İnternet Ad Hizmeti (WINS) sunucularının adreslerini alır. |
Equals(Object) |
Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler. (Devralındığı yer: Object) |
Get |
Varsayılan karma işlevi işlevi görür. (Devralındığı yer: Object) |
Get |
Bu ağ arabirimi için İnternet Protokolü sürüm 4 (IPv4) yapılandırma verilerini sağlar. |
Get |
Bu ağ arabirimi için İnternet Protokolü sürüm 6 (IPv6) yapılandırma verilerini sağlar. |
Get |
Type Geçerli örneğini alır. (Devralındığı yer: Object) |
Memberwise |
Geçerli Objectöğesinin sığ bir kopyasını oluşturur. (Devralındığı yer: Object) |
To |
Geçerli nesneyi temsil eden dizeyi döndürür. (Devralındığı yer: Object) |
Ürün | Sürümler |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET geri bildirimi
.NET, açık kaynak bir projedir. Geri bildirim sağlamak için bir bağlantı seçin: