InterfaceState.Connected not being set?

Aug 3, 2009 at 9:27 PM
Edited Aug 3, 2009 at 9:30 PM

Hello all,

First, thanks for this great API, I had a wild idea and this made it much easier since i didnt neet to handle creating a wireless manager. However... after sending the command to connect to the wireless access point, the interface state does not seem to be updating all the way to Connected. Using the following code in a timed loop to monitor it, i've noticed the interface state always shows as "Authenticating."

It could be something silly that i have missed, any help would be appreciated! Thanks!

The function below is always returning false, even after successful connections are established.

        public bool wirelessConnectedToProfile(string profileName)
        {
            WlanClient client = new WlanClient();
            foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
            {
                Console.WriteLine("WlanInterfaceState: " + wlanIface.InterfaceState.ToString());
                if (wlanIface.InterfaceState == Wlan.WlanInterfaceState.Connected)
                {
                    if (wlanIface.CurrentConnection.profileName == profileName)
                    {
                        return true;
                    }
                }
            }
            return false;
        }

 

Nov 26, 2012 at 8:44 PM

may be try this

try
{
	WlanClient client = new WlanClient();
	foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
	{
		// Lists all networks with WEP security
		Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
		foreach (Wlan.WlanAvailableNetwork network in networks)
		{
			if ((network.flags & Wlan.WlanAvailableNetworkFlags.Connected) == Wlan.WlanAvailableNetworkFlags.Connected){
				CurrentlyConnectedNetwork = GetStringForSSID(network.dot11Ssid);
				IsConnected = true;
			}
		}
				
	}

}

catch (Exception ex)
{

}