D and IPv6

D Programming languageThe D programming language is a relative new language compared to some others.

D itself supports IPv6 to its fullest since D can call any C function in any library. So basically it is IPv6 compatible. But with D we are more interested in its standard library.

D has two major libraries that can be considered standard. The official standard library called Phobos and the community made Tango.

Phobos has basic support in the socket class but lacks proper support for IPv6  in classes like the InternetAddress class. Since this class is used almost everywhere in Phobos there is no real support for IPv6.

Tango has no IPv6 anywhere at this point (version 0.99.8) but support has been put on the roadmap.

Since support for IPv6 in the D programming language  is more or less non existent I’m not going to write examples on how to connect or listen on an IPv6 address. It is possible but would require a lot more code and ugly hacks to get it properly working.

Hopefully in the future I can say something more about D programming language and IPv6. Keep in mind D is new and both Phobos and Tango are moving targets.

PHP and IPv6

PHPMost programming languages support IPv6 in some way or another since the dawn of IPv6. But how simple is it actually, to use IPv6 in your code? This is the first article in a series of articles where I’ll show you how each language handles IPv6, starting with PHP.


One of the first things you want to do is connect to an IPv6 address.


$fp = fsockopen('::1', 80);
if (!is_resource($fp)){
  // Error handling.
}


But this may fail if there is no IPv6 support. So to do it properly you would use something like:

$fp = fsockopen('::1', 80);
if (!is_resource($fp)) $fp = fsockopen('127.0.0.1', 80);
if (!is_resource($fp)){
  // Error handling.
}

As seen above we simply try the IPv6 address and if it fails we retry in IPv4.

(more…)