File: examples.qbk

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (222 lines) | stat: -rw-r--r-- 7,501 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
[/
 / Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff 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:examples Examples]


[heading Allocation]

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

* [@boost_asio/example/allocation/server.cpp]


[heading 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]


[heading 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]


[heading 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]


[heading HTTP Client]

Example programs implementing simple HTTP 1.0 clients. These examples show how
to use the [link boost_asio.reference.read_until read_until] and [link
boost_asio.reference.async_read_until async_read_until] functions.

* [@boost_asio/example/http/client/sync_client.cpp]
* [@boost_asio/example/http/client/async_client.cpp]


[heading 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]


[heading 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]


[heading 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]


[heading 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]


[heading Iostreams]

Two examples showing how to use [link boost_asio.reference.ip__tcp.iostream
ip::tcp::iostream].

* [@boost_asio/example/iostreams/daytime_client.cpp]
* [@boost_asio/example/iostreams/daytime_server.cpp]


[heading 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]


[heading 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]


[heading Services]

This example demonstrates how to integrate custom functionality (in this case,
for logging) into asio's [link boost_asio.reference.io_service io_service], and
how to use a custom service with [link
boost_asio.reference.basic_stream_socket 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]


[heading 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]


[heading SSL]

Example client and server programs showing the use of the [link
boost_asio.reference.ssl__stream ssl::stream<>] template with asynchronous
operations.

* [@boost_asio/example/ssl/client.cpp]
* [@boost_asio/example/ssl/server.cpp]


[heading 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]


[heading 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]


[endsect]