获取mac地址
来源:互联网 发布:python bloomfilter 编辑:程序博客网 时间:2024/06/08 08:39
public static void PrintAllMacAddress()
{
const int MIN_MAC_ADDR_LENGTH = 12;
string macAddress = string.Empty;
long maxSpeed = -1;
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
print(
"Name: " + nic.Name +
" Found MAC Address: " + nic.GetPhysicalAddress() +
" Type: " + nic.NetworkInterfaceType);
string tempMac = nic.GetPhysicalAddress().ToString();
if (nic.Speed > maxSpeed &&
!string.IsNullOrEmpty(tempMac) &&
tempMac.Length >= MIN_MAC_ADDR_LENGTH)
{
print("New Max Speed = " + nic.Speed + ", MAC: " + tempMac);
maxSpeed = nic.Speed;
macAddress = tempMac;
}
{
const int MIN_MAC_ADDR_LENGTH = 12;
string macAddress = string.Empty;
long maxSpeed = -1;
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
print(
"Name: " + nic.Name +
" Found MAC Address: " + nic.GetPhysicalAddress() +
" Type: " + nic.NetworkInterfaceType);
string tempMac = nic.GetPhysicalAddress().ToString();
if (nic.Speed > maxSpeed &&
!string.IsNullOrEmpty(tempMac) &&
tempMac.Length >= MIN_MAC_ADDR_LENGTH)
{
print("New Max Speed = " + nic.Speed + ", MAC: " + tempMac);
maxSpeed = nic.Speed;
macAddress = tempMac;
}
}
public static string GetFirstMacAddress()
{
string macAddresses = string.Empty;
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
if (nic.OperationalStatus == OperationalStatus.Up)
{
macAddresses += nic.GetPhysicalAddress().ToString();
print(macAddresses);
break;
}
}
return macAddresses;
}
阅读全文
0 0
- 获取MAC地址
- 获取Mac地址
- 获取Mac地址
- 获取MAC地址
- 获取MAC地址(Err)
- 获取网卡MAC地址
- 获取客户端MAC地址
- 获取mac地址
- 获取客户端mac地址
- 获取mac地址
- 获取网卡MAC地址
- 获取MAC地址。。。。。。。。。
- 获取MAC地址
- 获取计算机mac地址
- 获取网卡Mac地址
- 如何获取MAC地址
- 获取客户端MAC地址
- 获取网卡MAC地址
- oracle显式游标
- 唯快不破:TCP/IP详解--连接状态变迁图CLOSE_WAIT
- 七周一次课(11月27日) 13.5 字符串操作 13.6 list操作 13.7 set操作
- 2017免费最新版YY注册机
- AMS笔记
- 获取mac地址
- VisualVM 检测不到本地JAVA程序
- GROUP BY和HAVING用法简介
- Ansi,UTF8,Unicode,ASCII编码的区别
- 交叉法在几何上的应用
- SDUT 2016级 CF 每周题集 Round 2
- 代码review总结
- 用TensorFlow开发问答系统
- 入手pandas分析统计