3G Wireless Connection (Rogers Network)

Jun 4, 2012 at 12:54 PM

Hi Jeff,

I am working on a 3G Wireless connection to the Rogers network here in Canada (Toronto).

I have downloaded your DotRas SDK last week and have been looking at the example code given.

I understand that my Rogers stick (with SIM card) is a dialup connection. So I would need to use the CreateDialUpEntry method.

Here is what I got so far in the CreateEntryButton_Click, with my modification:

RasEntry aDialEntry = RasEntry.CreateDialUpEntry(aDialEntryName, rogersPhoneNumber, RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Modem));

For the DialButton_Click, with my modification:

this.Dialer.Credentials = new NetworkCredential(myUser, myPass);

I have the following questions:

1) GetDeviceByName, I have currently set it to PPTP, but what should it be?

2) I have also set the RasDeviceType to Modem, what should it be?

3) I also know my APN, should I set that?

4) For the Credentials am I setting that up correctly? or should I use a different class?

The reason as to why I am trying to build my own connection to the Rogers 3G network is because I want users of my other applications to easily connect or disconnect from the network within my applications.

Thanks,

Akhil P.

 

 

 

 

Coordinator
Jun 5, 2012 at 2:40 PM

1) GetDeviceByName, I have currently set it to PPTP, but what should it be?

2) I have also set the RasDeviceType to Modem, what should it be?

Due to the amount of permutations between connections, whenever I get asked this question I always give the same response. The easiest way to determine what settings you need for an entry is to create one manually with Windows, get that working, and check that entry in code to see what settings Windows had used.

You'll be able to use a known good configuration to set what you need to replicate that entry in code for later use.

3) I also know my APN, should I set that?

No clue.

4) For the Credentials am I setting that up correctly? or should I use a different class?

As for your credentials, whether you need to use a domain is determined by the account you're using to connect. I have no knowledge of what your credentials should be, so I can't be much help there. You're using the right class as far as I can tell.

Jun 8, 2012 at 3:50 PM

Hi Jeff,

Thank you for the response, I still have questions.

For the RasEntry class, the CreateDialUp or CreateBroadBandEntry. One of the parameters requires RasDevice, using the GetDeviceByName method, the example given with this SDK uses "(PPTP)".
That particular string, how did you know to use the string PPTP.
What are the possible string (values) that can be used? "OpenVPN"? "PPPOE"?

Basically I am looking for some documentation to determine the correct string to use for which kind of RasEntry I am trying.

PPTP = is for VPN connection
OpenVPN = is for VPN connection
PPPOE = is for ???
???? = is for ????

I need a list of string and what they are used for.

Or can you provide me some direction as to how I can determine what string I need to use when I configure it manually in windows?

Thanks,

Akhil P.

Coordinator
Jun 9, 2012 at 1:06 PM

The particular string "(PPTP)" was decided for my VPN example because a few years back we found that on every language that particular string was present on WAN Miniport devices (used for VPNs) no matter which language you were using. The full device name is "WAN Miniport (PPTP)". What you're looking for is the specific device you want your connection to use, which it can be the full device name if you choose.

Say you have a modem named "Some Manufacturer Modem", whose device type is RasDeviceType.Modem. In order to find that particular modem either of the below examples would work.

using DotRas;

RasDevice device = RasDevice.GetDeviceByName("Some Manufacturer Modem", RasDeviceType.Modem);

or

using System.Linq;
using DotRas;

RasDevice device = (from d in RasDevice.GetDevices()
                    where d.Name == "Some Manufacturer Modem" && d.DeviceType == RasDeviceType.Modem
                    select d).FirstOrDefault();

Both above examples would produce the same RasDevice, a device whose name is "Some Manufacturer Modem" and whose RasDeviceType is a modem.

If you want a list of strings that represent the devices available on your machine, look at the results from calling RasDevice.GetDevices(). That method is called internally by the other GetDeviceByXXX methods on the class to help locate entries. Those extra methods were there because LINQ didn't exist at the time when the project was started, and I thought they might prove useful so my users wouldn't have to all keep writing the exact same code to find entries. You can look at the implementation in the source code if you're really curious what's going on under the hood.

The string you need to use depends entirely on your application, if you have a specific device that is always be present on your target machines then that sounds like it would be the device you'd want to use. If the device has to be able to change, well then that's up to you to decide how you want to get that information so you know which device to use from the list of those available.

Jun 9, 2012 at 10:07 PM

Hi Jeff,

Thank you for the extra detailed information.

I found the RasDevice.GetDevices() and I dicsovered a PPPOE broadband connection.

