Chat freely about anything...

User avatar
By Pablo2048
#84231 Glad to hear.
You can not use standard sync client to get the ip address - you are on async one so (just guessing from my memory) you have to use something like request->client()->remoteIP();. You have to use this probably in asyncwebserver request handler and store this information somewhere in global variable...
User avatar
By Sirquil
#84234
Working remote IP.JPG
Working!!!
Remote IP is working...

Code: Select all   global:
   
   IPAddress ipREMOTE;
   
   setup:
   
   serverAsync.on("/Weather", HTTP_GET, [](AsyncWebServerRequest * request) {
   request->send_P(200, PSTR("text/html"), MAINPAGE, processor);
   ipREMOTE = request->client()->remoteIP();
   });

 
   processor function:
   
    if(var == F("CLIENTIP"))
      return ipREMOTE.toString().c_str();


Thank you Pavel your help is appreciated!

William
User avatar
By Sirquil
#84247
You are welcome. Just one thing - swap the two lines: first save the IP address to the variable and then call template processing. Otherwise you return ip address from previous request ;-)


Done. Thank you Pavel.

William