Chat freely about anything...

User avatar
By esp8266_abc
#89184 What type of "connection" are you referring to?

Is it a connection of an STA connected to the ESP8266 AP, or, an TCP Client connected to the ESP8266 TCP Server?

If it is a topic of STA/AP, you could config the field .max_connection of softap_config to limit the max STAs that could connect to the AP simuteneously, which means that more STA connection request will be refused automatically if the max connections reaches. Sure, you could set the max connection parameters to 1 ! Meanwhile, you could call wifi_set_event_handler_cb() to define your own wifi event handler callback function and inside the function, you could limit/refuse or permit some STA to connect the AP just upon it's connecting.

If it is a totic of TCP client/Server, you could call service_set_max_clients_allowed() to limit the max TCP clients that could connect to the ESP8266 TCP Server simuteneously, which means that more TCP Client connection request will be refused automatically if the max connections reaches. Sure, you could set the max connection parameters to 1 ! Meanwhile, you could get the remote connection info by calling espconn_get_connection_info() to determin whether the connection is permited and disconnect it by an API call if not permited.

Hope above is helpful.