Solved

Detecting PPP stack after connect using RAS

Posted on 1998-05-14
2
206 Views
Last Modified: 2006-11-17
How do I detect I have stack IP from server after dialing up using the Windows RASAPI.  I dial and connect but need to delay sending web string until I have my IP address from the server.
0
Comment
Question by:jw608ems
2 Comments
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 100 total points
ID: 1449551
jw608ems,

Use RasGetProjectionInfo API function to retreive your IP address after you establish the RAS connection, see the following example.

Example
=======
 Private Type RASPPPIP
  dwSize As Long
  dwError As Long
  szIpAddress(15) As Byte
  szServerAddress(15) As Byte
 End Type

 Private Const RASP_PppIp = &H8021&

Private Sub RasGetProjectionInfo()
 Dim lpraspppip As RASPPPIP
 Dim lpcb As Long
 Dim rasprojection As Long
 Dim strIPAddress As String

 rasprojection = RASP_PppIp
 lpraspppip.dwSize = 40
 lpcb = 40
 lngRetcode = RasGetProjectionInfo(lnghRasConn, rasprojection, lpraspppip, lpcb)   'lnghRasConn is RAS connection handle
 If lngRetcode Then
  strIPAddress = "Not Available"
 Else
  strIPAddress = StrConv(lpraspppip.szIpAddress, vbUnicode)
  strIPAddress = Left$(strIPAddress, InStr(strIPAddress, Chr$(0)) - 1)
 End If

 Msgbox "My IP is " & strIPAddress
End Sub


Best regards
Bin Huwairib
0
 

Author Comment

by:jw608ems
ID: 1449552
bin_huwairib:  Thanks, I have knocked myself silly looking for answer to this one.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question