Hello!<br><br>I wrote this small function but it always returns "127.0.0.1". I would like to be able to get my dynamically assigned IP when I connect to the net. What's wrong with this code?<br><br>char* GetLocalIP(void) <br>{<br> WORD wVerReq = MAKEWORD(1, 1);<br> WSADATA wsaData;<br> int error = 0;<br> HOSTENT* hostent;<br> in_addr* pPtr;<br> char* result;<br><br> error = WSAStartup(wVerReq, &wsaData);<br> if (error != 0)<br> return "winsock.dll version not supported";<br><br> hostent = gethostbyname("localhost"<br><br> pPtr = (in_addr *)(hostent->h_addr_list[0]);<br><br> result = inet_ntoa(*pPtr);<br><br> WSACleanup();<br><br> return result;<br>}<br><br>Could it possibly be the index passed with h_addr_list? How should I change it. Thanks in advance.<br><br>dex<br>