Managing wireless network connection in C#

一曲冷凌霜 提交于 2019-12-17 15:42:38

问题


We've got a WinForms app written in C# that has a very custom GUI. The user is not allowed to run any other applications and the user cannot go into the OS (WinXP Pro) at all. We're planning on allowing the user to connect to available wireless networks. We're going to have to create a configuration screen that displays available networks (by SSID) and allows the user to connect. While connected we want to display signal strength.

Are there any existing components that provide this capability? I haven't found anything but this.

I can set the TCP/IP settings using WMI, but it's the wireless stuff that I need a direction on.

Many thanks!

Matt


回答1:


Managed Wifi API should work.

This might not be ideal - you have XP, which is good, but you would have to deploy a hotfix. I'd go for it, because all the wifi code I've dealt with (for the Compact Framework) is hideous. This code is as simple as could be.

Their sample code doesn't include reading the signal strength, though, and I'm not sure if the Native wifi API provides that. I have written C# code that gets the wireless signal strength, but it did this by PInvoking into a manufacturer-specific DLL available only on their devices. It may be that you'll have to do something similar to get the wireless strength from your PC's wireless card (and that may be why that functionality is not available in an all-purpose API).




回答2:


It is possible to connect available wireless networks using native wifi.

http://www.codeproject.com/KB/gadgets/SignalStrenghth.aspx

Check the link, Which was developed by me.




回答3:


I wrote a library which is a layer of abstraction above Managed Wifi, it is a bit more convenient to use. You can find it on GitHub.



来源:https://stackoverflow.com/questions/285665/managing-wireless-network-connection-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!