问题描述
有人可以告诉我如何通过托管Wifi API 提取无线电类型,频道和加密信息. >在C#中?我可以通过"netsh wlan show interfaces"命令(当我连接到Wifi时)在命令提示符中看到上述所有信息,但是我不想使用此命令来获取C#中的信息.谢谢.
can someone please tell me how I can extract Radio Type, Channel and Encryption information through Managed Wifi API in C#? I am able to see all the above information in my command prompt through "netsh wlan show interfaces" command (when I am connected to Wifi), however I am not looking to use this command and get the info in C#.Thanks.
推荐答案
在进行了大量的谷歌搜索和R& D之后,我发现了一些解决问题的方法.我在" WlanClient "类下钻取了" WlanInterface "类,通过该类我可以提取"Channel"和"Encryption"值. 加密"有点棘手,代码片段如下:
After doing lot of googling and R&D, I have found some solution of my problem. I have drilled down "WlanInterface" class under "WlanClient" class through which I was able to extract "Channel" and "Encryption" values. "Encryption" was little tricky, the code snippet is as follows:
Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
Wlan.WlanAvailableNetwork network = networks.Where(x => x.flags.HasFlag(Wlan.WlanAvailableNetworkFlags.Connected)).FirstOrDefault();
muObject.Encryption = network.dot11DefaultCipherAlgorithm.ToString();
我从netsh wlan查询中提取了无线电类型",直到找到理想的解决方案... :-)
I have extracted "Radio Type" from netsh wlan query until I find the perfect solution... :-)
这篇关于从托管Wifi API c#获取无线电类型,频道和加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!