Installing and Administering Internet Services

126 Chapter3
Configuring and Administering the BIND Name Service
Configuring the Resolver to Set Timeout Values
Configuring Timeout Values using the Configuration
File
You can set the RES_RETRY and RES_RETRANS options in the
/etc/resolv.conf configuration file. Setting the timeout value with the
configuration file sets the RES_RETRY and RES_RETRANS values on a
specific system.
Add the following line to the /etc/resolv.conf configuration file
after the domain and nameserver entries. You specify the value for
retrans and retry:
retrans 600
retry 1
Configuring Timeout Values using APIs
If you configure the timeout values using the APIs, you will have to make
code changes and re-compile the code.
There are two APIs you can use to set and get the RES_RETRY and
RES_RETRANS values in the _res_state_structure :
set_resfield()
get_resfield()
set_resfield
The syntax for this function is:
set_resfield(int field, void *value)
The parameter field is the resolver option that you want to set. The
parameter value is the value you want to set for the field.
The return value of this function is 0 if the function successfully sets the
value for the option in the _res_state structure, which holds all the
resolver options and -1 on failure.
get_resfield
The syntax for this function is:
get_res(int field, void *value, sizeof value)
The parameter field is the resolver option that you want to get. The