title: Detect if the current connection supports both IPv4 and IPv6
body: <p>I need to detect in <strong>WinRT application</strong> on which protocols there is an internet access (IPv4/IPv6/both). I've got the following code to determine supported protocols:</p>
  
  <pre><code>enum IpVersion
  {
      None = 0,
      IPv4 = 1,
      IPv6 = 2,
      IPv46 = 3
  }
  
  IpVersion GetIpVersion(ConnectionProfile profile)
  {
      var result = IpVersion.None;
  
      if (profile != null &amp;&amp; profile.NetworkAdapter != null)
      {
          var hostnames = NetworkInformation.GetHostNames().Where(h =&gt; h.IPInformation != null &amp;&amp; 
                                                                  h.IPInformation.NetworkAdapter != null &amp;&amp;
                                                                  h.IPInformation.NetworkAdapter.NetworkAdapterId == profile.NetworkAdapter.NetworkAdapterId);
          foreach (var hostname in hostnames)
          {
              if (hostname.Type == HostNameType.Ipv4)
              {
                  result |= IpVersion.IPv4;
              }
              else if (hostname.Type == HostNameType.Ipv6)
              {
                  result |= IpVersion.IPv6;
              }
          }
      }
  
      return result;
  }  
  </code></pre>
  
  <p>I use it like this: </p>
  
  <pre><code>GetIpVersion(NetworkInformation.GetInternetConnectionProfile()); 
  </code></pre>
  
  <p>Now I would like to know if there is an internet access on each available protocol. Of course I could ping something, but I wonder if there is some SDK method for it. Those information are available in <code>Wi-Fi status</code> window:  </p>
  
  <p><a href="https://i.stack.imgur.com/cx6Lk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cx6Lk.png" alt="WiFi-status"></a></p>
  
  <p>There is a method, which can return for example <code>NetworkConnectivityLevel.InternetAccess</code>, but it doesn't contain information on which protocol there is a connection.</p>
  
  <pre><code>bool internetAccess = connectionProfile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess
  </code></pre>