forked from boostorg/beast
* The examples/ directory is renamed to example/ * Each program is in its own directory with its own build scripts
111 lines
2.7 KiB
Plaintext
111 lines
2.7 KiB
Plaintext
[/
|
|
Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
]
|
|
|
|
[section:example Example Programs]
|
|
|
|
These complete programs are intended to quickly impress upon readers the
|
|
flavor of the library. Source code and build scripts for them are located
|
|
in the examples directory.
|
|
|
|
|
|
|
|
[heading HTTP GET]
|
|
|
|
Use HTTP to make a GET request to a website and print the response:
|
|
|
|
File: [repo_file example/http-client/http_client.cpp]
|
|
|
|
[example_http_client]
|
|
|
|
|
|
|
|
[heading WebSocket]
|
|
|
|
Establish a WebSocket connection, send a message and receive the reply:
|
|
|
|
File: [repo_file example/websocket-client/websocket_client.cpp]
|
|
|
|
[example_websocket_client]
|
|
|
|
|
|
|
|
[heading WebSocket Echo Server]
|
|
|
|
This example demonstrates both synchronous and asynchronous
|
|
WebSocket server implementations.
|
|
|
|
* [repo_file example/websocket-server/main.cpp]
|
|
* [repo_file example/websocket-server/websocket_async_echo_server.hpp]
|
|
* [repo_file example/websocket-server/websocket_sync_echo_server.hpp]
|
|
|
|
|
|
|
|
[heading Secure WebSocket]
|
|
|
|
Establish a WebSocket connection over an encrypted TLS connection,
|
|
send a message and receive the reply. Requires OpenSSL to build.
|
|
|
|
* [repo_file example/ssl/websocket_ssl_example.cpp]
|
|
|
|
|
|
|
|
[heading HTTPS GET]
|
|
|
|
This example demonstrates sending and receiving HTTP messages
|
|
over a TLS connection. Requires OpenSSL to build.
|
|
|
|
* [repo_file example/ssl/http_ssl_example.cpp]
|
|
|
|
|
|
|
|
[heading HTTP Crawl]
|
|
|
|
This example retrieves the page at each of the most popular domains
|
|
as measured by Alexa.
|
|
|
|
* [repo_file example/http-crawl/http_crawl.cpp]
|
|
|
|
|
|
|
|
[heading HTTP Server]
|
|
|
|
This example demonstrates both synchronous and asynchronous server
|
|
implementations. It also provides an example of implementing a [*Body]
|
|
type, in `file_body`.
|
|
|
|
* [repo_file example/http-server/file_body.hpp]
|
|
* [repo_file example/http-server/http_async_server.hpp]
|
|
* [repo_file example/http-server/http_sync_server.hpp]
|
|
* [repo_file example/http-server/main.cpp]
|
|
|
|
|
|
|
|
[heading Composed Operations]
|
|
|
|
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 the Core Foundations document section.
|
|
|
|
* [repo_file example/echo-op/echo_op.cpp]
|
|
|
|
|
|
|
|
[heading Documentation Samples]
|
|
|
|
Here are all of the example functions and classes presented
|
|
throughout the documentation, they can be included and used
|
|
in your program without modification
|
|
|
|
* [repo_file example/doc/core_examples.hpp]
|
|
|
|
* [repo_file example/doc/http_examples.hpp]
|
|
|
|
|
|
|
|
[endsect]
|