lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] DNS lookup table or dynamic local hostlist?


From: Roman Lwip
Subject: Re: [lwip-users] DNS lookup table or dynamic local hostlist?
Date: Thu, 28 Feb 2019 12:02:12 +0100

Thanks for the answer!

Just for clarity. Correct me if I'm wrong: The DNS query happens only once during runtime. Only if the lookup table is cleared (e.g. reboot), the dns query happens again. So if the device is turned on for 200 days without reboot, it does not do another query in case the server ip has changed. How is waking up once an hour different? Very unlikely, that the ip address has changed in that short amount of time. 

What is the best way to save the ip? 

To check whether the ip of the server has changed, I could just check for errors during mqtt connection. I could also just check whether the mqtt port is open.

Thanks! 

On Sun, Feb 17, 2019 at 7:33 PM Simon Goldschmidt <address@hidden> wrote:

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
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

[Prev in Thread] Current Thread [Next in Thread]