2

我用的是华为e359

你好我正在创建一个简单的程序。我的代码将 3g 调制解调器连接到互联网。因为我的程序的一部分需要访问互联网。我做了一些搜索如何使用 c#

这是我添加条目的代码

string deviceName = null;
                path = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.User);
                using (RasPhoneBook pbk = new RasPhoneBook())
                {
                    pbk.Open(path);
                    foreach (var item in RasDevice.GetDevices())
                    {
                        if (item.DeviceType.ToString().ToLower() == "modem")
                        {
                            deviceName = item.Name;
                        }
                    }
                    RasDevice device = RasDevice.GetDevices().Where(o => o.Name == deviceName && o.DeviceType == RasDeviceType.Modem).First();
                    if (!RasEntry.Exists("Your Entry", path))
                    {
                        RasEntry entry = RasEntry.CreateDialUpEntry("Your Entry", "+00000000000", device);
                        pbk.Entries.Add(entry);
                    }
                }

这是拨号设备的代码

using (RasDialer dialer = new RasDialer())
                {
                    dialer.EntryName = "Your Entry";
                    dialer.PhoneBookPath = path;
                    dialer.AllowUseStoredCredentials = true;
                    dialer.Dial();
                }

这是错误,当我拨打设备时提示

The remote computer did not respond. To make sure that the server can be reached, ping the remote computer.
4

0 回答 0