我正在尝试让 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 是否可用,如果可用则进行连接。