I know I want to use it. But I am not sure if there is something else I would need to setup. when creating a broadband entry, I don't see an option for a phone number or anything.

I will test what I have and see if it works in a few days.

Thanks,

Akhil P.

Jun 11, 2012 at 8:59 PM

Hi Jeff,

App #1:

Unfortunately, I am getting an error with rasPhoneBook1.Open(), its the error about the structure.

According to your documentation I need to setup a Build Type.

But I can't figure out how to create a build type. Can you please make a guide or give link to on how to create a Build Type in VS2008, I am new to this whole Build Type thing.

Plus I need to use Visual Studio 2008 it has CreateBroadbandEntry, your example is written in VS2010, and it only has 2 RasEntry methods, CreateDialUpEntry and CreateVPNEntry.

 

App #2:

I have made a copy of your CreateAndDialVPNEntry application and modified the RasEntry.CreateDialUpEntry(entryName, phoneNumber, RasDevice.GetDeviceByName("ZTE", RasDeviceType.Modem));

After the your suggestion to figure out what devices I had available to me, I finally understand the GetDeviceByName method, and the above code is now correct, ZTE is the name of my modem and the device type is a modem.

I then launch your example, click Create, then click Dial, it voila it connects.

But no internet, I tried to ping www.google.com and nothing.

I checked the Rogers Network Connection and when I do ipconfig on it I get an IP, Subnet Mask and a Default Gateway.

But with my created Network Connection I am missing a Default Gateway. What should I do?

Kindly advise on what I need to do next for both applications.

 

Thanks,

Akhil P.

 

Coordinator
Jun 11, 2012 at 10:00 PM
Edited Jun 11, 2012 at 10:08 PM

App #1:

The build types are merely preprocessor directives in place in the code to change which assembly flavor is being built. I just happen to be calling it "build type", I suppose build flavor may be a better name for it. Depending on which features you need from Windows determines which version of the assembly you need built. If you look at the DotRas.chm help file included with the SDK under Getting Started -> Choosing Your Build you'll see which features are supported by each of the different builds available by the project. That help page also has some extra information about what causes that exception with code 632 to be thrown.

Your particular need seems to be PPPoE broadband entries, which according to the Choosing Your Build page was first introduced in Windows XP. Which that means you need to use a minimum of the WINXP build flavor. That doesn't mean you need to redeploy WINXP, WIN2K8, and WIN7 to your target machines.. if all you're making use of is PPPoE the WINXP build flavor will work across all future operating systems. The assemblies are all forward compatible, just not backward compatible.

The project was upgraded to VS2010 a while ago, so you won't be able to add the DotRas.csproj project file directly to your VS2008 solution any longer. If you want to do that, you'll have to maintain that project file on your own. The official builds can still produce assemblies compatible with the 2.0 runtime because of the build.proj file I wrote to help manage releases. There were just too many different build permutations to effectively maintain everything by hand. I usually don't support people using the csproj project file directly in their own solution, too many unknowns to be able to. My advice would be to make all attempts possible of using the pre-compiled binaries shipped with the SDK.

App #2:

Those examples are just that, examples. I cannot guarantee the entries that it generates will work for anyone, since there's about 50 different settings on an entry that could be different between each person that downloads the SDK. I have no way of knowing what settings you need to connect to the internet or network you're wanting to connect to. You should have enough knowledge of the network settings on the network you're trying to connect to so that you can establish a successful connnection. Unfortunately I won't be of any use in this area, aside from helping you find where settings are located in the SDK.

RAS in Windows is quite complicated, especially if you're new to the technology. Just stick with it and you'll figure it out, it took me 5 years before I finally understood enough of it to be proficient with it.

Jun 12, 2012 at 12:00 PM

Hi Jeff,

Thanks for the quick reply.

This RAS stuff is complicated and I know I'm barely even scratching the surface of it.

I have both VS2008 and VS2010 installed on my development laptop.

 

App #1: Using VS 2008 (I am building this from scratch using your given example to help)

I have read your chm, provided great insight to the possible Build Type options. I want to use the WINXP type how do I set it? Please provide a step by step procedure. Sadly this may be an easy thing to setup but I have no idea.

 

App #2: Using VS2010 (I am using a copy of your example and putting my own code into it because I can't figure out the Build Type issue for App #1)

I understand that there are about 50 settings for an entry and they can be different. Once I figure out the Build Type and determine if I need to use Broadband or Dialup, we can then start to figure out the settings.

I could easily provide you screenshots of existing connections that are created using the Rogers software and we can figure out which setting it is, in the code.

 

