The Remote Access Services (RAS) InternetDialer class enables an application to connect to an Internet Service Provider (ISP) using a standard Dial-Up Networking connection. Using this class, the application can discover what dial-up devices are available, what dial-up networking entries, known as "connectoids", are available on the local system and allows the program to manage those connections. Existing connections can be monitored, new connections created and a single instance of the class can be used to manage multiple dial-up connections if the system has more than one modem. While Windows can be configured to simply autodial a service provider whenever a network connection is needed, this component gives your application complete control over the process of connecting to a service provider, monitoring that connection and then terminating that connection if needed.
Initialize
Initialize an instance of the class, validating the development
license. This method must be called before any properties are
changed or any other methods in this class are called by the
application.
Connect
Establish a connection to the dial-up networking server. Once the
connection has been established, the class will authenticate the
session and the local system will have a network connection to the
service provider.
Disconnect
Disconnect from the server and release any resources that have been
allocated for the dial-up networking session. After this method is
called, the session is no longer valid.
Uninitialize
Release any resources that have been allocated for the current
process. This is the last method call that the application should
make prior to terminating.
The class properties are used to set or return information about the current dial-up networking connection. To load a dial-up networking connection, called a connectoid or phonebook entry, use the LoadEntry method. There are a large number of properties, however the most significant of those properties are as follows:
DeviceName
This property specifies the name of the device that is used to
establish the dial-up networking connection. In most cases this is
the name of an analog modem using a serial communications port,
connected to a standard telephone line. If your application needs
to enumerate the available dial-up networking devices, refer to the
DeviceCount, DeviceEntry and DeviceType properties.
DynamicAddress
This property determines if the dial-up networking connection uses
a dynamically assigned IP address returned by the server, or a
specific IP address configured on the local host. In most cases,
this property should be set to True, unless otherwise specified by
your service provider.
DynamicNameserver
This property determines if the dial-up networking connection uses
dynamically assigned nameservers, used to resolve domain names into
IP addresses. In most cases, this property should be set to True.
If your service provider requires that you explicitly specify the
nameservers to use, then set this property to False and set the
NameServer property array to the address of the nameserver(s) to
use.
EntryName
This property specifies the name of the connectoid for the current
dial-up networking connection. If no connection is active and no
connectoid has been loaded, then this property will return an empty
string.
InternetAddress
This property returns the IP address assigned to the current
dial-up networking session, if a connection has been established.
It can also be used to explicitly specify an IP address if the
DynamicAddress property is set to False.
NameServer
This is a property array which specifies the IP addresses of the
nameservers that are to be used for the current dial-up networking
session. If a connection has been established, this property array
will return the addresses of those nameservers that have been
assigned to you. If the DynamicNameserver property is set to False,
this property array can also be used to explicitly specify the
nameservers to be used by the dial-up networking connection.
Password
This property specifies the password used to authenticate the
dial-up networking connection.
PhoneNumber
This property specifies the telephone number for the dial-up
networking connection. You should also check the value of the
CountryCode property, which will tell your application if area code
dialing rules are being used. If the CountryCode property is set to
zero, then no area code dialing rules are in effect and the
telephone number is dialed as-is. Otherwise you should check the
value of the AreaCode property if you need to determine the area
code being used for the connection.
UserName
This property specifies the username used to authenticate the
dial-up networking connection
A connectoid contains the information needed to establish a connection, and is represented as the icon in the Network Connections for the local system. Connectoids are referenced by name and typically are named after the service provider, such as "EarthLink" or "Verizon". In addition to simply connecting to a dial-up networking server, the class also enables your application to create, edit and delete these connectoids. Note that in the class documentation, connectoids are also referred to as "entry names" or "phonebook entries".
CreateEntry
This method displays a dialog box that allows the user to specify
the information needed to create a new connectoid. This is similar
to the dialog that is displayed whenever the user chooses to create
a new Dial-Up Networking connection. Note that if you want to
create a connectoid without showing a dialog to the user, use the
SaveEntry method instead.
DeleteEntry
This method deletes an existing dial-up networking connection.
Exercise caution when using this method; once a connectoid has been
deleted, there is no way to recover it.
LoadEntry
This method loads an existing connectoid, and updates the
properties to reflect the connectoid's settings. Changing one or
more of those properties and then calling the SaveEntry method is
how you can modify an existing connectoid.
RenameEntry
This method renames an existing connectoid.
SaveEntry
This method modifies or creates a new connectoid based on the
current properties of the class instance. If the connectoid already
exists, it is modified, otherwise a new connectoid is created.
Unlike the CreateEntry method, this method will not display any
dialogs, so it is the responsibility of the application to provide
a user interface if needed.