?
Solved

RasDial (Forcing an IP Address through the API)

Posted on 2002-07-24
3
Medium Priority
?
923 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
[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
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 1200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

777 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