Solved

Detecting PPP stack after connect using RAS

Posted on 1998-05-14
2
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses
Course of the Month4 days, 1 hour left to enroll

630 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