The remote computer has two addresses: LAN and VPN
I tried to get the LAN IP address by running the following code:
hostent *host = gethostbyname(hostname); if (host) strcpy(ip, inet_ntoa(*((struct in_addr *)host->h_addr)));
So, sometime it returns LAN , but sometime VPN . I know there are many addresses in the h_addr_list field, but how do I know which address is local?
I tried using GetAdaptersInfo (), it has a field to determine the local ip or not, but just return the ip address of my computer. I do not know how to get ip for a remote computer.
Someone give me some advice please!
source share