Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/res_query.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/res_query.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/res_query.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/res_query.html on line 8
Query the local Internet domain name server
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int res_query( const char * dname,
int class,
int type,
u_char * answer,
int anslen );
- dname
- The fully qualified domain name that you want to query.
- class
- The class of information that you want; one of:
- C_IN — ARPA Internet.
- C_CHAOS — Chaos net (MIT).
- C_HS — Hesiod name server (MIT).
- C_ANY — any class.
You typically use C_IN.
- type
- The type of information that you want.
You typically use T_PTR, but you can use any of the
T_* constants defined in <arpa/nameser.h>.
- answer
- A pointer to a buffer where the function can store the answer to the
query.
- anslen
- The length of the buffer.
libsocket
Use the -l socket option to
qcc
to link against this library.
The res_query() function provides an interface to
the server query mechanism. It constructs a query, sends it
to the local server, waits for a response, and makes
preliminary checks on the reply. The query requests
information of the specified type and
class for the specified fully qualified domain
name dname. The reply message is left in the
answer buffer with length anslen
supplied by the caller.
The resolver routines are used for making, sending, and
interpreting query and reply messages with Internet domain
name servers.
Global configuration and state information used by the resolver
routines is kept in the structure _res.
For more information on the options, see
res_init().
The res_query() function uses the following lower-level routines:
- res_mkquery()
constructs a standard query message.
- res_send()
sends the preformatted query and returns an answer.
- dn_comp()
compresses a domain name.
- dn_expand()
expands the compressed domain name to a full domain
name.
The length of a reply message, in bytes, or -1 if an error occurs
(h_errno is set).
See herror().
- /etc/resolv.conf
- Resolver configuration file.
- LOCALDOMAIN
- When set, LOCALDOMAIN contains a domain name that overrides the
current domain name.
Unix
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
dn_comp(),
dn_expand(),
gethostbyname(),
herror(),
res_init(),
res_mkquery(),
res_querydomain(),
res_search(),
res_send()
hostname,
/etc/resolv.conf
in the Utilities Reference
Based on
RFC 974, RFC 1032, RFC 1033, RFC 1034, RFC 1035
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/res_query.html on line 244
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/res_query.html on line 244