Specifying nameservers with gethostbyname
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Specifying nameservers with gethostbyname




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Specifying nameservers with gethostbyname  
Jeff Rodriguez


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:01 PM

Is there any way to specify what nameservers will be used when a call to
gethostbyname is called? This must be done from within the code, not by
modifying /etc/resolv.conf.

I'm about to tear into the source code for dig and I would much rather avoid
that if possible 

Jeff






[ Post a follow-up to this message ]



    Re: Specifying nameservers with gethostbyname  
Michael Fuhr


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:02 PM

Jeff Rodriguez <newsgroup1@gurugeek.EXAMPLENOSPAM.com> writes:
quote:
> Is there any way to specify what nameservers will be used when a call to > gethostbyname is called? This must be done from within the code, not by > modifying /etc/resolv.conf.
You don't say what kind of system you're using, but programs can usually tweak the resolver's behavior by calling res_init() and then modifying the global _res structure before calling any resolver functions like gethostbyname(). _res is a struct __res_state, which should be defined in <resolv.h>. The number of nameservers and their IP addresses are in the nscount and nsaddr_list fields. -- Michael Fuhr http://www.fuhr.org/~mfuhr/




[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:14 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register