> For the complete documentation index, see [llms.txt](https://docs.ipwo.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipwo.net/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/chao-shi-timeout.md).

# 超时 Timeout

```
Timeout / Connection timed out
```

表示：

```
请求在规定时间内未完成
```

这是开发者接入代理时最常见的问题之一。

***

### 一、常见报错示例

#### cURL

```bash
curl: (28) Connection timed out
```

***

#### Python requests

```python
requests.exceptions.Timeout
```

***

#### Node.js

```
ETIMEDOUT
```

***

### 二、常见原因

***

#### 1️⃣ 网络环境问题

部分国内网络环境：

```
可能无法稳定连接海外代理节点
```

建议优先使用：

* 海外 VPS
* 海外云服务器

***

#### 2️⃣ 请求超时时间过短

默认超时时间可能不足。

***

#### cURL 示例

```bash
curl --max-time 30 \
-x http://us.ipwo.net:7878 \
-U username_custom_zone_us:password \
http://ipinfo.io
```

***

#### Python 示例

```python
requests.get(
    "http://ipinfo.io",
    proxies=proxies,
    timeout=30
)
```

***

#### 3️⃣ 代理节点不稳定

可能出现：

* 节点切换
* 网络波动
* 临时拥堵

建议增加：

```
重试机制（Retry）
```

***

#### 4️⃣ DNS 解析异常

可能导致：

```
请求长时间无法建立连接
```

建议：

* 更换 DNS
* 使用海外服务器

***

### 三、推荐排查方式

建议先使用 curl 测试：

```bash
curl -v --max-time 30 \
-x http://us.ipwo.net:7878 \
-U username_custom_zone_us:password \
http://ipinfo.io
```

重点检查：

* 是否能建立连接
* IP 是否正常返回
* 是否卡在 DNS 或 CONNECT 阶段

***

### 四、如何降低 Timeout？

推荐：

* 使用海外网络环境
* 增加超时时间
* 增加 Retry 重试
* 避免超高并发请求

***

### 五、推荐开发者调试流程

```
1. curl 测试代理
↓
2. 检查 DNS
↓
3. 增加 timeout
↓
4. 增加 retry
↓
5. 再接入代码
```

***

### 六、相关文章

* [407 Proxy Authentication Required](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/407-proxy-authentication-required.md)
* [DNS 解析失败](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/dns-jie-xi-shi-bai.md)
* [代理连接失败](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/dai-li-lian-jie-shi-bai.md)
* [HTTP 与 SOCKS5 区别](/dai-li-ji-chu-zhi-shi/http-yu-socks5-qu-bie.md)
