1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>C++03 Examples</title> 5<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../boost_asio.html" title="Boost.Asio"> 8<link rel="up" href="../examples.html" title="Examples"> 9<link rel="prev" href="../examples.html" title="Examples"> 10<link rel="next" href="cpp11_examples.html" title="C++11 Examples"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 15<td align="center"><a href="../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="../examples.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cpp11_examples.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_asio.examples.cpp03_examples"></a><a class="link" href="cpp03_examples.html" title="C++03 Examples">C++03 Examples</a> 28</h3></div></div></div> 29<h5> 30<a name="boost_asio.examples.cpp03_examples.h0"></a> 31 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.allocation"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.allocation">Allocation</a> 32 </h5> 33<p> 34 This example shows how to customise the allocation of memory associated with 35 asynchronous operations. 36 </p> 37<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 38 <a href="../example/cpp03/allocation/server.cpp" target="_top">boost_asio/example/cpp03/allocation/server.cpp</a> 39 </li></ul></div> 40<h5> 41<a name="boost_asio.examples.cpp03_examples.h1"></a> 42 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.buffers"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.buffers">Buffers</a> 43 </h5> 44<p> 45 This example demonstrates how to create reference counted buffers that can 46 be used with socket read and write operations. 47 </p> 48<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 49 <a href="../example/cpp03/buffers/reference_counted.cpp" target="_top">boost_asio/example/cpp03/buffers/reference_counted.cpp</a> 50 </li></ul></div> 51<h5> 52<a name="boost_asio.examples.cpp03_examples.h2"></a> 53 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.chat"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.chat">Chat</a> 54 </h5> 55<p> 56 This example implements a chat server and client. The programs use a custom 57 protocol with a fixed length message header and variable length message body. 58 </p> 59<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 60<li class="listitem"> 61 <a href="../example/cpp03/chat/chat_message.hpp" target="_top">boost_asio/example/cpp03/chat/chat_message.hpp</a> 62 </li> 63<li class="listitem"> 64 <a href="../example/cpp03/chat/chat_client.cpp" target="_top">boost_asio/example/cpp03/chat/chat_client.cpp</a> 65 </li> 66<li class="listitem"> 67 <a href="../example/cpp03/chat/chat_server.cpp" target="_top">boost_asio/example/cpp03/chat/chat_server.cpp</a> 68 </li> 69</ul></div> 70<p> 71 The following POSIX-specific chat client demonstrates how to use the <a class="link" href="../reference/posix__stream_descriptor.html" title="posix::stream_descriptor">posix::stream_descriptor</a> 72 class to perform console input and output. 73 </p> 74<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 75 <a href="../example/cpp03/chat/posix_chat_client.cpp" target="_top">boost_asio/example/cpp03/chat/posix_chat_client.cpp</a> 76 </li></ul></div> 77<h5> 78<a name="boost_asio.examples.cpp03_examples.h3"></a> 79 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.echo"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.echo">Echo</a> 80 </h5> 81<p> 82 A collection of simple clients and servers, showing the use of both synchronous 83 and asynchronous operations. 84 </p> 85<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 86<li class="listitem"> 87 <a href="../example/cpp03/echo/async_tcp_echo_server.cpp" target="_top">boost_asio/example/cpp03/echo/async_tcp_echo_server.cpp</a> 88 </li> 89<li class="listitem"> 90 <a href="../example/cpp03/echo/async_udp_echo_server.cpp" target="_top">boost_asio/example/cpp03/echo/async_udp_echo_server.cpp</a> 91 </li> 92<li class="listitem"> 93 <a href="../example/cpp03/echo/blocking_tcp_echo_client.cpp" target="_top">boost_asio/example/cpp03/echo/blocking_tcp_echo_client.cpp</a> 94 </li> 95<li class="listitem"> 96 <a href="../example/cpp03/echo/blocking_tcp_echo_server.cpp" target="_top">boost_asio/example/cpp03/echo/blocking_tcp_echo_server.cpp</a> 97 </li> 98<li class="listitem"> 99 <a href="../example/cpp03/echo/blocking_udp_echo_client.cpp" target="_top">boost_asio/example/cpp03/echo/blocking_udp_echo_client.cpp</a> 100 </li> 101<li class="listitem"> 102 <a href="../example/cpp03/echo/blocking_udp_echo_server.cpp" target="_top">boost_asio/example/cpp03/echo/blocking_udp_echo_server.cpp</a> 103 </li> 104</ul></div> 105<h5> 106<a name="boost_asio.examples.cpp03_examples.h4"></a> 107 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.fork"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.fork">Fork</a> 108 </h5> 109<p> 110 These POSIX-specific examples show how to use Boost.Asio in conjunction with 111 the <code class="computeroutput">fork()</code> system call. The first example illustrates the steps 112 required to start a daemon process: 113 </p> 114<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 115 <a href="../example/cpp03/fork/daemon.cpp" target="_top">boost_asio/example/cpp03/fork/daemon.cpp</a> 116 </li></ul></div> 117<p> 118 The second example demonstrates how it is possible to fork a process from 119 within a completion handler. 120 </p> 121<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 122 <a href="../example/cpp03/fork/process_per_connection.cpp" target="_top">boost_asio/example/cpp03/fork/process_per_connection.cpp</a> 123 </li></ul></div> 124<h5> 125<a name="boost_asio.examples.cpp03_examples.h5"></a> 126 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.http_client"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.http_client">HTTP 127 Client</a> 128 </h5> 129<p> 130 Example programs implementing simple HTTP 1.0 clients. These examples show 131 how to use the <a class="link" href="../reference/read_until.html" title="read_until">read_until</a> 132 and <a class="link" href="../reference/async_read_until.html" title="async_read_until">async_read_until</a> 133 functions. 134 </p> 135<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 136<li class="listitem"> 137 <a href="../example/cpp03/http/client/sync_client.cpp" target="_top">boost_asio/example/cpp03/http/client/sync_client.cpp</a> 138 </li> 139<li class="listitem"> 140 <a href="../example/cpp03/http/client/async_client.cpp" target="_top">boost_asio/example/cpp03/http/client/async_client.cpp</a> 141 </li> 142</ul></div> 143<h5> 144<a name="boost_asio.examples.cpp03_examples.h6"></a> 145 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.http_server"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.http_server">HTTP 146 Server</a> 147 </h5> 148<p> 149 This example illustrates the use of asio in a simple single-threaded server 150 implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown 151 by cancelling all outstanding asynchronous operations. 152 </p> 153<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 154<li class="listitem"> 155 <a href="../example/cpp03/http/server/connection.cpp" target="_top">boost_asio/example/cpp03/http/server/connection.cpp</a> 156 </li> 157<li class="listitem"> 158 <a href="../example/cpp03/http/server/connection.hpp" target="_top">boost_asio/example/cpp03/http/server/connection.hpp</a> 159 </li> 160<li class="listitem"> 161 <a href="../example/cpp03/http/server/connection_manager.cpp" target="_top">boost_asio/example/cpp03/http/server/connection_manager.cpp</a> 162 </li> 163<li class="listitem"> 164 <a href="../example/cpp03/http/server/connection_manager.hpp" target="_top">boost_asio/example/cpp03/http/server/connection_manager.hpp</a> 165 </li> 166<li class="listitem"> 167 <a href="../example/cpp03/http/server/header.hpp" target="_top">boost_asio/example/cpp03/http/server/header.hpp</a> 168 </li> 169<li class="listitem"> 170 <a href="../example/cpp03/http/server/main.cpp" target="_top">boost_asio/example/cpp03/http/server/main.cpp</a> 171 </li> 172<li class="listitem"> 173 <a href="../example/cpp03/http/server/mime_types.cpp" target="_top">boost_asio/example/cpp03/http/server/mime_types.cpp</a> 174 </li> 175<li class="listitem"> 176 <a href="../example/cpp03/http/server/mime_types.hpp" target="_top">boost_asio/example/cpp03/http/server/mime_types.hpp</a> 177 </li> 178<li class="listitem"> 179 <a href="../example/cpp03/http/server/reply.cpp" target="_top">boost_asio/example/cpp03/http/server/reply.cpp</a> 180 </li> 181<li class="listitem"> 182 <a href="../example/cpp03/http/server/reply.hpp" target="_top">boost_asio/example/cpp03/http/server/reply.hpp</a> 183 </li> 184<li class="listitem"> 185 <a href="../example/cpp03/http/server/request.hpp" target="_top">boost_asio/example/cpp03/http/server/request.hpp</a> 186 </li> 187<li class="listitem"> 188 <a href="../example/cpp03/http/server/request_handler.cpp" target="_top">boost_asio/example/cpp03/http/server/request_handler.cpp</a> 189 </li> 190<li class="listitem"> 191 <a href="../example/cpp03/http/server/request_handler.hpp" target="_top">boost_asio/example/cpp03/http/server/request_handler.hpp</a> 192 </li> 193<li class="listitem"> 194 <a href="../example/cpp03/http/server/request_parser.cpp" target="_top">boost_asio/example/cpp03/http/server/request_parser.cpp</a> 195 </li> 196<li class="listitem"> 197 <a href="../example/cpp03/http/server/request_parser.hpp" target="_top">boost_asio/example/cpp03/http/server/request_parser.hpp</a> 198 </li> 199<li class="listitem"> 200 <a href="../example/cpp03/http/server/server.cpp" target="_top">boost_asio/example/cpp03/http/server/server.cpp</a> 201 </li> 202<li class="listitem"> 203 <a href="../example/cpp03/http/server/server.hpp" target="_top">boost_asio/example/cpp03/http/server/server.hpp</a> 204 </li> 205</ul></div> 206<h5> 207<a name="boost_asio.examples.cpp03_examples.h7"></a> 208 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.http_server_2"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.http_server_2">HTTP 209 Server 2</a> 210 </h5> 211<p> 212 An HTTP server using an io_context-per-CPU design. 213 </p> 214<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 215<li class="listitem"> 216 <a href="../example/cpp03/http/server2/connection.cpp" target="_top">boost_asio/example/cpp03/http/server2/connection.cpp</a> 217 </li> 218<li class="listitem"> 219 <a href="../example/cpp03/http/server2/connection.hpp" target="_top">boost_asio/example/cpp03/http/server2/connection.hpp</a> 220 </li> 221<li class="listitem"> 222 <a href="../example/cpp03/http/server2/header.hpp" target="_top">boost_asio/example/cpp03/http/server2/header.hpp</a> 223 </li> 224<li class="listitem"> 225 <a href="../example/cpp03/http/server2/io_context_pool.cpp" target="_top">boost_asio/example/cpp03/http/server2/io_context_pool.cpp</a> 226 </li> 227<li class="listitem"> 228 <a href="../example/cpp03/http/server2/io_context_pool.hpp" target="_top">boost_asio/example/cpp03/http/server2/io_context_pool.hpp</a> 229 </li> 230<li class="listitem"> 231 <a href="../example/cpp03/http/server2/main.cpp" target="_top">boost_asio/example/cpp03/http/server2/main.cpp</a> 232 </li> 233<li class="listitem"> 234 <a href="../example/cpp03/http/server2/mime_types.cpp" target="_top">boost_asio/example/cpp03/http/server2/mime_types.cpp</a> 235 </li> 236<li class="listitem"> 237 <a href="../example/cpp03/http/server2/mime_types.hpp" target="_top">boost_asio/example/cpp03/http/server2/mime_types.hpp</a> 238 </li> 239<li class="listitem"> 240 <a href="../example/cpp03/http/server2/reply.cpp" target="_top">boost_asio/example/cpp03/http/server2/reply.cpp</a> 241 </li> 242<li class="listitem"> 243 <a href="../example/cpp03/http/server2/reply.hpp" target="_top">boost_asio/example/cpp03/http/server2/reply.hpp</a> 244 </li> 245<li class="listitem"> 246 <a href="../example/cpp03/http/server2/request.hpp" target="_top">boost_asio/example/cpp03/http/server2/request.hpp</a> 247 </li> 248<li class="listitem"> 249 <a href="../example/cpp03/http/server2/request_handler.cpp" target="_top">boost_asio/example/cpp03/http/server2/request_handler.cpp</a> 250 </li> 251<li class="listitem"> 252 <a href="../example/cpp03/http/server2/request_handler.hpp" target="_top">boost_asio/example/cpp03/http/server2/request_handler.hpp</a> 253 </li> 254<li class="listitem"> 255 <a href="../example/cpp03/http/server2/request_parser.cpp" target="_top">boost_asio/example/cpp03/http/server2/request_parser.cpp</a> 256 </li> 257<li class="listitem"> 258 <a href="../example/cpp03/http/server2/request_parser.hpp" target="_top">boost_asio/example/cpp03/http/server2/request_parser.hpp</a> 259 </li> 260<li class="listitem"> 261 <a href="../example/cpp03/http/server2/server.cpp" target="_top">boost_asio/example/cpp03/http/server2/server.cpp</a> 262 </li> 263<li class="listitem"> 264 <a href="../example/cpp03/http/server2/server.hpp" target="_top">boost_asio/example/cpp03/http/server2/server.hpp</a> 265 </li> 266</ul></div> 267<h5> 268<a name="boost_asio.examples.cpp03_examples.h8"></a> 269 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.http_server_3"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.http_server_3">HTTP 270 Server 3</a> 271 </h5> 272<p> 273 An HTTP server using a single io_context and a thread pool calling <code class="computeroutput">io_context::run()</code>. 274 </p> 275<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 276<li class="listitem"> 277 <a href="../example/cpp03/http/server3/connection.cpp" target="_top">boost_asio/example/cpp03/http/server3/connection.cpp</a> 278 </li> 279<li class="listitem"> 280 <a href="../example/cpp03/http/server3/connection.hpp" target="_top">boost_asio/example/cpp03/http/server3/connection.hpp</a> 281 </li> 282<li class="listitem"> 283 <a href="../example/cpp03/http/server3/header.hpp" target="_top">boost_asio/example/cpp03/http/server3/header.hpp</a> 284 </li> 285<li class="listitem"> 286 <a href="../example/cpp03/http/server3/main.cpp" target="_top">boost_asio/example/cpp03/http/server3/main.cpp</a> 287 </li> 288<li class="listitem"> 289 <a href="../example/cpp03/http/server3/mime_types.cpp" target="_top">boost_asio/example/cpp03/http/server3/mime_types.cpp</a> 290 </li> 291<li class="listitem"> 292 <a href="../example/cpp03/http/server3/mime_types.hpp" target="_top">boost_asio/example/cpp03/http/server3/mime_types.hpp</a> 293 </li> 294<li class="listitem"> 295 <a href="../example/cpp03/http/server3/reply.cpp" target="_top">boost_asio/example/cpp03/http/server3/reply.cpp</a> 296 </li> 297<li class="listitem"> 298 <a href="../example/cpp03/http/server3/reply.hpp" target="_top">boost_asio/example/cpp03/http/server3/reply.hpp</a> 299 </li> 300<li class="listitem"> 301 <a href="../example/cpp03/http/server3/request.hpp" target="_top">boost_asio/example/cpp03/http/server3/request.hpp</a> 302 </li> 303<li class="listitem"> 304 <a href="../example/cpp03/http/server3/request_handler.cpp" target="_top">boost_asio/example/cpp03/http/server3/request_handler.cpp</a> 305 </li> 306<li class="listitem"> 307 <a href="../example/cpp03/http/server3/request_handler.hpp" target="_top">boost_asio/example/cpp03/http/server3/request_handler.hpp</a> 308 </li> 309<li class="listitem"> 310 <a href="../example/cpp03/http/server3/request_parser.cpp" target="_top">boost_asio/example/cpp03/http/server3/request_parser.cpp</a> 311 </li> 312<li class="listitem"> 313 <a href="../example/cpp03/http/server3/request_parser.hpp" target="_top">boost_asio/example/cpp03/http/server3/request_parser.hpp</a> 314 </li> 315<li class="listitem"> 316 <a href="../example/cpp03/http/server3/server.cpp" target="_top">boost_asio/example/cpp03/http/server3/server.cpp</a> 317 </li> 318<li class="listitem"> 319 <a href="../example/cpp03/http/server3/server.hpp" target="_top">boost_asio/example/cpp03/http/server3/server.hpp</a> 320 </li> 321</ul></div> 322<h5> 323<a name="boost_asio.examples.cpp03_examples.h9"></a> 324 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.http_server_4"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.http_server_4">HTTP 325 Server 4</a> 326 </h5> 327<p> 328 A single-threaded HTTP server implemented using stackless coroutines. 329 </p> 330<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 331<li class="listitem"> 332 <a href="../example/cpp03/http/server4/file_handler.cpp" target="_top">boost_asio/example/cpp03/http/server4/file_handler.cpp</a> 333 </li> 334<li class="listitem"> 335 <a href="../example/cpp03/http/server4/file_handler.hpp" target="_top">boost_asio/example/cpp03/http/server4/file_handler.hpp</a> 336 </li> 337<li class="listitem"> 338 <a href="../example/cpp03/http/server4/header.hpp" target="_top">boost_asio/example/cpp03/http/server4/header.hpp</a> 339 </li> 340<li class="listitem"> 341 <a href="../example/cpp03/http/server4/main.cpp" target="_top">boost_asio/example/cpp03/http/server4/main.cpp</a> 342 </li> 343<li class="listitem"> 344 <a href="../example/cpp03/http/server4/mime_types.cpp" target="_top">boost_asio/example/cpp03/http/server4/mime_types.cpp</a> 345 </li> 346<li class="listitem"> 347 <a href="../example/cpp03/http/server4/mime_types.hpp" target="_top">boost_asio/example/cpp03/http/server4/mime_types.hpp</a> 348 </li> 349<li class="listitem"> 350 <a href="../example/cpp03/http/server4/reply.cpp" target="_top">boost_asio/example/cpp03/http/server4/reply.cpp</a> 351 </li> 352<li class="listitem"> 353 <a href="../example/cpp03/http/server4/reply.hpp" target="_top">boost_asio/example/cpp03/http/server4/reply.hpp</a> 354 </li> 355<li class="listitem"> 356 <a href="../example/cpp03/http/server4/request.hpp" target="_top">boost_asio/example/cpp03/http/server4/request.hpp</a> 357 </li> 358<li class="listitem"> 359 <a href="../example/cpp03/http/server4/request_parser.cpp" target="_top">boost_asio/example/cpp03/http/server4/request_parser.cpp</a> 360 </li> 361<li class="listitem"> 362 <a href="../example/cpp03/http/server4/request_parser.hpp" target="_top">boost_asio/example/cpp03/http/server4/request_parser.hpp</a> 363 </li> 364<li class="listitem"> 365 <a href="../example/cpp03/http/server4/server.cpp" target="_top">boost_asio/example/cpp03/http/server4/server.cpp</a> 366 </li> 367<li class="listitem"> 368 <a href="../example/cpp03/http/server4/server.hpp" target="_top">boost_asio/example/cpp03/http/server4/server.hpp</a> 369 </li> 370</ul></div> 371<h5> 372<a name="boost_asio.examples.cpp03_examples.h10"></a> 373 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.icmp"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.icmp">ICMP</a> 374 </h5> 375<p> 376 This example shows how to use raw sockets with ICMP to ping a remote host. 377 </p> 378<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 379<li class="listitem"> 380 <a href="../example/cpp03/icmp/ping.cpp" target="_top">boost_asio/example/cpp03/icmp/ping.cpp</a> 381 </li> 382<li class="listitem"> 383 <a href="../example/cpp03/icmp/ipv4_header.hpp" target="_top">boost_asio/example/cpp03/icmp/ipv4_header.hpp</a> 384 </li> 385<li class="listitem"> 386 <a href="../example/cpp03/icmp/icmp_header.hpp" target="_top">boost_asio/example/cpp03/icmp/icmp_header.hpp</a> 387 </li> 388</ul></div> 389<h5> 390<a name="boost_asio.examples.cpp03_examples.h11"></a> 391 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.invocation"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.invocation">Invocation</a> 392 </h5> 393<p> 394 This example shows how to customise handler invocation. Completion handlers 395 are added to a priority queue rather than executed immediately. 396 </p> 397<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 398 <a href="../example/cpp03/invocation/prioritised_handlers.cpp" target="_top">boost_asio/example/cpp03/invocation/prioritised_handlers.cpp</a> 399 </li></ul></div> 400<h5> 401<a name="boost_asio.examples.cpp03_examples.h12"></a> 402 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.iostreams"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.iostreams">Iostreams</a> 403 </h5> 404<p> 405 Two examples showing how to use <a class="link" href="../reference/ip__tcp/iostream.html" title="ip::tcp::iostream">ip::tcp::iostream</a>. 406 </p> 407<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 408<li class="listitem"> 409 <a href="../example/cpp03/iostreams/daytime_client.cpp" target="_top">boost_asio/example/cpp03/iostreams/daytime_client.cpp</a> 410 </li> 411<li class="listitem"> 412 <a href="../example/cpp03/iostreams/daytime_server.cpp" target="_top">boost_asio/example/cpp03/iostreams/daytime_server.cpp</a> 413 </li> 414<li class="listitem"> 415 <a href="../example/cpp03/iostreams/http_client.cpp" target="_top">boost_asio/example/cpp03/iostreams/http_client.cpp</a> 416 </li> 417</ul></div> 418<h5> 419<a name="boost_asio.examples.cpp03_examples.h13"></a> 420 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.multicast"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.multicast">Multicast</a> 421 </h5> 422<p> 423 An example showing the use of multicast to transmit packets to a group of 424 subscribers. 425 </p> 426<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 427<li class="listitem"> 428 <a href="../example/cpp03/multicast/receiver.cpp" target="_top">boost_asio/example/cpp03/multicast/receiver.cpp</a> 429 </li> 430<li class="listitem"> 431 <a href="../example/cpp03/multicast/sender.cpp" target="_top">boost_asio/example/cpp03/multicast/sender.cpp</a> 432 </li> 433</ul></div> 434<h5> 435<a name="boost_asio.examples.cpp03_examples.h14"></a> 436 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.serialization"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.serialization">Serialization</a> 437 </h5> 438<p> 439 This example shows how Boost.Serialization can be used with asio to encode 440 and decode structures for transmission over a socket. 441 </p> 442<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 443<li class="listitem"> 444 <a href="../example/cpp03/serialization/client.cpp" target="_top">boost_asio/example/cpp03/serialization/client.cpp</a> 445 </li> 446<li class="listitem"> 447 <a href="../example/cpp03/serialization/connection.hpp" target="_top">boost_asio/example/cpp03/serialization/connection.hpp</a> 448 </li> 449<li class="listitem"> 450 <a href="../example/cpp03/serialization/server.cpp" target="_top">boost_asio/example/cpp03/serialization/server.cpp</a> 451 </li> 452<li class="listitem"> 453 <a href="../example/cpp03/serialization/stock.hpp" target="_top">boost_asio/example/cpp03/serialization/stock.hpp</a> 454 </li> 455</ul></div> 456<h5> 457<a name="boost_asio.examples.cpp03_examples.h15"></a> 458 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.services"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.services">Services</a> 459 </h5> 460<p> 461 This example demonstrates how to integrate custom functionality (in this 462 case, for logging) into asio's <a class="link" href="../reference/io_context.html" title="io_context">io_context</a>, 463 and how to use a custom service with <a class="link" href="../reference/basic_stream_socket.html" title="basic_stream_socket">basic_stream_socket<></a>. 464 </p> 465<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 466<li class="listitem"> 467 <a href="../example/cpp03/services/basic_logger.hpp" target="_top">boost_asio/example/cpp03/services/basic_logger.hpp</a> 468 </li> 469<li class="listitem"> 470 <a href="../example/cpp03/services/daytime_client.cpp" target="_top">boost_asio/example/cpp03/services/daytime_client.cpp</a> 471 </li> 472<li class="listitem"> 473 <a href="../example/cpp03/services/logger.hpp" target="_top">boost_asio/example/cpp03/services/logger.hpp</a> 474 </li> 475<li class="listitem"> 476 <a href="../example/cpp03/services/logger_service.cpp" target="_top">boost_asio/example/cpp03/services/logger_service.cpp</a> 477 </li> 478<li class="listitem"> 479 <a href="../example/cpp03/services/logger_service.hpp" target="_top">boost_asio/example/cpp03/services/logger_service.hpp</a> 480 </li> 481<li class="listitem"> 482 <a href="../example/cpp03/services/stream_socket_service.hpp" target="_top">boost_asio/example/cpp03/services/stream_socket_service.hpp</a> 483 </li> 484</ul></div> 485<h5> 486<a name="boost_asio.examples.cpp03_examples.h16"></a> 487 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.socks_4"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.socks_4">SOCKS 488 4</a> 489 </h5> 490<p> 491 Example client program implementing the SOCKS 4 protocol for communication 492 via a proxy. 493 </p> 494<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 495<li class="listitem"> 496 <a href="../example/cpp03/socks4/sync_client.cpp" target="_top">boost_asio/example/cpp03/socks4/sync_client.cpp</a> 497 </li> 498<li class="listitem"> 499 <a href="../example/cpp03/socks4/socks4.hpp" target="_top">boost_asio/example/cpp03/socks4/socks4.hpp</a> 500 </li> 501</ul></div> 502<h5> 503<a name="boost_asio.examples.cpp03_examples.h17"></a> 504 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.ssl"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.ssl">SSL</a> 505 </h5> 506<p> 507 Example client and server programs showing the use of the <a class="link" href="../reference/ssl__stream.html" title="ssl::stream">ssl::stream<></a> 508 template with asynchronous operations. 509 </p> 510<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 511<li class="listitem"> 512 <a href="../example/cpp03/ssl/client.cpp" target="_top">boost_asio/example/cpp03/ssl/client.cpp</a> 513 </li> 514<li class="listitem"> 515 <a href="../example/cpp03/ssl/server.cpp" target="_top">boost_asio/example/cpp03/ssl/server.cpp</a> 516 </li> 517</ul></div> 518<h5> 519<a name="boost_asio.examples.cpp03_examples.h18"></a> 520 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.timeouts"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.timeouts">Timeouts</a> 521 </h5> 522<p> 523 A collection of examples showing how to cancel long running asynchronous 524 operations after a period of time. 525 </p> 526<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 527<li class="listitem"> 528 <a href="../example/cpp03/timeouts/async_tcp_client.cpp" target="_top">boost_asio/example/cpp03/timeouts/async_tcp_client.cpp</a> 529 </li> 530<li class="listitem"> 531 <a href="../example/cpp03/timeouts/blocking_tcp_client.cpp" target="_top">boost_asio/example/cpp03/timeouts/blocking_tcp_client.cpp</a> 532 </li> 533<li class="listitem"> 534 <a href="../example/cpp03/timeouts/blocking_token_tcp_client.cpp" target="_top">boost_asio/example/cpp03/timeouts/blocking_token_tcp_client.cpp</a> 535 </li> 536<li class="listitem"> 537 <a href="../example/cpp03/timeouts/blocking_udp_client.cpp" target="_top">boost_asio/example/cpp03/timeouts/blocking_udp_client.cpp</a> 538 </li> 539<li class="listitem"> 540 <a href="../example/cpp03/timeouts/server.cpp" target="_top">boost_asio/example/cpp03/timeouts/server.cpp</a> 541 </li> 542</ul></div> 543<h5> 544<a name="boost_asio.examples.cpp03_examples.h19"></a> 545 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.timers"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.timers">Timers</a> 546 </h5> 547<p> 548 Example showing how to customise basic_waitable_timer using a different clock 549 type. 550 </p> 551<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 552 <a href="../example/cpp03/timers/time_t_timer.cpp" target="_top">boost_asio/example/cpp03/timers/time_t_timer.cpp</a> 553 </li></ul></div> 554<h5> 555<a name="boost_asio.examples.cpp03_examples.h20"></a> 556 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.porthopper"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.porthopper">Porthopper</a> 557 </h5> 558<p> 559 Example illustrating mixed synchronous and asynchronous operations, and how 560 to use Boost.Lambda with Boost.Asio. 561 </p> 562<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 563<li class="listitem"> 564 <a href="../example/cpp03/porthopper/protocol.hpp" target="_top">boost_asio/example/cpp03/porthopper/protocol.hpp</a> 565 </li> 566<li class="listitem"> 567 <a href="../example/cpp03/porthopper/client.cpp" target="_top">boost_asio/example/cpp03/porthopper/client.cpp</a> 568 </li> 569<li class="listitem"> 570 <a href="../example/cpp03/porthopper/server.cpp" target="_top">boost_asio/example/cpp03/porthopper/server.cpp</a> 571 </li> 572</ul></div> 573<h5> 574<a name="boost_asio.examples.cpp03_examples.h21"></a> 575 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.nonblocking"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.nonblocking">Nonblocking</a> 576 </h5> 577<p> 578 Example demonstrating reactor-style operations for integrating a third-party 579 library that wants to perform the I/O operations itself. 580 </p> 581<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 582 <a href="../example/cpp03/nonblocking/third_party_lib.cpp" target="_top">boost_asio/example/cpp03/nonblocking/third_party_lib.cpp</a> 583 </li></ul></div> 584<h5> 585<a name="boost_asio.examples.cpp03_examples.h22"></a> 586 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.spawn"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.spawn">Spawn</a> 587 </h5> 588<p> 589 Example of using the boost::asio::spawn() function, a wrapper around the 590 <a href="http://www.boost.org/doc/libs/release/libs/coroutine/index.html" target="_top">Boost.Coroutine</a> 591 library, to implement a chain of asynchronous operations using stackful coroutines. 592 </p> 593<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 594 <a href="../example/cpp03/spawn/echo_server.cpp" target="_top">boost_asio/example/cpp03/spawn/echo_server.cpp</a> 595 </li></ul></div> 596<h5> 597<a name="boost_asio.examples.cpp03_examples.h23"></a> 598 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.unix_domain_sockets"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.unix_domain_sockets">UNIX Domain 599 Sockets</a> 600 </h5> 601<p> 602 Examples showing how to use UNIX domain (local) sockets. 603 </p> 604<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 605<li class="listitem"> 606 <a href="../example/cpp03/local/connect_pair.cpp" target="_top">boost_asio/example/cpp03/local/connect_pair.cpp</a> 607 </li> 608<li class="listitem"> 609 <a href="../example/cpp03/local/iostream_client.cpp" target="_top">boost_asio/example/cpp03/local/iostream_client.cpp</a> 610 </li> 611<li class="listitem"> 612 <a href="../example/cpp03/local/stream_server.cpp" target="_top">boost_asio/example/cpp03/local/stream_server.cpp</a> 613 </li> 614<li class="listitem"> 615 <a href="../example/cpp03/local/stream_client.cpp" target="_top">boost_asio/example/cpp03/local/stream_client.cpp</a> 616 </li> 617</ul></div> 618<h5> 619<a name="boost_asio.examples.cpp03_examples.h24"></a> 620 <span class="phrase"><a name="boost_asio.examples.cpp03_examples.windows"></a></span><a class="link" href="cpp03_examples.html#boost_asio.examples.cpp03_examples.windows">Windows</a> 621 </h5> 622<p> 623 An example showing how to use the Windows-specific function <code class="computeroutput">TransmitFile</code> 624 with Boost.Asio. 625 </p> 626<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 627 <a href="../example/cpp03/windows/transmit_file.cpp" target="_top">boost_asio/example/cpp03/windows/transmit_file.cpp</a> 628 </li></ul></div> 629</div> 630<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 631<td align="left"></td> 632<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 633 Kohlhoff<p> 634 Distributed under the Boost Software License, Version 1.0. (See accompanying 635 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>) 636 </p> 637</div></td> 638</tr></table> 639<hr> 640<div class="spirit-nav"> 641<a accesskey="p" href="../examples.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cpp11_examples.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 642</div> 643</body> 644</html> 645