Makes a query and awaits a response.
#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h>
int res_search (DomName, Class, Type, Answer, AnswerLength) char *DomName; int Class; int Type; u_char *Answer; int AnswerLength;
The res_search subroutine makes a query and awaits a response like the res_query subroutine. However, it also implements the default and search rules controlled by the RES_DEFNAMES and RES_DNSRCH options.
The res_search subroutine is one of a set of subroutines that form the resolver, a set of functions that resolve domain names. The _res data structure contains global information used by the resolver subroutines. The /usr/include/resolv.h file contains the _res structure definition.
DomName | Points to the name of the domain. If the DomName parameter points to a single-component name and the RES_DEFNAMES structure is set, as it is by default, the subroutine appends the default domain name to the single-component name. The current domain name is defined by the name server in use or is specified in the /etc/resolv.conf file.
If the RES_DNSRCH bit is set, as it is by default, the res_search subroutine searches for host names in both the current domain and in parent domains. | ||||||||||||||||||||||||||||||||||||
Class | Specifies one of the following values:
| ||||||||||||||||||||||||||||||||||||
Type | Requires one of the following values:
| ||||||||||||||||||||||||||||||||||||
Answer | Points to an address where the response is stored. | ||||||||||||||||||||||||||||||||||||
AnswerLength | Specifies the size of the answer buffer. |
Upon successful completion, the res_search subroutine returns the size of the response. Upon unsuccessful completion, the res_search subroutine returns a value of -1 and sets the h_errno value to the appropriate error.
The res_search subroutine is part of Base Operating System (BOS) Runtime.
All applications containing the res_search subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
/etc/resolv.conf | |
Contains the name server and domain name. |
The finger command.
The dn_comp subroutine, dn_expand subroutine, _getlong subroutine, _getshort subroutine, putlong subroutine, putshort subroutine, res_init subroutine, res_mkquery subroutine, res_query subroutine, res_send subroutine.
Sockets Overview and Understanding Domain Name Resolution in AIX Version 4.3 Communications Programming Concepts.