我现在要获得client的IP,连接方式是拨号上网!这个是动态分配IP的,不知怎么做才可以!高手指点一二!!
谢过!!!

解决方案 »

  1.   

    Re: Getting the PPP ip Address--------------------------------------------------------------------------------You need to use the RAS functions to get that information.  The quick way to do it is: use RasEnumConnections to get the list of current connections.  RASCONN * pRasConn = NULL;
    DWORD cb;
    DWORD dwConnections;
    CString sIP_Address;// use NULL to get the buffer size that we should use
    RasEnumConnections(
        NULL, &cb, &dwConnections );// allocate enough memory for the RASCONN array
    pRasConn = (RASCONN*)malloc(sizeof(RASCONN)*cb);// set the first Entry for RasEnumConnections
    pRasConn[0].dwSize = sizeof(RASCONN);// Now get the array of Connections
    RasEnumConnections(
        pRasConn, &cb, &dwConnections );// find the first modem connection
    for ( int jj=0; jj<dwConnections; jj++ ){
        if ( strnicmp(pRasConn[jj].szDeviceType,"modem") == 0 ) {
            // we need the PPP Projection 
            RASPPPIP pppProjection;
            pppProjection.dwSize = sizeof(RASPPPIP);
            RasGetProjectionInfo(
                pRasConn[jj].hrasconn,
                RASP_PppIp,
                &pppProjection,
                &cb );
            sIP_Address.Format("%s",
                szIpAddress );
            break;
        }
    }sIP_Address now holds the IP address of the modem device.  You could actually do this to get the IP address of all your devices.Submitted By: Yua CaVan (2002/07/03)