C# – 如何访问WLAN信号强度等?

前端之家收集整理的这篇文章主要介绍了C# – 如何访问WLAN信号强度等?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
许多科学家已经发表了 papers,记录了如何通过测量其信号强度,到达时间,往返时间等来跟踪通过WLAN连接的设备.任何想法如何使用任何.NET API在Windows中访问这些值?

或者您是否知道可用于位置跟踪的软件SDK?

解决方法

你好WIndows 7这是一个很好的代码,可以检测所有的AP与MAC地址RSSI SSID:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using NativeWifi;

class Program
{

    static void Main(string[] args)
    {

        WlanClient client = new WlanClient();
        // Wlan = new WlanClient();
        try
        {
            foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
            {

                Wlan.WlanBssEntry[] wlanBssEntries = wlanIface.GetNetworkBssList();

                foreach (Wlan.WlanBssEntry network in wlanBssEntries)
                {
                    int RSS = network.RSSi;
                    //     MessageBox.Show(RSS.ToString());
                    byte[] macAddr = network.dot11Bssid;

                    string tMac = "";

                    for (int i = 0; i < macAddr.Length; i++)
                    {

                        tMac += macAddr[i].ToString("x2").PadLeft(2,'0').ToUpper();

                    }



                    Console.WriteLine("Found network with SSID {0}.",System.Text.ASCIIEncoding.ASCII.GetString(network.dot11Ssid.SSID).ToString());

                    Console.WriteLine("Signal: {0}%.",network.linkQuality);

                    Console.WriteLine("BSS Type: {0}.",network.dot11BssType);

                    Console.WriteLine("MAC: {0}.",tMac);

                    Console.WriteLine("RSSID:{0}",RSS.ToString());


                }
                Console.ReadLine();
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }

        }
    }  
}

我希望这将是有益的享受

原文链接:https://www.f2er.com/csharp/94345.html

猜你在找的C#相关文章