Distinguishing clients between AP and STA webservers?

Hi -- programming an ESP32... I can start an APwebserver, or a STAwebserver which respond on the soft AP or STA interfaces, respectively. Or I can start a WebServer and it responds on both.

If I start a WebServer, how can I tell which interface a client request is coming in on?

I believe I can do:

bool isViaSoftAP()
{
    return(WiFi.softAPIP() == webserver->client().localIP())
}

...but it isn't it theoretically possible, however unlikely, that the soft AP IP could be the same as the STA IP that DHCP generates?

it shouldn't be. you can set the softAP IP

Ah, so just figure out what the STA IP is and switch the AP in the event that it's the same?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.