ASP.NET Get Remote Computer Net Card Mac

xiaoxiao2021-03-06  41

[DllImport ( "Iphlpapi.dll")] private static extern int SendARP (Int32 dest, Int32 host, ref Int64 mac, ref Int32 length); [DllImport ( "Ws2_32.dll")] private static extern Int32 inet_addr (string ip) ;

Static Private INT64 GetRemoteMac (String localip, string remoteip) {INT32 LDEST = inet_addr (remoteip); // Destination IP INT32 LHOST = INET_ADDR (localip); // Local Server IP

Try {int64 macinfo = new int64 (); int32 len = 6; int res = sendarp (LDEST, 0, REF MACINFO, REF LEN); RETURN MACINFO;} catch (Exception Err) {Console.Writeline ("error: {0 } ", err.message);} return 0;}

转载请注明原文地址:https://www.9cbs.com/read-76877.html

New Post(0)