4 ms·
gethostbyname uses /etc/nsswitch.conf to determine how host names should be resolved. The document describes /etc/hosts and DNS, but there can be more. On mode
by sanxiyn 12y ago
gethostbyname uses /etc/nsswitch.conf to determine how host names should be resolved. The document describes /etc/hosts and DNS, but there can be more.
On modern systems, it is likely that multicast DNS is performed to resolve local names before going to DNS.
I actually pointed this out in my Google interview and the interviewer instructed me to skip Name Service Switch part.