Thanks,

Akhil P.

Jun 12, 2012 at 3:03 PM

Hi Jeff,

Ok I figured out this whole Build Type issue, it was really easy. It all about selecting the correct Reference (library file) you want to use. Only took me 2 days to figure that out. LOL.

I wish the getting started documentation stated that the Build Type = which reference library you select. When I added the DotRas library I went to the first one, and it turned out to be th Win7 library, and of course it wouldn't work , since I'm developing in Win XP.

Your documentation gives a great explanation of each type of library, but does not explicitly state that this has anything to do with what library you reference in your project. I ended up looking at the last 75 threads and then found something that triggered my mind to check the reference and select the correct one.

Now my App #1 is working at the same level as App #2, I can create the connection, connect, but can't ping Google because I don't have a Default Gateway.

I will be continuing to develop App #1 since it is my own creation (well just looked at your example and took almost everything) and trying to have it connect to the internet.

Now I need to figure out all the settings to figure out to get access to the Internet, and I believe my first step it to somehow obtain a default gateway.

What information can I provide to you, so that you can help me figure this out?

 

Thanks,

 

Akhil P.

Coordinator
Jun 12, 2012 at 6:22 PM

I've asked for feedback a while ago for anyone who is just getting started with the project, just never got any so I figured everything was fine. I'll see what I can do about making the documentation better for those just getting started. Thanks for the suggestion!

Like I tell everyone, if you setup a connection using the normal Windows Add Network Connection dialog from the Control Panel, you'll know you have a good working connection to look at so you can replicate it. If you try configuring all the settings by hand without having a good working connection first, you'll never get anywhere.

1) Create a new connection in Windows that you can connect with successfully, and that works for what you need it to do.

2) Look at the connection settings using RasPhoneBook and RasEntry to see what options you need to set in code to replicate the functionality. You can use the CreateAndDialVpnEntry example to see how to use the RasPhoneBook class if you're unfamiliar with it.

3) Change your code to match the settings you identified in step 2.

That should get you a good working connection without having to trial-and-error with me what could be wrong with the connection. Also, keep in mind that ICMP traffic may not be enabled on the network, or the target of your ping request may have it turned off. In general pinging is not a good way to verify that you have connectivity.

Jun 12, 2012 at 6:37 PM

For new people or people who don't work with a lot of libraries from other people, we would have very little knowledge about even adding a Reference to a project.
I can be your dummy/tester to read and see if the documentation needs updates to increase clarity, especially to new programmers.

The 3 steps you have stated, give me a clear procedure to how I need to figure things out. I will be out of the office for the next 2 days, but I will let you know how things go and update this thread with my progress.

Even a simplified procedure like this, may be added to the documentation, First Steps, setting Build Type Reference, then manually creating the network connection, then try to emulate the same thing the DotRas library. Something to that effect.

Yah, I understand pinging is not a good way to verify for connectivity it is a rudimentary method I am using right now.


Thanks,

Akhil P.

Editor
Jun 19, 2012 at 8:52 PM
Edited Jun 19, 2012 at 8:55 PM

About APNs:

In my experience, they are set up by an AT command prior to dialing, and that's as far as I know outside of RAS's control. You have to use the fax and modems control panel to do it, or change the registry entry (with administrative permissions) that stores the appropriate field, which can be hard to find: it is burried down in HKLM\System\CurrentControlSet\Class under some GUID or other. Anyway, you have to make sure the ProviderName is the name of the device name of your device and set a further key UserInit, where you then put in the AT command to set the profile for APN usage. (AT+CGDCONT=1, etc. in the case of cell modems.)

 

EDIT: Oh, and since this is per modem, not per modem type, you may have to dyanamically search for the ProviderName to update it every time your code is used if you anticipate that the machine will see different modems, not just different types. (We do, since users get replacements, machines are reassigned without imaging, etc.) This is similar to the problems I outlined a while back on having to rewrite phonebooks a lot.

Jun 20, 2012 at 12:32 PM

Wow thank you so much for all the insight.

I have had many discussions with my IT guy and he also believes that the RAS library will not do what I need.

Instead he suggested that I have a look at the following.

http://msdn.microsoft.com/en-us/library/windows/hardware/gg454524.aspx

Basically I will be using a Windows 7 SDK to do Mobile Broadband connections.

It also means I wouldn't be able to support Win XP, which is fine, since we only have 1 or 2 laptops with Win XP and instead of using my own application to perform the connection to the 3G network, we can use the proprietary software with the Rogers Speedstick.

Once again, thank you so much.