【发布时间】:2011-08-13 02:11:42
【问题描述】:
我正在尝试让 Windows Mobile CE 的应用程序重新连接到启用 WEP 的特定网络(如果该网络可用)。我相信这段代码会扫描当前可用的接入点以获取对我需要的网络的引用:
// we have communicated with the server, so save the access point for future reference
INetworkInterface[] wniNet = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface wni in wniNet)
{
if (wni is WirelessNetworkInterface)
{
WirelessNetworkInterface wWireless = wni as WirelessNetworkInterface;
//if (mwniServerConnection == null)
if (string.IsNullOrEmpty(msAccessPointName))
{
MessageBox.Show("assigning: " + wWireless.AssociatedAccessPoint.ToString() + " to instance var.", "testing");
// first attempt to save the WEP enabled access point to the preferred networks
//WirelessZeroConfigNetworkInterface wWifiConnection = new WirelessZeroConfigNetworkInterface();
//wWifiConnection.AddPreferredNetwork(wWireless.AssociatedAccessPoint.ToString(),
// wWireless.InfrastructureMode,
// "9876543210",
// 1,
// wWireless.AuthenticationMode,
// WEPStatus.WEPEnabled,
// null);
mwniServerConnection = wWireless;
msAccessPointName = wWireless.AssociatedAccessPoint.ToString();
}
}
}
昨天找到了OpenNETCF库,我有点不知所措,我想问一下是否有任何代码示例可以测试网络ac是否可用,如果可用则连接。
【问题讨论】:
标签: c# windows windows-mobile wifi opennetcf