| Home | Libraries | People | FAQ | More

### C++11 Examples

##### Allocation

This example shows how to customise the allocation of memory associated with asynchronous operations.

- boost_asio/example/cpp11/allocation/server.cpp

##### Buffers

This example demonstrates how to create reference counted buffers that can be used with socket read and write operations.

- boost_asio/example/cpp11/buffers/reference_counted.cpp

##### Chat

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.

- boost_asio/example/cpp11/chat/chat_message.hpp
- boost_asio/example/cpp11/chat/chat_client.cpp
- boost_asio/example/cpp11/chat/chat_server.cpp

##### Echo

A collection of simple clients and servers, showing the use of both synchronous and asynchronous operations.

- boost_asio/example/cpp11/echo/async_tcp_echo_server.cpp
- boost_asio/example/cpp11/echo/async_udp_echo_server.cpp
- boost_asio/example/cpp11/echo/blocking_tcp_echo_client.cpp
- boost_asio/example/cpp11/echo/blocking_tcp_echo_server.cpp
- boost_asio/example/cpp11/echo/blocking_udp_echo_client.cpp
- boost_asio/example/cpp11/echo/blocking_udp_echo_server.cpp

##### Futures

This example demonstrates how to use std::future in conjunction with Boost.Asio's asynchronous operations.

- boost_asio/example/cpp11/futures/daytime_client.cpp

##### HTTP Server

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.

- boost_asio/example/cpp11/http/server/connection.cpp
- boost_asio/example/cpp11/http/server/connection.hpp
- boost_asio/example/cpp11/http/server/connection_manager.cpp
- boost_asio/example/cpp11/http/server/connection_manager.hpp
- boost_asio/example/cpp11/http/server/header.hpp
- boost_asio/example/cpp11/http/server/main.cpp
- boost_asio/example/cpp11/http/server/mime_types.cpp
- boost_asio/example/cpp11/http/server/mime_types.hpp
- boost_asio/example/cpp11/http/server/reply.cpp
- boost_asio/example/cpp11/http/server/reply.hpp
- boost_asio/example/cpp11/http/server/request.hpp
- boost_asio/example/cpp11/http/server/request_handler.cpp
- boost_asio/example/cpp11/http/server/request_handler.hpp
- boost_asio/example/cpp11/http/server/request_parser.cpp
- boost_asio/example/cpp11/http/server/request_parser.hpp
- boost_asio/example/cpp11/http/server/server.cpp
- boost_asio/example/cpp11/http/server/server.hpp

##### Spawn

Example of using the boost::asio::spawn() function, a wrapper around the Boost.Coroutine library, to implement a chain of asynchronous operations using stackful coroutines.

- boost_asio/example/cpp11/spawn/echo_server.cpp