Sends a query to a name server and retrieves a response.
Standard C Library (libc.a)
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int res_send (MessagePtr, MessageLength, Answer, AnswerLength)
char * MsgPtr;
int MsgLength;
char * Answer;
int AnswerLength;
The res_send subroutine sends a query to name servers and calls the res_init subroutine if the RES_INIT option of the _res structure is not set. This subroutine sends the query to the local name server and handles time outs and retries.
The res_send subroutine is one of a set of subroutines that form the resolver, a set of functions that resolve domain names. Global information used by the resolver subroutines is kept in the _res structure. The /usr/include/resolv.h file contains the _res structure definition.
All applications containing the res_send subroutine must be compiled with the _BSD macro set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
Item | Description |
---|---|
MessagePtr | Points to the beginning of a message. |
MessageLength | Specifies the length of the message. |
Answer | Points to an address where the response is stored. |
AnswerLength | Specifies the size of the answer area. |
Upon successful completion, the res_send subroutine returns the length of the message.
If the res_send subroutine is unsuccessful, the subroutine returns a -1.
Item | Description |
---|---|
/etc/resolv.conf | Contains general name server and domain name information. |