How to connect to a Wi-Fi network in .NET CF C # 3.5

Here is what I wanted to do in a .NET CF 3.5 application (C #)

1) Check if the wireless adapter is working / active 2) Add your preferred network with available SSID, password and other information 3) Establish a connection to your preferred network.

I tried using the OpenNetCF.Net.NetworkInformation class, but you're out of luck! I cannot detect wireless networks. All networks, including wifi and bluetooth, are displayed as Ethernet.

foreach (var networkInterface in NetworkInterface.GetAllNetworkInterfaces()) { if (networkInterface is WirelessNetworkInterface) MessageBox.Show("Found a WirelessNetworkInterface"); else if (networkInterface is WirelessZeroConfigNetworkInterface) MessageBox.Show("Found a WirelessZeroConfigNetworkInterface"); else MessageBox.Show("Ethernet??"); } 

The problem I am having is discussed here http://community.opennetcf.com/forums/t/11099.aspx . But there are no solutions.

Are there any .NET CF APIs that allow me to interact with Wifi?

+4
source share
2 answers

You misunderstand. This is a list, as the name implies, of all network interfaces. Bluetooth and Wi-Fi (and even RNDIS USB connections) are all network interfaces and therefore will be listed. Basically, under the hood, it just asks NDIS to tell us all the interfaces that he knows about.

While it is iterating, it has two functions. First, it asks for the WZC if it knows about the interface (i.e. if the interface driver is registered in the WZC). If so, then we know this wireless device that is compatible with WZC, and we will get more information for it and return the WirelessZeroConfig interface.

Then we ask that NDIS is a driver for a device that communicates itself as wireless. If so, then we get the NDIS information for wireless and return the wireless interface.

Everything else becomes a common NetworkInterface.

So how can a wireless device appear as a shared NetworkInterface? Simply. The driver for him did not register with the WZC, and also does not report that it is wireless via NDIS. Our code cannot determine that the driver is not reporting. This is actually quite common with older Cisco cards that use the Cico interface for a wireless network. They are physically a wireless device, but since the software does not tell us about it, and since we do not request any proprietary APIs, all we can do is return the general NDIS information for the adapter.

If you have such a device, the only way is to talk to the OEM adapter and see if they have an API for it that you can use.

+3
source

You can use System.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType = NetworkInterfaceType.Wireless80211 to determine if the adapter is a WiFi updater.

-1
source

Source: https://habr.com/ru/post/1302573/


All Articles