Print ip when assigned by ESP32 // Get all connected devices within my network

Hello altogether,

With the help of ESP32 Access Point (AP) for Web Server | Random Nerd Tutorials I made my ESP32 to amongst others be a simple router:

#include <WiFi.h>

const char* ssid     = "MyNetworkName";
const char* password = "MyNetworkPassword";

// Set web server port number to 80
WiFiServer server(80);

void setup() {

  // Connect to Wi-Fi network with SSID and password
  Serial.print("Setting AP (Access Point)… ");
  WiFi.softAP(ssid, password);

  IPAddress IP = WiFi.softAPIP();
  Serial.print("IP address of the router of this network: ");

So now if a client is set on DHCP, can anybody maybe tell me, what I have to do, so that if this client connects (meaning ask for ip and getting one from the ESP) at the same time that ip is as well printed onto my serial monitor?^^

Additionally, how can I make some kind of broadcast onto my network to find out how many clients there are in and which ip addresses they have?

Would be really happy for every answer - thanks in advance for every help effort.

Best regards

isn't that what you are looking for?

Hello @noiasca and thank you so much for the provided link, yes, that was exactly what I was looking for, sorry if i sometimes ask stupid / simple questions I am unfortunately only a student working on his bachelor thesis currently and trying to learn herefor^^