取客户端MAC地址的方法

 1public static string GetMac(string clientip)
 2        {
 3            string mac="";
 4            System.Diagnostics.Process process=new System.Diagnostics.Process();
 5            process.StartInfo.FileName="nbtstat";
 6            process.StartInfo.Arguments="-a "+clientip;
 7            process.StartInfo.UseShellExecute=false;
 8            process.StartInfo.CreateNoWindow=true;
 9            process.StartInfo.RedirectStandardOutput=true;
10            process.Start();
11            string output=process.StandardOutput.ReadToEnd();
12            int length=output.IndexOf("MAC Address =");
13            if(length>0)
14            {
15                mac=output.Substring(length+14,17);
16            }

17            return mac;
18        }

19
20    }
原文地址:https://www.cnblogs.com/DarkAngel/p/382177.html