Query the local Internet domain name server
#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int res_querydomain( const char * name, const char * domain, int class, int type, u_char * answer, int anslen );
You typically use C_IN.
libsocket
Use the -l socket option to qcc to link against this library.
The res_querydomain() 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 host specified by concatenating name and domain. The trailing dot is removed from name if domain is 0.
The reply message is left in the answer buffer with length anslen supplied by the caller.
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | No |