1ARES_PROCESS(3)            Library Functions Manual            ARES_PROCESS(3)
2
3
4

NAME

6       ares_process - Process events for name resolution
7

SYNOPSIS

9       #include <ares.h>
10
11       void ares_process(ares_channel channel,
12                         fd_set *read_fds,
13                         fd_set *write_fds)
14
15       void ares_process_fd(ares_channel channel,
16                            ares_socket_t read_fd,
17                            ares_socket_t write_fd)
18

DESCRIPTION

20       The  ares_process(3)  function handles input/output events and timeouts
21       associated with queries pending on the name service channel  identified
22       by  channel.   The  file  descriptor  sets  pointed  to by read_fds and
23       write_fds should have file descriptors set in them according to whether
24       the file descriptors specified by ares_fds(3) are ready for reading and
25       writing.  (The easiest way to determine this information is  to  invoke
26       select(3)  with  a  timeout  no  greater  than  the  timeout  given  by
27       ares_timeout(3)).
28
29       The ares_process(3) function will invoke callbacks for pending  queries
30       if they complete successfully or fail.
31
32       ares_process_fd(3) works the same way but acts and operates only on the
33       specific file descriptors (sockets) you pass in to  the  function.  Use
34       ARES_SOCKET_BAD  for  "no  action".  This function is provided to allow
35       users of c-ares to void select(3) in their applications and  within  c-
36       ares.
37
38       To  only  process  possible  timeout  conditions without a socket event
39       occurring, one may pass NULL  as  the  values  for  both  read_fds  and
40       write_fds  for ares_process(3), or ARES_SOCKET_BAD for both read_fd and
41       write_fd for ares_process_fd(3).
42

EXAMPLE

44       The following code fragment waits for all pending queries on a  channel
45       to complete:
46
47       int nfds, count;
48       fd_set readers, writers;
49       struct timeval tv, *tvp;
50
51       while (1) {
52         FD_ZERO(&readers);
53         FD_ZERO(&writers);
54         nfds = ares_fds(channel, &readers, &writers);
55         if (nfds == 0)
56           break;
57         tvp = ares_timeout(channel, NULL, &tv);
58         count = select(nfds, &readers, &writers, NULL, tvp);
59         ares_process(channel, &readers, &writers);
60       }
61

SEE ALSO

63       ares_fds(3), ares_timeout(3)
64

AUTHOR

66       Greg Hudson, MIT Information Systems
67       Copyright 1998 by the Massachusetts Institute of Technology.
68
69
70
71                                 25 July 1998                  ARES_PROCESS(3)
Impressum