|
|
Installing and Administering Internet Services: HP 9000 Networking > Chapter 3 Configuring and Administering the
BIND Name ServiceConfiguring the Resolver to Set Timeout Values |
|
Timeout values are configured for clients (resolver routines) that use DNS with the RES_RETRY and RES_RETRANS options. These options allow you to set the number of re-transmissions (RES_RETRY) and the time between each retransmission (RES_RETRANS). Setting smaller timeout values enable you to get better performance. You can configure the timeout values by defining environment variables, editing the /etc/resolv.conf configuration file, or using the resolver APIs. Valid values for RES_RETRY and RES_RETRANS options are any positive, non-zero integer. By default, the system will try to re-transmit 4 times, and the time between each retransmission is 5000 milliseconds. If the RES_RETRY and RES_RETRANS options contain an invalid value, the default values are set and an error message is logged in the syslog. The returned values of the APIs will indicate if the values specified were valid or not. You can set the RES_RETRY and RES_RETRANS options by defining them as environment variables. Setting the timeout values using environment variables only sets the RES_RETRY and RES_RETRANS values for individual users.
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.
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 :
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. 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 parameter value is the pointer to the location where the option value is stored. The sizeof value parameter is used to obtain the number of bytes required for the variable so that memory can be allocated to that variable when a function is invoked. The return value of this function is 0 if the function successfully gets the value of the field in the value parameter. It will return -1 on failure.
|
|