On 16.02.2019 20:58, Roman Lwip wrote:
Hi,

I am using lwip as part of the espressif/arduino-esp32 library and there is something I don't understand.

My question is about DNS implementation of lwip:
https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/lwip/lwip/dns.h

If I understand correctly there is a lookup table, which contains the host names, which have been queried before and their ip adress. Can I add a host to that lookup table during runtime?


Yes, see |DNS_LOCAL_HOSTLIST, ||DNS_LOCAL_HOSTLIST_ISDYNAMIC and ||dns_local_addhost().|

||

|
|

So what I want is this: The ESP32 wakes up and only does the DNS query (dns_gethostbyname), if the IP address of an MQTT server has changed, because an IP change of that server is not likely to happen often. So I would save the IP address over deep sleep and use it again, when the ESP wakes up. Do I need a dynamic host list for that (the DNS_LOCAL_HOSTLIST macro is undefined now)? Or can I edit the lookup table directly?


No, you can't edit the lookup table directly. However, I don't get how you detect the IP address has changed without using dns, as that's what dns is for...?


Regards,

Simon


_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to