2 .\" Copyright 1998 by Daniel Stenberg
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.
16 .TH ARES_GETSOCK 3 "11 March 2010"
18 ares_getsock \- get socket descriptors to wait on
23 .B int ares_getsock(ares_channel \fIchannel\fP, ares_socket_t *\fIsocks\fP,
24 .B int \fInumsocks\fP);
29 function retrieves the set of socket descriptors which the calling
30 application should wait on for reading and/or writing for the
31 processing of name service queries pending on the name service channel
34 Socket descriptors will be set in the socket descriptor array pointed to by
36 \fInumsocks\fP is the size of the given array in number of ints.
38 This function can only return information about up to 16 sockets. If more are
39 in use (however unlikely that is), they are simply not reported back.
41 \fBares_getsock\fP returns a bitmask for what actions to wait for on the
42 different sockets. The ares.h header file provides these convenience macros to
43 extract the information appropriately:
46 #define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about
48 #define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
49 #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
50 ARES_GETSOCK_MAXNUM)))
53 This function was added in c-ares 1.3.1