]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/doc/examples.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / asio / doc / examples.qbk
CommitLineData
7c673cae
FG
1[/
2 / Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3 /
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 /]
7
8[section:examples Examples]
9
10
11* [link boost_asio.examples.cpp03_examples C++03 Examples]: Illustrates the use of
12Boost.Asio using only C++03 language and library features. Where necessary, the
13examples make use of selected Boost C++ libraries.
14
15* [link boost_asio.examples.cpp11_examples C++11 Examples]: Contains a limited set of
16the C++03 Boost.Asio examples, updated to use only C++11 library and language
17facilities. These examples do not make direct use of Boost C++ libraries.
18
19
20[section:cpp03_examples C++03 Examples]
21
22
23[heading Allocation]
24
25This example shows how to customise the allocation of memory associated with
26asynchronous operations.
27
28* [@boost_asio/example/cpp03/allocation/server.cpp]
29
30
31[heading Buffers]
32
33This example demonstrates how to create reference counted buffers that can be
34used with socket read and write operations.
35
36* [@boost_asio/example/cpp03/buffers/reference_counted.cpp]
37
38
39[heading Chat]
40
41This example implements a chat server and client. The programs use a custom
42protocol with a fixed length message header and variable length message body.
43
44* [@boost_asio/example/cpp03/chat/chat_message.hpp]
45* [@boost_asio/example/cpp03/chat/chat_client.cpp]
46* [@boost_asio/example/cpp03/chat/chat_server.cpp]
47
48The following POSIX-specific chat client demonstrates how to use the
49[link boost_asio.reference.posix__stream_descriptor posix::stream_descriptor] class to
50perform console input and output.
51
52* [@boost_asio/example/cpp03/chat/posix_chat_client.cpp]
53
54
55[heading Echo]
56
57A collection of simple clients and servers, showing the use of both synchronous
58and asynchronous operations.
59
60* [@boost_asio/example/cpp03/echo/async_tcp_echo_server.cpp]
61* [@boost_asio/example/cpp03/echo/async_udp_echo_server.cpp]
62* [@boost_asio/example/cpp03/echo/blocking_tcp_echo_client.cpp]
63* [@boost_asio/example/cpp03/echo/blocking_tcp_echo_server.cpp]
64* [@boost_asio/example/cpp03/echo/blocking_udp_echo_client.cpp]
65* [@boost_asio/example/cpp03/echo/blocking_udp_echo_server.cpp]
66
67
68[heading Fork]
69
70These POSIX-specific examples show how to use Boost.Asio in conjunction with the
71`fork()` system call. The first example illustrates the steps required to start
72a daemon process:
73
74* [@boost_asio/example/cpp03/fork/daemon.cpp]
75
76The second example demonstrates how it is possible to fork a process from
77within a completion handler.
78
79* [@boost_asio/example/cpp03/fork/process_per_connection.cpp]
80
81
82[heading HTTP Client]
83
84Example programs implementing simple HTTP 1.0 clients. These examples show how
85to use the [link boost_asio.reference.read_until read_until] and [link
86boost_asio.reference.async_read_until async_read_until] functions.
87
88* [@boost_asio/example/cpp03/http/client/sync_client.cpp]
89* [@boost_asio/example/cpp03/http/client/async_client.cpp]
90
91
92[heading HTTP Server]
93
94This example illustrates the use of asio in a simple single-threaded server
95implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown by
96cancelling all outstanding asynchronous operations.
97
98* [@boost_asio/example/cpp03/http/server/connection.cpp]
99* [@boost_asio/example/cpp03/http/server/connection.hpp]
100* [@boost_asio/example/cpp03/http/server/connection_manager.cpp]
101* [@boost_asio/example/cpp03/http/server/connection_manager.hpp]
102* [@boost_asio/example/cpp03/http/server/header.hpp]
103* [@boost_asio/example/cpp03/http/server/main.cpp]
104* [@boost_asio/example/cpp03/http/server/mime_types.cpp]
105* [@boost_asio/example/cpp03/http/server/mime_types.hpp]
106* [@boost_asio/example/cpp03/http/server/reply.cpp]
107* [@boost_asio/example/cpp03/http/server/reply.hpp]
108* [@boost_asio/example/cpp03/http/server/request.hpp]
109* [@boost_asio/example/cpp03/http/server/request_handler.cpp]
110* [@boost_asio/example/cpp03/http/server/request_handler.hpp]
111* [@boost_asio/example/cpp03/http/server/request_parser.cpp]
112* [@boost_asio/example/cpp03/http/server/request_parser.hpp]
113* [@boost_asio/example/cpp03/http/server/server.cpp]
114* [@boost_asio/example/cpp03/http/server/server.hpp]
115
116
117[heading HTTP Server 2]
118
119An HTTP server using an io_service-per-CPU design.
120
121* [@boost_asio/example/cpp03/http/server2/connection.cpp]
122* [@boost_asio/example/cpp03/http/server2/connection.hpp]
123* [@boost_asio/example/cpp03/http/server2/header.hpp]
124* [@boost_asio/example/cpp03/http/server2/io_service_pool.cpp]
125* [@boost_asio/example/cpp03/http/server2/io_service_pool.hpp]
126* [@boost_asio/example/cpp03/http/server2/main.cpp]
127* [@boost_asio/example/cpp03/http/server2/mime_types.cpp]
128* [@boost_asio/example/cpp03/http/server2/mime_types.hpp]
129* [@boost_asio/example/cpp03/http/server2/reply.cpp]
130* [@boost_asio/example/cpp03/http/server2/reply.hpp]
131* [@boost_asio/example/cpp03/http/server2/request.hpp]
132* [@boost_asio/example/cpp03/http/server2/request_handler.cpp]
133* [@boost_asio/example/cpp03/http/server2/request_handler.hpp]
134* [@boost_asio/example/cpp03/http/server2/request_parser.cpp]
135* [@boost_asio/example/cpp03/http/server2/request_parser.hpp]
136* [@boost_asio/example/cpp03/http/server2/server.cpp]
137* [@boost_asio/example/cpp03/http/server2/server.hpp]
138
139
140[heading HTTP Server 3]
141
142An HTTP server using a single io_service and a thread pool calling `io_service::run()`.
143
144* [@boost_asio/example/cpp03/http/server3/connection.cpp]
145* [@boost_asio/example/cpp03/http/server3/connection.hpp]
146* [@boost_asio/example/cpp03/http/server3/header.hpp]
147* [@boost_asio/example/cpp03/http/server3/main.cpp]
148* [@boost_asio/example/cpp03/http/server3/mime_types.cpp]
149* [@boost_asio/example/cpp03/http/server3/mime_types.hpp]
150* [@boost_asio/example/cpp03/http/server3/reply.cpp]
151* [@boost_asio/example/cpp03/http/server3/reply.hpp]
152* [@boost_asio/example/cpp03/http/server3/request.hpp]
153* [@boost_asio/example/cpp03/http/server3/request_handler.cpp]
154* [@boost_asio/example/cpp03/http/server3/request_handler.hpp]
155* [@boost_asio/example/cpp03/http/server3/request_parser.cpp]
156* [@boost_asio/example/cpp03/http/server3/request_parser.hpp]
157* [@boost_asio/example/cpp03/http/server3/server.cpp]
158* [@boost_asio/example/cpp03/http/server3/server.hpp]
159
160
161[heading HTTP Server 4]
162
163A single-threaded HTTP server implemented using stackless coroutines.
164
165* [@boost_asio/example/cpp03/http/server4/file_handler.cpp]
166* [@boost_asio/example/cpp03/http/server4/file_handler.hpp]
167* [@boost_asio/example/cpp03/http/server4/header.hpp]
168* [@boost_asio/example/cpp03/http/server4/main.cpp]
169* [@boost_asio/example/cpp03/http/server4/mime_types.cpp]
170* [@boost_asio/example/cpp03/http/server4/mime_types.hpp]
171* [@boost_asio/example/cpp03/http/server4/reply.cpp]
172* [@boost_asio/example/cpp03/http/server4/reply.hpp]
173* [@boost_asio/example/cpp03/http/server4/request.hpp]
174* [@boost_asio/example/cpp03/http/server4/request_parser.cpp]
175* [@boost_asio/example/cpp03/http/server4/request_parser.hpp]
176* [@boost_asio/example/cpp03/http/server4/server.cpp]
177* [@boost_asio/example/cpp03/http/server4/server.hpp]
178
179
180[heading ICMP]
181
182This example shows how to use raw sockets with ICMP to ping a remote host.
183
184* [@boost_asio/example/cpp03/icmp/ping.cpp]
185* [@boost_asio/example/cpp03/icmp/ipv4_header.hpp]
186* [@boost_asio/example/cpp03/icmp/icmp_header.hpp]
187
188
189[heading Invocation]
190
191This example shows how to customise handler invocation. Completion handlers are
192added to a priority queue rather than executed immediately.
193
194* [@boost_asio/example/cpp03/invocation/prioritised_handlers.cpp]
195
196
197[heading Iostreams]
198
199Two examples showing how to use [link boost_asio.reference.ip__tcp.iostream
200ip::tcp::iostream].
201
202* [@boost_asio/example/cpp03/iostreams/daytime_client.cpp]
203* [@boost_asio/example/cpp03/iostreams/daytime_server.cpp]
204* [@boost_asio/example/cpp03/iostreams/http_client.cpp]
205
206
207[heading Multicast]
208
209An example showing the use of multicast to transmit packets to a group of
210subscribers.
211
212* [@boost_asio/example/cpp03/multicast/receiver.cpp]
213* [@boost_asio/example/cpp03/multicast/sender.cpp]
214
215
216[heading Serialization]
217
218This example shows how Boost.Serialization can be used with asio to encode and
219decode structures for transmission over a socket.
220
221* [@boost_asio/example/cpp03/serialization/client.cpp]
222* [@boost_asio/example/cpp03/serialization/connection.hpp]
223* [@boost_asio/example/cpp03/serialization/server.cpp]
224* [@boost_asio/example/cpp03/serialization/stock.hpp]
225
226
227[heading Services]
228
229This example demonstrates how to integrate custom functionality (in this case,
230for logging) into asio's [link boost_asio.reference.io_service io_service], and
231how to use a custom service with [link
232boost_asio.reference.basic_stream_socket basic_stream_socket<>].
233
234* [@boost_asio/example/cpp03/services/basic_logger.hpp]
235* [@boost_asio/example/cpp03/services/daytime_client.cpp]
236* [@boost_asio/example/cpp03/services/logger.hpp]
237* [@boost_asio/example/cpp03/services/logger_service.cpp]
238* [@boost_asio/example/cpp03/services/logger_service.hpp]
239* [@boost_asio/example/cpp03/services/stream_socket_service.hpp]
240
241
242[heading SOCKS 4]
243
244Example client program implementing the SOCKS 4 protocol for communication via
245a proxy.
246
247* [@boost_asio/example/cpp03/socks4/sync_client.cpp]
248* [@boost_asio/example/cpp03/socks4/socks4.hpp]
249
250
251[heading SSL]
252
253Example client and server programs showing the use of the [link
254boost_asio.reference.ssl__stream ssl::stream<>] template with asynchronous operations.
255
256* [@boost_asio/example/cpp03/ssl/client.cpp]
257* [@boost_asio/example/cpp03/ssl/server.cpp]
258
259
260[heading Timeouts]
261
262A collection of examples showing how to cancel long running asynchronous
263operations after a period of time.
264
265* [@boost_asio/example/cpp03/timeouts/async_tcp_client.cpp]
266* [@boost_asio/example/cpp03/timeouts/blocking_tcp_client.cpp]
267* [@boost_asio/example/cpp03/timeouts/blocking_udp_client.cpp]
268* [@boost_asio/example/cpp03/timeouts/server.cpp]
269
270
271[heading Timers]
272
273Examples showing how to customise deadline_timer using different time types.
274
275* [@boost_asio/example/cpp03/timers/tick_count_timer.cpp]
276* [@boost_asio/example/cpp03/timers/time_t_timer.cpp]
277
278
279[heading Porthopper]
280
281Example illustrating mixed synchronous and asynchronous operations, and how to
282use Boost.Lambda with Boost.Asio.
283
284* [@boost_asio/example/cpp03/porthopper/protocol.hpp]
285* [@boost_asio/example/cpp03/porthopper/client.cpp]
286* [@boost_asio/example/cpp03/porthopper/server.cpp]
287
288
289[heading Nonblocking]
290
291Example demonstrating reactor-style operations for integrating a third-party
292library that wants to perform the I/O operations itself.
293
294* [@boost_asio/example/cpp03/nonblocking/third_party_lib.cpp]
295
296
297[heading Spawn]
298
299Example of using the boost::asio::spawn() function, a wrapper around the
300[@http://www.boost.org/doc/libs/release/libs/coroutine/index.html Boost.Coroutine]
301library, to implement a chain of asynchronous operations using stackful
302coroutines.
303
304* [@boost_asio/example/cpp03/spawn/echo_server.cpp]
305
306
307[heading UNIX Domain Sockets]
308
309Examples showing how to use UNIX domain (local) sockets.
310
311* [@boost_asio/example/cpp03/local/connect_pair.cpp]
312* [@boost_asio/example/cpp03/local/stream_server.cpp]
313* [@boost_asio/example/cpp03/local/stream_client.cpp]
314
315
316[heading Windows]
317
318An example showing how to use the Windows-specific function `TransmitFile`
319with Boost.Asio.
320
321* [@boost_asio/example/cpp03/windows/transmit_file.cpp]
322
323
324[endsect]
325
326
327[section:cpp11_examples C++11 Examples]
328
329
330[heading Allocation]
331
332This example shows how to customise the allocation of memory associated with
333asynchronous operations.
334
335* [@boost_asio/example/cpp11/allocation/server.cpp]
336
337
338[heading Buffers]
339
340This example demonstrates how to create reference counted buffers that can be
341used with socket read and write operations.
342
343* [@boost_asio/example/cpp11/buffers/reference_counted.cpp]
344
345
346[heading Chat]
347
348This example implements a chat server and client. The programs use a custom
349protocol with a fixed length message header and variable length message body.
350
351* [@boost_asio/example/cpp11/chat/chat_message.hpp]
352* [@boost_asio/example/cpp11/chat/chat_client.cpp]
353* [@boost_asio/example/cpp11/chat/chat_server.cpp]
354
355
356[heading Echo]
357
358A collection of simple clients and servers, showing the use of both synchronous
359and asynchronous operations.
360
361* [@boost_asio/example/cpp11/echo/async_tcp_echo_server.cpp]
362* [@boost_asio/example/cpp11/echo/async_udp_echo_server.cpp]
363* [@boost_asio/example/cpp11/echo/blocking_tcp_echo_client.cpp]
364* [@boost_asio/example/cpp11/echo/blocking_tcp_echo_server.cpp]
365* [@boost_asio/example/cpp11/echo/blocking_udp_echo_client.cpp]
366* [@boost_asio/example/cpp11/echo/blocking_udp_echo_server.cpp]
367
368
369[heading Futures]
370
371This example demonstrates how to use std::future in conjunction with
372Boost.Asio's asynchronous operations.
373
374* [@boost_asio/example/cpp11/futures/daytime_client.cpp]
375
376
377[heading HTTP Server]
378
379This example illustrates the use of asio in a simple single-threaded server
380implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown by
381cancelling all outstanding asynchronous operations.
382
383* [@boost_asio/example/cpp11/http/server/connection.cpp]
384* [@boost_asio/example/cpp11/http/server/connection.hpp]
385* [@boost_asio/example/cpp11/http/server/connection_manager.cpp]
386* [@boost_asio/example/cpp11/http/server/connection_manager.hpp]
387* [@boost_asio/example/cpp11/http/server/header.hpp]
388* [@boost_asio/example/cpp11/http/server/main.cpp]
389* [@boost_asio/example/cpp11/http/server/mime_types.cpp]
390* [@boost_asio/example/cpp11/http/server/mime_types.hpp]
391* [@boost_asio/example/cpp11/http/server/reply.cpp]
392* [@boost_asio/example/cpp11/http/server/reply.hpp]
393* [@boost_asio/example/cpp11/http/server/request.hpp]
394* [@boost_asio/example/cpp11/http/server/request_handler.cpp]
395* [@boost_asio/example/cpp11/http/server/request_handler.hpp]
396* [@boost_asio/example/cpp11/http/server/request_parser.cpp]
397* [@boost_asio/example/cpp11/http/server/request_parser.hpp]
398* [@boost_asio/example/cpp11/http/server/server.cpp]
399* [@boost_asio/example/cpp11/http/server/server.hpp]
400
401
402[heading Spawn]
403
404Example of using the boost::asio::spawn() function, a wrapper around the
405[@http://www.boost.org/doc/libs/release/libs/coroutine/index.html Boost.Coroutine]
406library, to implement a chain of asynchronous operations using stackful
407coroutines.
408
409* [@boost_asio/example/cpp11/spawn/echo_server.cpp]
410
411
412[endsect]
413
414
415[endsect]