HP-UX IP Address and Client Management Administrator's Guide HP-UX 11i v2, HP-UX 11i v3
set_resfield(int field, void *value)
The set_resfield() function contains two parameters: field and *value. You can set the
resolver option using the field parameter and the value for the field using the value parameter.
The set_resfield() function returns either 0 or -1. It returns a value0 if the function
successfully sets the value for the resolver option in the instance of the_res_state structure,
which holds all the resolver options. A value of -1 denotes a failure to set the resolver option.
The get_resfield() API
The syntax for the get_resfield() function is as follows:
get_resfield(int field, void *value, sizeof
value)
The get_resfield() function contains three parameters: field, *value, and value. The
parameter field contains the resolver option. The parameter *value is the pointer to the
location where the option value is stored. The value parameter specifies the memory (in bytes)
allocated for a variable when a function is invoked.
The get_resfield() function returns either 0 or -1. It returns a value of 0 if the function
successfully gets the value of the field in the value parameter and returns a value -1 on failure.
Sample Program with Timeout Values
A sample program with timeout values is as follows:
main() { int retrans = 600;
int retry =1;
struct hostent *hp;
struct in_addr ia;
char *name = “localhost”;
res_init(); set_resfield(RES_RETRANS, &retrans);
set_resfield(RES_RETRY, &retry);
hp = gethostbyname (name);
if (hp == NULL )
{ printf (“gethostbyname failed\n”);
herror(“Error”);
} else
{ int i;
for (i=o; hp->h_addr_list[i]; i++)
{
memcpy((caddr_t)&ia, hep->h_addr_list[i],\
sizeof(ia));
printf(“%s”, inet_ntoa(ia));
}
} get_resfield (RES_RETRANS, &retrans, sizeof retrans);
get_resfield (RES_RETRY, &retry, sizeof retry);
printf (“retry = %d \n retrans = %d\n”, retry,retrans);
}
Starting the Name Server Daemon
The name server daemon, /usr/sbin/named, must be running on all the master, slave, and
caching-only name servers. If you have configured your system to query a remote name server
(that is, if you have created an /etc/resolv.conf file that directs BIND queries to a name
server on another host), you need not run the named daemon on your host.
Before you start the name server daemon, ensure that syslogd is running. syslogd logs
informational and error messages. For information on configuring syslogd, see the HP-UX
Internet Services Administrators Guide at the URL
http://www.docs.hp.com/hpux/netcom/index.html#Internet%20Services.
Follow these steps to start the name server daemon:
Starting the Name Server Daemon 81