How can I find the default network interface?
I tried: const NetworkInterface& theDefaultInterface = NetworkInterface::forIndex(0);
The documentation says:
static NetworkInterface forIndex( int index);
Returns the NetworkInterface for the given interface index. If an index of 0 is specified, a NetworkInterface instance representing the default interface (empty name and wildcard address) is returned.
Throws an InterfaceNotFoundException if an interface with the given index does not exist (or IPv6 is not available).
But I always get the InterfaceNotFoundException and I saw that forIndex just does a looup in the map of network interfaces (no special handling of index 0 and there is no entry with an index of 0 in the map)
I'am working on an Windows 7 (64) Machine.





