ESP8266 Soft AP mode as UDP server

I am using a ESP8266 as a data logger. And to be able to view the data on my cell phone I am trying to operate the ESP8266 in AP mode and then log on to it with my cell phone and use a UDP receiver app to view the data.

When I operate the ESP8266 in Station mode I am able to do the above with the home router as the WiFi link. But unable to the same if use the ESP8266 in AP mode.

Why is this ?

#include <ESP8266WiFi.h> // Used for the soft AP
#include <WiFiUdp.h>        // used for UDP comms.

WiFiUDP Udp;

const char *APssid = "ESP8266-AP";
const char *APpassword = "";

//*************************

void setup() {

  Serial.begin(9600);                //fire up the serial port
 
   WiFi.softAP(ssid, password); 

  Serial.print("Soft-AP IP address = ");
  Serial.println(WiFi.softAPIP()); // Confirm AP IP address
}
//**************************

void loop() {

  Udp.beginPacket((255,255,255,255), 52971);  // Broadcast the message
  Udp.write(millis());
  Udp.endPacket();

  delay(500); 
}
//**************************

( Actually I had posted a similar query sometime last year but did not get any reply and hence repeating ..)

You need to "forget" your router's network then connect to the ESP8266 AP.

.

ieee488:
You need to "forget" your router's network then connect to the ESP8266 AP.

.

Thanks

Does it mean I need to use the ESP tool and erase the flash ? Or in other words how do I make the ESP8266 forget my credentials ... I have read some methods by using the WiFiManager library ... but I am not sure if thats the only way !

Since I was not too sure about erasing the old WiFi credentials, I used a brand new MCU and downloaded the above code.

I can see the Temperature & Humidity readings in Serial Monitor but the UDP test tool still does not receive the data.

I have made the ESP8266 AP network a trusted one and made sure no Firewall is blocking. This is quite surprising.