ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • MFC의 Ping의 응답 코드값
    NMS(ICMP,SNMP) 2011. 4. 14. 11:46

    MFC 상으로 ping 응답을 확인하는 함수인 IcmpSendEcho() 에서 리턴값이 1인 경우에는 응답이 온 경우지만

    리턴값이 0 인 경우에는 응답이 오지 않은 경우다. 이럴 때 4번째 파라메타인 LPVOID ReplyBuffer를 분석해 보면 응답이 오지

    않은 이유를 알 수 있다. 확인 방법은 아래와 같다.

    거의 대부분의 11010코드(Request time out)이었지만, 실제 상황에서 테스트 해 본결과

    아무도 없는 한밤중에 11002(Destination Net Unreachable),11003(Destination Host Unreachable) 같은 상황이 나타나기도 했다.

    PICMP_ECHO_REPLY pEchoReply = (PICMP_ECHO_REPLY)ReplyBuffer;

    CString _status;

    _status.Format(_T("%ld"),pEchoReply->Status);

    if( _status == "11001")
    pingStatusContent = "buffer too small";
    else if(_status == "11002")
    pingStatusContent = "Destination Net Unreachable";
    else if( _status == "11003")
    pingStatusContent = "Destination Host Unreachable";
    else if(_status == "11004")
    pingStatusContent = "Destination Protocol Unreachable";
    else if( _status == "11005")
    pingStatusContent = "Destination Port Unreachable";
    else if( _status == "11006")
    pingStatusContent = "No Resource";
    else if( _status == "11007")
    pingStatusContent = "Bad Option";
    else if( _status == "11008")
    pingStatusContent = "Hardware Error";
    else if( _status == "11009")
    pingStatusContent = "Packet Too Big";
    else if( _status == "11010")
    pingStatusContent = "request time out";
    else if(_status == "11011")
    pingStatusContent = "Bad request";
    else if( _status == "11012")
    pingStatusContent = "Bad Route";
    else if( _status == "11013")
    pingStatusContent = "Time To Live Expired Transit";
    else if( _status == "11014")
    pingStatusContent = "Time To Live Expired Reassembly";
    else if( _status == "11015")
    pingStatusContent = "Parameter Problem";
    else if(_status == "11016")
    pingStatusContent = "Source Quench";
    else if( _status == "11017")
    pingStatusContent = "Option Too Big";
    else if( _status == "11018")
    pingStatusContent = "Bad Destination";
    else if( _status == "11032")
    pingStatusContent = "Negotiating IPSEC";
    else if( _status == "11050")
    pingStatusContent = "General Failure";
    else
    pingStatusContent = "other failure";

    - 2013.03.21 추가
       위와 같이 하지 않고 switch ~ case ~ 문으로 바꿀 것


Designed by Tistory.