# lwIP: TCP connection to 192.168.1.100:80 timed out after 3 retransmissions

- **ID:** `embedded/lwip-tcp-retransmit-timeout`
- **Domain:** embedded
- **Category:** network_error
- **Error Code:** `ERR_TIMEOUT`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The TCP remote host is unreachable or not responding due to network congestion, firewall blocking, or device power state.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| lwIP v2.1.3 | active | — | — |
| lwIP v2.2.0 | active | — | — |
| FreeRTOS+TCP v3.0.0 | active | — | — |

## Workarounds

1. **Implement a TCP keepalive mechanism using tcp_keepalive() to detect connection failure earlier and reduce retransmission count.** (75% success)
   ```
   Implement a TCP keepalive mechanism using tcp_keepalive() to detect connection failure earlier and reduce retransmission count.
   ```
2. **Add a fallback DNS resolution check before connecting: if host resolution fails, abort and retry with exponential backoff.** (70% success)
   ```
   Add a fallback DNS resolution check before connecting: if host resolution fails, abort and retry with exponential backoff.
   ```

## Dead Ends

- **Increase the TCP retransmission timeout in lwIP configuration (e.g., TCP_RTO_MIN)** — Longer timeouts only mask the problem; if the remote host is unreachable, the connection will still fail eventually. (80% fail)
- **Disable TCP checksum offloading on the network interface** — Checksum offloading is unrelated to retransmission timeouts; the issue is network reachability, not data corruption. (95% fail)
