How To Obtain the IP Address Assigned to a RAS Client

Last reviewed: August 13, 1997
Article ID: Q160622
3.51 4.00 WINDOWS NT kbnetwork kbhowto

The information in this article applies to:

  • Microsoft Win32 Software Development Kit (SDK) for Windows NT, versions 3.51, 4.0
  • Microsoft Win32 Software Development Kit (SDK) for Windows 95, versions 3.51, 4.0

SUMMARY

The IP address assigned to a RAS client is obtained by the client program using the RasGetProjectionInfo API. You call this API after a RAS connection has been established.

MORE INFORMATION

If your program is using the RasDial API to establish a RAS connection, the following code demonstrates printing out the IP address assigned to your client by the RAS server:

if (!RasDial(NULL, NULL, &MyRasdialParams, 0L, NULL, &hRasConn))

   {
   cb = sizeof(proj_buf);
   proj_buf.dwSize = cb;
   if (!RasGetProjectionInfo(hRasConn, RASP_PppIp, (LPVOID)&proj_buf, &cb))
      printf("Client ip addr is %s\n",  proj_buf.szIpAddress);
   }

If your program did not establish the RAS connection, you need to call the RasEnumConnections API to obtain a list of RAS connections already established on your client machine. From this list of existing RAS connections, you can obtain a RAS connection handle that you can then pass into RasGetProjectionInfo (as the first parameter).


KBCategory: kbnetwork kbhowto
KBSubcategory: NtwkRAS
Additional reference words: 3.51 4.00 kbdsi
Keywords : kbhowto kbnetwork
Version : 3.51 4.00
Platform : NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 13, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.