[Previous] [Contents] [Index] [Next]

res_send()

Send a preformatted Internet domain name query

Synopsis:

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>

int res_send( const u_char * msg, 
              int msglen, 
              u_char * answer,
              int anslen );

Library:

socket3r.lib, socket3s.lib

Description:

The res_send() function is a low-level routine that's used by res_query() to send a preformatted Internet domain name query and return an answer. It calls res_init() if RES_INIT isn't set, sends the query to the local name server, and handles timeouts and retries.

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().

Returns:

The length of a reply message, in bytes; or -1 if an error occurs.

Errors:

ECONNREFUSED
No name servers found.
ETIMEDOUT
No answer obtained.

Files:

/etc/resolv.conf
Resolver configuration file.

Environment variables:

LOCALDOMAIN
When set, LOCALDOMAIN contains a domain name that overrides the current domain name.

Classification:

Unix

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

dn_comp(), dn_expand(), gethostbyname(), res_init(), res_mkquery(), res_query(), res_search()

hostname, named, /etc/resolv.conf in the TCP/IP User's Guide

RFC 974, RFC 1032, RFC 1033, RFC 1034, RFC 1035


[Previous] [Contents] [Index] [Next]