如果要想获得远程的地址需要用sendarp这个函数来实现具体的代码如下
[DllImport(Iphlpapidll)]
private static unsafe extern int SendARP(Int destInt hostref IntPtr macref IntPtr length);
[DllImport(Ws_dll)]
private static extern Int inet_addr(string ip);
Int ldest= inet_addr();//目的地的ip
Int lhost= inet_addr();//本地的ip
try
{
Byte[] macinfo=new Byte[];
Int length=;
IntPtr mac=new IntPtr(macinfo[]);
IntPtr len=new IntPtr();
int ii=SendARP(ldestlhost ref mac ref len);
ConsoleWriteLine(Mac Add:+mac);
ConsoleWriteLine(length:+len);
}
catch(Exception err)
{
ConsoleWriteLine(err);
}