handle connection error on socket