I just updated only on CodePlex (for now) M2Mqtt library (version, adding the automatic detection of any IPv6 address to connect.

To determine the address class (AddressFamily), I implemented the '"Extension Method" GetAddressFamily() for the IPAddress class through the static class IPAddressUtility, necessary only because the. NET Micro Framework does not itself provide the property AddressFamily the IPAddress class. In fact, in the case of full / compact. Net Framework is returned that property while in the case of. NET Micro Framework is done by a simple search of the ":" character (separator in IPv6 addresses).

   1: public static AddressFamily GetAddressFamily(this IPAddress ipAddress)
   2: {
   4:     return ipAddress.AddressFamily;
   5: #else
   6:     return (ipAddress.ToString().IndexOf(':') != -1) ? 
   7:         AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork;
   8: #endif
   9: }

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: this.socket = new Socket(this.remoteIpAddress.GetAddressFamily(), 
   2:         SocketType.Stream, ProtocolType.Tcp);

Little change .... very useful!