title: how to find the MAC address of another computer (client server)?
body: <p><strong>i am trying to get the MAC address of another computer</strong> using a server and client program in c++ using UDP connections. The server is on one computer (it contains 2 listboxes, 1 for the IP addresses of connected clients, the other for the MAC address) the client is on another computer. my current code only gets the MAC address if i run the server and client and the same computer. When i debug the program i see that when trying to get the MAC address of another computer the program doesn't go into the if statement and run the line PrintMACaddress(pAdapterInfo->Address);</p>
  
  <pre><code> void CmfcServerDlg:: PrintMACFromIP(const CString &amp;selected_ip_adr)
  {
      IP_ADAPTER_INFO AdapterInfo[16];            
      DWORD dwBufLen = sizeof(AdapterInfo);       
      DWORD dwStatus = GetAdaptersInfo(           
          AdapterInfo,                            
          &amp;dwBufLen);                             
      assert(dwStatus == ERROR_SUCCESS);          
  
      PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;// Contains pointer to current adapter info
      bool found = false;
      do {
          const IP_ADDR_STRING *addr_str = &amp;pAdapterInfo-&gt;IpAddressList; 
          if (addr_str != NULL)
          {
              if (selected_ip_adr == addr_str-&gt;IpAddress.String)
              {
                  PrintMACaddress(pAdapterInfo-&gt;Address);
              }              
          }   
  
          pAdapterInfo = pAdapterInfo-&gt;Next; 
  
  
      }
      while(pAdapterInfo);                        
  
  }
  </code></pre>
  
  <p>i found that using the ARP function may help with this or since the MAC address is data i may transmit it as a string or raw data but i have idea how to this</p>
  
  <p>here is the PrintMAC function:</p>
  
  <pre><code>    void CmfcServerDlg::PrintMACaddress(unsigned char MACData[])
  {
      CString strText;
      strText.Format("%02X-%02X-%02X-%02X-%02X-%02X\n",MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]);
      m_ClientIdList.AddString(strText); 
  }
  </code></pre>