Using WiFi.hostByName() on LAN to get Server IP address
Posted: Sat Dec 02, 2017 9:56 am
I'm trying to not use static ip addresses for my MQTT server by using the hostByName.
When I use the command to get the ip address of an external (nttp) server, the command returns the ip address of the server just fine, but when I use the same command to get an ip address of a host on my LAN, it fails to get the ip address.
Here my code:
const char* mqttServerName ="servername";
IPAddress mqttServerIP;
WiFi.hostByName(mqttServerName, mqttServerIP)
What did I do wrong?
Thanks
bdollerup
When I use the command to get the ip address of an external (nttp) server, the command returns the ip address of the server just fine, but when I use the same command to get an ip address of a host on my LAN, it fails to get the ip address.
Here my code:
const char* mqttServerName ="servername";
IPAddress mqttServerIP;
WiFi.hostByName(mqttServerName, mqttServerIP)
What did I do wrong?
Thanks
bdollerup