views:

113

answers:

2

Hi,

I am trying to set two dynamic nameserver IP addresses in my QNX system. I have been able to use confstr to set up an address by setting a "_nameserver=xxx.xxx.xxx.xxx" string into _CS_RESOLVE. Then res_search returns the correct IP address for a given name. I actually have two questions:

  1. How do I set up two nameservers (primary and secondary) using setconf?

  2. If the nameserver IP addresses change, can I just call setconf again to change them while my application is running?

Thanks,

Randy

A: 

According to the QNX docs, your confstr() setting needs to contain:

nameserver_1.2.3.4
nameserver_5.6.7.8

(i.e. one line per nameserver, with a maximum of three)

If the nameservers change, you'll probably need to call res_init() to force the resolver library to use the new settings.

Alnitak
A: 

Thanks for the tip. I am using res_search but I will explicitly call res_init again.

if it works, please mark it up, and accept the answer
Alnitak