When using C# WiFiAdapter to get information, always get the "too many session" error message......

ly Xu 1 Reputation point
2020-05-14T07:05:16.977+00:00
for(int i=1; i<=30; i++)
            {
                Console.WriteLine(i);
                var access = await WiFiAdapter.RequestAccessAsync();
                if (access == WiFiAccessStatus.Allowed)
                {
                    var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector());
                    if (result.Count >= 1)
                    {
                        fiAdapter = await WiFiAdapter.FromIdAsync(result[0].Id);
                        await fiAdapter.ScanAsync();
                        foreach (var item in fiAdapter.NetworkReport.AvailableNetworks)
                        {
                            if (item.Ssid == ssid)
                            {
                                double rssi = item.NetworkRssiInDecibelMilliwatts;
                                Console.WriteLine(rssi);
                            }
                        }
                    }
                }
            }

After 19 loops, return "......too many sessions......" error message, someone help?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
23,872 questions
No comments
{count} votes