如何使用c#在wifi扫描中获取设备类型 [英] How to get device type in wifi scan using c#

查看:267
本文介绍了如何使用c#在wifi扫描中获取设备类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于winform项目我扫描我的wifi是否有任何设备连接。如果连接我得到mac id,制造,设备的IP地址..但我想要什么类型的设备(iPhone,iPad,笔记本电脑,mac设备,智能电视等)。帮我怎么找..

for a winform project i am scanning my wifi is there any device connected or not. if connected i am getting mac id, manufacture, ip address of device..but i want what type of device(iphone, ipad, laptop, mac device, smart tv etc). help me how to find..

推荐答案

这是你的意思吗?我希望它对你有所帮助。

你可以使用Managed Wifi API。它只是Native Wifi Api的包装,可用于Windows XP及更高版本。



此代码应显示可用的网络:

Is it your mean? I hope thet it helps you.
You could use the Managed Wifi API. It's just a wrapper for the Native Wifi Api, wich is available to Windows XP and later versions.

This code should show the available networks:
WlanClient client = new WlanClient();
foreach ( WlanClient.WlanInterface wlanIface in client.Interfaces )
{
    // Lists all available networks
    Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList( 0 );
    foreach ( Wlan.WlanAvailableNetwork network in networks )
    {                     
        Console.WriteLine( "Found network with SSID {0}.", GetStringForSSID(network.dot11Ssid));
    }
}

static string GetStringForSSID(Wlan.Dot11Ssid ssid)
{
    return Encoding.ASCII.GetString( ssid.SSID, 0, (int) ssid.SSIDLength );
}


你应该使用* native WiFi API *,因为你需要首先使用openhandler()来设置一组函数getEnuminterface()在这里你将获得你的WiFi硬件的GUID wlanscann()

wlangetavailablenetworklist()在这里作为输出你将得到一个结构,你可以找到所有上述信息。 closehandler()



只需深入了解natice WiFi即可获得所有信息。我想你得到了你想要的答案
you should use *native WiFi API* for that there are set of function which you need to use first of all use openhandler() getEnuminterface() here you will get GUID of your WiFi hardware wlanscann()
wlangetavailablenetworklist() here as output you will get a structure where you can find all above information . closehandler()

just dig into natice WiFi you will get all information. i think you got answer what you want


这篇关于如何使用c#在wifi扫描中获取设备类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