I have just updated on CodePlex and Nuget my uPLibrary library (version 184.108.40.206), 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)
3: return (ipAddress.ToString().IndexOf(':') != -1) ?
4: AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork;
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(
4: SocketType.Stream, ProtocolType.Tcp);
View this page in another language: