文章目录

  • Allocation
  • Buffers
  • Chat
  • Echo
  • HTTP Client
  • HTTP Server
  • HTTP Server 2
  • HTTP Server 3
  • HTTP Server 4
  • ICMP
  • Invocation
  • Iostreams
  • Multicast
  • Serialization
  • Services
  • SOCKS 4
  • SSL
  • Timeouts
  • Timers
  • Porthopper
  • Nonblocking
  • UNIX Domain Sockets
  • Windows

Allocation

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

  • boost_asio/example/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/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/chat/chat_message.hpp
  • boost_asio/example/chat/chat_client.cpp
  • boost_asio/example/chat/chat_server.cpp

The following POSIX-specific chat client demonstrates how to use the posix::stream_descriptor class to perform console input and output.

  • boost_asio/example/chat/posix_chat_client.cpp

Echo

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

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

HTTP Client

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

  • boost_asio/example/http/client/sync_client.cpp
  • boost_asio/example/http/client/async_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/http/server/connection.cpp
  • boost_asio/example/http/server/connection.hpp
  • boost_asio/example/http/server/connection_manager.cpp
  • boost_asio/example/http/server/connection_manager.hpp
  • boost_asio/example/http/server/header.hpp
  • boost_asio/example/http/server/mime_types.cpp
  • boost_asio/example/http/server/mime_types.hpp
  • boost_asio/example/http/server/posix_main.cpp
  • boost_asio/example/http/server/reply.cpp
  • boost_asio/example/http/server/reply.hpp
  • boost_asio/example/http/server/request.hpp
  • boost_asio/example/http/server/request_handler.cpp
  • boost_asio/example/http/server/request_handler.hpp
  • boost_asio/example/http/server/request_parser.cpp
  • boost_asio/example/http/server/request_parser.hpp
  • boost_asio/example/http/server/server.cpp
  • boost_asio/example/http/server/server.hpp
  • boost_asio/example/http/server/win_main.cpp

HTTP Server 2

An HTTP server using an io_service-per-CPU design.

  • boost_asio/example/http/server2/connection.cpp
  • boost_asio/example/http/server2/connection.hpp
  • boost_asio/example/http/server2/header.hpp
  • boost_asio/example/http/server2/io_service_pool.cpp
  • boost_asio/example/http/server2/io_service_pool.hpp
  • boost_asio/example/http/server2/mime_types.cpp
  • boost_asio/example/http/server2/mime_types.hpp
  • boost_asio/example/http/server2/posix_main.cpp
  • boost_asio/example/http/server2/reply.cpp
  • boost_asio/example/http/server2/reply.hpp
  • boost_asio/example/http/server2/request.hpp
  • boost_asio/example/http/server2/request_handler.cpp
  • boost_asio/example/http/server2/request_handler.hpp
  • boost_asio/example/http/server2/request_parser.cpp
  • boost_asio/example/http/server2/request_parser.hpp
  • boost_asio/example/http/server2/server.cpp
  • boost_asio/example/http/server2/server.hpp
  • boost_asio/example/http/server2/win_main.cpp

HTTP Server 3

An HTTP server using a single io_service and a thread pool calling io_service::run().

  • boost_asio/example/http/server3/connection.cpp
  • boost_asio/example/http/server3/connection.hpp
  • boost_asio/example/http/server3/header.hpp
  • boost_asio/example/http/server3/mime_types.cpp
  • boost_asio/example/http/server3/mime_types.hpp
  • boost_asio/example/http/server3/posix_main.cpp
  • boost_asio/example/http/server3/reply.cpp
  • boost_asio/example/http/server3/reply.hpp
  • boost_asio/example/http/server3/request.hpp
  • boost_asio/example/http/server3/request_handler.cpp
  • boost_asio/example/http/server3/request_handler.hpp
  • boost_asio/example/http/server3/request_parser.cpp
  • boost_asio/example/http/server3/request_parser.hpp
  • boost_asio/example/http/server3/server.cpp
  • boost_asio/example/http/server3/server.hpp
  • boost_asio/example/http/server3/win_main.cpp

HTTP Server 4

