Microsoft KB Archive/160622

{|
 * width="100%"|

HOWTO: Obtain the IP Address Assigned to a RAS Client

 * }

Q160622

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK), used with:
 * Microsoft Windows 95
 * the operating system: Microsoft Windows NT, versions 3.51, 4.0
 * the operating system: Microsoft Windows 2000

-

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).

Additional query words:

Keywords : kbnetwork kbAPI kbIP kbOSWinNT351 kbOSWinNT400 kbOSWin2000 kbRAS kbSDKPlatform kbGrpDSNet

Issue type : kbhowto

Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch