Effectively, I want the httpd server to start up when a device connects to the esp8266's access point. Then I want to remove that web server when that device disconnects to the esp8266's access point. I find that when a device repeatedly connects and disconnects to the esp8266's access point, the httpd server stops responding to requests and outputs these errors instead:
```
httpd: httpd_accept_conn: error in accept (23)
httpd: httpd_server: error accepting new connection.
```
I have the server starting up in a wifi_event_handler like so:
```
esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
{
httpd_handle_t *server = (httpd_handle_t *) ctx;
/* For accessing reason codes in case of disconnection */
// system_event_info_t *info = &event->event_info;
ESP_LOGI(TAG, "Handle incoming wifi event");
switch(event->event_id) {
case SYSTEM_EVENT_AP_STACONNECTED:
// Start webserver once client joins
if (*server == NULL) {
*server = start_webserver();
}
break;
case SYSTEM_EVENT_AP_STADISCONNECTED:
// Stop webserver once client leaves
/* Stop the web server */
if (*server) {
stop_webserver(*server);
*server = NULL;
}
break;
default:
break;
}
return ESP_OK;
}
```
I'm wondering if anyone has also experienced this, or if I am just missing somethingStatistics: Posted by GreenLoofa — Fri Mar 05, 2021 5:28 am
]]>