2

huawei 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