Solved

RasDial (Forcing an IP Address through the API)

Posted on 2002-07-24
3
863 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

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

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

863 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

21 Experts available now in Live!

Get 1:1 Help Now