I am sorry, I missed your reply. I have an application which periodically polls for changes to a particular file stored in a server. In this case, creating a connection for every download is expensive. Hence, I want to keep the connection and handle for a long time. However during this time, there can be changes to the DNS server/data. I would like the application to be agnostic to the changes to the DNS. This would have been possible if CURL queried the DNS periodically and updated its cache for long running handles.
I am still not able to understand the use of CURLOPT_DNS_CACHE_TIMEOUT in the context of a given connection which runs for a long time. I searched for an example to illustrate its use/working. docs/examples folder does not have an example which shows this. Could you please point me to any example which can illustrate CURLOPT_DNS_CACHE_TIMEOUT in context of a given curl handle? Thanks, Narasimha On Sun, Aug 30, 2020 at 8:17 PM Daniel Stenberg <dan...@haxx.se> wrote: > On Sun, 30 Aug 2020, Narasimha M wrote: > > > Is there a way to force the name resolution/DNS checking periodically. > > You can for example close your handle and crete a new one, so that the > connection won't survive. > > > In my particular case, I would like to keep a single connection and > check > > for updates on the server using that connection forever. > > If you want to reuse the connection, why would you bother to resolve the > name > over and over? It's pointless then! > > > Could you please explain when CURLOPT_DNS_CACHE_TIMEOUT is used? > > When libcurl wants to resolve a host name it checks if the address is > already > present in its DNS cache, where it will be stored and used for up to > CURLOPT_DNS_CACHE_TIMEOUT seconds. > > > If the connection lives for more than this time and if the time between > > performs is more than this time, resolution would be done. > > Not at all. If there's an existing connection present already, there's no > need > to resolve the name. > > -- > > / daniel.haxx.se | Commercial curl support up to 24x7 is available! > | Private help, bug fixes, support, ports, new features > | https://www.wolfssl.com/contact/ >
------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html