When using WiFiServerSocket (in the context of a simple web server) on ESP32 (and I think this would be useful on ESP8266 as well), I needed to get the connecting clients IP address. There's currently no way to get this from B4R. A little surprised, I started researching this and it looks like the really wasn't a way to do this in the Arduino IDE either, until recently (maybe the last year and a half or so - definitely after WIFI support was added to B4R). Seems like this was there for UDP and not for TCP. The WIFI TCP client now has a RemoteIP method that should be fairly easy to expose. I suspect it can return a string just like ESP8266WiFi.LocalIP does.
Please see this web page for the a description and the example sketch (I've run it in Arduino IDE and it works - the connecting clients IP address is returned correctly). While this is being added it might be useful to add the RemotePort method as well. This is not in the example but I tested it and it works.
Adding the RemoteIP would be useful for additional checking of connected clients (i.e. implementing an allow or ban list for additional security)
Please see this web page for the a description and the example sketch (I've run it in Arduino IDE and it works - the connecting clients IP address is returned correctly). While this is being added it might be useful to add the RemotePort method as well. This is not in the example but I tested it and it works.
C++:
WiFiClient client = wifiServer.available();
if (client) {
Serial.print("Client connected with IP:");
Serial.println(client.remoteIP());
Serial.println(client.remotePort()); <- Print connected port
client.stop();
}
Adding the RemoteIP would be useful for additional checking of connected clients (i.e. implementing an allow or ban list for additional security)