IPv4InterfaceProperties 클래스

정의

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

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

예제

다음 코드 예제에서는 개체를 GetIPv4Properties 가져오고 해당 데이터를 표시합니다.

void DisplayIPv4NetworkInterfaces()
{
   array<NetworkInterface^>^nics = NetworkInterface::GetAllNetworkInterfaces();
   IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties();
   Console::WriteLine( "IPv4 interface information for {0}.{1}", properties->HostName, properties->DomainName );
   System::Collections::IEnumerator^ myEnum23 = nics->GetEnumerator();
   while ( myEnum23->MoveNext() )
   {
      NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum23->Current);

      // Only display informatin for interfaces that support IPv4.
      if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) == false )
      {
         continue;
      }
      Console::WriteLine();
      Console::WriteLine( adapter->Description );

      // Underline the description.
      Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) );
      IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties();

      // Try to get the IPv4 interface properties.
      IPv4InterfaceProperties ^ p = adapterProperties->GetIPv4Properties();
      if ( !p )
      {
         Console::WriteLine( "No IPv4 information is available for this interface." );
         continue;
      }

      // Display the IPv4 specific data.
      Console::WriteLine( "  Index ............................. : {0}", 
         p->Index );
      Console::WriteLine( "  MTU ............................... : {0}", 
         p->Mtu );
      Console::WriteLine( "  APIPA active....................... : {0}", 
         p->IsAutomaticPrivateAddressingActive );
      Console::WriteLine( "  APIPA enabled...................... : {0}", 
         p->IsAutomaticPrivateAddressingEnabled );
      Console::WriteLine( "  Forwarding enabled................. : {0}", 
         p->IsForwardingEnabled );
      Console::WriteLine( "  Uses WINS ......................... : {0}", 
         p->UsesWins );
   }
}
public static void DisplayIPv4NetworkInterfaces()
{
    NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
    IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
    Console.WriteLine("IPv4 interface information for {0}.{1}",
       properties.HostName, properties.DomainName);
    Console.WriteLine();

    foreach (NetworkInterface adapter in nics)
    {
        // Only display informatin for interfaces that support IPv4.
        if (adapter.Supports(NetworkInterfaceComponent.IPv4) == false)
        {
            continue;
        }
        Console.WriteLine(adapter.Description);
        // Underline the description.
        Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
        IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
        // Try to get the IPv4 interface properties.
        IPv4InterfaceProperties p = adapterProperties.GetIPv4Properties();

        if (p == null)
        {
            Console.WriteLine("No IPv4 information is available for this interface.");
            Console.WriteLine();
            continue;
        }
        // Display the IPv4 specific data.
        Console.WriteLine("  Index ............................. : {0}", p.Index);
        Console.WriteLine("  MTU ............................... : {0}", p.Mtu);
        Console.WriteLine("  APIPA active....................... : {0}",
            p.IsAutomaticPrivateAddressingActive);
        Console.WriteLine("  APIPA enabled...................... : {0}",
            p.IsAutomaticPrivateAddressingEnabled);
        Console.WriteLine("  Forwarding enabled................. : {0}",
            p.IsForwardingEnabled);
        Console.WriteLine("  Uses WINS ......................... : {0}",
            p.UsesWins);
        Console.WriteLine();
    }
}
Public Shared Sub DisplayIPv4NetworkInterfaces() 
    Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
    Dim properties As IPGlobalProperties = IPGlobalProperties.GetIPGlobalProperties()
    Console.WriteLine("IPv4 interface information for {0}.{1}", properties.HostName, properties.DomainName)
    
    Dim adapter As NetworkInterface
    For Each adapter In  nics
        ' Only display informatin for interfaces that support IPv4.
        If adapter.Supports(NetworkInterfaceComponent.IPv4) = False Then
            GoTo ContinueForEach1
        End If
        Console.WriteLine()
        Console.WriteLine(adapter.Description)
        ' Underline the description.
        Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length, "="c))
        Dim adapterProperties As IPInterfaceProperties = adapter.GetIPProperties()
        ' Try to get the IPv4 interface properties.
        Dim p As IPv4InterfaceProperties = adapterProperties.GetIPv4Properties()
        
        If p Is Nothing Then
            Console.WriteLine("No IPv4 information is available for this interface.")
            GoTo ContinueForEach1
        End If
        ' Display the IPv4 specific data.
        Console.WriteLine("  Index ............................. : {0}", p.Index)
        Console.WriteLine("  MTU ............................... : {0}", p.Mtu)
        Console.WriteLine("  APIPA active....................... : {0}", p.IsAutomaticPrivateAddressingActive)
        Console.WriteLine("  APIPA enabled...................... : {0}", p.IsAutomaticPrivateAddressingEnabled)
        Console.WriteLine("  Forwarding enabled................. : {0}", p.IsForwardingEnabled)
        Console.WriteLine("  Uses WINS ......................... : {0}", p.UsesWins)
    ContinueForEach1:
    Next adapter

End Sub

설명

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

IPV6 속성은 를 참조하세요 GetIPv6Properties.

생성자

IPv4InterfaceProperties()

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

속성

Index

인터넷 프로토콜 버전 4(IPv4) 주소와 연결된 네트워크 인터페이스의 인덱스를 가져옵니다.

IsAutomaticPrivateAddressingActive

이 인터페이스가 APIPA(Automatic Private IP Addressing) 주소를 사용하는지 여부를 나타내는 Boolean 값을 가져옵니다.

IsAutomaticPrivateAddressingEnabled

이 인터페이스가 APIPA(Automatic Private IP Addressing)를 사용하도록 설정되었는지 여부를 나타내는 Boolean 값을 가져옵니다.

IsDhcpEnabled

인터페이스가 DHCP(Dynamic Host Configuration Protocol) 서버를 사용하여 IP 주소를 얻도록 구성되었는지 여부를 나타내는 Boolean 값을 가져옵니다.

IsForwardingEnabled

이 인터페이스가 패킷을 전달(라우팅)할 수 있는지 여부를 나타내는 Boolean 값을 가져옵니다.

Mtu

이 네트워크 인터페이스의 MTU(최대 전송 단위)를 가져옵니다.

UsesWins

인터페이스가 WINS(Windows Internet Name Service)를 사용하는지 여부를 나타내는 Boolean 값을 가져옵니다.

메서드

Equals(Object)

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

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

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

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

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상