/**/ /// <summary>/// 读取IP地址对应的MAC地址/// </summary>/// <param name="ip">访问者的IP</param>/// <returns></returns> public string getmac( string ip) ... { string result=""; try ...{ string dirresults=""; System.Diagnostics.ProcessStartInfo psi=new System.Diagnostics.ProcessStartInfo(); System.Diagnostics.Process proc = new System.Diagnostics.Process(); psi.FileName = "nbtstat"; psi.RedirectStandardInput=false; psi.RedirectStandardOutput=true; psi.Arguments="-A "+ip; psi.UseShellExecute=false; proc=System.Diagnostics.Process.Start(psi); int x=-1; while(x<=-1) ...{ if(dirresults!=null) ...{ x=dirresults.Trim().ToLower().IndexOf("mac address"); if (x>-1) ...{ break; } } dirresults=proc.StandardOutput.ReadLine().ToString(); }; proc.WaitForExit(); result=ValueSepR(dirresults.Trim(),"="); return result; } catch ...{ return ""; }}