ESP32 as Access Point: TCP connection drops after 1–2 minutes on Windows 10/11, but only on first connection

Vahid Ajalluian 0 Reputation points
2026-07-10T15:38:41.6433333+00:00

I have an ESP32 running a program that opens both a TCP and UDP server on a specific port.

In Station mode (connecting to a modem/router): both connections work reliably with no drops.

In Access Point mode (ESP32 acts as Wi-Fi AP): the connection drops after about 1–2 minutes when connecting from Windows 10 or 11. but no problem in Windows 7. There is another connection on the PC with ethernet internet connection.

Here's the strange part: if I manually disconnect the PC from the ESP32's Wi-Fi and reconnect it, the TCP connection then stays stable indefinitely – no more drops.

What I've tried:

Disabling Windows power-saving on the Wi-Fi adapter.

Setting tcp_keepalive on the ESP32 side.

Increasing TCP timeout values.

Questions:

Could it be related to ARP table expiration or DHCP lease renewal on first association?

Why would reconnecting the Wi-Fi client fix it permanently?

Environment:

ESP-IDF v5.3.1

Windows 10/11 clients

ESP32 acting as soft-AP with static IP

Windows for home | Other | Internet and connectivity
0 comments No comments

1 answer

Sort by: Most helpful
  1. Carl-L 19,955 Reputation points Microsoft External Staff Moderator
    2026-07-14T07:13:16.5633333+00:00

    Hello Vahid Ajalluian,

    Welcome to Microsoft Q&A forum.

    Based on your description, I'd say the issue is with the stack network decision in Windows 10 and 11 rather than ARP/DHCP issues. Before we proceed further, may I know if the ESP32 has access to internet while using as an AP? When you manually disconnect and reconnect, the priorities are stabilized and the connection remain on the Wi-fi.

    In this case, please help me do a little check regarding this.

    • Open PowerShell as administrator.
    • Type Get-NetIPInterface | Sort-Object InterfaceMetric and press Enter.
    • Please note if the Wifi and Ethernet metric change when you connect for the first time and after reconnecting.
    • Type route print and press Enter before and after the drop will also helps.

    I'm waiting for your reply.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.