source: trunk/athena/lib/ares/ares_process.3 @ 11890

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