softAP mode will never timeout client

riataman
Posts: 4
Joined: Mon Oct 02, 2017 8:39 pm

softAP mode will never timeout client

Postby riataman » Sun Apr 22, 2018 1:37 am

I have setup a ESP32 in softAP mode to allow just 1 client connection.

1 client connects and then establishes a tcp connection (esp32 AP is the tcp server).

Then I cut power to the wifi client (doesn't matter if the client is a computer or another esp32).

The SoftAP ESP32 will never realize the client is gone (I never get a SYSTEM_EVENT_AP_STADISCONNECTED), and the ESP32 will keep returning success on the send() call to the tcp soscket.

Is this a bug? Is there a way to setup a timeout other than handling it myself in the tcp connection?

I just updated my esp-idf to today's latest (4e982d4b185460da4499bfe6e6530e4852eb6b9e). I'm running also in single core mode at 80Mhz.

PS: As I was writing this I finnaly got a SYSTEM_EVENT_AP_STADISCONNECTED, but that was after several minutes, is there are way to make that faster? Also despise the client being gone calls on the tcp socket keep succeeding (send(socket, buf, 1, 0) returns 1).

riataman
Posts: 4
Joined: Mon Oct 02, 2017 8:39 pm

Re: softAP mode will never timeout client

Postby riataman » Sun Apr 22, 2018 3:47 pm

PS2: The TCP connection eventually timed out, but that was after about 30min. Is there a way to detect the client is gone faster (seconds)?

There's a clue in the message when the client eventually disconnects:

W (321422) wifi: inactive timer: now=12fede98 last_rx_time=10bab94 diff=4985e, a
id[1]10:fe:ed:24:a2:dd leave
I (321422) wifi: station: 10:fe:ed:24:a2:dd leave, AID = 1
I (321426) wifi: n:5 0, o:5 0, ap:5 0, sta:255 255, prof:5
SYSTEM_EVENT_AP_STADISCONNECTED

But I can't find any of those strings in the idf code so I don't know how to change the inactive timer.

benjammin2068
Posts: 4
Joined: Tue Mar 26, 2024 1:32 am

Re: softAP mode will never timeout client

Postby benjammin2068 » Mon Apr 15, 2024 2:05 am

I have a similar issue I'd like to solve without resorting to ICMP/ping packets.

I wouldn't mind like a 1 or 2 minute timeout.

Who is online

Users browsing this forum: Bing [Bot] and 223 guests