WiFi.softAP("ESP AP" );
What I would like to do is serve different content with the webserver, depending on if someone gets there through the IP on the wifi network it's connected to, of if they get there while they are connected to the AP.
The softAP gets IP 192.168.4.1 by default, and seems to give 192.168.4.2 to the first connected client.
I could do a check like this:
String addy = server.client().remoteIP().toString();
if (addy == "192.168.4.2"){
server.send(200, "text/html", "you're connected to the AP");
} else {
server.send(200, "text/html", "You're on the same network as the ESP");
}
but that seems a bit unreliable, since it's possible (even though the chance is low) that someone has 192.168.4.2 wheil connected to his wifi network. It also will not work when a second client is connected to the AP (although in reality only one client should be connected in my use case)
I was wondering if there's a better way to determine if the user is connected to the AP or the the wifi network that the ESP is on.