取得客户端MAC

    public  void GetNetCardAddress(string strIp)
    
{
        System.Diagnostics.Process process 
= new System.Diagnostics.Process();
        process.StartInfo.FileName 
= "nbtstat";
        process.StartInfo.Arguments 
= "-a " + strIp;
        process.StartInfo.UseShellExecute 
= false;
        process.StartInfo.CreateNoWindow 
= true;
        process.StartInfo.RedirectStandardOutput 
= true;

        process.Start();

        
string output = process.StandardOutput.ReadToEnd();
        
int length = output.IndexOf("MAC Address = ");

        
if (length > 0)
        
{
            mac 
= output.Substring(length + 1417);
        }


        process.WaitForExit();
    }
mac即为所求串
posted on 2006-11-18 19:40  冰封王座(.net)博客  阅读(207)  评论(0编辑  收藏  举报