Solved

RasDial (Forcing an IP Address through the API)

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

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 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.
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.

737 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