GPRS Connection!!! RRS feed

  • Question


    Hi Everyone,

    Well, i want help regarding the GPRS connection. Let me give some details of the work i m doing. Actually i want to send some data to HTTP server and i m using winsock for this purpose.. its working fine with the emulator but for device i need to connect to the internet to send the data .. so the GPRS is the only option... i m using ConnMgrEstablishConnectionSync function to connect the GPRS.. and its working fine, as its returning S_OK. But when i call gethostbyname function to get the IP of the server, it gives an error "HOST NOT FOUND", whereas by using emulator it returns the correct IP as the emulator use the default Internet settings when connected through ActiveSync...

    Now can anyone plzz tell me why the gethostbyname function is giving error of not finding the host.. its not using the GPRS or what?? .. or do i have to add more code after the ConnMgrEstablishConnectionSync?? .. well my code is as follows:

    DWORD error;
    WSADATA wsaData;
    WORD wVersion = MAKEWORD(2,2);
    error = WSAStartup(wVersion,&wsaData);
    char* IPAddress;

    pConnInfo.cbSize =
    pConnInfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
    pConnInfo.bExclusive = FALSE;
    pConnInfo.bDisabled = FALSE;
    pConnInfo.guidDestNet = IID_DestNetInternet;

    HANDLE phConnection = NULL;

    HRESULT hr = ConnMgrEstablishConnectionSync(&pConnInfo,&phConnection,15000,&dwStatus);

    if (hr == S_OK)
    if (error == ERROR_SUCCESS)
    if ((LOBYTE(wsaData.wVersion) == 2) && (HIBYTE(wsaData.wVersion) == 2))
                   hostent* host = gethostbyname(
                   if (host)
                       IPAddress = host->h_addr_list[0];
    error = WSAGetLastError();

    So plzz tell me where is the problem.. m i using the correct flag, i.e. CONNMGR_FLAG_PROXY_HTTP, or do i have to use some other?? .. its really very urgent as i m doing this from the whole week... plzz help me in this regard asap.

    Thanx in advance.

    Monday, August 28, 2006 8:43 AM


  •  hi Ayaz,

    As per my knolodge i think you donot have to think about the gprs connection is present or not.


    Reason is if you want to do some internet programming through winsock programming then it will take care to see what kind of connection(for internet) the pocket pc has.By default all the pocket pc will be configured for the gprs connection.

    Condition 1 . if the gprs connection is not configured

    Say the gprs connection is not configured then then connnection manger of the pocket pc will prompt the user to do it

    To test this functionality - go to the ie of the pocket pc ( donot connect it by usb to the computer with internet) and try to open a site in your case say google.

    If u have hard reseted/device is new/never touched the internet configuration of the deveice  then the ie will try to open the website through the gprs connection.

    Condition 2 > if the the gprs is not configured and but lan / usb / active sync configuration is configured

    Sat the gprs is not configured but some other alternative is pocket pc connects it to the internet

    To test this functionality - go to the ie and connect to internet if it shows the page then (if u have not configured gprs) then the internet is connected through other methods.


    So the summary of saying all this is whatever u do the best way to do this i feel is not check for the gprs connection but write the winsock program.If ie does in the similar way then i feel this should be the standard for the us programms


    Please do send me your feed back

    Thanks and regards











    Tuesday, August 29, 2006 6:25 AM