ares_getsock.3 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .\"
  2. .\" Copyright 1998 by Daniel Stenberg
  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_GETSOCK 3 "11 March 2010"
  17. .SH NAME
  18. ares_getsock \- get socket descriptors to wait on
  19. .SH SYNOPSIS
  20. .nf
  21. #include <ares.h>
  22. int ares_getsock(ares_channel \fIchannel\fP, ares_socket_t *\fIsocks\fP,
  23. int \fInumsocks\fP);
  24. .fi
  25. .SH DESCRIPTION
  26. The
  27. .B ares_getsock
  28. function retrieves the set of socket descriptors which the calling
  29. application should wait on for reading and/or writing for the
  30. processing of name service queries pending on the name service channel
  31. identified by
  32. .IR channel .
  33. Socket descriptors will be set in the socket descriptor array pointed to by
  34. \fIsocks\fP.
  35. \fInumsocks\fP is the size of the given array in number of ints.
  36. This function can only return information about up to 16 sockets. If more are
  37. in use (however unlikely that is), they are simply not reported back.
  38. .SH RETURN VALUES
  39. \fBares_getsock\fP returns a bitmask for what actions to wait for on the
  40. different sockets. The ares.h header file provides these convenience macros to
  41. extract the information appropriately:
  42. .nf
  43. #define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about
  44. this many sockets */
  45. #define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
  46. #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
  47. ARES_GETSOCK_MAXNUM)))
  48. .fi
  49. .SH NOTES
  50. This function was added in c-ares 1.3.1
  51. .SH SEE ALSO
  52. .BR ares_timeout (3),
  53. .BR ares_fds (3),
  54. .BR ares_process (3)