So I followed this example: How to find a list of wireless networks (SSID's) C# and now have following code using Native Wifi (like the accepted answer of the link):
WlanClient client = new WlanClient();
foreach ( WlanClient.WlanInterface wlanIface in client.Interfaces )
{
Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList( 0 );
foreach ( Wlan.WlanAvailableNetwork network in networks )
{
SomeListBox.Add(Encoding.ASCII.GetString(network.SSID, 0, (int)network.SSIDLength))
}
}
But this doesn't list all networks it only lists the one I'm currently connected to. Only if I press the Windows Wlan button in the taskbar, the code lists all networks. Did I do something wrong or is there a way to trigger this Windows Wlan scan thing?
Thanks in advance ;)
Ok so calling wlanIface.Scan();
before Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
did the thing for me so that the full code now looks like this:
WlanClient client = new WlanClient();
foreach ( WlanClient.WlanInterface wlanIface in client.Interfaces )
{
wlanIface.Scan();
Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
foreach ( Wlan.WlanAvailableNetwork network in networks )
{
SomeListBox.Add(Encoding.ASCII.GetString(network.SSID, 0, (int)network.SSIDLength))
}
}