I am using the WiFi.hostByName function to obtain the IP for a given hostname on ESP32 and ESP8266 systems.
The host is a Raspberry Pi which for a long time had a static address. I now wanted to change this into a dynamic IP obtained from DHCP. The new IP is valid and shown in my router web interface, I also can ping it. My ESP32/9266 sketches however still return the old IP with WiFi.hostByName, even after a reboot of the router/dhcp server and ESP systems.
In a description of the underlying dns_gethostbyname() I found that this function immediately returns „ERR_OK if hostname is a valid IP address string or the host name is already in the local names table.“
What can I do in order to get the new IP?
Any hint is welcome.