Chat freely about anything...

User avatar
By stavbodik
#57870 Hello I would like to be able to recognize connected clients IP address to main esp device which is act as access point .

WiFiClient provides this functions :

Code: Select allIPAddress remoteIP();
IPAddress localIP();


But as I know this functions used when you establish client connection to remote .
If I use this functions from server is it possible to get actual client IP ? If no how can I establish that ?

Code: Select allWiFiClient client = server.available();
 
if (client) {

if (client.connected()) {
   Serial.println("Client Connected IP test:");
   IPAddress ip1 = client.localIP();
   IPAddress  ip2 = client.remoteIP();
   Serial.println(ip1);
   Serial.println(ip2);
}

client.stop();
}


Result :

Code: Select allClient Connected IP test:
192.168.4.1  <--- this is the IP of the access point server ( this esp ).
192.168.4.2  <--- is this the actual IP of the connected client (other esp) ?