A single-threaded HTTP server implemented using stackless coroutines.

  • boost_asio/example/http/server4/coroutine.hpp
  • boost_asio/example/http/server4/file_handler.cpp
  • boost_asio/example/http/server4/file_handler.hpp
  • boost_asio/example/http/server4/header.hpp
  • boost_asio/example/http/server4/mime_types.cpp
  • boost_asio/example/http/server4/mime_types.hpp
  • boost_asio/example/http/server4/posix_main.cpp
  • boost_asio/example/http/server4/reply.cpp
  • boost_asio/example/http/server4/reply.hpp
  • boost_asio/example/http/server4/request.hpp
  • boost_asio/example/http/server4/request_parser.cpp
  • boost_asio/example/http/server4/request_parser.hpp
  • boost_asio/example/http/server4/server.cpp
  • boost_asio/example/http/server4/server.hpp
  • boost_asio/example/http/server4/unyield.hpp
  • boost_asio/example/http/server4/win_main.cpp
  • boost_asio/example/http/server4/yield.hpp

ICMP

This example shows how to use raw sockets with ICMP to ping a remote host.

  • boost_asio/example/icmp/ping.cpp
  • boost_asio/example/icmp/ipv4_header.hpp
  • boost_asio/example/icmp/icmp_header.hpp

Invocation

This example shows how to customise handler invocation. Completion handlers are added to a priority queue rather than executed immediately.

  • boost_asio/example/invocation/prioritised_handlers.cpp

Iostreams

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

  • boost_asio/example/iostreams/daytime_client.cpp
  • boost_asio/example/iostreams/daytime_server.cpp

Multicast

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

  • boost_asio/example/multicast/receiver.cpp
  • boost_asio/example/multicast/sender.cpp

Serialization

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

  • boost_asio/example/serialization/client.cpp
  • boost_asio/example/serialization/connection.hpp
  • boost_asio/example/serialization/server.cpp
  • boost_asio/example/serialization/stock.hpp

Services

This example demonstrates how to integrate custom functionality (in this case, for logging) into asio’s io_service, and how to use a custom service with basic_stream_socket<>.

  • boost_asio/example/services/basic_logger.hpp
  • boost_asio/example/services/daytime_client.cpp
  • boost_asio/example/services/logger.hpp
  • boost_asio/example/services/logger_service.cpp
  • boost_asio/example/services/logger_service.hpp
  • boost_asio/example/services/stream_socket_service.hpp

SOCKS 4

Example client program implementing the SOCKS 4 protocol for communication via a proxy.

  • boost_asio/example/socks4/sync_client.cpp
  • boost_asio/example/socks4/socks4.hpp

SSL

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

  • boost_asio/example/ssl/client.cpp
  • boost_asio/example/ssl/server.cpp

Timeouts

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

  • boost_asio/example/timeouts/accept_timeout.cpp
  • boost_asio/example/timeouts/connect_timeout.cpp
  • boost_asio/example/timeouts/datagram_receive_timeout.cpp
  • boost_asio/example/timeouts/stream_receive_timeout.cpp

Timers

Examples showing how to customise deadline_timer using different time types.

  • boost_asio/example/timers/tick_count_timer.cpp
  • boost_asio/example/timers/time_t_timer.cpp

Porthopper

Example illustrating mixed synchronous and asynchronous operations, and how to use Boost.Lambda with Boost.Asio.

  • boost_asio/example/porthopper/protocol.hpp
  • boost_asio/example/porthopper/client.cpp
  • boost_asio/example/porthopper/server.cpp

Nonblocking

Example demonstrating reactor-style operations for integrating a third-party library that wants to perform the I/O operations itself.

  • boost_asio/example/nonblocking/third_party_lib.cpp

UNIX Domain Sockets

Examples showing how to use UNIX domain (local) sockets.

  • boost_asio/example/local/connect_pair.cpp
  • boost_asio/example/local/stream_server.cpp
  • boost_asio/example/local/stream_client.cpp

Windows

An example showing how to use the Windows-specific function TransmitFile with Boost.Asio.

  • boost_asio/example/windows/transmit_file.cpp

