I have found DotRas a wrapper for RAS. And this is what i was able to do with it
private void btnConnect_Click(object sender, EventArgs e)
{
RasDevice device = RasDevice.GetDeviceByName("ZTE Proprietary USB Modem", RasDeviceType.Modem);
if (device != null)
{
MessageBox.Show("Found "+device.Name.ToString()+device.DeviceType.ToString(), "hah!", MessageBoxButtons.OK);
}
else
{
MessageBox.Show("Device not found", "Error", MessageBoxButtons.OK);
}
this.rasPhoneBook1.Open();
RasEntry entry = RasEntry.CreateDialUpEntry("ZTE Proprietary USB Modem", "+880000000", device);
this.rasPhoneBook1.Entries.Add(entry);
this.rasDialer1.EntryName = "ZTE Proprietary USB Modem";
this.rasDialer1.PhoneBookPath = rasPhoneBook1.Path;
this.rasDialer1.DialAsync();
}
private void rasDialer1_StateChanged(object sender, StateChangedEventArgs e)
{
MessageBox.Show(e.State.ToString(), "Dial Status", MessageBoxButtons.OK);
}
private void rasDialer1_DialCompleted(object sender, DialCompletedEventArgs e)
{
if (e.Cancelled)
{
MessageBox.Show("Cancelled");
}
else if (e.TimedOut)
{
MessageBox.Show("Time out");
}
else if (e.Error != null)
{
MessageBox.Show(e.Error.ToString(),"Error");
}
else if (e.Connected)
{
MessageBox.Show("Connection successful!");
}
}
The code attempts to dial the modem but shows this error message:
"The remote computer did not respond. To make sure that the server can be reached,ping the remote computer."}
The error is caght in here:
else if (e.Error != null)
{
MessageBox.Show(e.Error.ToString(),"Error");
}
I am trying to connect a 3g modem and send and recieve SMS via the modem. How can i achieve that with DotRas? Yes I have read the API documentation and read the discussions treads in DOtRas official site but I am still lost. Any help will be hugely appreciated. Thank you.