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