SocketTools IPv6 Support

Although IPv6 has been getting a lot of attention recently, it’s actually been around for quite a while now. Work on the protocol began in the early 1990’s and there have been public IPv6 networks that have existed for well over a decade. Currently, IPv4 remains the dominant protocol used over the Internet (the worldwide adoption rate for IPv6 is approximately 20% as of 2018). However, this is changing and support for IPv6 is increasingly important.

The last of the large blocks of available IPv4 addresses were allocated by the Internet Assigned Numbers Authority (IANA) early in 2011. The widespread adoption of classless routing (CIDR) and network address translation (NAT) has delayed the inevitable exhaustion of IPv4 addresses, but we’re rapidly approaching the point where the transition to IPv6 will be required to accommodate the ever increasing number of devices connected to the Internet.

Fortunately, the transition for developers using SocketTools will be fairly simple. Most of the real complexity in dealing with both IPv4 and IPv6 is handled internally, although there are some important considerations when updating your applications to use IPv6.

1. If your application stores IP addresses in a database, configuration file, etc. then you need to make sure that your program will recognize both IPv4 and IPv6 formatted addresses. If your program is written to only recognize IPv4 addresses in dotted notation, this will create problems with IPv6 because it uses a completely different format. Instead of a sequence of four numbers separated by periods, IPv6 consists of hexadecimal values separated by colons. So while an IPv4 address looks like 192.168.0.20, an IPv6 address will looks something like fd7c:2f6a:4f4f:ba34::a32 and can be much longer than an IPv4 address. You’ll want to allocate at least 46 characters to store a full IPv6 address.

2. If your application allows the user to input an IPv4 address, then you’ll need to change that code to accept both address formats. If you’re using some kind of masked input that expects four individual numbers that are in the range of 0-255, then that code will need to be rewritten.

3. If your application uses the SocketTools Library Edition and stores IP addresses as 32-bit integer values, that code will need to be changed. There are several API functions in earlier versions of SocketTools that expect an IP address to be stored in a DWORD (unsigned 32-bit integer) variable. Those functions have been changed to use a new type named INTERNET_ADDRESS that is capable of representing both IPv4 and IPv6 addresses.

If your software is designed to work with both host names and IP addresses, and you don’t make any assumptions about the format of the address, then there aren’t as many changes that you’ll need to make. The SocketTools functions and methods that accept either host names or addresses will automatically recognize the difference in formats and act accordingly. Because a host name can resolve to either an IPv4 or IPv6 address, SocketTools will normally choose the IPv4 address whenever one is available. For example, if the host name www.company.com has both an IPv4 and IPv6 address assigned to it (which will be common, particularly during the transition period to IPv6) then SocketTools will prefer the IPv4 address for backwards compatibility. However, if that domain only has an IPv6 address, then SocketTools will use IPv6 to establish the connection. There’s also an option that you can use if you only want to use IPv6 addresses, even if there is an IPv4 address for the host.

Because it’s likely you’ll need to continue to support older Windows platforms, SocketTools will also automatically handle situations where an IPv6 stack is not installed, and it compensates for some internal differences between the various versions of Windows. The most complete support for IPv6 is available on Windows 7 and Windows Server 2008 R2 or later platforms. You can install an IPv6 stack on Windows XP and Windows Server 2003, however it does not come pre-installed.

We recommend that all developers begin looking into making the change to support IPv6. If you have any questions about IPv6 support in SocketTools, feel free to send any questions to our technical support team.