Patched connect function to enable IPv6 support.