Solved

Detecting PPP stack after connect using RAS

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

930 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

12 Experts available now in Live!

Get 1:1 Help Now