Fix exceptions if python is built without ipv6 support.

See:
http://bugs.python.org/issue16208
http://bugs.python.org/issue7735
This is the same way as it is already used in other parts of the code (https://github.com/ros/ros_comm/blob/4d2b423239452da9e6cc7bb4b1bbad22bd0376fa/tools/rosgraph/src/rosgraph/network.py#L234). The change looks good - was probably just forgotten in the original patch for IPv6.