public static PhysicalAddress GetMacAddress()
{
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
// Only consider Ethernet network interfaces
if (nic.NetworkInterfaceType == NetworkInterfaceType.Ethernet &&
nic.OperationalStatus == OperationalStatus.Up)
{
return nic.GetPhysicalAddress();
}
}
return null;
}
No comments:
Post a Comment