ares_getsock.3 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. .\" $Id$
  2. .\"
  3. .\" Copyright 1998 by Daniel Stenberg
  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_GETSOCK 3 "22 December 2005"
  18. .SH NAME
  19. ares_getsock \- get file descriptors to wait on
  20. .SH SYNOPSIS
  21. .nf
  22. .B #include <ares.h>
  23. .PP
  24. .B int ares_getsock(ares_channel \fIchannel\fP, int *\fIsocks\fP,
  25. .B int \fInumsocks\fP);
  26. .fi
  27. .SH DESCRIPTION
  28. The
  29. .B ares_getsock
  30. function retrieves the set of file descriptors which the calling
  31. application should wait on for reading and/or writing for the
  32. processing of name service queries pending on the name service channel
  33. identified by
  34. .IR channel .
  35. File descriptors will be set in the integer array pointed to by
  36. \fIsocks\fP.
  37. \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.
  40. .SH RETURN VALUES
  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:
  44. .nf
  45. #define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about
  46. this many sockets */
  47. #define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
  48. #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
  49. ARES_GETSOCK_MAXNUM)))
  50. .fi
  51. .SH NOTES
  52. This function was added in c-ares 1.3.1
  53. .SH SEE ALSO
  54. .BR ares_timeout (3),
  55. .BR ares_fds (3),
  56. .BR ares_process (3)