此代码提供了我的 PC 的 MAC 地址,但我想查找连接到我的 WiFi 热点的移动或计算机设备的 MAC 地址。
string mac = "";
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
if (nic.OperationalStatus == OperationalStatus.Up &&
(!nic.Description.Contains("Virtual") && !nic.Description.Contains("Pseudo")))
{
if (nic.GetPhysicalAddress().ToString() != "")
{
mac = nic.GetPhysicalAddress().ToString();
}
}
}
MessageBox.Show(mac);
我想做类似的事情,比如下面的伪代码:
string MAC;
//method for retrieving mac address of the connected devices to my hotspot.
ConnectedDevices()
{
// some code which will give you MAC of that device.
MAC = mac address of connected device;
}
label1.text=mac.toString();
谢谢!
最佳答案
初步估计您需要一个 ARP 缓存查看器(尝试执行“arp -a”并查看它是否是您想要的。)。
请参阅this question .
关于c# - 使用c#获取连接到我的热点的设备的MAC地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35091991/