Solved

RasDial (Forcing an IP Address through the API)

Posted on 2002-07-24
3
873 Views
Last Modified: 2007-12-19
I am using the RasDial API.  

There is a way to force the Ras dial up connection to use a specific IP address (that I set) in the Windows GUI.  

My QUESTION is :  is there a way to do this using the API.  I was looking at rasEntry, but I am not sure if this is correct. Does anyone know how to do this and/or have any sample code to share.  

Thank you very much........
0
Comment
Question by:jalgazi
  • 2
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7174490
>>I was looking at rasEntry, but I am not sure if this is correct

This is the correct place to look for - if 'fdwOptions' specifies RASEO_SpecificIpAddr, RAS tries to use the IP address specified by ipaddr as the IP address for the dial-up connection.
0
 

Author Comment

by:jalgazi
ID: 7174509
hi jkr,

   Thank you....  Do you have any sample code???
I'm going to accept your answer, but sample will help out a lot.  I am a Java programmer and I am not that good with C++ windows API calls.

Thanks again.

0
 
LVL 86

Accepted Solution

by:
jkr earned 300 total points
ID: 7174573
>>Do you have any sample code???

Unfortunately not. But, setting that is pretty straightfoward. You'd first get an existing entry and then set the flag and the IP address, e.g.

RASENTRY re;
RASIPADDR ria = { 192, 168, 1, 25};

// get an existing entry
RasGetEntryProperties ( NULL, "The Cool RAS Provider", &re, sizeof ( RASENTRY), NULL, 0);

re.dwfOptions |= RASEO_SpecificIpAddr; // set the flag
re.ipaddr = ria; // and the IP address

// write entry back
RasSetEntryProperties ( NULL, "The Cool RAS Provider", &re, sizeof ( RASENTRY), NULL, 0);


0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

785 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