2013-01-01 3 views
3

다음은 Windows XP에서 기본 NIC를 가져 오는 코드이지만 Windows 7에서는 동일한 코드가 작동하지 않습니다. MSDN을 읽은 후 정말 혼란 스럽습니다. 어떤 해결책?Windows 7 기본 네트워크 어댑터

//----------------- Getting all the Nic's -------------------- 
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) 
{ 
    //------------ Getting properties of IPV4 ---------------- 
    IPInterfaceProperties ipProps = nic.GetIPProperties(); 

    //------------ Getting the Ip Properties ----------------- 
    if (ipProps.GetIPv4Properties() != null) 
    { 
     dic.Add(ipProps.GetIPv4Properties().Index, nic.Name); 
    } 

오류 : 요청 프로토콜이 구성되지 않았거나 구현이 없습니다.

+0

오류가 발생하는 라인은 무엇입니까? –

답변

2

IPv4 지원이없는 인터페이스를 사용한다는 의미입니다. 와 그것에 대한 점검 :

if (nic.Supports(NetworkInterfaceComponent.IPv4)) // means IPv4 support is present 

그 이상을 here를 참조하십시오.

+0

Genious ...................... –

관련 문제