- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- gethostbyaddr call
Operating System - HP-UX
1821246
Members
2851
Online
109632
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2001 11:19 AM
тАО05-31-2001 11:19 AM
gethostbyaddr call
I am running on HPUX-11.
I am using dns (have resolv.conf and nsswitch.conf set up)
I have a server process that accepts client connections and prior to forking a child process does a gethostbyaddr call (which retrieves host name info about the client via dns). The server goes back to waiting for more client connections. The problem is when dns is down the gethostbyaddr call hangs until until dns times out. I tried removing the resolv.conf and nsswitch.conf files but it still hangs. It appears that the gethostbyaddr remembers that dns was being used even though I removed the dns files (is it caching something). The only solution is to stop and restart the server process.
My question: Is there a way other than stopping my server process for gethostbyaddr call to know that I am no longer using dns? What is the gethostbyaddr doing?
Thanks,
Marc
I am using dns (have resolv.conf and nsswitch.conf set up)
I have a server process that accepts client connections and prior to forking a child process does a gethostbyaddr call (which retrieves host name info about the client via dns). The server goes back to waiting for more client connections. The problem is when dns is down the gethostbyaddr call hangs until until dns times out. I tried removing the resolv.conf and nsswitch.conf files but it still hangs. It appears that the gethostbyaddr remembers that dns was being used even though I removed the dns files (is it caching something). The only solution is to stop and restart the server process.
My question: Is there a way other than stopping my server process for gethostbyaddr call to know that I am no longer using dns? What is the gethostbyaddr doing?
Thanks,
Marc
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2001 03:22 PM
тАО05-31-2001 03:22 PM
Re: gethostbyaddr call
Hi Marc,
gethostbyaddr() does just what its name implies. It looks up the host data by IP Address rather than hostname. If you add a signal handler to your code, you could do a second res_init() to force a re-read of /etc/resolv.conf and /etc/nsswitch.conf.
But I have to tell you that is really, really dumb; the best answer is to add at least a second DNS server and list it in resolv.conf.
In any case, you should be able to have nsswitch.conf try DNS first then go to /etc/hosts and the resolver functions should work albeit with delays if DNS is down.
P.S. I suspect that you would have gotten replies much sooner if you had a better history of assigning points.
Regards, Clay
gethostbyaddr() does just what its name implies. It looks up the host data by IP Address rather than hostname. If you add a signal handler to your code, you could do a second res_init() to force a re-read of /etc/resolv.conf and /etc/nsswitch.conf.
But I have to tell you that is really, really dumb; the best answer is to add at least a second DNS server and list it in resolv.conf.
In any case, you should be able to have nsswitch.conf try DNS first then go to /etc/hosts and the resolver functions should work albeit with delays if DNS is down.
P.S. I suspect that you would have gotten replies much sooner if you had a better history of assigning points.
Regards, Clay
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-31-2001 05:47 PM
тАО05-31-2001 05:47 PM
Re: gethostbyaddr call
The second DNS server won't eliminate the timeout for a dead server. That's why a DNS server is so critical for every system in the network. A better alternative is to use hosts first, then DNS. Put your critical system names and addresses into /etc/hosts and leave DNS to the occasional system connection.
Note also that using hosts first can significantly reduce network overhead for network backups as most commercial tools call gethostbyaddr for EVERY file that is backed up. Put the name(s) of remote systems involved in backups into /etc/hosts and change nsswitch.conf to hosts then DNS.
Bill Hassell, sysadmin
Note also that using hosts first can significantly reduce network overhead for network backups as most commercial tools call gethostbyaddr for EVERY file that is backed up. Put the name(s) of remote systems involved in backups into /etc/hosts and change nsswitch.conf to hosts then DNS.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2001 04:45 AM
тАО06-01-2001 04:45 AM
Re: gethostbyaddr call
Hi Marc,
To work arround this problem, I suggess to load hostnames and IP addresses first in a dynamic structure ( within an initializing procedure ) resolving names in DNS first and second from /etc/hosts. And replace your gethostbyaddr by gethostbyaddr_from_struct.
Bye
To work arround this problem, I suggess to load hostnames and IP addresses first in a dynamic structure ( within an initializing procedure ) resolving names in DNS first and second from /etc/hosts. And replace your gethostbyaddr by gethostbyaddr_from_struct.
Bye
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP