IPv6 support - in anger...

Whilst The Server Framework has supported IPv6 for a while now I haven’t really used the functionality a great deal. My previous development box didn’t have IPv6 installed and so I never really got around to playing with it. Since my new box has IPv6 installed and since porting, building and testing can become a bit dull after a while I’ve spent a little time this afternoon playing with making sure the example servers are fully IPv6 aware, and, in fact, address type agnostic.

The bulk of the code was already address type agnostic, so much so that we’ve built bluetooth servers using the same framework. However, there were a few holes that have now been filled. The rendering of addresses was limited to IPv4 since it used inet_ntoa() to do the rendering. That’s now fixed and we use GetNameInfoW() to convert from binary addresses to printable addresses. Likewise the string address format to binary format was IPv4 only. That’s now fixed too and we use getaddrinfo() to translate from strings to addresses.

With that done there’s nothing to stop the command line parameters for the servers and clients from taking hex format IPv6 addresses (“fe80::c69:f933:33de:4478”) as well as “dotted IP” IPv4 addresses (“192.168.0.3”) and the same server can listen either as IPv4 or IPv6…

I still can’t help thinking that my addressing classes are over the top though…. They’re even worse now with a concrete implementation of IFullAddress… and all because it’s impossible to know the protocol from the data held in a sockaddr structure…