> 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/connection-reset.md).

# Connection reset

如果出现：

```
Connection reset
Connection reset by peer
ECONNRESET
```

通常表示：

```
连接被远程服务器中断
```

这是国内开发者连接海外代理或网站时非常常见的问题。

***

### 一、常见原因

#### 1. 网络环境不稳定

部分国内网络环境：

```
连接海外网络时可能被中断
```

建议优先使用：

* 海外 VPS
* 海外云服务器

***

#### 2. 请求频率过高

高频请求可能触发：

* 网站风控
* IP 限制
* 连接主动断开

***

#### 3. 代理节点波动

可能出现：

* 节点切换
* 临时网络波动
* 长连接断开

***

#### 4. HTTPS / SSL 异常

SSL 握手失败时，也可能出现：

```
连接被重置
```

***

### 二、常见报错示例

#### cURL

```bash
curl: (56) Connection reset by peer
```

***

#### Python

```python
requests.exceptions.ConnectionError
```

***

#### Node.js

```
ECONNRESET
```

***

### 三、推荐排查方式

#### 1. 测试代理是否正常

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

***

#### 2. 降低请求频率

避免：

```
短时间大量请求
```

建议增加：

* 请求间隔
* Retry 重试机制

***

#### 3. 增加 timeout

**cURL**

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

***

### 四、推荐解决方案

推荐：

* [使用海外 VPS](/huan-jing-zhun-bei/vps-yun-fu-wu-qi-tui-jian.md)
* 增加 Retry
* 使用粘性 Session
* 降低并发频率

避免：

* 高频采集
* 多账号共享 IP
* 国内网络高并发请求海外服务

***

### 五、推荐排查流程

```
1. curl 测试代理
↓
2. 检查网络环境
↓
3. 降低请求频率
↓
4. 增加 timeout 与 retry
↓
5. 再次测试
```

***

### 六、相关文章

* [超时 Timeout](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/chao-shi-timeout.md)
* [DNS 解析失败](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/dns-jie-xi-shi-bai.md)
* [SSL 证书错误](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/ssl-zheng-shu-cuo-wu.md)
* [API 返回为空](/kai-fa-zhe-wen-dang/chang-jian-cuo-wu/api-fan-hui-wei-kong.md)
* [如何检测代理是否生效](/dai-li-jian-ce-yu-yin-si-an-quan/ru-he-jian-ce-dai-li-shi-fou-sheng-xiao.md)
* [API 调用与批量采集](/dai-li-ji-chu-zhi-shi/api-diao-yong-yu-pi-liang-cai-ji.md)
