deal with socket exception.