# 读取 tcp 192.168.1.1:8080->192.168.1.2:54321：I/O 超时

- **ID:** `go/io-read-timeout`
- **领域:** go
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

网络读取操作超过了连接或上下文设置的超时时间。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.21 | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   Set reasonable timeout: net.Dialer{Timeout: 5 * time.Second} and use context with timeout.
   ```
2. **** (85% 成功率)
   ```
   Implement exponential backoff with context: for { select { case <-ctx.Done(): return; default: try again } }
   ```

## 无效尝试

- **** — May cause indefinite blocking; not scalable. (70% 失败率)
- **** — If network is down, retries fail repeatedly. (60% 失败率)
