This project is read-only.

how to detect free modem

Jun 5, 2012 at 4:46 AM

hello every body.

in my system i have some modem.

how to detect automaticly free modem and use it in ras api.


Jun 5, 2012 at 3:41 PM

All that DotRas can tell you is what devices on the system are RAS compatible, whether they are in-use is currently out-of-scope of the product.


Jun 6, 2012 at 3:51 AM

Thanks mr Jeff_winn.

so, how i can to get modem name with ras api (which properties or class)

and how to set a default modem for ras api to connect internet.

Jun 6, 2012 at 6:00 PM

The RasDevice.GetDevices() will return a list of devices, from that collection you can determine which specific instance you want to use for your connection.

See the examples included with the SDK for creating entries. The CreateAndDialVpnEntry example is the same as creating dial-up entries, other than you need to call CreateDialUpEntry instead of CreateVpnEntry as indicated in the example.

Jun 7, 2012 at 3:14 PM

hello again jeff_winn.

thank you to answer my question.

in my application with this code i can connect to internet with dialup.

rasDialer1 = new RasDialer();
rasDialer1.PhoneNumber = txtPhone.Text;
rasDialer1.Options.SetModemSpeaker = true;

System.Net.NetworkCredential a;
a = new System.Net.NetworkCredential();
a.UserName = txtUserName.Text.Trim();
a.Password = txtPassword.Text.Trim();
rasDialer1.Credentials = a;


with this code , rasdialer1 connect to default modem.

i don't know how to change default modem to my modem for some code.

can you write code for change modem for this code.

thank you.

Jun 8, 2012 at 1:47 AM

If you have a specific device you want to connect with, you're better off creating a phone book entry that specifies the device you want to use rather than changing the default modem and dialing it directly from RasDialer. That way you're not changing system settings on the user. As for the function to change the default modem, it doesn't exist in the DotRas SDK.

As I said in my previous post, you should look at the CreateAndDialVpnEntry example to get an idea how to create a connection, just substitute CreateDialUpEntry for CreateVpnEntry.