请教个问题,C#、IP、MAC方面的 我现在能循环获取局域网同一网段内的所有在线主机能对某个指定的IP获取其MAC地址现在如何获取局域网内所有在线主机IP对应的MAC地址???谢谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DirectoryEntry root = new DirectoryEntry("WinNT:"); DirectoryEntries domains = root.Children; domains.SchemaFilter.Add("domain"); foreach (DirectoryEntry domain in domains) { IPHostEntry iphe = null; try { iphe = Dns.GetHostByName(computer.Name); } catch { } }//获取MACSendARPpublic string 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 Convert.ToString(macinfo,16); } catch(Exception err) { Console.WriteLine("Error:{0}",err.Message); } return 0.ToString();} 这个可以实现获取所有mac地址吗? 截取字符串 关于txtBox以及查询操作 access查询的问题 ListView控件列头排序记录DisplayIndex索引 c#集体打印的问题 一个小问题,送分! 为什么我老是不能回复别人的问题!!!???没有回复按钮!! 如何使用程序控制在被打开的程序中某按钮(或热键)的点中? 各位仁兄:请教小弟一个用ADO访问数据库的步骤(附代码,最好用C#,简单即可) C#中取左几位,取右几位函数是什么?马上给分 datagridview与数据库同时更新 ilasm 汇编一段程序出错!熟悉的来看看解决下!
DirectoryEntries domains = root.Children;
domains.SchemaFilter.Add("domain");
foreach (DirectoryEntry domain in domains) {
IPHostEntry iphe = null;
try {
iphe = Dns.GetHostByName(computer.Name);
}
catch { }
}
//获取MAC
SendARP
public string 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 Convert.ToString(macinfo,16);
}
catch(Exception err)
{
Console.WriteLine("Error:{0}",err.Message);
}
return 0.ToString();
}