c# - How do I get the available wifi APs and their signal strength in .net? -


Is there any way to access all wifi access points and their associated RSSI value to NAT? It would be really good if I can do it without using unmanaged code or better if it works in mono as well as simultaneously. NET

If possible, I can use a code sample.

-

-

-

/ div>

This is a cover project with managed code which supports C # on

it supports Windows Vista and XP SP2 (or later versions).

Sample code:

  using Native WiFi; Using the system; Using System.Text; Namespace WifiExample {class program {/// & lt; Summary & gt; /// Converts an 802.11 SSID to a string. /// & lt; / Summary & gt; Static String GetStringForSSID (Wlan.Dot11Ssid ssid) {return encoding. ASCII.GetString (ssid.SSID, 0, (int) ssid.SSIDLength); } Fixed Zero main (string [] args) {WlanClient Client = New WlanClient (); Foreach (WlanClient.WlanInterface wlanIface client.Interfaces) {// WEP Security List of All Networks with Wlan.WlanAvailableNetwork [] Network = wlanIface.GetAvailableNetworkList (0); foreach (Wlan.WlanAvailableNetwork Network) network {if (network.dot11DefaultCipherAlgorithm == Wlan.Dot11CipherAlgorithm.WEP) {Console.WriteLine ( "Found SSID with WEP network {0}.", GetStringForSSID (network.dot11Ssid)); }} // can assist in the creation of the current profile of XML configuration recover the // The XML configuration // you have your own (ie, it will give you an example) Foreach (Wlan.WlanProfileInfo profile inline WlanIfacekGetProfiles ( )) {String name = profileInfo.profileName; // This is usually the network's SSID string XML = wlanIface.GetProfileXml (profileInfo.profileName); } // WEP connects to a known network with a security string profileName = "Cheesecake"; // This is also the SSID string mac = "52544131303235572D454137443638"; String key = "hello"; String profileXml = String.Format ( "? & LT; xml version = \" 1.0 \ http "& gt; & lt; WLANProfile xmlns = \": //www.microsoft.com/networking/WLAN/profile/v1 \ " & Gt; & lt; name & gt; {0} & lt; / name & gt; & lt; SSIDConfig & gt; & lt; SSID & gt; & lt; hex & gt; {1} & lt; / hex & gt; & lt; name & gt; {0} & lt; / name & gt; & lt; / SSID and gt; & lt; / SSIDConfig & gt; & lt; connectionType & gt; ESS & lt; / connectionType & gt; & lt; MSM & gt; & lt; security & gt; & lt; authEncryption & gt; & lt; authentication & gt; open & lt; / authentication & gt; & lt; encryption & gt; WEP & lt ; / encryption & gt; & lt; useOneX & gt; false & lt; / useOneX & gt; & lt; / authEncryption & gt; & lt; sharedKey & gt; & lt; KeyType & gt; networkKey & lt; / KeyType & Gt; & lt; security Gt; li & gt; false & lt; / protected & gt; & lt; keyMaterial & gt; {2} & lt; / keyMaterial & gt; & lt; / sharedKey & gt; & lt; keyIndex & gt; 0 & lt; / KeyIndex & gt; & lt; / security & gt; & lt; / MSM & gt; & lt; / WLANProfile & gt ;, profile, mac, key); WlanIface.SetProfile (Wlan.WlanProfileFlags.AllUser, profileXml, true); WlanIface.Connect (Wlan.WlanConnectionMode.Profile, Wlan.Dot11BssType.Any, profileName); }}}}  

Comments