How to get the ip address under Windows
问题 all i already had a "socketfd", and i was wondering how to use it to retrieve the local ip address. under linux, i can do something like this(not exactly correct): struct ifreq ifr; ifr.ifr_addr.sa_family = AF_INET; ioctl(socketfd, SIOCGIFADDR, &ifr); char *address = inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr); but, on Windows, how can i achieve the same goal? (not using MFC) many thanks. edit: maybe my host has multiple ip addresses, and i want the one "connected" with