Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Examples

Source code and build scripts for these programs are located in the example directory.

These HTTP clients submit a GET request to a server specified on the command line, and prints the resulting response. The crawl client asynchronously fetches the document root of the 10,000 top ranked domains, this may be used to evaluate robustness.

Description

Source File

Source File (using SSL)

HTTP, synchronous

http_client_sync.cpp

http_client_sync_ssl.cpp

HTTP, asynchronous

http_client_async.cpp

http_client_async_ssl.cpp

HTTP, coroutine

http_client_coro.cpp

http_client_coro_ssl.cpp

HTTP crawl (asynchronous)

http_crawl.cpp

These WebSocket clients connect to a server and send a message, then receive a message and print the response before disconnecting.

Description

Source File

Source File (using SSL)

WebSocket, synchronous

websocket_client_sync.cpp

websocket_client_sync_ssl.cpp

WebSocket, asynchronous

websocket_client_async.cpp

websocket_client_async_ssl.cpp

WebSocket, coroutine

websocket_client_coro.cpp

websocket_client_coro_ssl.cpp

These HTTP servers deliver files from a root directory specified on the command line.

Description

Source File

Source File (using SSL)

HTTP, synchronous

http_server_sync.cpp

http_server_sync_ssl.cpp

HTTP, asynchronous

http_server_async.cpp

http_server_async_ssl.cpp

HTTP, coroutine

http_server_coro.cpp

http_server_coro_ssl.cpp

HTTP, stackless coroutine

http_server_stackless.cpp

http_server_stackless_ssl.cpp

HTTP, fast (optimized for speed)

http_server_fast.cpp

HTTP, small (optimized for space)

http_server_small.cpp

HTTP, flex (plain + SSL)

http_server_flex.cpp

These WebSocket servers echo back any message received, keeping the session open until the client disconnects.

Description

Source File

Source File (using SSL)

WebSocket, synchronous

websocket_server_sync.cpp

websocket_server_sync_ssl.cpp

WebSocket, asynchronous

websocket_server_async.cpp

websocket_server_async_ssl.cpp

WebSocket, coroutine

websocket_server_coro.cpp

websocket_server_coro_ssl.cpp

WebSocket, stackless coroutine

websocket_server_stackless.cpp

websocket_server_stackless_ssl.cpp

WebSocket, fast (suited for benchmarks)

websocket_server_fast.cpp

These servers offer both HTTP and WebSocket services on the same port, and illustrate the implementation of advanced features.

Description

Features

Source File

Advanced

  • HTTP pipelining
  • Asynchronous timeouts
  • Dual protocols: HTTP and WebSocket
  • WebSocket use idle ping for timeout
  • Clean exit via SIGINT (CTRL+C) or SIGTERM (kill)

advanced_server.cpp

Advanced, flex (plain + SSL)

  • HTTP pipelining
  • Asynchronous timeouts
  • Dual protocols: HTTP and WebSocket
  • WebSocket use idle ping for timeout
  • Flexible ports: plain and SSL on the same port
  • Clean exit via SIGINT (CTRL+C) or SIGTERM (kill)

advanced_server_flex.cpp

Some of the examples use one or more shared header files, they are listed here along with a description of their use:

Source File

Description

example/common/detect_ssl.hpp

This contains the detect SSL algorithm including the synchronous and asynchronous initiating functions, described in the documentation. It is used by the "flex" servers which support both plain and SSL sessions on the same port.

example/common/root_certificates.hpp

This contains the root SSL certificates used in the SSL client examples. These certificates are used to verify the signatures of SSL certificates presented by remote servers. They represent a subset of the public keys usually installed as part of the operating system or browser, so they may not identify every possible server.

example/common/server_certificate.hpp

This file contains a self-signed SSL certificate used by the SSL server examples. It has not been validated by a Certificate Authority ("CA") so connecting to an example HTTP server using a browser may generate security warnings.

Here are all of the example functions and classes presented throughout the documentation, they can be included and used in your program without modification

This program shows how to use Beast's network foundations to build a composable asynchronous initiation function with associated composed operation implementation. This is a complete, runnable version of the example described in Writing Composed Operations: Echo.


PrevUpHomeNext