LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-27-2012, 08:32 AM   #1
icegood
Member
 
Registered: Sep 2009
Distribution: ubuntu 21.04
Posts: 65

Rep: Reputation: 15
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?
 
Old 12-28-2012, 02:21 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
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.
 
Old 12-29-2012, 05:29 PM   #3
icegood
Member
 
Registered: Sep 2009
Distribution: ubuntu 21.04
Posts: 65

Original Poster
Rep: Reputation: 15
Thanks, what about aliases in /etc/hosts? Why they become unavailable under DNS?
 
Old 12-31-2012, 03:04 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why does getnameinfo get timeout jshih Linux - Software 5 02-21-2011 05:01 PM
what's the matter with the function gethostbyaddr() galaxier Programming 3 04-08-2005 10:04 AM
Sendmail and gethostbyaddr mikz Linux - General 1 03-20-2005 08:05 PM
telnet problem (getnameinfo.) minor Linux - Networking 6 01-23-2002 10:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration