In case the given domain name resolves to more than one IP address, you need to make sure your capture filter is set up to capture for all of them, because you never know which one the web browser is going to select. If you only filter for (say) the first one returned, there is only a 1 in n chance that you will pick the same one as the web browser does (where n is the number of addresses).
By the way, you should consider using getaddrinfo()
instead of gethosybyname()
. gethostbyname()
is deprecated and obsolete. Most importantly, it is unable to return IPv6 addresses.
gethostbyname()
returns the list of resolved IP addresses as an array... but only the IPv4 ones.
getddrinfo()
returns the list of resolved IP addresses as a linked list.