Alarm panel wired connection problem

Hi @nate I’m also having the issue connecting to the Alarm Panel Pro using Ethernet - as @BuddyRayAtl already reported.

Not sure why it started thought. WiFi connection works fine.

The error is mostly connection aborted, but sometimes I get

“httpd_server: error accepting new connection” or
“httpd_accept_conn: error in accept (23)”

Googling for the last error:

  • Reason: “errno 23 ” means open many open files in system. Closing a socket takes 2 MSL of time, which means sockets will not be closed immediately after calling the close interface. Due to this reason, open sockets are accumulated and exceeds the maximum connection number (the default is 10 in menuconfig, the maximum connection is 16) thus triggering this error.
  • Solution: Set SO_LINGER via the setsockopt interface to adjust the TCP close time.

https://docs.espressif.com/projects/espressif-esp-faq/en/latest/software-framework/protocols/lwip.html#after-creating-and-closing-tcp-socket-several-times-an-error-is-reported-as-unable-to-create-tcp-socket-errno-23-how-to-resolve-such-issue

And another one:

I could fix this issue by modifying the http_config struct I used to initialize the http server.
When using the macro HTTPD_DEFAULT_CONFIG() the field lru_pruge_enable is set to false.
I had to set this true.

However, while writing this, I got error 23 with WiFi connection too:

As I mentioned before, Alarm Panel only sends one or two pings, then EventSource things that connection is dead, and I have to start polling instead. Each poll starts a new socket connection.