How to change the APN

Jul 24, 2009 at 9:29 AM

Hi there,

 

I am creating a connection using a GPRS modem(name and type doesn't matter).

 

I have been able to create the entry and connect to my default APN. But, I need to also create a different entry that will allow me to connect to a different APN.

 

Is there a way to specify the APN that I am connecting to, using DotRAS?

 

Thanks very much in advance for your help!

Chris(hnutz2006)

Coordinator
Jul 24, 2009 at 12:44 PM

Chris,

I'm not sure what an APN is, I just wrote the assembly. However, if you can setup the entry in Windows exactly how you need it, you can do the exact same thing with DotRas programmatically. The easiest way I've found is to create an entry exactly how I need it using Windows and then opening the entry using the RasPhoneBook class and copying down all the options on the RasEntry. After that, you'll know what settings you need to set programmatically to replicate the entry in code.

If you provide whatever solution you find I could try and figure out how to get it into the examples or documentation depending on the size of the solution.

Jul 24, 2009 at 3:21 PM

Thanks for your response Greg.

 

To connect to the internet using a GPRS modem, one has to send the modem an AT Command string 'AT+CGDCONT=1,"ip","internet"'. Currently, the string that Windows is sending to the modem is AT+CGDCONT=1,"ip",<network name>. This is basically an initialisation string to get the modem to know which 'APN'/network to connect to.

I use Hyper Terminal to do this. I don't know how to set this in my windows network connection. I was actually hoping that you could maybe tell me where I can set this, then I'm sure I'd be able to set it programmatically.

Thanks again for your help.

Chris(hnutz2006)

Coordinator
Jul 24, 2009 at 3:44 PM
Edited Jul 24, 2009 at 3:59 PM

No idea, that sounds a lot lower level into TAPI than what is included in this project.

Edit: Maybe you can use a script to do it for you.

Sep 17, 2009 at 12:01 PM

The APN can be set in Windows on the device itself.

Go into your device manager choose Modems and select Properties of the device you are working with. Go to the Advanced tab and put your APN into the init textfield.

So I guess it is not possible to set it programmatically via dotras.

 

Coordinator
Sep 17, 2009 at 1:41 PM

Correct, at this point DotRas does not access the TAPI directly, instead it goes through the Remote Access Service (RAS) available in Windows. Taking on TAPI will be much more challenging and take a lot longer than I am willing to put into it at this point. Maybe once the 1.0 components are solid and aren't needing many features added to them I can put some thought into adding TAPI support in the project.

Sep 17, 2009 at 2:24 PM

Thanks for your feedback Tezem and Jeff...

I actually found a solution for my problem. I basically added the alternate Initialization String into the registry where the Modems Properties setting sets it. ie. "SYSTEM\CurrentControlSet\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0000\UserInit"

I do this programatically and it works fine. I hope that helps in the future with you dev and with anyone else out there who wants to do the same.

Oh, again, thanks very much for DotRAS. :) Awesome!

Chris(hnutz2006)