How to get internal IP, external IP and default gateway for UPnP
问题 I'm wondering how I'd go about getting the: Internal IP address; External IP address; and Default gateway in Windows (WinSock) and Unix systems. Thanks in advance, 回答1: There is no general purpose mechanism that works on Windows and UNIX. Under Windows you want to start with GetIfTable(). Under most UNIX systems, try getifaddrs(). Those will give you various things like the IP address of each interface. I'm not sure how one would go about getting the default gateway. I would guess that it is