Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
//source
//[URL unfurl="true"]http://www-new.experts-exchange.com/Programming/Languages/C_Sharp/Q_21735460.html?qid=21735460&qid=21735460[/URL]
using System;
class GetMacAddress
{
[System.Runtime.InteropServices.DllImport("iphlpapi.dll", ExactSpelling=true)]
public static extern int SendARP(int DestIP, int SrcIP, byte[] pMacAddr, ref int PhyAddrLen);
public static string GetMacAddressByIP(System.Net.IPAddress ipAddress)
{
byte[] macBytes = new byte[6];
int length = 6;
SendARP(BitConverter.ToInt32(ipAddress.GetAddressBytes(), 0), 0, macBytes, ref length);
return BitConverter.ToString(macBytes, 0, 6);
}
static void Main(string[] args)
{
Console.WriteLine("GetMacAddress");
System.Net.IPAddress ipa = System.Net.IPAddress.Parse("192.168.1.1");
Console.WriteLine(GetMacAddressByIP(ipa));
}
}