title: C++ SendARP returns wrong mac address?
body: <p>im trying to retrieve the mac address of devices on my lan and im using the SendARP function to do this  but for some weird reason it is giving me the wrong mac address, im telling it to get the mac of my laptop that is also on lan but it does not work :/</p>
  
  <p>link to SendARP function(MSDN): <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366358%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/aa366358%28v=vs.85%29.aspx</a></p>
  
  <p>the mac of the laptop is really: e0:94:67:18:a7:dc
  Mac output by SendARP: e9:ad:2d:01:c8:11</p>
  
  <p>this is the function i created to simply fetch the mac from an ip address :P</p>
  
  <pre><code>BYTE* GetMacAddress(IPAddr destination, IPAddr source) {
  Sleep(500);
  ULONG DestMacAddr[2];
  ULONG PhysicalLength = 6;
  
  memset(&amp;DestMacAddr, 0xff, sizeof(DestMacAddr));
  
  DWORD returnValue = SendARP(destination, source, &amp;DestMacAddr, &amp;PhysicalLength);
  
  if(returnValue == NO_ERROR) {
      cout &lt;&lt; "Fetched destination mac" &lt;&lt; endl;
  }else {
      printf("Error: %d\n", returnValue);
  
      if(returnValue == ERROR_BAD_NET_NAME) {
          printf("ERROR_BAD_NET_NAME\n trying to fetch mac address...");
          return GetMacAddress(destination, source);
      }
  
      if(returnValue == ERROR_BUFFER_OVERFLOW) {
          printf("ERROR_BUFFER_OVERFLOW\n");
      }
  
      if(returnValue == ERROR_GEN_FAILURE) {
          printf("ERROR_GEN_FAILURE\n");
      }
  
      if(returnValue == ERROR_INVALID_PARAMETER) {
          printf("ERROR_INVALID_PARAMETER\n");
      }
  
      if(returnValue == ERROR_INVALID_USER_BUFFER) {
          printf("ERROR_INVALID_USER_BUFFER\n");
      }
  
      if(returnValue == ERROR_NOT_FOUND) {
          printf("ERROR_NOT_FOUND\n");
      }
  
      if(returnValue == ERROR_NOT_SUPPORTED) {
          printf("ERROR_NOT_SUPPORTED\n");
      }
  }
  BYTE *bMacAddr = (BYTE *) &amp;DestMacAddr;
  
  return bMacAddr;
  </code></pre>
  
  <p>}</p>
  
  <p>i was thinking it might be because it is network byte order or something but nothl() did not work either :/ please help me out here :/</p>