tags:

views:

63

answers:

4

Is there a way to programmatically check if IPv6 is installed/enabled on windows using c++? Either at an interface level, or system wide.

+1  A: 

With a lot of network availability things the easiest way is to attempt to use it and catch the exceptions if it fails.

Fish
A: 

One answer would be to enumerate the system interfaces using GetAdapterAddresses() and look for an IPv6 address.

Steve-o
+1  A: 

WSCEnumProtocols() can be used to check whether IPv6 is installed as a protocol.

Steve-o
A: 

Easiest is just to try opening a socket,

const int sock6 = socket (AF_INET6, SOCK_DGRAM, 0);
const BOOL is_ip6_enabled = (SOCKET_ERROR != sock6);
close (sock6);
Steve-o