Handle socket errors.