I'm writing an application to search the AP with the highest strength and then to connect to it.
After I found the best AP I run following code. It always return true! But every time the current IP is 0.0.0.0 so I suppose no connection is available.
Where am I wrong?
OpenNETCF.Net.NetworkInformation.
EAPParameters eap = new OpenNETCF.Net.NetworkInformation.EAPParameters();eap.Enable8021x = true;
eap.EapType =
EAPType.Default;eap.EapFlags = EAPFlags.Enabled;
bool b = false;lock (m_syncRoot)
{
b = this.wirelessAdapter.AddPreferredNetwork(this.bestAccessPoint.Name, false, passphrase, 1, this.bestAccessPoint.AuthenticationMode, this.bestAccessPoint.Privacy, eap);
}
if (b)
{
lock (m_syncRoot)
{
return this.wirelessAdapter.ConnectToPreferredNetwork(this.bestAccessPoint.Name);
}
}
else
{
return false;
}