Blame ares_getsock.3

Packit 514978
.\"
Packit 514978
.\" Copyright 1998 by Daniel Stenberg
Packit 514978
.\"
Packit 514978
.\" Permission to use, copy, modify, and distribute this
Packit 514978
.\" software and its documentation for any purpose and without
Packit 514978
.\" fee is hereby granted, provided that the above copyright
Packit 514978
.\" notice appear in all copies and that both that copyright
Packit 514978
.\" notice and this permission notice appear in supporting
Packit 514978
.\" documentation, and that the name of M.I.T. not be used in
Packit 514978
.\" advertising or publicity pertaining to distribution of the
Packit 514978
.\" software without specific, written prior permission.
Packit 514978
.\" M.I.T. makes no representations about the suitability of
Packit 514978
.\" this software for any purpose.  It is provided "as is"
Packit 514978
.\" without express or implied warranty.
Packit 514978
.\"
Packit 514978
.TH ARES_GETSOCK 3 "11 March 2010"
Packit 514978
.SH NAME
Packit 514978
ares_getsock \- get socket descriptors to wait on
Packit 514978
.SH SYNOPSIS
Packit 514978
.nf
Packit 514978
.B #include <ares.h>
Packit 514978
.PP
Packit 514978
.B int ares_getsock(ares_channel \fIchannel\fP, ares_socket_t *\fIsocks\fP,
Packit 514978
.B int \fInumsocks\fP);
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The
Packit 514978
.B ares_getsock
Packit 514978
function retrieves the set of socket descriptors which the calling
Packit 514978
application should wait on for reading and/or writing for the
Packit 514978
processing of name service queries pending on the name service channel
Packit 514978
identified by
Packit 514978
.IR channel .
Packit 514978
Socket descriptors will be set in the socket descriptor array pointed to by
Packit 514978
\fIsocks\fP.
Packit 514978
\fInumsocks\fP is the size of the given array in number of ints.
Packit 514978
Packit 514978
This function can only return information about up to 16 sockets. If more are
Packit 514978
in use (however unlikely that is), they are simply not reported back.
Packit 514978
.SH RETURN VALUES
Packit 514978
\fBares_getsock\fP returns a bitmask for what actions to wait for on the
Packit 514978
different sockets. The ares.h header file provides these convenience macros to
Packit 514978
extract the information appropriately:
Packit 514978
Packit 514978
.nf
Packit 514978
#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about
Packit 514978
                                  this many sockets */
Packit 514978
#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
Packit 514978
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
Packit 514978
                                         ARES_GETSOCK_MAXNUM)))
Packit 514978
.fi
Packit 514978
.SH NOTES
Packit 514978
This function was added in c-ares 1.3.1
Packit 514978
.SH SEE ALSO
Packit 514978
.BR ares_timeout (3),
Packit 514978
.BR ares_fds (3),
Packit 514978
.BR ares_process (3)