LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   gethostbyaddr vs getaddrinfo and getnameinfo (https://www.linuxquestions.org/questions/linux-networking-3/gethostbyaddr-vs-getaddrinfo-and-getnameinfo-4175443115/)

icegood 12-27-2012 08:32 AM

gethostbyaddr vs getaddrinfo and getnameinfo
 
Why gethostbyaddr treated as obsolete and getaddrinfo and getnameinfo should be used instead, if unde latter one i'm unable to get aliases from /etc/hosts while in case gethostbyaddr i will?

nini09 12-28-2012 02:21 PM

The gethostbyaddr performs netbios lookup. It is very slow when the host can't be found. The getnameinfo only contact DNS server, should be faster.

icegood 12-29-2012 05:29 PM

Thanks, what about aliases in /etc/hosts? Why they become unavailable under DNS?

nini09 12-31-2012 03:04 PM

In general, the file is for domain name and static host name. Some distribution could change file name to another one. It look like no affaction.


All times are GMT -5. The time now is 08:30 AM.