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

EXAMPLE

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

SEE ALSO

58       ares_fds(3), ares_timeout(3)
59

AUTHOR

61       Greg Hudson, MIT Information Systems
62       Copyright 1998 by the Massachusetts Institute of Technology.
63
64
65
66                                 25 July 1998                  ARES_PROCESS(3)
Impressum