The res_search() call makes a query and awaits a response.
Syntax
#include <sys\types.h> #include <netinet\in.h> #include <arpa\nameser.h> #include <resolv.h> int res_search(name, class, type, answer, anslen) char *name; int class; int type; u_char *answer; int anslen;
Parameters
name
If the RES_DNSRCH bit is set, as it is by default, the res_search() call searches for host names in both the current domain and in parent domains.
C_IN
T_A
Description
The res_search() call makes a query and awaits a response, like the res_query() call. However, it also implements the default and search rules controlled by the RES_DEFNAMES and RES_DNSRCH options.
Note: This call is only useful for queries in the same name hierarchy as the local host.
The res_search() call is one of a group of calls that form the resolver, a set of functions that resolve domain names. The _res data structure contains global information used by the resolver calls. The <RESOLV.H> file contains the _res structure definition. (See The _res Data Structure for more on the _res data structure.)
Return Values
When successful, the res_search() call returns the size of the response. When unsuccessful, the res_search() call returns a value of -1 and sets the h_errno value to the appropriate error.
Related Calls
dn_comp() dn_expand()
dn_find()
dn_skipname()
putlong()
putshort()
res_init()
res_mkquery()
res_query()
res_send()