jimmyxing

永远进取

博客园 首页 新随笔 联系 订阅 管理
  0 Posts :: 5 Stories :: 0 Comments :: 0 Trackbacks

公告

[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); //目的地的ip
Int32 lhost= inet_addr(localIP); //本地服务器的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;
}

如何获得System.Management?
引用下 System.Management 这个.net组件就行了.
提示: 类型或命名空间名称“Management”在类或命名空间“System”中不存在(是否缺少程序集引用?)——怎么回事?
“添加引用”-->“.NET组件”-->找到System.Management.dll组件。按引用即可拉。

posted on 2005-08-25 10:37 永远进取 阅读(163) 评论(0)  编辑 收藏