/[resiprocate]/main/contrib/ares/ares_process.3
ViewVC logotype

Contents of /main/contrib/ares/ares_process.3

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5295 - (show annotations) (download)
Mon Aug 22 00:30:05 2005 UTC (14 years, 2 months ago) by jason
File size: 2255 byte(s)
merged 5270:HEAD from b-directory-reorg
1 .\"
2 .\" Copyright 1998 by the Massachusetts Institute of Technology.
3 .\"
4 .\" Permission to use, copy, modify, and distribute this
5 .\" software and its documentation for any purpose and without
6 .\" fee is hereby granted, provided that the above copyright
7 .\" notice appear in all copies and that both that copyright
8 .\" notice and this permission notice appear in supporting
9 .\" documentation, and that the name of M.I.T. not be used in
10 .\" advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission.
12 .\" M.I.T. makes no representations about the suitability of
13 .\" this software for any purpose. It is provided "as is"
14 .\" without express or implied warranty.
15 .\"
16 .TH ARES_PROCESS 3 "25 July 1998"
17 .SH NAME
18 ares_process \- Process events for name resolution
19 .SH SYNOPSIS
20 .nf
21 .B #include <ares.h>
22 .PP
23 .B void ares_process(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP,
24 .B fd_set *\fIwrite_fds\fP)
25 .fi
26 .SH DESCRIPTION
27 The
28 .B ares_process
29 function handles input/output events and timeouts associated with
30 queries pending on the name service channel identified by
31 .IR channel .
32 The file descriptor sets pointed to by
33 .I read_fds
34 and
35 .I write_fds
36 should have file descriptors set in them according to whether the file
37 descriptors specified by
38 .BR ares_fds (3)
39 are ready for reading and writing. (The easiest way to determine this
40 information is to invoke
41 .B select
42 with a timeout no greater than the timeout given by
43 .BR ares_timeout (3)).
44 .PP
45 The
46 .B ares_process
47 function will invoke callbacks for pending queries if they complete
48 successfully or fail.
49 .SS EXAMPLE
50 The following code fragment waits for all pending queries on a channel
51 to complete:
52 .PP
53 .RS
54 .nf
55 int nfds, count;
56 fd_set readers, writers;
57 struct timeval tv, *tvp;
58
59 while (1)
60 {
61 FD_ZERO(&readers);
62 FD_ZERO(&writers);
63 nfds = ares_fds(channel, &readers, &writers);
64 if (nfds == 0)
65 break;
66 tvp = ares_timeout(channel, NULL, &tv);
67 count = select(nfds, &readers, &writers, NULL, tvp);
68 ares_process(channel, &readers, &writers);
69 }
70 .fi
71 .RE
72 .SH SEE ALSO
73 .BR ares_fds (3),
74 .BR ares_timeout (3)
75 .SH AUTHOR
76 Greg Hudson, MIT Information Systems
77 .br
78 Copyright 1998 by the Massachusetts Institute of Technology.

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27