you should probably just use `socket.create_connection`, which properly handles IPv6 &c (unless you're insistent on maintaining py2.5 compat)