I'm writing a linux userspace application that opens a stateless socket (ICMP/UDP) to an internet host The user specifies a hostname FQDN (www.google.com) and I use getaddrinfo (or the old deprecated gethostbyname) function to resolve to an IPv4 address.
The nature of DNS is that host entries may get updated from time to time but I query it only once. Is there a way I could tell when the entry will expire ? I'm trying to avoid periodically running getaddrinfo() (querying OS DB) since on a large scale will result on unwanted system calls.
Thanks !