| Home | Libraries | People | FAQ | More

# Boost.Asio Examples

## Allocation

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

- allocation/server.cpp

## Buffers

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

- 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.

- chat/chat_message.hpp
- chat/chat_client.cpp
- chat/chat_server.cpp

## Echo

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

- echo/async_tcp_echo_server.cpp
- echo/async_udp_echo_server.cpp
- echo/blocking_tcp_echo_client.cpp
- echo/blocking_tcp_echo_server.cpp
- echo/blocking_udp_echo_client.cpp
- echo/blocking_udp_echo_server.cpp

## HTTP Client

Example programs implementing simple HTTP 1.0 clients. These examples show how to use the boost::asio::read_until and boost::asio::async_read_until functions.

- http/client/sync_client.cpp
- http/client/async_client.cpp

## HTTP Server

This example illustrates the use of Boost.Asio in a server implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown by cancelling all outstanding asynchronous operations.

- HTTP Server Classes
- HTTP Server Files

## Iostreams

Two examples showing how to use boost::asio::ip::tcp::iostream.

- iostreams/daytime_client.cpp
- iostreams/daytime_server.cpp

## Multicast

An example showing the use of multicast to transmit packets to a group of subscribers.

- multicast/receiver.cpp
- multicast/sender.cpp

## Serialization

This example shows how Boost.Serialization can be used with Boost.Asio to encode and decode structures for transmission over a socket.

- Serialization Classes
- Serialization Files

## Services

This example demonstrates how to:

- Integrate custom functionality (in this case, for logging) into Boost.Asio's io_service. It follows the pattern defined in the Services design note.
- Use a custom service with boost::asio::basic_stream_socket.

- Services Classes
- Services Files

## SSL

Example client and server programs showing the use of the boost::asio::ssl::stream template with asynchronous operations.

- ssl/client.cpp
- ssl/server.cpp

## Timeouts

A collection of examples showing how to cancel long running asynchronous operations after a period of time.

- timeouts/accept_timeout.cpp
- timeouts/connect_timeout.cpp
- timeouts/datagram_receive_timeout.cpp
- timeouts/stream_receive_timeout.cpp

| Copyright © 2003 - 2006 Christopher M. Kohlhoff