title: How to get local network IP address of a remote computer
body: <p>A remote computer has two address: <strong>LAN</strong> and <strong>VPN</strong></p>
  
  <p>I tried to get <strong>LAN</strong> IP address by following code:</p>
  
  <pre><code>hostent *host = gethostbyname(hostname);
  if (host) strcpy(ip, inet_ntoa(*((struct in_addr *)host-&gt;h_addr)));
  </code></pre>
  
  <p>So, sometime it return <strong>LAN</strong>, but sometime <strong>VPN</strong>. I know that there're many address in h_addr_list field, but how can I know which address is local?</p>
  
  <p>I tried to use GetAdaptersInfo(), it has field to determine local ip or not, but just return ip address of my computer. I don't know how to get ip for remote computer.</p>
  
  <p>Anyone give me some advices, please!</p>