[Solved] How to get my external ip (primary interface) without internet connection, without eth0 and without any hardcoded constnts using C [closed]
If you just want to discover the default adapter’s assigned IP address, e.g. 192.168.0.237, call getifaddrs and enumerate each address. This is the same list of adapters that ifconfig would normally display with associated information for gateway and netmask. Filter out the ones that are flagged as IFF_LOOPBACK or don’t have IFF_UP. Some sample code … Read more