ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Windows Mobile에서 PPP 연결...
    공장 이야기 2009. 6. 12. 14:18

     

    ConnMgr.zip

    int                      nLoop       = 0;
    HRESULT                  hResult     = NULL;
    CONNMGR_CONNECTIONINFO   tagConnInfo;
    CONNMGR_DESTINATION_INFO tagDestInfo;

    while( 1 )
    {
            if(!SUCCEEDED(ConnMgrEnumDestinations(nLoop, &tagDestInfo)))
                    break;

            ZeroMemory(&tagConnInfo, sizeof(CONNMGR_CONNECTIONINFO));
            tagConnInfo.cbSize      = sizeof(CONNMGR_CONNECTIONINFO);
            tagConnInfo.dwParams    = CONNMGR_PARAM_GUIDDESTNET;
            tagConnInfo.dwPriority  = CONNMGR_PRIORITY_HIPRIBKGND;
            tagConnInfo.bExclusive  = FALSE;
            tagConnInfo.bDisabled   = FALSE;
            tagConnInfo.guidDestNet = tagDestInfo.guid;
            tagConnInfo.dwFlags     = CONNMGR_FLAG_SUSPEND_AWARE;
            tagConnInfo.hWnd        = this->GetSafeHwnd();
            tagConnInfo.uMsg        = WM_NOTIFY_CONNMGR;
            tagConnInfo.lParam      = 0;

            m_hWebConnection = NULL;
            hResult = ConnMgrEstablishConnection(&tagConnInfo, &m_hWebConnection);
            if(SUCCEEDED(hResult))
            {
                    break;
            }

            nLoop++;

    }

    위와 같이 코딩하고 단말에서 테스트를 해보면 tagDestInfo.szDescription에 여러가지 값들이 보입니다.

    그중 전 처음 올라오는 "SKT 3G"로 테스트 하였습니다. 다른분들은 다른 넘 일수도...

    그후 DefWindowProc 으로 메세지(WM_NOTIFY_CONNMGR)가 넘어 욺니다.

    wParam에서 CONNMGR_STATUS_CONNECTED 이런 값들과 비교 하시면됩니다.

    Connection Manager는  종료 시 문제가 있습니다. "ConnMgrReleaseConnection" 이 넘으로 연결이 끊기지 않는 다는 것... 분위기 상 MS 두 어쩔 수 없겠지만...

    CONNMGR_CONNECTIONINFO의 bExclusive, "ConnMgrReleaseConnection" 문제를 잘 다룬 곳은

    "애교쟁이후니", "W.C.의 몽상" 이 두분 블로거에서...

    전 아주 호덥한 꽁수로 해결 했습니다.  선택은 여러분 자유에...

     

    그리고 각 단말 제조사나 이통사(SKT 기준)에서 Connection을 돕기 위해 제공하는 lib가 있는 걸로 알고 있습니다.

    MSDN의 Connection Manager 를 참고 하였습니다.

    연결 테스트는 "Multi-threaded Client/Server Socket Class" 여기서 다운 받은 파일로...

    작업은 Visual Studio 2008, Windows Mobile 6.0 에서 하였음.

    Windows Mobile Version 5.0 SDK 이상을 기준으로 함.

    테스트 한 풀 소스를 첨부 합니다.

     

     

     

     PS. 왜 굴림체는 없는 것일까요? 굴림은 글자 간격이 안맞아요~~~~~~ 

    ConnMgr.zip
    0.05MB

    '공장 이야기' 카테고리의 다른 글

    SIP 설정하기  (0) 2009.10.12
    자주 사용하는 메크로...  (0) 2009.09.30
    Windows Mobile에서 유니코드 변환  (0) 2009.09.29
    Windows Mobile 에서 DC를 Bitmap 저장  (0) 2009.09.21
    위피에서 lrotl, lrotr 구현  (0) 2009.08.12
Designed by Tistory.