# lwIP: TCP retransmission timeout on connection 192.168.1.100:80, max retries exceeded

- **ID:** `embedded/lwip-tcp-retransmission-timeout`
- **Domain:** embedded
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

TCP connection lost due to network congestion, remote host unresponsive, or insufficient memory for retransmission buffers.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| lwIP V2.1.3 | active | — | — |
| FreeRTOS V10.4.3 | active | — | — |

## Workarounds

1. **Increase lwIP memory pool for TCP segments: in lwipopts.h set `#define MEMP_NUM_TCP_SEG 64` and `#define TCP_SND_BUF 4096`.** (85% success)
   ```
   Increase lwIP memory pool for TCP segments: in lwipopts.h set `#define MEMP_NUM_TCP_SEG 64` and `#define TCP_SND_BUF 4096`.
   ```
2. **Implement application-level keep-alive with shorter interval (e.g., 5 seconds) to detect dead connections early.** (80% success)
   ```
   Implement application-level keep-alive with shorter interval (e.g., 5 seconds) to detect dead connections early.
   ```
3. **Use lwIP callback `tcp_err()` to handle connection reset and trigger reconnection logic.** (90% success)
   ```
   Use lwIP callback `tcp_err()` to handle connection reset and trigger reconnection logic.
   ```

## Dead Ends

- **** — Increasing TCP timeout values delays failure but does not fix connectivity issue. (70% fail)
- **** — Disabling Nagle algorithm reduces latency but not retransmission due to packet loss. (60% fail)
