revised connection failure handling for csocket_impl