使用api http://www.programfan.com/showarticle.asp?id=2248------------------------------------
分应该给我吧  哈哈

解决方案 »

  1.   

    [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 remoteIP) 

    Int32 ldest= inet_addr(remoteIP); //目的地的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; 

    public static string GetMacAddress(string hostname)
    {
    string HumanReadableMac=string.Empty;
    string tmpHumanReadableMac=string.Empty;
    try
    {

    Int64 mac=getRemoteMAC(hostname);
    tmpHumanReadableMac=Convert.ToString(mac,16);
    for(int i=0;i<tmpHumanReadableMac.Length;i=i+2)
    {
    HumanReadableMac=tmpHumanReadableMac.Substring(i,2)+HumanReadableMac;
    }
    }
    catch(System.Exception ee)
    {
    string errMsg
    ="获取"
    +hostname
    +"的mac的时候\n发生错误:"
    +ee.Message
    +"\n原始mac为:"
    +tmpHumanReadableMac;
    System.Windows.Forms.MessageBox.Show(errMsg);
    }
    return HumanReadableMac; }
      

  2.   

    好象arp协议中要是对方IP和自己不是同网段时, 
    将返回的是网关的Mac~
      

  3.   

    嗯。只能够获取本网段的mac。