IPInterfaceProperties 클래스

정의

IPv4(인터넷 프로토콜 버전 4) 또는 IPv6(인터넷 프로토콜 버전 6)을 지원하는 네트워크 인터페이스에 대한 정보를 제공합니다.

public ref class IPInterfaceProperties abstract
public abstract class IPInterfaceProperties
type IPInterfaceProperties = class
Public MustInherit Class IPInterfaceProperties
상속
IPInterfaceProperties

예제

다음 코드 예제에서는 주소 정보를 표시합니다.

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();
    }
}

설명

이 클래스는 IPv4 또는 IPv6을 지원하는 네트워크 인터페이스에 대한 구성 및 주소 정보에 대한 액세스를 제공합니다. 이 클래스의 인스턴스는 만들지 않습니다. 메서드에서 반환됩니다 GetIPProperties .

IPv4 관련 속성에 액세스하려면 메서드에서 반환된 개체를 GetIPv4Properties 사용합니다. IPv6 관련 속성에 액세스하려면 메서드에서 반환된 개체를 GetIPv6Properties 사용합니다.

생성자

IPInterfaceProperties()

IPInterfaceProperties 클래스의 새 인스턴스를 초기화합니다.

속성

AnycastAddresses

이 인터페이스에 할당된 애니캐스트 IP 주소를 가져옵니다.

DhcpServerAddresses

이 인터페이스에 대한 DHCP(Dynamic Host Configuration Protocol) 서버의 주소를 가져옵니다.

DnsAddresses

이 인터페이스에 대한 DNS(Domain Name System) 서버의 주소를 가져옵니다.

DnsSuffix

이 인터페이스와 관련된 DNS(Domain Name System) 접미사를 가져옵니다.

GatewayAddresses

이 인터페이스에 대한 IPv4 네트워크 게이트웨이 주소를 가져옵니다.

IsDnsEnabled

NetBt가 이 인터페이스에서 DNS 이름 확인을 사용하도록 구성되어 있는지 여부를 나타내는 Boolean 값을 가져옵니다.

IsDynamicDnsEnabled

이 인터페이스가 DNS(Domain Name System)에 IP 주소 정보를 자동으로 등록하도록 구성되었는지 여부를 나타내는 Boolean 값을 가져옵니다.

MulticastAddresses

이 인터페이스에 할당된 멀티캐스트 주소를 가져옵니다.

UnicastAddresses

이 인터페이스에 할당된 유니캐스트 주소를 가져옵니다.

WinsServersAddresses

WINS(Windows Internet Name Service) 서버의 주소를 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetIPv4Properties()

이 네트워크 인터페이스에 대한 IPv4(인터넷 프로토콜 버전 4) 구성 데이터를 제공합니다.

GetIPv6Properties()

이 네트워크 인터페이스에 대한 IPv6(인터넷 프로토콜 버전 6) 구성 데이터를 제공합니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상