I have just updated on CodePlex and Nuget my uPLibrary library (version 2.1.0.0), adding automatic detection of any IPv6 address to the HTTP client (HttpClient class) .

To determine the address class (AddressFamily), I implemented the '"Extension Method" GetAddressFamily () for the IPAddress class through the static class IPAddressUtility, needed only because the. NET Micro Framework does not itself provide the property AddressFamily in the IPAddress class.

 

   1: public static AddressFamily GetAddressFamily(this IPAddress ipAddress)
   2: {
   3:     return (ipAddress.ToString().IndexOf(':') != -1) ?
   4:         AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork;
   5: }

In this way, at the time of the creation of the socket, it is automatically set to the correct address family from the address to connect to.

   1: // create socket and connect
   2: this.socket = new Socket(
   3:         this.hostIpEndPoint.Address.GetAddressFamily(), 
   4:         SocketType.Stream, ProtocolType.Tcp);
   5: this.socket.Connect(this.hostIpEndPoint);