locked
Connection setting for Multiple PDP RRS feed

  • Question

  •  

    [Problem]

    In case of device is set for Multiple PDP, if Private APN is established, application which is connected by Public APN can not be connected with Public APN as usual.

    (If Private APN is not established, this application can be connected with Public APN.)

     

    [Preparation]

    1. Set registry setting for Multiple PDP.

      In specified folder for SIM card under [HKEY_LOCAL_MACHINE\Software\OEM\RIL\OperatorContexts\]

                      GPRSContextNumber = 3

                      UMTSContextNumber = 2

    2. Set Public APN information.

    3. Set Private APN information.

     

    [Steps]

    1. Establish Public APN.

    2. Connect by application (Update information of application) → OK

    3. Establish Private APN.

    4. Connect by application (Update information of application) → NG

    5. Terminate Private APN connection.

    6. Connect by application (Update information of application) → OK

     

    [Question]

    By above steps, in case of PIE is used instead of our application, PIE can connect with Public APN even Private APN is established at the same time.

    We would like to know how to connect with Public APN while Private APN is established as PIE.

    We appreciate if it you could give us any comment.


    (Windows Mobile 6)
    Wednesday, February 18, 2009 7:25 AM

All replies

  • Hi,
    I add some details with some code as follows.

    - In environment for Multiple PDP.  
    - Connecting to Private APN already.  
     
    On the above situation, following process is started.  
     
    - Step  
    1. Connect to Public APN by ConnectionManager  
    -----------------------------------------------------------  
     
        DWORD ConnectionThread()  
        {  
            HANDLE hThisThread=m_hConnectionThread;  
            HANDLE hConnection = NULL;  
            CONNMGR_CONNECTIONINFO ConnInfo={0};  
            ConnInfo.cbSize=sizeof(CONNMGR_CONNECTIONINFO);  
     
            ConnInfo.dwParams=CONNMGR_PARAM_GUIDDESTNET;  
            ConnInfo.dwFlags=GetProxy() ? CONNMGR_FLAG_PROXY_HTTP: 0;  
            ConnInfo.dwPriority=CONNMGR_PRIORITY_USERINTERACTIVE ;  
            ConnInfo.guidDestNet = GetNetworkGuid();  
     
            HRESULT hr = ConnMgrEstablishConnection(&ConnInfo, &hConnection);  
            if( FAILED( hr ) )  
            {  
                DoConnectingError();  
                SetCache(FALSE);  
            }  
            else  
            {  
                DoEstablishingConnection();  
    #if __TEST__  
                HANDLE hObjects[2];  
                hObjects[0]=hConnection;  
                hObjects[1]=m_hThreadStop;  
                BOOL    bStop=FALSE;  
                  
                ResetEvent(m_hThreadStop);  
     
                while( bStop == FALSE )  
                {  
                    DWORD dwResult = WaitForMultipleObjects( 2, hObjects, FALSE, INFINITE);   
                      
                    if (dwResult == (WAIT_OBJECT_0))  
                    {   
                        HRESULT hr;  
                        DWORD   dwStatus;  
                        hr=ConnMgrConnectionStatus(hConnection,&dwStatus);  
                        m_dwStatus = dwStatus;  
                        if( SUCCEEDED(hr))  
                        {  
                            if( DoStatusUpdate(m_dwStatus) != S_OK )  
                                bStop=TRUE;  
                        }  
                        else  
                        {  
                            m_dwStatus=hr;  
                            bStop=TRUE;  
                        }  
                    }  
                    else // failures, or signalled to stop.  
                    {  
                        bStop = TRUE;  
                        ResetEvent(m_hThreadStop);  
                    }  
                }  
    #endif  
            }  
     
            DoReleaseConnection();  
            // Release the connection, caching if we should.  
            if( hConnection )  
            {  
                ConnMgrReleaseConnection(hConnection, GetCache() );  
            }  
            m_hConnection = hConnection;  
     
            CloseHandle(hThisThread);  
     
            Connecting(FALSE);  
            return GetStatus();  
        }  
     
    -----------------------------------------------------------  
     
    2. Connect to network by InternetOpen and InternetOpenUrl.  
    -----------------------------------------------------------  
     
        InternetGetConnectedState(&dwFlags, 0);  
        if((dwFlags & INTERNET_CONNECTION_PROXY))  
            m_ifProxy = true;  
        else  
            m_ifProxy = false;  
     
        if(m_ifProxy)  
            hInternet = InternetOpen(m_szAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);  
        else  
            hInternet = InternetOpen(m_szAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);  
              
              
        TCHAR szHead[] = L"Accept: */*\r\n\r\n";  
        long filelen = 0;  
        int count = 0;  
     
        while( !(hFile = InternetOpenUrl( hInternet,wstrUrl, szHead,  
             wcslen(szHead), INTERNET_FLAG_RELOAD, 0)))  
        {  
            DWORD err = GetLastError();  
                count++;  
            if(count >= 3)  
                break;  
            Sleep(100);  
        }  
          
        if(hFile != NULL) {  
            DWORD dwTotal;  
            if( InternetQueryDataAvailable( hFile, &dwTotal, 0 , 0 ) == TRUE ){  
                HANDLE hWriteFile = CreateFile(lpszPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);  
                LPDWORD pdwData;  
                DWORD dwBytesToRead;  
                DWORD dwWritten;  
                pdwData = (LPDWORD)GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD, dwTotal);  
                while(1){  
                    InternetReadFile(hFile, pdwData, dwTotal, &dwBytesToRead);  
                    if( dwBytesToRead == 0 ){  
                        break;  
                    }  
                    WriteFile(hWriteFile, pdwData, dwBytesToRead, &dwWritten, NULL);  
                }  
                CloseHandle(hWriteFile);  
                GlobalUnlock(pdwData);  
                GlobalFree(pdwData);  
            }  
            InternetCloseHandle(hFile);  
        }else{  
            InternetCloseHandle(hInternet);  
            er = 1;  
            goto err;  
        }  
        InternetCloseHandle(hInternet);  
     
    -----------------------------------------------------------  
     
    3. At the moment when InternetReadFile is executed, program is stopped for long.  
      ->After stopped for a few minutes, time out is done.  
     
      Error code by GetLastError() is ERROR_INTERNET_TIMEOUT  
     
    Note:  
    - ConnectionManager is based on cmhelper code which is MS sample code.  
    - When code between #if __TEST__ and #endif is commented out, this issue does not happened.  
     

    But I am not sure if this part is the cause of this issue.

    I am not sure correct part of this issue.


    Hope I can have answer.
    Thanks,
    ts
    Tuesday, March 3, 2009 3:22 AM