using.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Using Asio</title>
  5. <link rel="stylesheet" href="../boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
  7. <link rel="home" href="../index.html" title="Asio">
  8. <link rel="up" href="../index.html" title="Asio">
  9. <link rel="prev" href="overview/implementation.html" title="Platform-Specific Implementation Notes">
  10. <link rel="next" href="tutorial.html" title="Tutorial">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../asio.png"></td></tr></table>
  14. <hr>
  15. <div class="spirit-nav">
  16. <a accesskey="p" href="overview/implementation.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../next.png" alt="Next"></a>
  17. </div>
  18. <div class="section">
  19. <div class="titlepage"><div><div><h2 class="title" style="clear: both">
  20. <a name="asio.using"></a><a class="link" href="using.html" title="Using Asio">Using Asio</a>
  21. </h2></div></div></div>
  22. <h4>
  23. <a name="asio.using.h0"></a>
  24. <span><a name="asio.using.supported_platforms"></a></span><a class="link" href="using.html#asio.using.supported_platforms">Supported
  25. Platforms</a>
  26. </h4>
  27. <p>
  28. The following platforms and compilers have been tested:
  29. </p>
  30. <div class="itemizedlist"><ul class="itemizedlist" type="disc">
  31. <li class="listitem">
  32. Win32 and Win64 using Visual C++ 7.1 and Visual C++ 8.0.
  33. </li>
  34. <li class="listitem">
  35. Win32 using MinGW.
  36. </li>
  37. <li class="listitem">
  38. Win32 using Cygwin. (<code class="computeroutput"><span class="identifier">__USE_W32_SOCKETS</span></code>
  39. must be defined.)
  40. </li>
  41. <li class="listitem">
  42. Linux (2.4 or 2.6 kernels) using g++ 3.3 or later.
  43. </li>
  44. <li class="listitem">
  45. Solaris using g++ 3.3 or later.
  46. </li>
  47. <li class="listitem">
  48. Mac OS X 10.4 using g++ 3.3 or later.
  49. </li>
  50. </ul></div>
  51. <p>
  52. The following platforms may also work:
  53. </p>
  54. <div class="itemizedlist"><ul class="itemizedlist" type="disc">
  55. <li class="listitem">
  56. AIX 5.3 using XL C/C++ v9.
  57. </li>
  58. <li class="listitem">
  59. HP-UX 11i v3 using patched aC++ A.06.14.
  60. </li>
  61. <li class="listitem">
  62. QNX Neutrino 6.3 using g++ 3.3 or later.
  63. </li>
  64. <li class="listitem">
  65. Solaris using Sun Studio 11 or later.
  66. </li>
  67. <li class="listitem">
  68. Tru64 v5.1 using Compaq C++ v7.1.
  69. </li>
  70. </ul></div>
  71. <h4>
  72. <a name="asio.using.h1"></a>
  73. <span><a name="asio.using.dependencies"></a></span><a class="link" href="using.html#asio.using.dependencies">Dependencies</a>
  74. </h4>
  75. <p>
  76. The following libraries must be available in order to link programs that use
  77. Asio:
  78. </p>
  79. <div class="itemizedlist"><ul class="itemizedlist" type="disc">
  80. <li class="listitem">
  81. Boost.Regex (optional) if you use any of the <a class="link" href="reference/read_until.html" title="read_until"><code class="computeroutput"><span class="identifier">read_until</span><span class="special">()</span></code></a>
  82. or <a class="link" href="reference/async_read_until.html" title="async_read_until"><code class="computeroutput"><span class="identifier">async_read_until</span><span class="special">()</span></code></a> overloads that take a <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex</span></code> parameter.
  83. </li>
  84. <li class="listitem">
  85. <a href="http://www.openssl.org" target="_top">OpenSSL</a> (optional) if you use
  86. Asio's SSL support.
  87. </li>
  88. </ul></div>
  89. <p>
  90. Furthermore, some of the examples also require Boost.Date_Time or Boost.Serialization
  91. libraries.
  92. </p>
  93. <div class="note"><table border="0" summary="Note">
  94. <tr>
  95. <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../note.png"></td>
  96. <th align="left">Note</th>
  97. </tr>
  98. <tr><td align="left" valign="top"><p>
  99. With MSVC or Borland C++ you may want to add <code class="computeroutput"><span class="special">-</span><span class="identifier">DBOOST_DATE_TIME_NO_LIB</span></code> and <code class="computeroutput"><span class="special">-</span><span class="identifier">DBOOST_REGEX_NO_LIB</span></code>
  100. to your project settings to disable autolinking of the Boost.Date_Time and
  101. Boost.Regex libraries respectively. Alternatively, you may choose to build
  102. these libraries and link to them.
  103. </p></td></tr>
  104. </table></div>
  105. <h4>
  106. <a name="asio.using.h2"></a>
  107. <span><a name="asio.using.optional_separate_compilation"></a></span><a class="link" href="using.html#asio.using.optional_separate_compilation">Optional
  108. separate compilation</a>
  109. </h4>
  110. <p>
  111. By default, Asio is a header-only library. However, some developers may prefer
  112. to build Asio using separately compiled source code. To do this, add <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">asio</span><span class="special">/</span><span class="identifier">impl</span><span class="special">/</span><span class="identifier">src</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> to
  113. one (and only one) source file in a program, then build the program with <code class="computeroutput"><span class="identifier">ASIO_SEPARATE_COMPILATION</span></code> defined in the
  114. project/compiler settings. Alternatively, <code class="computeroutput"><span class="identifier">ASIO_DYN_LINK</span></code>
  115. may be defined to build a separately-compiled Asio as part of a shared library.
  116. </p>
  117. <p>
  118. If using Asio's SSL support, you will also need to add <code class="computeroutput"><span class="preprocessor">#include</span>
  119. <span class="special">&lt;</span><span class="identifier">asio</span><span class="special">/</span><span class="identifier">ssl</span><span class="special">/</span><span class="identifier">impl</span><span class="special">/</span><span class="identifier">src</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>.
  120. </p>
  121. <h4>
  122. <a name="asio.using.h3"></a>
  123. <span><a name="asio.using.building_the_tests_and_examples_on_linux_or_unix"></a></span><a class="link" href="using.html#asio.using.building_the_tests_and_examples_on_linux_or_unix">Building
  124. the tests and examples on Linux or UNIX</a>
  125. </h4>
  126. <p>
  127. If the boost directory (e.g. the directory called <code class="computeroutput"><span class="identifier">boost_1_34_1</span></code>)
  128. is in the same directory as the asio source kit, then you may configure asio
  129. by simply going:
  130. </p>
  131. <pre class="programlisting"><span class="special">./</span><span class="identifier">configure</span>
  132. </pre>
  133. <p>
  134. in the root directory of the asio source kit. Note that configure will always
  135. use the most recent boost version it knows about (i.e. 1.34.1) in preference
  136. to earlier versions, if there is more than one version present.
  137. </p>
  138. <p>
  139. If the boost directory is in some other location, then you need to specify
  140. this directory when running configure:
  141. </p>
  142. <pre class="programlisting"><span class="special">./</span><span class="identifier">configure</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">boost</span><span class="special">=</span><span class="emphasis"><em>path_to_boost</em></span>
  143. </pre>
  144. <p>
  145. When specifying the boost directory in this way you should ensure that you
  146. use an absolute path.
  147. </p>
  148. <p>
  149. To build the examples, simply run <code class="computeroutput"><span class="identifier">make</span></code>
  150. in the root directory of the asio source kit. To also build and run the unit
  151. tests, to confirm that asio is working correctly, run <code class="computeroutput"><span class="identifier">make</span>
  152. <span class="identifier">check</span></code>.
  153. </p>
  154. <h4>
  155. <a name="asio.using.h4"></a>
  156. <span><a name="asio.using.building_the_tests_and_examples_with_msvc"></a></span><a class="link" href="using.html#asio.using.building_the_tests_and_examples_with_msvc">Building
  157. the tests and examples with MSVC</a>
  158. </h4>
  159. <p>
  160. To build using the MSVC 7.1 or MSVC 8.0 command line compiler, perform the
  161. following steps in a Command Prompt window:
  162. </p>
  163. <div class="itemizedlist"><ul class="itemizedlist" type="disc">
  164. <li class="listitem">
  165. If you are using a version of boost other than 1.34.1, or if the boost
  166. directory (i.e. the directory called <code class="computeroutput"><span class="identifier">boost_1_34_1</span></code>)
  167. is not in the same directory as the asio source kit, then specify the location
  168. of boost by running a command similar to <code class="literal">set BOOSTDIR=<span class="emphasis"><em>path_to_boost</em></span></code>.
  169. Ensure that you specify an absolute path.
  170. </li>
  171. <li class="listitem">
  172. Change to the asio <code class="computeroutput"><span class="identifier">src</span></code>
  173. directory.
  174. </li>
  175. <li class="listitem">
  176. Execute the command <code class="computeroutput"><span class="identifier">nmake</span> <span class="special">-</span><span class="identifier">f</span> <span class="identifier">Makefile</span><span class="special">.</span><span class="identifier">msc</span></code>.
  177. </li>
  178. <li class="listitem">
  179. Execute the command <code class="computeroutput"><span class="identifier">nmake</span> <span class="special">-</span><span class="identifier">f</span> <span class="identifier">Makefile</span><span class="special">.</span><span class="identifier">msc</span> <span class="identifier">check</span></code> to run a suite of tests to confirm
  180. that asio is working correctly.
  181. </li>
  182. </ul></div>
  183. <h4>
  184. <a name="asio.using.h5"></a>
  185. <span><a name="asio.using.building_the_tests_and_examples_with_mingw"></a></span><a class="link" href="using.html#asio.using.building_the_tests_and_examples_with_mingw">Building
  186. the tests and examples with MinGW</a>
  187. </h4>
  188. <p>
  189. To build using the MinGW g++ compiler from the command line, perform the following
  190. steps in a Command Prompt window:
  191. </p>
  192. <div class="itemizedlist"><ul class="itemizedlist" type="disc">
  193. <li class="listitem">
  194. If you are using a version of boost other than 1.34.1, or if the boost
  195. directory (i.e. the directory called <code class="computeroutput"><span class="identifier">boost_1_34_1</span></code>)
  196. is not in the same directory as the asio source kit, then specify the location
  197. of boost by running a command similar to <code class="literal">set BOOSTDIR=<span class="emphasis"><em>path_to_boost</em></span></code>.
  198. Ensure that you specify an absolute path using <span class="emphasis"><em>forward slashes</em></span>
  199. (i.e. <code class="computeroutput"><span class="identifier">c</span><span class="special">:/</span><span class="identifier">projects</span><span class="special">/</span><span class="identifier">boost_1_34_1</span></code> rather than <code class="computeroutput"><span class="identifier">c</span><span class="special">:\</span><span class="identifier">projects</span><span class="special">\</span><span class="identifier">boost_1_34_1</span></code>).
  200. </li>
  201. <li class="listitem">
  202. Change to the asio <code class="computeroutput"><span class="identifier">src</span></code>
  203. directory.
  204. </li>
  205. <li class="listitem">
  206. Execute the command <code class="computeroutput"><span class="identifier">make</span> <span class="special">-</span><span class="identifier">f</span> <span class="identifier">Makefile</span><span class="special">.</span><span class="identifier">mgw</span></code>.
  207. </li>
  208. <li class="listitem">
  209. Execute the command <code class="computeroutput"><span class="identifier">make</span> <span class="special">-</span><span class="identifier">f</span> <span class="identifier">Makefile</span><span class="special">.</span><span class="identifier">mgw</span> <span class="identifier">check</span></code> to run a suite of tests to confirm
  210. that asio is working correctly.
  211. </li>
  212. </ul></div>
  213. <div class="note"><table border="0" summary="Note">
  214. <tr>
  215. <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../note.png"></td>
  216. <th align="left">Note</th>
  217. </tr>
  218. <tr><td align="left" valign="top"><p>
  219. The above instructions do not work when building inside MSYS. If you want
  220. to build using MSYS, you should use <code class="literal">export</code> rather than
  221. <code class="literal">set</code> to specify the location of boost.
  222. </p></td></tr>
  223. </table></div>
  224. <h4>
  225. <a name="asio.using.h6"></a>
  226. <span><a name="asio.using.macros"></a></span><a class="link" href="using.html#asio.using.macros">Macros</a>
  227. </h4>
  228. <p>
  229. The macros listed in the table below may be used to control the behaviour of
  230. Asio.
  231. </p>
  232. <div class="informaltable"><table class="table">
  233. <colgroup>
  234. <col>
  235. <col>
  236. </colgroup>
  237. <thead><tr>
  238. <th>
  239. <p>
  240. Macro
  241. </p>
  242. </th>
  243. <th>
  244. <p>
  245. Description
  246. </p>
  247. </th>
  248. </tr></thead>
  249. <tbody>
  250. <tr>
  251. <td>
  252. <p>
  253. <code class="computeroutput"><span class="identifier">ASIO_ENABLE_BUFFER_DEBUGGING</span></code>
  254. </p>
  255. </td>
  256. <td>
  257. <p>
  258. Enables Asio's buffer debugging support, which can help identify
  259. when invalid buffers are used in read or write operations (e.g. if
  260. a std::string object being written is destroyed before the write
  261. operation completes).
  262. </p>
  263. <p>
  264. When using Microsoft Visual C++, this macro is defined automatically
  265. if the compiler's iterator debugging support is enabled, unless
  266. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_BUFFER_DEBUGGING</span></code>
  267. has been defined.
  268. </p>
  269. <p>
  270. When using g++, this macro is defined automatically if standard library
  271. debugging is enabled (<code class="computeroutput"><span class="identifier">_GLIBCXX_DEBUG</span></code>
  272. is defined), unless <code class="computeroutput"><span class="identifier">ASIO_DISABLE_BUFFER_DEBUGGING</span></code>
  273. has been defined.
  274. </p>
  275. </td>
  276. </tr>
  277. <tr>
  278. <td>
  279. <p>
  280. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_BUFFER_DEBUGGING</span></code>
  281. </p>
  282. </td>
  283. <td>
  284. <p>
  285. Explictly disables Asio's buffer debugging support.
  286. </p>
  287. </td>
  288. </tr>
  289. <tr>
  290. <td>
  291. <p>
  292. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_DEV_POLL</span></code>
  293. </p>
  294. </td>
  295. <td>
  296. <p>
  297. Explicitly disables <code class="literal">/dev/poll</code> support on Solaris,
  298. forcing the use of a <code class="computeroutput"><span class="identifier">select</span></code>-based
  299. implementation.
  300. </p>
  301. </td>
  302. </tr>
  303. <tr>
  304. <td>
  305. <p>
  306. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_EPOLL</span></code>
  307. </p>
  308. </td>
  309. <td>
  310. <p>
  311. Explicitly disables <code class="computeroutput"><span class="identifier">epoll</span></code>
  312. support on Linux, forcing the use of a <code class="computeroutput"><span class="identifier">select</span></code>-based
  313. implementation.
  314. </p>
  315. </td>
  316. </tr>
  317. <tr>
  318. <td>
  319. <p>
  320. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_EVENTFD</span></code>
  321. </p>
  322. </td>
  323. <td>
  324. <p>
  325. Explicitly disables <code class="computeroutput"><span class="identifier">eventfd</span></code>
  326. support on Linux, forcing the use of a pipe to interrupt blocked
  327. epoll/select system calls.
  328. </p>
  329. </td>
  330. </tr>
  331. <tr>
  332. <td>
  333. <p>
  334. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_KQUEUE</span></code>
  335. </p>
  336. </td>
  337. <td>
  338. <p>
  339. Explicitly disables <code class="computeroutput"><span class="identifier">kqueue</span></code>
  340. support on Mac OS X and BSD variants, forcing the use of a <code class="computeroutput"><span class="identifier">select</span></code>-based implementation.
  341. </p>
  342. </td>
  343. </tr>
  344. <tr>
  345. <td>
  346. <p>
  347. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_IOCP</span></code>
  348. </p>
  349. </td>
  350. <td>
  351. <p>
  352. Explicitly disables I/O completion ports support on Windows, forcing
  353. the use of a <code class="computeroutput"><span class="identifier">select</span></code>-based
  354. implementation.
  355. </p>
  356. </td>
  357. </tr>
  358. <tr>
  359. <td>
  360. <p>
  361. <code class="computeroutput"><span class="identifier">ASIO_DISABLE_THREADS</span></code>
  362. </p>
  363. </td>
  364. <td>
  365. <p>
  366. Explicitly disables Asio's threading support, independent of whether
  367. or not Boost supports threads.
  368. </p>
  369. </td>
  370. </tr>
  371. <tr>
  372. <td>
  373. <p>
  374. <code class="computeroutput"><span class="identifier">ASIO_NO_WIN32_LEAN_AND_MEAN</span></code>
  375. </p>
  376. </td>
  377. <td>
  378. <p>
  379. By default, Asio will automatically define <code class="computeroutput"><span class="identifier">WIN32_LEAN_AND_MEAN</span></code>
  380. when compiling for Windows, to minimise the number of Windows SDK
  381. header files and features that are included. The presence of <code class="computeroutput"><span class="identifier">ASIO_NO_WIN32_LEAN_AND_MEAN</span></code> prevents
  382. <code class="computeroutput"><span class="identifier">WIN32_LEAN_AND_MEAN</span></code>
  383. from being defined.
  384. </p>
  385. </td>
  386. </tr>
  387. <tr>
  388. <td>
  389. <p>
  390. <code class="computeroutput"><span class="identifier">ASIO_NO_NOMINMAX</span></code>
  391. </p>
  392. </td>
  393. <td>
  394. <p>
  395. By default, Asio will automatically define <code class="computeroutput"><span class="identifier">NOMINMAX</span></code>
  396. when compiling for Windows, to suppress the definition of the <code class="computeroutput"><span class="identifier">min</span><span class="special">()</span></code>
  397. and <code class="computeroutput"><span class="identifier">max</span><span class="special">()</span></code>
  398. macros. The presence of <code class="computeroutput"><span class="identifier">ASIO_NO_NOMINMAX</span></code>
  399. prevents <code class="computeroutput"><span class="identifier">NOMINMAX</span></code>
  400. from being defined.
  401. </p>
  402. </td>
  403. </tr>
  404. <tr>
  405. <td>
  406. <p>
  407. <code class="computeroutput"><span class="identifier">ASIO_NO_DEFAULT_LINKED_LIBS</span></code>
  408. </p>
  409. </td>
  410. <td>
  411. <p>
  412. When compiling for Windows using Microsoft Visual C++ or Borland
  413. C++, Asio will automatically link in the necessary Windows SDK libraries
  414. for sockets support (i.e. <code class="literal">ws2_32.lib</code> and <code class="literal">mswsock.lib</code>,
  415. or <code class="literal">ws2.lib</code> when building for Windows CE). The
  416. <code class="computeroutput"><span class="identifier">ASIO_NO_DEFAULT_LINKED_LIBS</span></code>
  417. macro prevents these libraries from being linked.
  418. </p>
  419. </td>
  420. </tr>
  421. <tr>
  422. <td>
  423. <p>
  424. <code class="computeroutput"><span class="identifier">ASIO_SOCKET_STREAMBUF_MAX_ARITY</span></code>
  425. </p>
  426. </td>
  427. <td>
  428. <p>
  429. Determines the maximum number of arguments that may be passed to
  430. the <code class="computeroutput"><span class="identifier">basic_socket_streambuf</span></code>
  431. class template's <code class="computeroutput"><span class="identifier">connect</span></code>
  432. member function. Defaults to 5.
  433. </p>
  434. </td>
  435. </tr>
  436. <tr>
  437. <td>
  438. <p>
  439. <code class="computeroutput"><span class="identifier">ASIO_SOCKET_IOSTREAM_MAX_ARITY</span></code>
  440. </p>
  441. </td>
  442. <td>
  443. <p>
  444. Determines the maximum number of arguments that may be passed to
  445. the <code class="computeroutput"><span class="identifier">basic_socket_iostream</span></code>
  446. class template's constructor and <code class="computeroutput"><span class="identifier">connect</span></code>
  447. member function. Defaults to 5.
  448. </p>
  449. </td>
  450. </tr>
  451. <tr>
  452. <td>
  453. <p>
  454. <code class="computeroutput"><span class="identifier">ASIO_ENABLE_CANCELIO</span></code>
  455. </p>
  456. </td>
  457. <td>
  458. <p>
  459. Enables use of the <code class="computeroutput"><span class="identifier">CancelIo</span></code>
  460. function on older versions of Windows. If not enabled, calls to
  461. <code class="computeroutput"><span class="identifier">cancel</span><span class="special">()</span></code>
  462. on a socket object will always fail with <code class="computeroutput"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error</span><span class="special">::</span><span class="identifier">operation_not_supported</span></code>
  463. when run on Windows XP, Windows Server 2003, and earlier versions
  464. of Windows. When running on Windows Vista, Windows Server 2008, and
  465. later, the <code class="computeroutput"><span class="identifier">CancelIoEx</span></code>
  466. function is always used.
  467. </p>
  468. <p>
  469. The <code class="computeroutput"><span class="identifier">CancelIo</span></code> function
  470. has two issues that should be considered before enabling its use:
  471. </p>
  472. <p>
  473. * It will only cancel asynchronous operations that were initiated
  474. in the current thread.
  475. </p>
  476. <p>
  477. * It can appear to complete without error, but the request to cancel
  478. the unfinished operations may be silently ignored by the operating
  479. system. Whether it works or not seems to depend on the drivers that
  480. are installed.
  481. </p>
  482. <p>
  483. For portable cancellation, consider using one of the following alternatives:
  484. </p>
  485. <p>
  486. * Disable asio's I/O completion port backend by defining ASIO_DISABLE_IOCP.
  487. </p>
  488. <p>
  489. * Use the socket object's close() function to simultaneously cancel
  490. the outstanding operations and close the socket.
  491. </p>
  492. </td>
  493. </tr>
  494. <tr>
  495. <td>
  496. <p>
  497. <code class="computeroutput"><span class="identifier">ASIO_NO_TYPEID</span></code>
  498. </p>
  499. </td>
  500. <td>
  501. <p>
  502. Disables uses of the <code class="computeroutput"><span class="keyword">typeid</span></code>
  503. operator in asio. Defined automatically if <code class="computeroutput"><span class="identifier">BOOST_NO_TYPEID</span></code>
  504. is defined.
  505. </p>
  506. </td>
  507. </tr>
  508. <tr>
  509. <td>
  510. <p>
  511. <code class="computeroutput"><span class="identifier">ASIO_HASH_MAP_BUCKETS</span></code>
  512. </p>
  513. </td>
  514. <td>
  515. <p>
  516. Determines the number of buckets in asio's internal <code class="computeroutput"><span class="identifier">hash_map</span></code> objects. The value should
  517. be a comma separated list of prime numbers, in ascending order. The
  518. <code class="computeroutput"><span class="identifier">hash_map</span></code> implementation
  519. will automatically increase the number of buckets as the number of
  520. elements in the map increases.
  521. </p>
  522. <p>
  523. Some examples:
  524. </p>
  525. <p>
  526. * Defining <code class="computeroutput"><span class="identifier">ASIO_HASH_MAP_BUCKETS</span></code>
  527. to <code class="computeroutput"><span class="number">1021</span></code> means that the
  528. <code class="computeroutput"><span class="identifier">hash_map</span></code> objects
  529. will always contain 1021 buckets, irrespective of the number of elements
  530. in the map.
  531. </p>
  532. <p>
  533. * Defining <code class="computeroutput"><span class="identifier">ASIO_HASH_MAP_BUCKETS</span></code>
  534. to <code class="computeroutput"><span class="number">53</span><span class="special">,</span><span class="number">389</span><span class="special">,</span><span class="number">1543</span></code> means that the <code class="computeroutput"><span class="identifier">hash_map</span></code>
  535. objects will initially contain 53 buckets. The number of buckets
  536. will be increased to 389 and then 1543 as elements are added to the
  537. map.
  538. </p>
  539. </td>
  540. </tr>
  541. </tbody>
  542. </table></div>
  543. <h4>
  544. <a name="asio.using.h7"></a>
  545. <span><a name="asio.using.mailing_list"></a></span><a class="link" href="using.html#asio.using.mailing_list">Mailing
  546. List</a>
  547. </h4>
  548. <p>
  549. A mailing list specifically for Asio may be found on <a href="http://sourceforge.net/mail/?group_id=122478" target="_top">SourceForge.net</a>.
  550. Newsgroup access is provided via <a href="http://dir.gmane.org/gmane.comp.lib.boost.asio.user" target="_top">Gmane</a>.
  551. </p>
  552. <h4>
  553. <a name="asio.using.h8"></a>
  554. <span><a name="asio.using.wiki"></a></span><a class="link" href="using.html#asio.using.wiki">Wiki</a>
  555. </h4>
  556. <p>
  557. Users are encouraged to share examples, tips and FAQs on the Asio wiki, which
  558. is located at <a href="http://think-async.com/Asio/" target="_top">http://think-async.com/Asio/</a>.
  559. </p>
  560. </div>
  561. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  562. <td align="left"></td>
  563. <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2014 Christopher M. Kohlhoff<p>
  564. Distributed under the Boost Software License, Version 1.0. (See accompanying
  565. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  566. </p>
  567. </div></td>
  568. </tr></table>
  569. <hr>
  570. <div class="spirit-nav">
  571. <a accesskey="p" href="overview/implementation.html"><img src="../prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../next.png" alt="Next"></a>
  572. </div>
  573. </body>
  574. </html>