SocketTools IPv6 Support

One of the newer features in SocketTools has been support for IPv6 networks, in addition to IPv4 that most developers are already familiar with. 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 over a decade now. However, up to this point it has never gained much traction and IPv4 remains the dominant protocol used over the Internet. This is in the process of changing however, because we’re rapidly approaching the exhaustion of new IPv4 addresses. If you develop software that accesses the Internet, this affects you.

The last of the large blocks of available IPv4 addresses has been allocated by the Internet Assigned Numbers Authority (IANA) early in 2011 and the regional registries will exhaust their pool of new addresses within a few years. The widespread adoption of classless routing (CIDR) and network address translation (NAT) 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 software.

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 for you 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, 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 because.

3. Your application uses the SocketTools Library Edition and stores addresses as 32-bit integer values, that code will need to be changed. There are several API functions in SocketTools 6.0 and earlier versions 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 are few changes that you’d 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 possible. For example, if host name 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 specify which will force SocketTools to always use IPv6 if necessary.

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 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, join us on our technical support forums.

Share This