res_setservers()--Set Name Server Addresses
Syntax
#include <resolv.h> void res_setservers(state* res, union res_sockaddr_union *addresses, int num_addresses)
Service Program Name: QSOSRV2
Default Public Authority: *USE
Threadsafe: Yes
The res_setservers() function sets the list of name server addresses that will be used on resolver or network APIs that use the state structure.
Parameters
- res
- (Input) The pointer to the state structure.
- addresses
- (Input) A pointer to a list of name server addresses to use. The structure of
each address entry is:
union res_sockaddr_union { struct sockaddr_in sin; struct sockaddr_in6 sin6; int64_t __align64; /* 64bit alignment */ char __space[128]; /* max size */ };
- num_addresses
- (Input) The number of addresses in the list. The maximum number of addresses is MAXNS.
Authorities
No authorization is required.
Return Value
None.
Error Conditions
When the res_setservers() function fails, errno will be set to one of the following:
- [EFAULT]
The system detected a pointer that was invalid while attempting to access an input pointer.
- [EINVAL]
res appears to have been previously initialized but the reserved field is not set to zeros.
Usage Notes
- res_setservers() replaces the entire list of existing name server addresses with the new list. If the new list has fewer than MAXNS entries, the remaining entries will be set to null.
- If more than MAXNS entries are used, only MAXNS entries will be set and extra entries will be ignored.
Related Information
- res_ninit()--Initialize res Structure
- res_nclose()--Close Socket and Reset res
Structure
- res_getservers()--Get Name Server Addresses
API introduced: V6R1