Solved

Detecting PPP stack after connect using RAS

Posted on 1998-05-14
2
195 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now