Added ETIMEDOUT detection and retry