[DllImport("Iphlpapi.dll")]
static extern int SendARP(Int32 DestIP, Int32 SrcIP, ref Int64 MacAddr, ref Int32 PhyAddrLen);
/// <summary>
/// SendArp获取MAC地址
/// </summary>
/// <returns></returns>
public string GetMacAddressBySendARP()
{
StringBuilder strReturn = new StringBuilder();
try
{
System.Net.IPHostEntry Tempaddr = (System.Net.IPHostEntry)Dns.GetHostByName(Dns.GetHostName());
System.Net.IPAddress[] TempAd = Tempaddr.AddressList;
Int32 remote = (int)TempAd[0].Address;
Int64 macinfo = new Int64();
Int32 length = 6;
SendARP(remote, 0, ref macinfo, ref length);
string temp =
static extern int SendARP(Int32 DestIP, Int32 SrcIP, ref Int64 MacAddr, ref Int32 PhyAddrLen);
/// <summary>
/// SendArp获取MAC地址
/// </summary>
/// <returns></returns>
public string GetMacAddressBySendARP()
{
StringBuilder strReturn = new StringBuilder();
try
{
System.Net.IPHostEntry Tempaddr = (System.Net.IPHostEntry)Dns.GetHostByName(Dns.GetHostName());
System.Net.IPAddress[] TempAd = Tempaddr.AddressList;
Int32 remote = (int)TempAd[0].Address;
Int64 macinfo = new Int64();
Int32 length = 6;
SendARP(remote, 0, ref macinfo, ref length);
string temp =