Solved

RasDial (Forcing an IP Address through the API)

Posted on 2002-07-24
3
856 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
Comment Utility
>>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
Comment Utility
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
Comment Utility
>>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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

744 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

16 Experts available now in Live!

Get 1:1 Help Now