Boost Asio Examples(整理)相关推荐

  1. boost::asio中的C/S同步实例源码

    近来狂热地研究boost的开发技术,现将读书笔记整理如下: 需要说明的是, 本博该专题下面关于boost的源码是采用boost1.55版本, 运行在Ubuntu 14.04 64bit下面, 使用ap ...

  2. muduo 与 boost asio 吞吐量对比

    muduo (http://code.google.com/p/muduo) 是一个基于 Reactor 模式的 C++ 网络库,我在编写它的时候并没有以高并发高吞吐为主要目标,但出乎我的意料,pin ...

  3. boost::asio译文

    boost::asio译文 Christopher Kohlhoff Copyright © 2003-2012 Christopher M. Kohlhoff 以Boost1.0的软件授权进行发布( ...

  4. Boost.Asio技术文档汇总

    Christopher Kohlhoff Copyright © 2003-2012 Christopher M. Kohlhoff 以Boost1.0的软件授权进行发布(见附带的LICENSE_1_ ...

  5. VScode CMake 编写 Boost Asio Chat程序----记录6

    目录 一 前言 二  参考 三 程序 四 解读 五  注意事项 一 前言 实现了如下功能: 1 留言室(原功能). 2 两个client可以相互交谈 但是需要离开room, 要想留言,需要重新进入, ...

  6. boost::asio中文文档

    Christopher Kohlhoff Copyright © 2003-2012 Christopher M. Kohlhoff 以Boost1.0的软件授权进行发布(见附带的LICENSE_1_ ...

  7. Boost.Asio技术文档

    文章来源:http://blog.csdn.net/henreash/article/details/7469707 Boost.Asio是一个跨平台的网络及底层IO的C++编程库,它使用现代C++手 ...

  8. Boost.Asio 技术文档

    Christopher Kohlhoff Copyright © 2003-2012 Christopher M. Kohlhoff 以Boost1.0的软件授权进行发布(见附带的LICENSE_1_ ...

  9. Boost.Asio初步(一)

    [注]本翻译来自https://theboostcpplibraries.com/boost.asio.boost.asio从v1.66起io_service变成了io_context,二者有一定差异 ...

  10. boost::asio使用UDP协议通信源码实现

    说明:以下源码来自参考文献[1], 比原文更丰富, 更有指导意义, 方便日后参考. udp servr端源码 //g++ -g udp_server.cpp -o udp_server -lboost ...

最新文章

  1. RHEL\CentOS 7 下 MySQL 连接数被限制为214个
  2. 如何从代码层面优化系统性能
  3. C 标准转换运算符const_cast
  4. yii 使用 有赞sdk_有赞ABTest系统:数据驱动增长实践
  5. sklearn决策树概述
  6. iOS coredata 避免添加重复数据
  7. 10个绕过反病毒的恶意用户技巧
  8. matlab的try函数,matlab – 是否可以在没有try块的情况下测试函数句柄?
  9. 校验身份证_Excel每日一技巧:从身份证号可以提取哪些信息呢?
  10. [poj2752]Seek the Name, Seek the Fame_KMP
  11. MT4本地跟单使用说明
  12. android模拟器录制视频教程,夜神安卓模拟器怎么录制视频 夜神安卓模拟器录制视频教程...
  13. 在线预览pdf(不可下载)
  14. 大数据之Hadoop学习——动手实战学习MapReduce编程实例
  15. Heap size 80869K exceeds notification threshold (51200K)
  16. eclipse设置炫酷唯美背景图片
  17. 详解:Hyper-V虚拟主机数据磁盘扩容
  18. The role of Roles
  19. 取中文拼音首字母,提供了多音字的选择 js javascript c# java 存储过程
  20. pandas库读取多个excel文件数据并进行筛选合并处理后导入到新表格中

热门文章

  1. 吴恩达课后作业学习1-week4-homework-two-hidden-layer -1
  2. angular的组件通信
  3. 《中国人工智能学会通讯》——4.40 什么是类人概念学习?
  4. 哈佛学生是如何度过大学4年的(没有学习动力时候就看一遍)
  5. QTP连接数据库,并将数据保存至Excel中
  6. 55.Linux/Unix 系统编程手册(下) -- 文件加锁
  7. 2.ELK stack 集群 搭建
  8. 60. cache
  9. Magento url 问题
  10. [2019杭电多校第三场][hdu6609]Find the answer(线段树)