Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72428 - in branches/release: boost boost/asio boost/asio/detail boost/asio/detail/impl boost/asio/impl boost/asio/ip boost/asio/ip/detail boost/asio/ip/detail/impl boost/asio/ip/impl boost/asio/local boost/asio/local/detail boost/asio/local/detail/impl boost/asio/posix boost/asio/ssl boost/asio/ssl/detail boost/asio/ssl/detail/impl boost/asio/ssl/impl boost/asio/ssl/old boost/asio/ssl/old/detail boost/asio/windows libs/asio/doc libs/asio/doc/overview libs/asio/doc/requirements libs/asio/example/allocation libs/asio/example/buffers libs/asio/example/chat libs/asio/example/echo libs/asio/example/fork libs/asio/example/http/client libs/asio/example/http/server libs/asio/example/http/server2 libs/asio/example/http/server3 libs/asio/example/http/server4 libs/asio/example/iostreams libs/asio/example/local libs/asio/example/nonblocking libs/asio/example/porthopper libs/asio/example/serialization libs/asio/example/services libs/asio/example/socks4 libs/asio/example/ssl libs/asio/example/timeouts libs/asio/example/timers libs/asio/example/tutorial/daytime1 libs/asio/example/tutorial/daytime2 libs/asio/example/tutorial/daytime3 libs/asio/example/tutorial/daytime4 libs/asio/example/tutorial/daytime7 libs/asio/example/tutorial/timer2 libs/asio/example/tutorial/timer5 libs/asio/example/windows libs/asio/test libs/asio/test/archetypes libs/asio/test/ip libs/asio/test/local libs/asio/test/posix libs/asio/test/ssl libs/asio/test/windows libs/asio/tools
From: chris_at_[hidden]
Date: 2011-06-05 19:22:25


Author: chris_kohlhoff
Date: 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
New Revision: 72428
URL: http://svn.boost.org/trac/boost/changeset/72428

Log:
Merge asio from trunk.
Added:
   branches/release/boost/asio/basic_seq_packet_socket.hpp (contents, props changed)
   branches/release/boost/asio/basic_signal_set.hpp (contents, props changed)
   branches/release/boost/asio/connect.hpp (contents, props changed)
   branches/release/boost/asio/detail/array.hpp (contents, props changed)
   branches/release/boost/asio/detail/atomic_count.hpp (contents, props changed)
   branches/release/boost/asio/detail/handler_tracking.hpp (contents, props changed)
   branches/release/boost/asio/detail/handler_type_requirements.hpp (contents, props changed)
   branches/release/boost/asio/detail/impl/handler_tracking.ipp (contents, props changed)
   branches/release/boost/asio/detail/impl/signal_set_service.ipp (contents, props changed)
   branches/release/boost/asio/detail/impl/win_static_mutex.ipp (contents, props changed)
   branches/release/boost/asio/detail/null_static_mutex.hpp (contents, props changed)
   branches/release/boost/asio/detail/posix_static_mutex.hpp (contents, props changed)
   branches/release/boost/asio/detail/reactive_socket_recvmsg_op.hpp (contents, props changed)
   branches/release/boost/asio/detail/scoped_ptr.hpp (contents, props changed)
   branches/release/boost/asio/detail/signal_handler.hpp (contents, props changed)
   branches/release/boost/asio/detail/signal_op.hpp (contents, props changed)
   branches/release/boost/asio/detail/signal_set_service.hpp (contents, props changed)
   branches/release/boost/asio/detail/static_mutex.hpp (contents, props changed)
   branches/release/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp (contents, props changed)
   branches/release/boost/asio/detail/win_static_mutex.hpp (contents, props changed)
   branches/release/boost/asio/impl/connect.hpp (contents, props changed)
   branches/release/boost/asio/seq_packet_socket_service.hpp (contents, props changed)
   branches/release/boost/asio/signal_set.hpp (contents, props changed)
   branches/release/boost/asio/signal_set_service.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/engine.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/handshake_op.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/impl/
   branches/release/boost/asio/ssl/detail/impl/engine.ipp (contents, props changed)
   branches/release/boost/asio/ssl/detail/impl/openssl_init.ipp (contents, props changed)
   branches/release/boost/asio/ssl/detail/io.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/password_callback.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/read_op.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/shutdown_op.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/stream_core.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/verify_callback.hpp (contents, props changed)
   branches/release/boost/asio/ssl/detail/write_op.hpp (contents, props changed)
   branches/release/boost/asio/ssl/error.hpp (contents, props changed)
   branches/release/boost/asio/ssl/impl/
   branches/release/boost/asio/ssl/impl/context.hpp (contents, props changed)
   branches/release/boost/asio/ssl/impl/context.ipp (contents, props changed)
   branches/release/boost/asio/ssl/impl/error.ipp (contents, props changed)
   branches/release/boost/asio/ssl/impl/rfc2818_verification.ipp (contents, props changed)
   branches/release/boost/asio/ssl/impl/src.hpp (contents, props changed)
   branches/release/boost/asio/ssl/old/
   branches/release/boost/asio/ssl/old/basic_context.hpp (contents, props changed)
   branches/release/boost/asio/ssl/old/context_service.hpp (contents, props changed)
   branches/release/boost/asio/ssl/old/detail/
   branches/release/boost/asio/ssl/old/detail/openssl_context_service.hpp (contents, props changed)
   branches/release/boost/asio/ssl/old/detail/openssl_operation.hpp (contents, props changed)
   branches/release/boost/asio/ssl/old/detail/openssl_stream_service.hpp (contents, props changed)
   branches/release/boost/asio/ssl/old/stream.hpp (contents, props changed)
   branches/release/boost/asio/ssl/old/stream_service.hpp (contents, props changed)
   branches/release/boost/asio/ssl/rfc2818_verification.hpp (contents, props changed)
   branches/release/boost/asio/ssl/verify_context.hpp (contents, props changed)
   branches/release/boost/asio/ssl/verify_mode.hpp (contents, props changed)
   branches/release/libs/asio/doc/overview/cpp2011.qbk (contents, props changed)
   branches/release/libs/asio/doc/overview/handler_tracking.qbk (contents, props changed)
   branches/release/libs/asio/doc/overview/signals.qbk (contents, props changed)
   branches/release/libs/asio/doc/requirements/ComposedConnectHandler.qbk (contents, props changed)
   branches/release/libs/asio/doc/requirements/HandshakeHandler.qbk (contents, props changed)
   branches/release/libs/asio/doc/requirements/SeqPacketSocketService.qbk (contents, props changed)
   branches/release/libs/asio/doc/requirements/ShutdownHandler.qbk (contents, props changed)
   branches/release/libs/asio/doc/requirements/SignalHandler.qbk (contents, props changed)
   branches/release/libs/asio/doc/requirements/SignalSetService.qbk (contents, props changed)
   branches/release/libs/asio/example/fork/
   branches/release/libs/asio/example/fork/Jamfile (contents, props changed)
   branches/release/libs/asio/example/fork/Jamfile.v2 (contents, props changed)
   branches/release/libs/asio/example/fork/daemon.cpp (contents, props changed)
   branches/release/libs/asio/example/fork/process_per_connection.cpp (contents, props changed)
   branches/release/libs/asio/example/http/server/main.cpp (contents, props changed)
   branches/release/libs/asio/example/http/server2/main.cpp (contents, props changed)
   branches/release/libs/asio/example/http/server3/main.cpp (contents, props changed)
   branches/release/libs/asio/example/http/server4/main.cpp (contents, props changed)
   branches/release/libs/asio/example/iostreams/http_client.cpp (contents, props changed)
   branches/release/libs/asio/test/archetypes/gettable_socket_option.hpp (contents, props changed)
   branches/release/libs/asio/test/archetypes/settable_socket_option.hpp (contents, props changed)
   branches/release/libs/asio/test/basic_raw_socket.cpp (contents, props changed)
   branches/release/libs/asio/test/basic_seq_packet_socket.cpp (contents, props changed)
   branches/release/libs/asio/test/basic_signal_set.cpp (contents, props changed)
   branches/release/libs/asio/test/basic_streambuf.cpp (contents, props changed)
   branches/release/libs/asio/test/connect.cpp (contents, props changed)
   branches/release/libs/asio/test/raw_socket_service.cpp (contents, props changed)
   branches/release/libs/asio/test/seq_packet_socket_service.cpp (contents, props changed)
   branches/release/libs/asio/test/signal_set.cpp (contents, props changed)
   branches/release/libs/asio/test/signal_set_service.cpp (contents, props changed)
   branches/release/libs/asio/test/ssl/rfc2818_verification.cpp (contents, props changed)
   branches/release/libs/asio/test/streambuf.cpp (contents, props changed)
   branches/release/libs/asio/tools/
   branches/release/libs/asio/tools/handlerviz.pl (contents, props changed)
Removed:
   branches/release/boost/asio/ssl/detail/openssl_context_service.hpp
   branches/release/boost/asio/ssl/detail/openssl_operation.hpp
   branches/release/boost/asio/ssl/detail/openssl_stream_service.hpp
   branches/release/libs/asio/example/http/server/posix_main.cpp
   branches/release/libs/asio/example/http/server/win_main.cpp
   branches/release/libs/asio/example/http/server2/posix_main.cpp
   branches/release/libs/asio/example/http/server2/win_main.cpp
   branches/release/libs/asio/example/http/server3/posix_main.cpp
   branches/release/libs/asio/example/http/server3/win_main.cpp
   branches/release/libs/asio/example/http/server4/posix_main.cpp
   branches/release/libs/asio/example/http/server4/win_main.cpp
Text files modified:
   branches/release/boost/asio.hpp | 6
   branches/release/boost/asio/basic_datagram_socket.hpp | 186
   branches/release/boost/asio/basic_deadline_timer.hpp | 83
   branches/release/boost/asio/basic_io_object.hpp | 182
   branches/release/boost/asio/basic_raw_socket.hpp | 185
   branches/release/boost/asio/basic_serial_port.hpp | 159
   branches/release/boost/asio/basic_socket.hpp | 536
   branches/release/boost/asio/basic_socket_acceptor.hpp | 364
   branches/release/boost/asio/basic_socket_iostream.hpp | 145
   branches/release/boost/asio/basic_socket_streambuf.hpp | 384
   branches/release/boost/asio/basic_stream_socket.hpp | 146
   branches/release/boost/asio/basic_streambuf.hpp | 4
   branches/release/boost/asio/buffer.hpp | 1350
   branches/release/boost/asio/buffered_read_stream.hpp | 99
   branches/release/boost/asio/buffered_stream.hpp | 7
   branches/release/boost/asio/buffered_write_stream.hpp | 87
   branches/release/boost/asio/buffers_iterator.hpp | 53
   branches/release/boost/asio/completion_condition.hpp | 56
   branches/release/boost/asio/datagram_socket_service.hpp | 107
   branches/release/boost/asio/deadline_timer_service.hpp | 24
   branches/release/boost/asio/detail/array_fwd.hpp | 9
   branches/release/boost/asio/detail/bind_handler.hpp | 96
   branches/release/boost/asio/detail/buffer_sequence_adapter.hpp | 60
   branches/release/boost/asio/detail/buffered_stream_storage.hpp | 19
   branches/release/boost/asio/detail/completion_handler.hpp | 10
   branches/release/boost/asio/detail/config.hpp | 122
   branches/release/boost/asio/detail/deadline_timer_service.hpp | 30
   branches/release/boost/asio/detail/descriptor_ops.hpp | 10
   branches/release/boost/asio/detail/descriptor_read_op.hpp | 8
   branches/release/boost/asio/detail/descriptor_write_op.hpp | 8
   branches/release/boost/asio/detail/dev_poll_reactor.hpp | 30
   branches/release/boost/asio/detail/epoll_reactor.hpp | 35
   branches/release/boost/asio/detail/eventfd_select_interrupter.hpp | 9
   branches/release/boost/asio/detail/gcc_arm_fenced_block.hpp | 5
   branches/release/boost/asio/detail/handler_alloc_helpers.hpp | 4
   branches/release/boost/asio/detail/handler_invoke_helpers.hpp | 15
   branches/release/boost/asio/detail/hash_map.hpp | 36
   branches/release/boost/asio/detail/impl/descriptor_ops.ipp | 85
   branches/release/boost/asio/detail/impl/dev_poll_reactor.hpp | 5
   branches/release/boost/asio/detail/impl/dev_poll_reactor.ipp | 121
   branches/release/boost/asio/detail/impl/epoll_reactor.hpp | 5
   branches/release/boost/asio/detail/impl/epoll_reactor.ipp | 180
   branches/release/boost/asio/detail/impl/eventfd_select_interrupter.ipp | 47
   branches/release/boost/asio/detail/impl/kqueue_reactor.hpp | 5
   branches/release/boost/asio/detail/impl/kqueue_reactor.ipp | 139
   branches/release/boost/asio/detail/impl/pipe_select_interrupter.ipp | 25
   branches/release/boost/asio/detail/impl/reactive_descriptor_service.ipp | 85
   branches/release/boost/asio/detail/impl/reactive_serial_port_service.ipp | 6
   branches/release/boost/asio/detail/impl/reactive_socket_service_base.ipp | 69
   branches/release/boost/asio/detail/impl/resolver_service_base.ipp | 32
   branches/release/boost/asio/detail/impl/select_reactor.hpp | 5
   branches/release/boost/asio/detail/impl/select_reactor.ipp | 39
   branches/release/boost/asio/detail/impl/service_registry.ipp | 32
   branches/release/boost/asio/detail/impl/socket_ops.ipp | 241
   branches/release/boost/asio/detail/impl/socket_select_interrupter.ipp | 20
   branches/release/boost/asio/detail/impl/strand_service.hpp | 44
   branches/release/boost/asio/detail/impl/strand_service.ipp | 41
   branches/release/boost/asio/detail/impl/task_io_service.hpp | 16
   branches/release/boost/asio/detail/impl/task_io_service.ipp | 14
   branches/release/boost/asio/detail/impl/timer_queue.ipp | 4
   branches/release/boost/asio/detail/impl/win_iocp_handle_service.ipp | 84
   branches/release/boost/asio/detail/impl/win_iocp_io_service.hpp | 21
   branches/release/boost/asio/detail/impl/win_iocp_io_service.ipp | 20
   branches/release/boost/asio/detail/impl/win_iocp_serial_port_service.ipp | 6
   branches/release/boost/asio/detail/impl/win_iocp_socket_service_base.ipp | 102
   branches/release/boost/asio/detail/impl/win_thread.ipp | 13
   branches/release/boost/asio/detail/io_control.hpp | 4
   branches/release/boost/asio/detail/kqueue_reactor.hpp | 28
   branches/release/boost/asio/detail/old_win_sdk_compat.hpp | 124
   branches/release/boost/asio/detail/pipe_select_interrupter.hpp | 9
   branches/release/boost/asio/detail/posix_thread.hpp | 2
   branches/release/boost/asio/detail/reactive_descriptor_service.hpp | 61
   branches/release/boost/asio/detail/reactive_null_buffers_op.hpp | 8
   branches/release/boost/asio/detail/reactive_serial_port_service.hpp | 27
   branches/release/boost/asio/detail/reactive_socket_accept_op.hpp | 8
   branches/release/boost/asio/detail/reactive_socket_connect_op.hpp | 8
   branches/release/boost/asio/detail/reactive_socket_recv_op.hpp | 10
   branches/release/boost/asio/detail/reactive_socket_recvfrom_op.hpp | 8
   branches/release/boost/asio/detail/reactive_socket_send_op.hpp | 8
   branches/release/boost/asio/detail/reactive_socket_sendto_op.hpp | 8
   branches/release/boost/asio/detail/reactive_socket_service.hpp | 46
   branches/release/boost/asio/detail/reactive_socket_service_base.hpp | 139
   branches/release/boost/asio/detail/resolve_endpoint_op.hpp | 8
   branches/release/boost/asio/detail/resolve_op.hpp | 8
   branches/release/boost/asio/detail/resolver_service.hpp | 12
   branches/release/boost/asio/detail/resolver_service_base.hpp | 12
   branches/release/boost/asio/detail/select_reactor.hpp | 27
   branches/release/boost/asio/detail/service_registry.hpp | 3
   branches/release/boost/asio/detail/shared_ptr.hpp | 12
   branches/release/boost/asio/detail/socket_ops.hpp | 31
   branches/release/boost/asio/detail/socket_select_interrupter.hpp | 9
   branches/release/boost/asio/detail/socket_types.hpp | 2
   branches/release/boost/asio/detail/strand_service.hpp | 13
   branches/release/boost/asio/detail/task_io_service.hpp | 13
   branches/release/boost/asio/detail/task_io_service_operation.hpp | 3
   branches/release/boost/asio/detail/timer_queue.hpp | 16
   branches/release/boost/asio/detail/wait_handler.hpp | 8
   branches/release/boost/asio/detail/weak_ptr.hpp | 13
   branches/release/boost/asio/detail/win_iocp_handle_read_op.hpp | 9
   branches/release/boost/asio/detail/win_iocp_handle_service.hpp | 49
   branches/release/boost/asio/detail/win_iocp_handle_write_op.hpp | 8
   branches/release/boost/asio/detail/win_iocp_io_service.hpp | 20
   branches/release/boost/asio/detail/win_iocp_null_buffers_op.hpp | 8
   branches/release/boost/asio/detail/win_iocp_operation.hpp | 2
   branches/release/boost/asio/detail/win_iocp_overlapped_op.hpp | 8
   branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp | 8
   branches/release/boost/asio/detail/win_iocp_serial_port_service.hpp | 26
   branches/release/boost/asio/detail/win_iocp_socket_accept_op.hpp | 10
   branches/release/boost/asio/detail/win_iocp_socket_recv_op.hpp | 8
   branches/release/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp | 8
   branches/release/boost/asio/detail/win_iocp_socket_send_op.hpp | 8
   branches/release/boost/asio/detail/win_iocp_socket_service.hpp | 61
   branches/release/boost/asio/detail/win_iocp_socket_service_base.hpp | 127
   branches/release/boost/asio/detail/wince_thread.hpp | 2
   branches/release/boost/asio/detail/wrapped_handler.hpp | 61
   branches/release/boost/asio/error.hpp | 24
   branches/release/boost/asio/impl/error.ipp | 26
   branches/release/boost/asio/impl/io_service.hpp | 32
   branches/release/boost/asio/impl/io_service.ipp | 14
   branches/release/boost/asio/impl/read.hpp | 200
   branches/release/boost/asio/impl/read_at.hpp | 209
   branches/release/boost/asio/impl/read_until.hpp | 286
   branches/release/boost/asio/impl/src.hpp | 3
   branches/release/boost/asio/impl/write.hpp | 231
   branches/release/boost/asio/impl/write_at.hpp | 236
   branches/release/boost/asio/io_service.hpp | 125
   branches/release/boost/asio/ip/address.hpp | 19
   branches/release/boost/asio/ip/address_v4.hpp | 41
   branches/release/boost/asio/ip/address_v6.hpp | 22
   branches/release/boost/asio/ip/basic_endpoint.hpp | 26
   branches/release/boost/asio/ip/basic_resolver.hpp | 27
   branches/release/boost/asio/ip/basic_resolver_entry.hpp | 10
   branches/release/boost/asio/ip/basic_resolver_iterator.hpp | 25
   branches/release/boost/asio/ip/basic_resolver_query.hpp | 69
   branches/release/boost/asio/ip/detail/endpoint.hpp | 5
   branches/release/boost/asio/ip/detail/impl/endpoint.ipp | 20
   branches/release/boost/asio/ip/detail/socket_option.hpp | 43
   branches/release/boost/asio/ip/icmp.hpp | 12
   branches/release/boost/asio/ip/impl/address.ipp | 40
   branches/release/boost/asio/ip/impl/address_v4.ipp | 24
   branches/release/boost/asio/ip/impl/address_v6.ipp | 89
   branches/release/boost/asio/ip/resolver_service.hpp | 30
   branches/release/boost/asio/ip/tcp.hpp | 10
   branches/release/boost/asio/ip/udp.hpp | 10
   branches/release/boost/asio/local/basic_endpoint.hpp | 29
   branches/release/boost/asio/local/connect_pair.hpp | 2
   branches/release/boost/asio/local/detail/endpoint.hpp | 4
   branches/release/boost/asio/local/detail/impl/endpoint.ipp | 20
   branches/release/boost/asio/placeholders.hpp | 14
   branches/release/boost/asio/posix/basic_descriptor.hpp | 238
   branches/release/boost/asio/posix/basic_stream_descriptor.hpp | 80
   branches/release/boost/asio/posix/descriptor_base.hpp | 3
   branches/release/boost/asio/posix/stream_descriptor_service.hpp | 98
   branches/release/boost/asio/raw_socket_service.hpp | 107
   branches/release/boost/asio/read.hpp | 78
   branches/release/boost/asio/read_at.hpp | 90
   branches/release/boost/asio/read_until.hpp | 32
   branches/release/boost/asio/serial_port_service.hpp | 66
   branches/release/boost/asio/socket_acceptor_service.hpp | 84
   branches/release/boost/asio/socket_base.hpp | 8
   branches/release/boost/asio/ssl.hpp | 4
   branches/release/boost/asio/ssl/basic_context.hpp | 412
   branches/release/boost/asio/ssl/context.hpp | 507
   branches/release/boost/asio/ssl/context_base.hpp | 23
   branches/release/boost/asio/ssl/context_service.hpp | 152
   branches/release/boost/asio/ssl/detail/openssl_init.hpp | 116
   branches/release/boost/asio/ssl/detail/openssl_types.hpp | 3
   branches/release/boost/asio/ssl/stream.hpp | 395
   branches/release/boost/asio/ssl/stream_base.hpp | 2
   branches/release/boost/asio/ssl/stream_service.hpp | 162
   branches/release/boost/asio/strand.hpp | 35
   branches/release/boost/asio/stream_socket_service.hpp | 96
   branches/release/boost/asio/version.hpp | 2
   branches/release/boost/asio/windows/basic_handle.hpp | 90
   branches/release/boost/asio/windows/basic_random_access_handle.hpp | 94
   branches/release/boost/asio/windows/basic_stream_handle.hpp | 85
   branches/release/boost/asio/windows/overlapped_ptr.hpp | 10
   branches/release/boost/asio/windows/random_access_handle_service.hpp | 70
   branches/release/boost/asio/windows/stream_handle_service.hpp | 66
   branches/release/boost/asio/write.hpp | 80
   branches/release/boost/asio/write_at.hpp | 89
   branches/release/libs/asio/doc/Jamfile.v2 | 2
   branches/release/libs/asio/doc/asio.qbk | 11
   branches/release/libs/asio/doc/examples.qbk | 34
   branches/release/libs/asio/doc/history.qbk | 21
   branches/release/libs/asio/doc/overview.qbk | 14
   branches/release/libs/asio/doc/overview/allocation.qbk | 5
   branches/release/libs/asio/doc/overview/basics.qbk | 12
   branches/release/libs/asio/doc/overview/implementation.qbk | 4
   branches/release/libs/asio/doc/overview/iostreams.qbk | 26
   branches/release/libs/asio/doc/overview/posix.qbk | 39
   branches/release/libs/asio/doc/overview/protocols.qbk | 34
   branches/release/libs/asio/doc/overview/reactor.qbk | 5
   branches/release/libs/asio/doc/overview/serial_ports.qbk | 11
   branches/release/libs/asio/doc/overview/ssl.qbk | 73
   branches/release/libs/asio/doc/reference.qbk | 68769 +++++++++++++++++++++++++--------------
   branches/release/libs/asio/doc/reference.xsl | 149
   branches/release/libs/asio/doc/requirements/AsyncReadStream.qbk | 4
   branches/release/libs/asio/doc/requirements/AsyncWriteStream.qbk | 4
   branches/release/libs/asio/doc/requirements/DatagramSocketService.qbk | 8
   branches/release/libs/asio/doc/requirements/DescriptorService.qbk | 40
   branches/release/libs/asio/doc/requirements/HandleService.qbk | 40
   branches/release/libs/asio/doc/requirements/Handler.qbk | 6
   branches/release/libs/asio/doc/requirements/IoObjectService.qbk | 22
   branches/release/libs/asio/doc/requirements/RawSocketService.qbk | 8
   branches/release/libs/asio/doc/requirements/ResolverService.qbk | 4
   branches/release/libs/asio/doc/requirements/SerialPortService.qbk | 42
   branches/release/libs/asio/doc/requirements/SocketAcceptorService.qbk | 59
   branches/release/libs/asio/doc/requirements/SocketService.qbk | 50
   branches/release/libs/asio/doc/requirements/StreamDescriptorService.qbk | 4
   branches/release/libs/asio/doc/requirements/StreamHandleService.qbk | 4
   branches/release/libs/asio/doc/requirements/StreamSocketService.qbk | 4
   branches/release/libs/asio/doc/requirements/TimerService.qbk | 2
   branches/release/libs/asio/doc/requirements/asynchronous_operations.qbk | 16
   branches/release/libs/asio/doc/tutorial.qbk | 62
   branches/release/libs/asio/doc/using.qbk | 3
   branches/release/libs/asio/example/allocation/server.cpp | 9
   branches/release/libs/asio/example/buffers/reference_counted.cpp | 9
   branches/release/libs/asio/example/chat/chat_client.cpp | 18
   branches/release/libs/asio/example/chat/chat_message.hpp | 4
   branches/release/libs/asio/example/chat/chat_server.cpp | 11
   branches/release/libs/asio/example/chat/posix_chat_client.cpp | 18
   branches/release/libs/asio/example/echo/async_tcp_echo_server.cpp | 15
   branches/release/libs/asio/example/echo/blocking_tcp_echo_client.cpp | 2
   branches/release/libs/asio/example/echo/blocking_tcp_echo_server.cpp | 2
   branches/release/libs/asio/example/http/client/async_client.cpp | 21
   branches/release/libs/asio/example/http/client/sync_client.cpp | 11
   branches/release/libs/asio/example/http/server/Jamfile | 3
   branches/release/libs/asio/example/http/server/Jamfile.v2 | 3
   branches/release/libs/asio/example/http/server/server.cpp | 44
   branches/release/libs/asio/example/http/server/server.hpp | 9
   branches/release/libs/asio/example/http/server2/Jamfile | 3
   branches/release/libs/asio/example/http/server2/Jamfile.v2 | 3
   branches/release/libs/asio/example/http/server2/io_service_pool.cpp | 2
   branches/release/libs/asio/example/http/server2/server.cpp | 41
   branches/release/libs/asio/example/http/server2/server.hpp | 12
   branches/release/libs/asio/example/http/server3/Jamfile | 3
   branches/release/libs/asio/example/http/server3/Jamfile.v2 | 3
   branches/release/libs/asio/example/http/server3/server.cpp | 38
   branches/release/libs/asio/example/http/server3/server.hpp | 12
   branches/release/libs/asio/example/http/server4/Jamfile | 3
   branches/release/libs/asio/example/http/server4/Jamfile.v2 | 3
   branches/release/libs/asio/example/iostreams/Jamfile | 12
   branches/release/libs/asio/example/iostreams/Jamfile.v2 | 1
   branches/release/libs/asio/example/iostreams/daytime_client.cpp | 6
   branches/release/libs/asio/example/iostreams/daytime_server.cpp | 8
   branches/release/libs/asio/example/local/connect_pair.cpp | 2
   branches/release/libs/asio/example/local/iostream_client.cpp | 2
   branches/release/libs/asio/example/nonblocking/third_party_lib.cpp | 8
   branches/release/libs/asio/example/porthopper/protocol.hpp | 19
   branches/release/libs/asio/example/porthopper/server.cpp | 12
   branches/release/libs/asio/example/serialization/client.cpp | 17
   branches/release/libs/asio/example/serialization/connection.hpp | 2
   branches/release/libs/asio/example/serialization/server.cpp | 21
   branches/release/libs/asio/example/services/daytime_client.cpp | 16
   branches/release/libs/asio/example/services/logger_service.hpp | 4
   branches/release/libs/asio/example/services/stream_socket_service.hpp | 4
   branches/release/libs/asio/example/socks4/sync_client.cpp | 11
   branches/release/libs/asio/example/ssl/client.cpp | 53
   branches/release/libs/asio/example/ssl/server.cpp | 24
   branches/release/libs/asio/example/timeouts/async_tcp_client.cpp | 3
   branches/release/libs/asio/example/timeouts/blocking_tcp_client.cpp | 67
   branches/release/libs/asio/example/timeouts/server.cpp | 15
   branches/release/libs/asio/example/timers/tick_count_timer.cpp | 17
   branches/release/libs/asio/example/timers/time_t_timer.cpp | 2
   branches/release/libs/asio/example/tutorial/daytime1/client.cpp | 10
   branches/release/libs/asio/example/tutorial/daytime2/server.cpp | 3
   branches/release/libs/asio/example/tutorial/daytime3/server.cpp | 5
   branches/release/libs/asio/example/tutorial/daytime4/client.cpp | 2
   branches/release/libs/asio/example/tutorial/daytime7/server.cpp | 5
   branches/release/libs/asio/example/tutorial/timer2/timer.cpp | 2
   branches/release/libs/asio/example/tutorial/timer5/timer.cpp | 2
   branches/release/libs/asio/example/windows/transmit_file.cpp | 9
   branches/release/libs/asio/test/Jamfile | 10
   branches/release/libs/asio/test/Jamfile.v2 | 20
   branches/release/libs/asio/test/buffer.cpp | 116
   branches/release/libs/asio/test/buffered_read_stream.cpp | 2
   branches/release/libs/asio/test/buffered_stream.cpp | 2
   branches/release/libs/asio/test/buffered_write_stream.cpp | 2
   branches/release/libs/asio/test/deadline_timer.cpp | 39
   branches/release/libs/asio/test/io_service.cpp | 26
   branches/release/libs/asio/test/ip/address.cpp | 100
   branches/release/libs/asio/test/ip/address_v4.cpp | 141
   branches/release/libs/asio/test/ip/address_v6.cpp | 220
   branches/release/libs/asio/test/ip/tcp.cpp | 250
   branches/release/libs/asio/test/ip/udp.cpp | 124
   branches/release/libs/asio/test/local/datagram_protocol.cpp | 2
   branches/release/libs/asio/test/local/stream_protocol.cpp | 2
   branches/release/libs/asio/test/posix/stream_descriptor.cpp | 35
   branches/release/libs/asio/test/read.cpp | 1085
   branches/release/libs/asio/test/read_at.cpp | 3215 +
   branches/release/libs/asio/test/read_until.cpp | 26
   branches/release/libs/asio/test/serial_port.cpp | 32
   branches/release/libs/asio/test/ssl/Jamfile | 1
   branches/release/libs/asio/test/ssl/Jamfile.v2 | 2
   branches/release/libs/asio/test/ssl/stream.cpp | 27
   branches/release/libs/asio/test/strand.cpp | 2
   branches/release/libs/asio/test/windows/overlapped_ptr.cpp | 4
   branches/release/libs/asio/test/windows/random_access_handle.cpp | 27
   branches/release/libs/asio/test/windows/stream_handle.cpp | 27
   branches/release/libs/asio/test/write.cpp | 965
   branches/release/libs/asio/test/write_at.cpp | 2560 +
   302 files changed, 62859 insertions(+), 29102 deletions(-)

Modified: branches/release/boost/asio.hpp
==============================================================================
--- branches/release/boost/asio.hpp (original)
+++ branches/release/boost/asio.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -21,7 +21,9 @@
 #include <boost/asio/basic_deadline_timer.hpp>
 #include <boost/asio/basic_io_object.hpp>
 #include <boost/asio/basic_raw_socket.hpp>
+#include <boost/asio/basic_seq_packet_socket.hpp>
 #include <boost/asio/basic_serial_port.hpp>
+#include <boost/asio/basic_signal_set.hpp>
 #include <boost/asio/basic_socket_acceptor.hpp>
 #include <boost/asio/basic_socket_iostream.hpp>
 #include <boost/asio/basic_socket_streambuf.hpp>
@@ -36,6 +38,7 @@
 #include <boost/asio/buffered_write_stream.hpp>
 #include <boost/asio/buffers_iterator.hpp>
 #include <boost/asio/completion_condition.hpp>
+#include <boost/asio/connect.hpp>
 #include <boost/asio/datagram_socket_service.hpp>
 #include <boost/asio/deadline_timer_service.hpp>
 #include <boost/asio/deadline_timer.hpp>
@@ -76,9 +79,12 @@
 #include <boost/asio/read.hpp>
 #include <boost/asio/read_at.hpp>
 #include <boost/asio/read_until.hpp>
+#include <boost/asio/seq_packet_socket_service.hpp>
 #include <boost/asio/serial_port.hpp>
 #include <boost/asio/serial_port_base.hpp>
 #include <boost/asio/serial_port_service.hpp>
+#include <boost/asio/signal_set.hpp>
+#include <boost/asio/signal_set_service.hpp>
 #include <boost/asio/socket_acceptor_service.hpp>
 #include <boost/asio/socket_base.hpp>
 #include <boost/asio/strand.hpp>

Modified: branches/release/boost/asio/basic_datagram_socket.hpp
==============================================================================
--- branches/release/boost/asio/basic_datagram_socket.hpp (original)
+++ branches/release/boost/asio/basic_datagram_socket.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,6 +19,7 @@
 #include <cstddef>
 #include <boost/asio/basic_socket.hpp>
 #include <boost/asio/datagram_socket_service.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 
@@ -42,8 +43,12 @@
   : public basic_socket<Protocol, DatagramSocketService>
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// socket.
+ typedef typename DatagramSocketService::native_handle_type native_type;
+
   /// The native representation of a socket.
- typedef typename DatagramSocketService::native_type native_type;
+ typedef typename DatagramSocketService::native_handle_type native_handle_type;
 
   /// The protocol type.
   typedef Protocol protocol_type;
@@ -121,12 +126,48 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_datagram_socket(boost::asio::io_service& io_service,
- const protocol_type& protocol, const native_type& native_socket)
+ const protocol_type& protocol, const native_handle_type& native_socket)
     : basic_socket<Protocol, DatagramSocketService>(
         io_service, protocol, native_socket)
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_datagram_socket from another.
+ /**
+ * This constructor moves a datagram socket from one object to another.
+ *
+ * @param other The other basic_datagram_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_datagram_socket(io_service&) constructor.
+ */
+ basic_datagram_socket(basic_datagram_socket&& other)
+ : basic_socket<Protocol, DatagramSocketService>(
+ BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other))
+ {
+ }
+
+ /// Move-assign a basic_datagram_socket from another.
+ /**
+ * This assignment operator moves a datagram socket from one object to
+ * another.
+ *
+ * @param other The other basic_datagram_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_datagram_socket(io_service&) constructor.
+ */
+ basic_datagram_socket& operator=(basic_datagram_socket&& other)
+ {
+ basic_socket<Protocol, DatagramSocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Send some data on a connected socket.
   /**
    * This function is used to send data on the datagram socket. The function
@@ -153,8 +194,9 @@
   std::size_t send(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "send");
     return s;
   }
 
@@ -180,9 +222,9 @@
       socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "send");
     return s;
   }
 
@@ -207,7 +249,8 @@
   std::size_t send(const ConstBufferSequence& buffers,
       socket_base::message_flags flags, boost::system::error_code& ec)
   {
- return this->service.send(this->implementation, buffers, flags, ec);
+ return this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
   }
 
   /// Start an asynchronous send on a connected socket.
@@ -247,9 +290,15 @@
    * std::vector.
    */
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Start an asynchronous send on a connected socket.
@@ -283,9 +332,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send(this->implementation, buffers, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Send a datagram to the specified endpoint.
@@ -318,9 +373,9 @@
       const endpoint_type& destination)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send_to(
- this->implementation, buffers, destination, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send_to(
+ this->get_implementation(), buffers, destination, 0, ec);
+ boost::asio::detail::throw_error(ec, "send_to");
     return s;
   }
 
@@ -345,9 +400,9 @@
       const endpoint_type& destination, socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send_to(
- this->implementation, buffers, destination, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send_to(
+ this->get_implementation(), buffers, destination, flags, ec);
+ boost::asio::detail::throw_error(ec, "send_to");
     return s;
   }
 
@@ -372,7 +427,7 @@
       const endpoint_type& destination, socket_base::message_flags flags,
       boost::system::error_code& ec)
   {
- return this->service.send_to(this->implementation,
+ return this->get_service().send_to(this->get_implementation(),
         buffers, destination, flags, ec);
   }
 
@@ -415,10 +470,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, WriteHandler handler)
+ const endpoint_type& destination,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send_to(this->implementation, buffers, destination, 0,
- handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send_to(this->get_implementation(), buffers,
+ destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Start an asynchronous send.
@@ -451,10 +511,14 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
       const endpoint_type& destination, socket_base::message_flags flags,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send_to(this->implementation, buffers, destination,
- flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send_to(this->get_implementation(), buffers,
+ destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data on a connected socket.
@@ -485,9 +549,9 @@
   std::size_t receive(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive(
- this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "receive");
     return s;
   }
 
@@ -514,9 +578,9 @@
       socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "receive");
     return s;
   }
 
@@ -542,7 +606,8 @@
   std::size_t receive(const MutableBufferSequence& buffers,
       socket_base::message_flags flags, boost::system::error_code& ec)
   {
- return this->service.receive(this->implementation, buffers, flags, ec);
+ return this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
   }
 
   /// Start an asynchronous receive on a connected socket.
@@ -582,9 +647,15 @@
    * std::vector.
    */
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Start an asynchronous receive on a connected socket.
@@ -617,9 +688,15 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive(this->implementation, buffers, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Receive a datagram with the endpoint of the sender.
@@ -653,9 +730,9 @@
       endpoint_type& sender_endpoint)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive_from(
- this->implementation, buffers, sender_endpoint, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive_from(
+ this->get_implementation(), buffers, sender_endpoint, 0, ec);
+ boost::asio::detail::throw_error(ec, "receive_from");
     return s;
   }
   
@@ -680,9 +757,9 @@
       endpoint_type& sender_endpoint, socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive_from(
- this->implementation, buffers, sender_endpoint, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive_from(
+ this->get_implementation(), buffers, sender_endpoint, flags, ec);
+ boost::asio::detail::throw_error(ec, "receive_from");
     return s;
   }
   
@@ -707,8 +784,8 @@
       endpoint_type& sender_endpoint, socket_base::message_flags flags,
       boost::system::error_code& ec)
   {
- return this->service.receive_from(this->implementation, buffers,
- sender_endpoint, flags, ec);
+ return this->get_service().receive_from(this->get_implementation(),
+ buffers, sender_endpoint, flags, ec);
   }
 
   /// Start an asynchronous receive.
@@ -749,10 +826,15 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, ReadHandler handler)
+ endpoint_type& sender_endpoint,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive_from(this->implementation, buffers,
- sender_endpoint, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive_from(this->get_implementation(), buffers,
+ sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Start an asynchronous receive.
@@ -787,10 +869,14 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
       endpoint_type& sender_endpoint, socket_base::message_flags flags,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive_from(this->implementation, buffers,
- sender_endpoint, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive_from(this->get_implementation(), buffers,
+ sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/basic_deadline_timer.hpp
==============================================================================
--- branches/release/boost/asio/basic_deadline_timer.hpp (original)
+++ branches/release/boost/asio/basic_deadline_timer.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,6 +19,7 @@
 #include <cstddef>
 #include <boost/asio/basic_io_object.hpp>
 #include <boost/asio/deadline_timer_service.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 
@@ -161,7 +162,7 @@
   {
     boost::system::error_code ec;
     this->service.expires_at(this->implementation, expiry_time, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "expires_at");
   }
 
   /// Constructor to set a particular expiry time relative to now.
@@ -180,7 +181,7 @@
   {
     boost::system::error_code ec;
     this->service.expires_from_now(this->implementation, expiry_time, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "expires_from_now");
   }
 
   /// Cancel any asynchronous operations that are waiting on the timer.
@@ -209,7 +210,7 @@
   {
     boost::system::error_code ec;
     std::size_t s = this->service.cancel(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "cancel");
     return s;
   }
 
@@ -240,6 +241,67 @@
     return this->service.cancel(this->implementation, ec);
   }
 
+ /// Cancels one asynchronous operation that is waiting on the timer.
+ /**
+ * This function forces the completion of one pending asynchronous wait
+ * operation against the timer. Handlers are cancelled in FIFO order. The
+ * handler for the cancelled operation will be invoked with the
+ * boost::asio::error::operation_aborted error code.
+ *
+ * Cancelling the timer does not change the expiry time.
+ *
+ * @return The number of asynchronous operations that were cancelled. That is,
+ * either 0 or 1.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note If the timer has already expired when cancel_one() is called, then
+ * the handlers for asynchronous wait operations will:
+ *
+ * @li have already been invoked; or
+ *
+ * @li have been queued for invocation in the near future.
+ *
+ * These handlers can no longer be cancelled, and therefore are passed an
+ * error code that indicates the successful completion of the wait operation.
+ */
+ std::size_t cancel_one()
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->service.cancel_one(this->implementation, ec);
+ boost::asio::detail::throw_error(ec, "cancel_one");
+ return s;
+ }
+
+ /// Cancels one asynchronous operation that is waiting on the timer.
+ /**
+ * This function forces the completion of one pending asynchronous wait
+ * operation against the timer. Handlers are cancelled in FIFO order. The
+ * handler for the cancelled operation will be invoked with the
+ * boost::asio::error::operation_aborted error code.
+ *
+ * Cancelling the timer does not change the expiry time.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @return The number of asynchronous operations that were cancelled. That is,
+ * either 0 or 1.
+ *
+ * @note If the timer has already expired when cancel_one() is called, then
+ * the handlers for asynchronous wait operations will:
+ *
+ * @li have already been invoked; or
+ *
+ * @li have been queued for invocation in the near future.
+ *
+ * These handlers can no longer be cancelled, and therefore are passed an
+ * error code that indicates the successful completion of the wait operation.
+ */
+ std::size_t cancel_one(boost::system::error_code& ec)
+ {
+ return this->service.cancel_one(this->implementation, ec);
+ }
+
   /// Get the timer's expiry time as an absolute time.
   /**
    * This function may be used to obtain the timer's current expiry time.
@@ -277,7 +339,7 @@
     boost::system::error_code ec;
     std::size_t s = this->service.expires_at(
         this->implementation, expiry_time, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "expires_at");
     return s;
   }
 
@@ -346,7 +408,7 @@
     boost::system::error_code ec;
     std::size_t s = this->service.expires_from_now(
         this->implementation, expiry_time, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "expires_from_now");
     return s;
   }
 
@@ -390,7 +452,7 @@
   {
     boost::system::error_code ec;
     this->service.wait(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "wait");
   }
 
   /// Perform a blocking wait on the timer.
@@ -430,9 +492,14 @@
    * boost::asio::io_service::post().
    */
   template <typename WaitHandler>
- void async_wait(WaitHandler handler)
+ void async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
   {
- this->service.async_wait(this->implementation, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WaitHandler.
+ BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
+
+ this->service.async_wait(this->implementation,
+ BOOST_ASIO_MOVE_CAST(WaitHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/basic_io_object.hpp
==============================================================================
--- branches/release/boost/asio/basic_io_object.hpp (original)
+++ branches/release/boost/asio/basic_io_object.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,7 +16,6 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <boost/asio/detail/noncopyable.hpp>
 #include <boost/asio/io_service.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -24,10 +23,42 @@
 namespace boost {
 namespace asio {
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+namespace detail
+{
+ // Type trait used to determine whether a service supports move.
+ template <typename IoObjectService>
+ class service_has_move
+ {
+ private:
+ typedef IoObjectService service_type;
+ typedef typename service_type::implementation_type implementation_type;
+
+ template <typename T, typename U>
+ static auto eval(T* t, U* u) -> decltype(t->move_construct(*u, *u), char());
+ static char (&eval(...))[2];
+
+ public:
+ static const bool value =
+ sizeof(service_has_move::eval(
+ static_cast<service_type*>(0),
+ static_cast<implementation_type*>(0))) == 1;
+ };
+}
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
 /// Base class for all I/O objects.
+/**
+ * @note All I/O objects are non-copyable. However, when using C++0x, certain
+ * I/O objects do support move construction and move assignment.
+ */
+#if !defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
 template <typename IoObjectService>
+#else
+template <typename IoObjectService,
+ bool Movable = detail::service_has_move<IoObjectService>::value>
+#endif
 class basic_io_object
- : private noncopyable
 {
 public:
   /// The type of the service that will be used to provide I/O operations.
@@ -36,20 +67,6 @@
   /// The underlying implementation type of I/O object.
   typedef typename service_type::implementation_type implementation_type;
 
- /// (Deprecated: use get_io_service().) Get the io_service associated with
- /// the object.
- /**
- * This function may be used to obtain the io_service object that the I/O
- * object uses to dispatch handlers for asynchronous operations.
- *
- * @return A reference to the io_service object that the I/O object will use
- * to dispatch handlers. Ownership is not transferred to the caller.
- */
- boost::asio::io_service& io_service()
- {
- return service.get_io_service();
- }
-
   /// Get the io_service associated with the object.
   /**
    * This function may be used to obtain the io_service object that the I/O
@@ -67,7 +84,7 @@
   /// Construct a basic_io_object.
   /**
    * Performs:
- * @code service.construct(implementation); @endcode
+ * @code get_service().construct(get_implementation()); @endcode
    */
   explicit basic_io_object(boost::asio::io_service& io_service)
     : service(boost::asio::use_service<IoObjectService>(io_service))
@@ -75,22 +92,147 @@
     service.construct(implementation);
   }
 
+#if defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_io_object.
+ /**
+ * Performs:
+ * @code get_service().move_construct(
+ * get_implementation(), other.get_implementation()); @endcode
+ *
+ * @note Available only for services that support movability,
+ */
+ basic_io_object(basic_io_object&& other);
+
+ /// Move-assign a basic_io_object.
+ /**
+ * Performs:
+ * @code get_service().move_assign(get_implementation(),
+ * other.get_service(), other.get_implementation()); @endcode
+ *
+ * @note Available only for services that support movability,
+ */
+ basic_io_object& operator=(basic_io_object&& other);
+#endif // defined(GENERATING_DOCUMENTATION)
+
   /// Protected destructor to prevent deletion through this type.
   /**
    * Performs:
- * @code service.destroy(implementation); @endcode
+ * @code get_service().destroy(get_implementation()); @endcode
    */
   ~basic_io_object()
   {
     service.destroy(implementation);
   }
 
- /// The service associated with the I/O object.
+ /// Get the service associated with the I/O object.
+ service_type& get_service()
+ {
+ return service;
+ }
+
+ /// Get the service associated with the I/O object.
+ const service_type& get_service() const
+ {
+ return service;
+ }
+
+ /// (Deprecated: Use get_service().) The service associated with the I/O
+ /// object.
+ /**
+ * @note Available only for services that do not support movability.
+ */
   service_type& service;
 
- /// The underlying implementation of the I/O object.
+ /// Get the underlying implementation of the I/O object.
+ implementation_type& get_implementation()
+ {
+ return implementation;
+ }
+
+ /// Get the underlying implementation of the I/O object.
+ const implementation_type& get_implementation() const
+ {
+ return implementation;
+ }
+
+ /// (Deprecated: Use get_implementation().) The underlying implementation of
+ /// the I/O object.
   implementation_type implementation;
+
+private:
+ basic_io_object(const basic_io_object&);
+ basic_io_object& operator=(const basic_io_object&);
+};
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+// Specialisation for movable objects.
+template <typename IoObjectService>
+class basic_io_object<IoObjectService, true>
+{
+public:
+ typedef IoObjectService service_type;
+ typedef typename service_type::implementation_type implementation_type;
+
+ boost::asio::io_service& get_io_service()
+ {
+ return service_->get_io_service();
+ }
+
+protected:
+ explicit basic_io_object(boost::asio::io_service& io_service)
+ : service_(&boost::asio::use_service<IoObjectService>(io_service))
+ {
+ service_->construct(implementation);
+ }
+
+ basic_io_object(basic_io_object&& other)
+ : service_(&other.get_service())
+ {
+ service_->move_construct(implementation, other.implementation);
+ }
+
+ ~basic_io_object()
+ {
+ service_->destroy(implementation);
+ }
+
+ basic_io_object& operator=(basic_io_object&& other)
+ {
+ service_->move_assign(implementation,
+ *other.service_, other.implementation);
+ service_ = other.service_;
+ return *this;
+ }
+
+ service_type& get_service()
+ {
+ return *service_;
+ }
+
+ const service_type& get_service() const
+ {
+ return *service_;
+ }
+
+ implementation_type& get_implementation()
+ {
+ return implementation;
+ }
+
+ const implementation_type& get_implementation() const
+ {
+ return implementation;
+ }
+
+ implementation_type implementation;
+
+private:
+ basic_io_object(const basic_io_object&);
+ void operator=(const basic_io_object&);
+
+ IoObjectService* service_;
 };
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
 } // namespace asio
 } // namespace boost

Modified: branches/release/boost/asio/basic_raw_socket.hpp
==============================================================================
--- branches/release/boost/asio/basic_raw_socket.hpp (original)
+++ branches/release/boost/asio/basic_raw_socket.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,6 +18,7 @@
 #include <boost/asio/detail/config.hpp>
 #include <cstddef>
 #include <boost/asio/basic_socket.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/raw_socket_service.hpp>
@@ -42,8 +43,12 @@
   : public basic_socket<Protocol, RawSocketService>
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// socket.
+ typedef typename RawSocketService::native_handle_type native_type;
+
   /// The native representation of a socket.
- typedef typename RawSocketService::native_type native_type;
+ typedef typename RawSocketService::native_handle_type native_handle_type;
 
   /// The protocol type.
   typedef Protocol protocol_type;
@@ -121,12 +126,47 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_raw_socket(boost::asio::io_service& io_service,
- const protocol_type& protocol, const native_type& native_socket)
+ const protocol_type& protocol, const native_handle_type& native_socket)
     : basic_socket<Protocol, RawSocketService>(
         io_service, protocol, native_socket)
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_raw_socket from another.
+ /**
+ * This constructor moves a raw socket from one object to another.
+ *
+ * @param other The other basic_raw_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_raw_socket(io_service&) constructor.
+ */
+ basic_raw_socket(basic_raw_socket&& other)
+ : basic_socket<Protocol, RawSocketService>(
+ BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other))
+ {
+ }
+
+ /// Move-assign a basic_raw_socket from another.
+ /**
+ * This assignment operator moves a raw socket from one object to another.
+ *
+ * @param other The other basic_raw_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_raw_socket(io_service&) constructor.
+ */
+ basic_raw_socket& operator=(basic_raw_socket&& other)
+ {
+ basic_socket<Protocol, RawSocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Send some data on a connected socket.
   /**
    * This function is used to send data on the raw socket. The function call
@@ -152,8 +192,9 @@
   std::size_t send(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "send");
     return s;
   }
 
@@ -178,9 +219,9 @@
       socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "send");
     return s;
   }
 
@@ -204,7 +245,8 @@
   std::size_t send(const ConstBufferSequence& buffers,
       socket_base::message_flags flags, boost::system::error_code& ec)
   {
- return this->service.send(this->implementation, buffers, flags, ec);
+ return this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
   }
 
   /// Start an asynchronous send on a connected socket.
@@ -243,9 +285,15 @@
    * std::vector.
    */
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Start an asynchronous send on a connected socket.
@@ -278,9 +326,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send(this->implementation, buffers, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Send raw data to the specified endpoint.
@@ -313,9 +367,9 @@
       const endpoint_type& destination)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send_to(
- this->implementation, buffers, destination, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send_to(
+ this->get_implementation(), buffers, destination, 0, ec);
+ boost::asio::detail::throw_error(ec, "send_to");
     return s;
   }
 
@@ -340,9 +394,9 @@
       const endpoint_type& destination, socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send_to(
- this->implementation, buffers, destination, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send_to(
+ this->get_implementation(), buffers, destination, flags, ec);
+ boost::asio::detail::throw_error(ec, "send_to");
     return s;
   }
 
@@ -367,7 +421,7 @@
       const endpoint_type& destination, socket_base::message_flags flags,
       boost::system::error_code& ec)
   {
- return this->service.send_to(this->implementation,
+ return this->get_service().send_to(this->get_implementation(),
         buffers, destination, flags, ec);
   }
 
@@ -410,10 +464,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, WriteHandler handler)
+ const endpoint_type& destination,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send_to(this->implementation, buffers, destination, 0,
- handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send_to(this->get_implementation(), buffers,
+ destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Start an asynchronous send.
@@ -446,10 +505,14 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
       const endpoint_type& destination, socket_base::message_flags flags,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send_to(this->implementation, buffers, destination,
- flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send_to(this->get_implementation(), buffers,
+ destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data on a connected socket.
@@ -480,9 +543,9 @@
   std::size_t receive(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive(
- this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "receive");
     return s;
   }
 
@@ -509,9 +572,9 @@
       socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "receive");
     return s;
   }
 
@@ -537,7 +600,8 @@
   std::size_t receive(const MutableBufferSequence& buffers,
       socket_base::message_flags flags, boost::system::error_code& ec)
   {
- return this->service.receive(this->implementation, buffers, flags, ec);
+ return this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
   }
 
   /// Start an asynchronous receive on a connected socket.
@@ -577,9 +641,15 @@
    * std::vector.
    */
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Start an asynchronous receive on a connected socket.
@@ -612,9 +682,15 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive(this->implementation, buffers, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Receive raw data with the endpoint of the sender.
@@ -648,9 +724,9 @@
       endpoint_type& sender_endpoint)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive_from(
- this->implementation, buffers, sender_endpoint, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive_from(
+ this->get_implementation(), buffers, sender_endpoint, 0, ec);
+ boost::asio::detail::throw_error(ec, "receive_from");
     return s;
   }
   
@@ -675,9 +751,9 @@
       endpoint_type& sender_endpoint, socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive_from(
- this->implementation, buffers, sender_endpoint, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive_from(
+ this->get_implementation(), buffers, sender_endpoint, flags, ec);
+ boost::asio::detail::throw_error(ec, "receive_from");
     return s;
   }
   
@@ -702,8 +778,8 @@
       endpoint_type& sender_endpoint, socket_base::message_flags flags,
       boost::system::error_code& ec)
   {
- return this->service.receive_from(this->implementation, buffers,
- sender_endpoint, flags, ec);
+ return this->get_service().receive_from(this->get_implementation(),
+ buffers, sender_endpoint, flags, ec);
   }
 
   /// Start an asynchronous receive.
@@ -744,10 +820,15 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, ReadHandler handler)
+ endpoint_type& sender_endpoint,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive_from(this->implementation, buffers,
- sender_endpoint, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive_from(this->get_implementation(), buffers,
+ sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Start an asynchronous receive.
@@ -782,10 +863,14 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
       endpoint_type& sender_endpoint, socket_base::message_flags flags,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive_from(this->implementation, buffers,
- sender_endpoint, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive_from(this->get_implementation(), buffers,
+ sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 };
 

Added: branches/release/boost/asio/basic_seq_packet_socket.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/basic_seq_packet_socket.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,514 @@
+//
+// basic_seq_packet_socket.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP
+#define BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstddef>
+#include <boost/asio/basic_socket.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/seq_packet_socket_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Provides sequenced packet socket functionality.
+/**
+ * The basic_seq_packet_socket class template provides asynchronous and blocking
+ * sequenced packet socket functionality.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe._at_n
+ * @e Shared @e objects: Unsafe.
+ */
+template <typename Protocol,
+ typename SeqPacketSocketService = seq_packet_socket_service<Protocol> >
+class basic_seq_packet_socket
+ : public basic_socket<Protocol, SeqPacketSocketService>
+{
+public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// socket.
+ typedef typename SeqPacketSocketService::native_handle_type native_type;
+
+ /// The native representation of a socket.
+ typedef typename SeqPacketSocketService::native_handle_type
+ native_handle_type;
+
+ /// The protocol type.
+ typedef Protocol protocol_type;
+
+ /// The endpoint type.
+ typedef typename Protocol::endpoint endpoint_type;
+
+ /// Construct a basic_seq_packet_socket without opening it.
+ /**
+ * This constructor creates a sequenced packet socket without opening it. The
+ * socket needs to be opened and then connected or accepted before data can
+ * be sent or received on it.
+ *
+ * @param io_service The io_service object that the sequenced packet socket
+ * will use to dispatch handlers for any asynchronous operations performed on
+ * the socket.
+ */
+ explicit basic_seq_packet_socket(boost::asio::io_service& io_service)
+ : basic_socket<Protocol, SeqPacketSocketService>(io_service)
+ {
+ }
+
+ /// Construct and open a basic_seq_packet_socket.
+ /**
+ * This constructor creates and opens a sequenced_packet socket. The socket
+ * needs to be connected or accepted before data can be sent or received on
+ * it.
+ *
+ * @param io_service The io_service object that the sequenced packet socket
+ * will use to dispatch handlers for any asynchronous operations performed on
+ * the socket.
+ *
+ * @param protocol An object specifying protocol parameters to be used.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ basic_seq_packet_socket(boost::asio::io_service& io_service,
+ const protocol_type& protocol)
+ : basic_socket<Protocol, SeqPacketSocketService>(io_service, protocol)
+ {
+ }
+
+ /// Construct a basic_seq_packet_socket, opening it and binding it to the
+ /// given local endpoint.
+ /**
+ * This constructor creates a sequenced packet socket and automatically opens
+ * it bound to the specified endpoint on the local machine. The protocol used
+ * is the protocol associated with the given endpoint.
+ *
+ * @param io_service The io_service object that the sequenced packet socket
+ * will use to dispatch handlers for any asynchronous operations performed on
+ * the socket.
+ *
+ * @param endpoint An endpoint on the local machine to which the sequenced
+ * packet socket will be bound.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ basic_seq_packet_socket(boost::asio::io_service& io_service,
+ const endpoint_type& endpoint)
+ : basic_socket<Protocol, SeqPacketSocketService>(io_service, endpoint)
+ {
+ }
+
+ /// Construct a basic_seq_packet_socket on an existing native socket.
+ /**
+ * This constructor creates a sequenced packet socket object to hold an
+ * existing native socket.
+ *
+ * @param io_service The io_service object that the sequenced packet socket
+ * will use to dispatch handlers for any asynchronous operations performed on
+ * the socket.
+ *
+ * @param protocol An object specifying protocol parameters to be used.
+ *
+ * @param native_socket The new underlying socket implementation.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ basic_seq_packet_socket(boost::asio::io_service& io_service,
+ const protocol_type& protocol, const native_handle_type& native_socket)
+ : basic_socket<Protocol, SeqPacketSocketService>(
+ io_service, protocol, native_socket)
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_seq_packet_socket from another.
+ /**
+ * This constructor moves a sequenced packet socket from one object to
+ * another.
+ *
+ * @param other The other basic_seq_packet_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_seq_packet_socket(io_service&) constructor.
+ */
+ basic_seq_packet_socket(basic_seq_packet_socket&& other)
+ : basic_socket<Protocol, SeqPacketSocketService>(
+ BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other))
+ {
+ }
+
+ /// Move-assign a basic_seq_packet_socket from another.
+ /**
+ * This assignment operator moves a sequenced packet socket from one object to
+ * another.
+ *
+ * @param other The other basic_seq_packet_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_seq_packet_socket(io_service&) constructor.
+ */
+ basic_seq_packet_socket& operator=(basic_seq_packet_socket&& other)
+ {
+ basic_socket<Protocol, SeqPacketSocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
+ /// Send some data on the socket.
+ /**
+ * This function is used to send data on the sequenced packet socket. The
+ * function call will block until the data has been sent successfully, or an
+ * until error occurs.
+ *
+ * @param buffers One or more data buffers to be sent on the socket.
+ *
+ * @param flags Flags specifying how the send call is to be made.
+ *
+ * @returns The number of bytes sent.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @par Example
+ * To send a single data buffer use the @ref buffer function as follows:
+ * @code
+ * socket.send(boost::asio::buffer(data, size), 0);
+ * @endcode
+ * See the @ref buffer documentation for information on sending multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t send(const ConstBufferSequence& buffers,
+ socket_base::message_flags flags)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "send");
+ return s;
+ }
+
+ /// Send some data on the socket.
+ /**
+ * This function is used to send data on the sequenced packet socket. The
+ * function call will block the data has been sent successfully, or an until
+ * error occurs.
+ *
+ * @param buffers One or more data buffers to be sent on the socket.
+ *
+ * @param flags Flags specifying how the send call is to be made.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes sent. Returns 0 if an error occurred.
+ *
+ * @note The send operation may not transmit all of the data to the peer.
+ * Consider using the @ref write function if you need to ensure that all data
+ * is written before the blocking operation completes.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t send(const ConstBufferSequence& buffers,
+ socket_base::message_flags flags, boost::system::error_code& ec)
+ {
+ return this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
+ }
+
+ /// Start an asynchronous send.
+ /**
+ * This function is used to asynchronously send data on the sequenced packet
+ * socket. The function call always returns immediately.
+ *
+ * @param buffers One or more data buffers to be sent on the socket. Although
+ * the buffers object may be copied as necessary, ownership of the underlying
+ * memory blocks is retained by the caller, which must guarantee that they
+ * remain valid until the handler is called.
+ *
+ * @param flags Flags specifying how the send call is to be made.
+ *
+ * @param handler The handler to be called when the send operation completes.
+ * Copies will be made of the handler as required. The function signature of
+ * the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes sent.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @par Example
+ * To send a single data buffer use the @ref buffer function as follows:
+ * @code
+ * socket.async_send(boost::asio::buffer(data, size), 0, handler);
+ * @endcode
+ * See the @ref buffer documentation for information on sending multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename ConstBufferSequence, typename WriteHandler>
+ void async_send(const ConstBufferSequence& buffers,
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
+ {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+ }
+
+ /// Receive some data on the socket.
+ /**
+ * This function is used to receive data on the sequenced packet socket. The
+ * function call will block until data has been received successfully, or
+ * until an error occurs.
+ *
+ * @param buffers One or more buffers into which the data will be received.
+ *
+ * @param out_flags After the receive call completes, contains flags
+ * associated with the received data. For example, if the
+ * socket_base::message_end_of_record bit is set then the received data marks
+ * the end of a record.
+ *
+ * @returns The number of bytes received.
+ *
+ * @throws boost::system::system_error Thrown on failure. An error code of
+ * boost::asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @par Example
+ * To receive into a single data buffer use the @ref buffer function as
+ * follows:
+ * @code
+ * socket.receive(boost::asio::buffer(data, size), out_flags);
+ * @endcode
+ * See the @ref buffer documentation for information on receiving into
+ * multiple buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t receive(const MutableBufferSequence& buffers,
+ socket_base::message_flags& out_flags)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, 0, out_flags, ec);
+ boost::asio::detail::throw_error(ec, "receive");
+ return s;
+ }
+
+ /// Receive some data on the socket.
+ /**
+ * This function is used to receive data on the sequenced packet socket. The
+ * function call will block until data has been received successfully, or
+ * until an error occurs.
+ *
+ * @param buffers One or more buffers into which the data will be received.
+ *
+ * @param in_flags Flags specifying how the receive call is to be made.
+ *
+ * @param out_flags After the receive call completes, contains flags
+ * associated with the received data. For example, if the
+ * socket_base::message_end_of_record bit is set then the received data marks
+ * the end of a record.
+ *
+ * @returns The number of bytes received.
+ *
+ * @throws boost::system::system_error Thrown on failure. An error code of
+ * boost::asio::error::eof indicates that the connection was closed by the
+ * peer.
+ *
+ * @note The receive operation may not receive all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that the
+ * requested amount of data is read before the blocking operation completes.
+ *
+ * @par Example
+ * To receive into a single data buffer use the @ref buffer function as
+ * follows:
+ * @code
+ * socket.receive(boost::asio::buffer(data, size), 0, out_flags);
+ * @endcode
+ * See the @ref buffer documentation for information on receiving into
+ * multiple buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t receive(const MutableBufferSequence& buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags)
+ {
+ boost::system::error_code ec;
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, in_flags, out_flags, ec);
+ boost::asio::detail::throw_error(ec, "receive");
+ return s;
+ }
+
+ /// Receive some data on a connected socket.
+ /**
+ * This function is used to receive data on the sequenced packet socket. The
+ * function call will block until data has been received successfully, or
+ * until an error occurs.
+ *
+ * @param buffers One or more buffers into which the data will be received.
+ *
+ * @param in_flags Flags specifying how the receive call is to be made.
+ *
+ * @param out_flags After the receive call completes, contains flags
+ * associated with the received data. For example, if the
+ * socket_base::message_end_of_record bit is set then the received data marks
+ * the end of a record.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes received. Returns 0 if an error occurred.
+ *
+ * @note The receive operation may not receive all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that the
+ * requested amount of data is read before the blocking operation completes.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t receive(const MutableBufferSequence& buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, boost::system::error_code& ec)
+ {
+ return this->get_service().receive(this->get_implementation(),
+ buffers, in_flags, out_flags, ec);
+ }
+
+ /// Start an asynchronous receive.
+ /**
+ * This function is used to asynchronously receive data from the sequenced
+ * packet socket. The function call always returns immediately.
+ *
+ * @param buffers One or more buffers into which the data will be received.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param out_flags Once the asynchronous operation completes, contains flags
+ * associated with the received data. For example, if the
+ * socket_base::message_end_of_record bit is set then the received data marks
+ * the end of a record. The caller must guarantee that the referenced
+ * variable remains valid until the handler is called.
+ *
+ * @param handler The handler to be called when the receive operation
+ * completes. Copies will be made of the handler as required. The function
+ * signature of the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes received.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @par Example
+ * To receive into a single data buffer use the @ref buffer function as
+ * follows:
+ * @code
+ * socket.async_receive(boost::asio::buffer(data, size), out_flags, handler);
+ * @endcode
+ * See the @ref buffer documentation for information on receiving into
+ * multiple buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_receive(const MutableBufferSequence& buffers,
+ socket_base::message_flags& out_flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
+ {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(), buffers,
+ 0, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+ }
+
+ /// Start an asynchronous receive.
+ /**
+ * This function is used to asynchronously receive data from the sequenced
+ * data socket. The function call always returns immediately.
+ *
+ * @param buffers One or more buffers into which the data will be received.
+ * Although the buffers object may be copied as necessary, ownership of the
+ * underlying memory blocks is retained by the caller, which must guarantee
+ * that they remain valid until the handler is called.
+ *
+ * @param in_flags Flags specifying how the receive call is to be made.
+ *
+ * @param out_flags Once the asynchronous operation completes, contains flags
+ * associated with the received data. For example, if the
+ * socket_base::message_end_of_record bit is set then the received data marks
+ * the end of a record. The caller must guarantee that the referenced
+ * variable remains valid until the handler is called.
+ *
+ * @param handler The handler to be called when the receive operation
+ * completes. Copies will be made of the handler as required. The function
+ * signature of the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes received.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @par Example
+ * To receive into a single data buffer use the @ref buffer function as
+ * follows:
+ * @code
+ * socket.async_receive(
+ * boost::asio::buffer(data, size),
+ * 0, out_flags, handler);
+ * @endcode
+ * See the @ref buffer documentation for information on receiving into
+ * multiple buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ */
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_receive(const MutableBufferSequence& buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
+ {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(), buffers,
+ in_flags, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+ }
+};
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP

Modified: branches/release/boost/asio/basic_serial_port.hpp
==============================================================================
--- branches/release/boost/asio/basic_serial_port.hpp (original)
+++ branches/release/boost/asio/basic_serial_port.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -23,6 +23,7 @@
 
 #include <string>
 #include <boost/asio/basic_io_object.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/serial_port_base.hpp>
@@ -48,8 +49,12 @@
     public serial_port_base
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// serial port.
+ typedef typename SerialPortService::native_handle_type native_type;
+
   /// The native representation of a serial port.
- typedef typename SerialPortService::native_type native_type;
+ typedef typename SerialPortService::native_handle_type native_handle_type;
 
   /// A basic_serial_port is always the lowest layer.
   typedef basic_serial_port<SerialPortService> lowest_layer_type;
@@ -82,8 +87,8 @@
     : basic_io_object<SerialPortService>(io_service)
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, device, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(), device, ec);
+ boost::asio::detail::throw_error(ec, "open");
   }
 
   /// Construct and open a basic_serial_port.
@@ -102,8 +107,8 @@
     : basic_io_object<SerialPortService>(io_service)
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, device, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(), device, ec);
+ boost::asio::detail::throw_error(ec, "open");
   }
 
   /// Construct a basic_serial_port on an existing native serial port.
@@ -119,13 +124,49 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_serial_port(boost::asio::io_service& io_service,
- const native_type& native_serial_port)
+ const native_handle_type& native_serial_port)
     : basic_io_object<SerialPortService>(io_service)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, native_serial_port, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ native_serial_port, ec);
+ boost::asio::detail::throw_error(ec, "assign");
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_serial_port from another.
+ /**
+ * This constructor moves a serial port from one object to another.
+ *
+ * @param other The other basic_serial_port object from which the move will
+ * occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_serial_port(io_service&) constructor.
+ */
+ basic_serial_port(basic_serial_port&& other)
+ : basic_io_object<SerialPortService>(
+ BOOST_ASIO_MOVE_CAST(basic_serial_port)(other))
+ {
+ }
+
+ /// Move-assign a basic_serial_port from another.
+ /**
+ * This assignment operator moves a serial port from one object to another.
+ *
+ * @param other The other basic_serial_port object from which the move will
+ * occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_serial_port(io_service&) constructor.
+ */
+ basic_serial_port& operator=(basic_serial_port&& other)
+ {
+ basic_io_object<SerialPortService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_serial_port)(other));
+ return *this;
   }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
 
   /// Get a reference to the lowest layer.
   /**
@@ -166,8 +207,8 @@
   void open(const std::string& device)
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, device, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(), device, ec);
+ boost::asio::detail::throw_error(ec, "open");
   }
 
   /// Open the serial port using the specified device name.
@@ -182,7 +223,7 @@
   boost::system::error_code open(const std::string& device,
       boost::system::error_code& ec)
   {
- return this->service.open(this->implementation, device, ec);
+ return this->get_service().open(this->get_implementation(), device, ec);
   }
 
   /// Assign an existing native serial port to the serial port.
@@ -193,11 +234,12 @@
    *
    * @throws boost::system::system_error Thrown on failure.
    */
- void assign(const native_type& native_serial_port)
+ void assign(const native_handle_type& native_serial_port)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, native_serial_port, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ native_serial_port, ec);
+ boost::asio::detail::throw_error(ec, "assign");
   }
 
   /// Assign an existing native serial port to the serial port.
@@ -208,16 +250,17 @@
    *
    * @param ec Set to indicate what error occurred, if any.
    */
- boost::system::error_code assign(const native_type& native_serial_port,
+ boost::system::error_code assign(const native_handle_type& native_serial_port,
       boost::system::error_code& ec)
   {
- return this->service.assign(this->implementation, native_serial_port, ec);
+ return this->get_service().assign(this->get_implementation(),
+ native_serial_port, ec);
   }
 
   /// Determine whether the serial port is open.
   bool is_open() const
   {
- return this->service.is_open(this->implementation);
+ return this->get_service().is_open(this->get_implementation());
   }
 
   /// Close the serial port.
@@ -231,8 +274,8 @@
   void close()
   {
     boost::system::error_code ec;
- this->service.close(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().close(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "close");
   }
 
   /// Close the serial port.
@@ -245,10 +288,11 @@
    */
   boost::system::error_code close(boost::system::error_code& ec)
   {
- return this->service.close(this->implementation, ec);
+ return this->get_service().close(this->get_implementation(), ec);
   }
 
- /// Get the native serial port representation.
+ /// (Deprecated: Use native_handle().) Get the native serial port
+ /// representation.
   /**
    * This function may be used to obtain the underlying representation of the
    * serial port. This is intended to allow access to native serial port
@@ -256,7 +300,18 @@
    */
   native_type native()
   {
- return this->service.native(this->implementation);
+ return this->get_service().native_handle(this->get_implementation());
+ }
+
+ /// Get the native serial port representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * serial port. This is intended to allow access to native serial port
+ * functionality that is not otherwise provided.
+ */
+ native_handle_type native_handle()
+ {
+ return this->get_service().native_handle(this->get_implementation());
   }
 
   /// Cancel all asynchronous operations associated with the serial port.
@@ -270,8 +325,8 @@
   void cancel()
   {
     boost::system::error_code ec;
- this->service.cancel(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().cancel(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "cancel");
   }
 
   /// Cancel all asynchronous operations associated with the serial port.
@@ -284,7 +339,7 @@
    */
   boost::system::error_code cancel(boost::system::error_code& ec)
   {
- return this->service.cancel(this->implementation, ec);
+ return this->get_service().cancel(this->get_implementation(), ec);
   }
 
   /// Send a break sequence to the serial port.
@@ -297,8 +352,8 @@
   void send_break()
   {
     boost::system::error_code ec;
- this->service.send_break(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().send_break(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "send_break");
   }
 
   /// Send a break sequence to the serial port.
@@ -310,7 +365,7 @@
    */
   boost::system::error_code send_break(boost::system::error_code& ec)
   {
- return this->service.send_break(this->implementation, ec);
+ return this->get_service().send_break(this->get_implementation(), ec);
   }
 
   /// Set an option on the serial port.
@@ -332,8 +387,8 @@
   void set_option(const SettableSerialPortOption& option)
   {
     boost::system::error_code ec;
- this->service.set_option(this->implementation, option, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().set_option(this->get_implementation(), option, ec);
+ boost::asio::detail::throw_error(ec, "set_option");
   }
 
   /// Set an option on the serial port.
@@ -355,7 +410,8 @@
   boost::system::error_code set_option(const SettableSerialPortOption& option,
       boost::system::error_code& ec)
   {
- return this->service.set_option(this->implementation, option, ec);
+ return this->get_service().set_option(
+ this->get_implementation(), option, ec);
   }
 
   /// Get an option from the serial port.
@@ -378,8 +434,8 @@
   void get_option(GettableSerialPortOption& option)
   {
     boost::system::error_code ec;
- this->service.get_option(this->implementation, option, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().get_option(this->get_implementation(), option, ec);
+ boost::asio::detail::throw_error(ec, "get_option");
   }
 
   /// Get an option from the serial port.
@@ -402,7 +458,8 @@
   boost::system::error_code get_option(GettableSerialPortOption& option,
       boost::system::error_code& ec)
   {
- return this->service.get_option(this->implementation, option, ec);
+ return this->get_service().get_option(
+ this->get_implementation(), option, ec);
   }
 
   /// Write some data to the serial port.
@@ -436,8 +493,9 @@
   std::size_t write_some(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.write_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "write_some");
     return s;
   }
 
@@ -461,7 +519,8 @@
   std::size_t write_some(const ConstBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.write_some(this->implementation, buffers, ec);
+ return this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
   }
 
   /// Start an asynchronous write.
@@ -501,9 +560,14 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_write_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_write_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the serial port.
@@ -538,8 +602,9 @@
   std::size_t read_some(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.read_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "read_some");
     return s;
   }
 
@@ -564,7 +629,8 @@
   std::size_t read_some(const MutableBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.read_some(this->implementation, buffers, ec);
+ return this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
   }
 
   /// Start an asynchronous read.
@@ -605,9 +671,14 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_read_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_read_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 };
 

Added: branches/release/boost/asio/basic_signal_set.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/basic_signal_set.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,384 @@
+//
+// basic_signal_set.hpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_BASIC_SIGNAL_SET_HPP
+#define BOOST_ASIO_BASIC_SIGNAL_SET_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#include <boost/asio/basic_io_object.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/signal_set_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Provides signal functionality.
+/**
+ * The basic_signal_set class template provides the ability to perform an
+ * asynchronous wait for one or more signals to occur.
+ *
+ * Most applications will use the boost::asio::signal_set typedef.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe._at_n
+ * @e Shared @e objects: Unsafe.
+ *
+ * @par Example
+ * Performing an asynchronous wait:
+ * @code
+ * void handler(
+ * const boost::system::error_code& error,
+ * int signal_number)
+ * {
+ * if (!error)
+ * {
+ * // A signal occurred.
+ * }
+ * }
+ *
+ * ...
+ *
+ * // Construct a signal set registered for process termination.
+ * boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
+ *
+ * // Start an asynchronous wait for one of the signals to occur.
+ * signals.async_wait(handler);
+ * @endcode
+ *
+ * @par Queueing of signal notifications
+ *
+ * If a signal is registered with a signal_set, and the signal occurs when
+ * there are no waiting handlers, then the signal notification is queued. The
+ * next async_wait operation on that signal_set will dequeue the notification.
+ * If multiple notifications are queued, subsequent async_wait operations
+ * dequeue them one at a time. Signal notifications are dequeued in order of
+ * ascending signal number.
+ *
+ * If a signal number is removed from a signal_set (using the @c remove or @c
+ * erase member functions) then any queued notifications for that signal are
+ * discarded.
+ *
+ * @par Multiple registration of signals
+ *
+ * The same signal number may be registered with different signal_set objects.
+ * When the signal occurs, one handler is called for each signal_set object.
+ *
+ * Note that multiple registration only works for signals that are registered
+ * using Asio. The application must not also register a signal handler using
+ * functions such as @c signal() or @c sigaction().
+ *
+ * @par Signal masking on POSIX platforms
+ *
+ * POSIX allows signals to be blocked using functions such as @c sigprocmask()
+ * and @c pthread_sigmask(). For signals to be delivered, programs must ensure
+ * that any signals registered using signal_set objects are unblocked in at
+ * least one thread.
+ */
+template <typename SignalSetService = signal_set_service>
+class basic_signal_set
+ : public basic_io_object<SignalSetService>
+{
+public:
+ /// Construct a signal set without adding any signals.
+ /**
+ * This constructor creates a signal set without registering for any signals.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ */
+ explicit basic_signal_set(boost::asio::io_service& io_service)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ }
+
+ /// Construct a signal set and add one signal.
+ /**
+ * This constructor creates a signal set and registers for one signal.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ *
+ * @param signal_number_1 The signal number to be added.
+ *
+ * @note This constructor is equivalent to performing:
+ * @code boost::asio::signal_set signals(io_service);
+ * signals.add(signal_number_1); @endcode
+ */
+ basic_signal_set(boost::asio::io_service& io_service, int signal_number_1)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ boost::system::error_code ec;
+ this->service.add(this->implementation, signal_number_1, ec);
+ boost::asio::detail::throw_error(ec, "add");
+ }
+
+ /// Construct a signal set and add two signals.
+ /**
+ * This constructor creates a signal set and registers for two signals.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ *
+ * @param signal_number_1 The first signal number to be added.
+ *
+ * @param signal_number_2 The second signal number to be added.
+ *
+ * @note This constructor is equivalent to performing:
+ * @code boost::asio::signal_set signals(io_service);
+ * signals.add(signal_number_1);
+ * signals.add(signal_number_2); @endcode
+ */
+ basic_signal_set(boost::asio::io_service& io_service, int signal_number_1,
+ int signal_number_2)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ boost::system::error_code ec;
+ this->service.add(this->implementation, signal_number_1, ec);
+ boost::asio::detail::throw_error(ec, "add");
+ this->service.add(this->implementation, signal_number_2, ec);
+ boost::asio::detail::throw_error(ec, "add");
+ }
+
+ /// Construct a signal set and add three signals.
+ /**
+ * This constructor creates a signal set and registers for three signals.
+ *
+ * @param io_service The io_service object that the signal set will use to
+ * dispatch handlers for any asynchronous operations performed on the set.
+ *
+ * @param signal_number_1 The first signal number to be added.
+ *
+ * @param signal_number_2 The second signal number to be added.
+ *
+ * @param signal_number_3 The third signal number to be added.
+ *
+ * @note This constructor is equivalent to performing:
+ * @code boost::asio::signal_set signals(io_service);
+ * signals.add(signal_number_1);
+ * signals.add(signal_number_2);
+ * signals.add(signal_number_3); @endcode
+ */
+ basic_signal_set(boost::asio::io_service& io_service, int signal_number_1,
+ int signal_number_2, int signal_number_3)
+ : basic_io_object<SignalSetService>(io_service)
+ {
+ boost::system::error_code ec;
+ this->service.add(this->implementation, signal_number_1, ec);
+ boost::asio::detail::throw_error(ec, "add");
+ this->service.add(this->implementation, signal_number_2, ec);
+ boost::asio::detail::throw_error(ec, "add");
+ this->service.add(this->implementation, signal_number_3, ec);
+ boost::asio::detail::throw_error(ec, "add");
+ }
+
+ /// Add a signal to a signal_set.
+ /**
+ * This function adds the specified signal to the set. It has no effect if the
+ * signal is already in the set.
+ *
+ * @param signal_number The signal to be added to the set.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void add(int signal_number)
+ {
+ boost::system::error_code ec;
+ this->service.add(this->implementation, signal_number, ec);
+ boost::asio::detail::throw_error(ec, "add");
+ }
+
+ /// Add a signal to a signal_set.
+ /**
+ * This function adds the specified signal to the set. It has no effect if the
+ * signal is already in the set.
+ *
+ * @param signal_number The signal to be added to the set.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code add(int signal_number,
+ boost::system::error_code& ec)
+ {
+ return this->service.add(this->implementation, signal_number, ec);
+ }
+
+ /// Remove a signal from a signal_set.
+ /**
+ * This function removes the specified signal from the set. It has no effect
+ * if the signal is not in the set.
+ *
+ * @param signal_number The signal to be removed from the set.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Removes any notifications that have been queued for the specified
+ * signal number.
+ */
+ void remove(int signal_number)
+ {
+ boost::system::error_code ec;
+ this->service.remove(this->implementation, signal_number, ec);
+ boost::asio::detail::throw_error(ec, "remove");
+ }
+
+ /// Remove a signal from a signal_set.
+ /**
+ * This function removes the specified signal from the set. It has no effect
+ * if the signal is not in the set.
+ *
+ * @param signal_number The signal to be removed from the set.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Removes any notifications that have been queued for the specified
+ * signal number.
+ */
+ boost::system::error_code remove(int signal_number,
+ boost::system::error_code& ec)
+ {
+ return this->service.remove(this->implementation, signal_number, ec);
+ }
+
+ /// Remove all signals from a signal_set.
+ /**
+ * This function removes all signals from the set. It has no effect if the set
+ * is already empty.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Removes all queued notifications.
+ */
+ void clear()
+ {
+ boost::system::error_code ec;
+ this->service.clear(this->implementation, ec);
+ boost::asio::detail::throw_error(ec, "clear");
+ }
+
+ /// Remove all signals from a signal_set.
+ /**
+ * This function removes all signals from the set. It has no effect if the set
+ * is already empty.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Removes all queued notifications.
+ */
+ boost::system::error_code clear(boost::system::error_code& ec)
+ {
+ return this->service.clear(this->implementation, ec);
+ }
+
+ /// Cancel all operations associated with the signal set.
+ /**
+ * This function forces the completion of any pending asynchronous wait
+ * operations against the signal set. The handler for each cancelled
+ * operation will be invoked with the boost::asio::error::operation_aborted
+ * error code.
+ *
+ * Cancellation does not alter the set of registered signals.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note If a registered signal occurred before cancel() is called, then the
+ * handlers for asynchronous wait operations will:
+ *
+ * @li have already been invoked; or
+ *
+ * @li have been queued for invocation in the near future.
+ *
+ * These handlers can no longer be cancelled, and therefore are passed an
+ * error code that indicates the successful completion of the wait operation.
+ */
+ void cancel()
+ {
+ boost::system::error_code ec;
+ this->service.cancel(this->implementation, ec);
+ boost::asio::detail::throw_error(ec, "cancel");
+ }
+
+ /// Cancel all operations associated with the signal set.
+ /**
+ * This function forces the completion of any pending asynchronous wait
+ * operations against the signal set. The handler for each cancelled
+ * operation will be invoked with the boost::asio::error::operation_aborted
+ * error code.
+ *
+ * Cancellation does not alter the set of registered signals.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note If a registered signal occurred before cancel() is called, then the
+ * handlers for asynchronous wait operations will:
+ *
+ * @li have already been invoked; or
+ *
+ * @li have been queued for invocation in the near future.
+ *
+ * These handlers can no longer be cancelled, and therefore are passed an
+ * error code that indicates the successful completion of the wait operation.
+ */
+ boost::system::error_code cancel(boost::system::error_code& ec)
+ {
+ return this->service.cancel(this->implementation, ec);
+ }
+
+ /// Start an asynchronous operation to wait for a signal to be delivered.
+ /**
+ * This function may be used to initiate an asynchronous wait against the
+ * signal set. It always returns immediately.
+ *
+ * For each call to async_wait(), the supplied handler will be called exactly
+ * once. The handler will be called when:
+ *
+ * @li One of the registered signals in the signal set occurs; or
+ *
+ * @li The signal set was cancelled, in which case the handler is passed the
+ * error code boost::asio::error::operation_aborted.
+ *
+ * @param handler The handler to be called when the signal occurs. Copies
+ * will be made of the handler as required. The function signature of the
+ * handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * int signal_number // Indicates which signal occurred.
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ */
+ template <typename SignalHandler>
+ void async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler)
+ {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a SignalHandler.
+ BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check;
+
+ this->service.async_wait(this->implementation,
+ BOOST_ASIO_MOVE_CAST(SignalHandler)(handler));
+ }
+};
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_BASIC_SIGNAL_SET_HPP

Modified: branches/release/boost/asio/basic_socket.hpp
==============================================================================
--- branches/release/boost/asio/basic_socket.hpp (original)
+++ branches/release/boost/asio/basic_socket.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,6 +17,7 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <boost/asio/basic_io_object.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/socket_base.hpp>
@@ -41,8 +42,12 @@
     public socket_base
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// socket.
+ typedef typename SocketService::native_handle_type native_type;
+
   /// The native representation of a socket.
- typedef typename SocketService::native_type native_type;
+ typedef typename SocketService::native_handle_type native_handle_type;
 
   /// The protocol type.
   typedef Protocol protocol_type;
@@ -81,8 +86,8 @@
     : basic_io_object<SocketService>(io_service)
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, protocol, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(), protocol, ec);
+ boost::asio::detail::throw_error(ec, "open");
   }
 
   /// Construct a basic_socket, opening it and binding it to the given local
@@ -105,10 +110,11 @@
     : basic_io_object<SocketService>(io_service)
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, endpoint.protocol(), ec);
- boost::asio::detail::throw_error(ec);
- this->service.bind(this->implementation, endpoint, ec);
- boost::asio::detail::throw_error(ec);
+ const protocol_type protocol = endpoint.protocol();
+ this->get_service().open(this->get_implementation(), protocol, ec);
+ boost::asio::detail::throw_error(ec, "open");
+ this->get_service().bind(this->get_implementation(), endpoint, ec);
+ boost::asio::detail::throw_error(ec, "bind");
   }
 
   /// Construct a basic_socket on an existing native socket.
@@ -125,13 +131,49 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_socket(boost::asio::io_service& io_service,
- const protocol_type& protocol, const native_type& native_socket)
+ const protocol_type& protocol, const native_handle_type& native_socket)
     : basic_io_object<SocketService>(io_service)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, protocol, native_socket, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ protocol, native_socket, ec);
+ boost::asio::detail::throw_error(ec, "assign");
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_socket from another.
+ /**
+ * This constructor moves a socket from one object to another.
+ *
+ * @param other The other basic_socket object from which the move will
+ * occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_socket(io_service&) constructor.
+ */
+ basic_socket(basic_socket&& other)
+ : basic_io_object<SocketService>(
+ BOOST_ASIO_MOVE_CAST(basic_socket)(other))
+ {
+ }
+
+ /// Move-assign a basic_socket from another.
+ /**
+ * This assignment operator moves a socket from one object to another.
+ *
+ * @param other The other basic_socket object from which the move will
+ * occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_socket(io_service&) constructor.
+ */
+ basic_socket& operator=(basic_socket&& other)
+ {
+ basic_io_object<SocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_socket)(other));
+ return *this;
   }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
 
   /// Get a reference to the lowest layer.
   /**
@@ -178,8 +220,8 @@
   void open(const protocol_type& protocol = protocol_type())
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, protocol, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(), protocol, ec);
+ boost::asio::detail::throw_error(ec, "open");
   }
 
   /// Open the socket using the specified protocol.
@@ -204,7 +246,7 @@
   boost::system::error_code open(const protocol_type& protocol,
       boost::system::error_code& ec)
   {
- return this->service.open(this->implementation, protocol, ec);
+ return this->get_service().open(this->get_implementation(), protocol, ec);
   }
 
   /// Assign an existing native socket to the socket.
@@ -217,11 +259,13 @@
    *
    * @throws boost::system::system_error Thrown on failure.
    */
- void assign(const protocol_type& protocol, const native_type& native_socket)
+ void assign(const protocol_type& protocol,
+ const native_handle_type& native_socket)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, protocol, native_socket, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ protocol, native_socket, ec);
+ boost::asio::detail::throw_error(ec, "assign");
   }
 
   /// Assign an existing native socket to the socket.
@@ -235,16 +279,16 @@
    * @param ec Set to indicate what error occurred, if any.
    */
   boost::system::error_code assign(const protocol_type& protocol,
- const native_type& native_socket, boost::system::error_code& ec)
+ const native_handle_type& native_socket, boost::system::error_code& ec)
   {
- return this->service.assign(this->implementation,
+ return this->get_service().assign(this->get_implementation(),
         protocol, native_socket, ec);
   }
 
   /// Determine whether the socket is open.
   bool is_open() const
   {
- return this->service.is_open(this->implementation);
+ return this->get_service().is_open(this->get_implementation());
   }
 
   /// Close the socket.
@@ -253,7 +297,8 @@
    * or connect operations will be cancelled immediately, and will complete
    * with the boost::asio::error::operation_aborted error.
    *
- * @throws boost::system::system_error Thrown on failure.
+ * @throws boost::system::system_error Thrown on failure. Note that, even if
+ * the function indicates an error, the underlying descriptor is closed.
    *
    * @note For portable behaviour with respect to graceful closure of a
    * connected socket, call shutdown() before closing the socket.
@@ -261,8 +306,8 @@
   void close()
   {
     boost::system::error_code ec;
- this->service.close(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().close(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "close");
   }
 
   /// Close the socket.
@@ -271,7 +316,8 @@
    * or connect operations will be cancelled immediately, and will complete
    * with the boost::asio::error::operation_aborted error.
    *
- * @param ec Set to indicate what error occurred, if any.
+ * @param ec Set to indicate what error occurred, if any. Note that, even if
+ * the function indicates an error, the underlying descriptor is closed.
    *
    * @par Example
    * @code
@@ -290,10 +336,10 @@
    */
   boost::system::error_code close(boost::system::error_code& ec)
   {
- return this->service.close(this->implementation, ec);
+ return this->get_service().close(this->get_implementation(), ec);
   }
 
- /// Get the native socket representation.
+ /// (Deprecated: Use native_handle().) Get the native socket representation.
   /**
    * This function may be used to obtain the underlying representation of the
    * socket. This is intended to allow access to native socket functionality
@@ -301,7 +347,18 @@
    */
   native_type native()
   {
- return this->service.native(this->implementation);
+ return this->get_service().native_handle(this->get_implementation());
+ }
+
+ /// Get the native socket representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * socket. This is intended to allow access to native socket functionality
+ * that is not otherwise provided.
+ */
+ native_handle_type native_handle()
+ {
+ return this->get_service().native_handle(this->get_implementation());
   }
 
   /// Cancel all asynchronous operations associated with the socket.
@@ -348,8 +405,8 @@
   void cancel()
   {
     boost::system::error_code ec;
- this->service.cancel(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().cancel(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "cancel");
   }
 
   /// Cancel all asynchronous operations associated with the socket.
@@ -395,7 +452,7 @@
 #endif
   boost::system::error_code cancel(boost::system::error_code& ec)
   {
- return this->service.cancel(this->implementation, ec);
+ return this->get_service().cancel(this->get_implementation(), ec);
   }
 
   /// Determine whether the socket is at the out-of-band data mark.
@@ -411,8 +468,8 @@
   bool at_mark() const
   {
     boost::system::error_code ec;
- bool b = this->service.at_mark(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ bool b = this->get_service().at_mark(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "at_mark");
     return b;
   }
 
@@ -428,7 +485,7 @@
    */
   bool at_mark(boost::system::error_code& ec) const
   {
- return this->service.at_mark(this->implementation, ec);
+ return this->get_service().at_mark(this->get_implementation(), ec);
   }
 
   /// Determine the number of bytes available for reading.
@@ -444,8 +501,9 @@
   std::size_t available() const
   {
     boost::system::error_code ec;
- std::size_t s = this->service.available(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().available(
+ this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "available");
     return s;
   }
 
@@ -461,7 +519,7 @@
    */
   std::size_t available(boost::system::error_code& ec) const
   {
- return this->service.available(this->implementation, ec);
+ return this->get_service().available(this->get_implementation(), ec);
   }
 
   /// Bind the socket to the given local endpoint.
@@ -485,8 +543,8 @@
   void bind(const endpoint_type& endpoint)
   {
     boost::system::error_code ec;
- this->service.bind(this->implementation, endpoint, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().bind(this->get_implementation(), endpoint, ec);
+ boost::asio::detail::throw_error(ec, "bind");
   }
 
   /// Bind the socket to the given local endpoint.
@@ -515,7 +573,7 @@
   boost::system::error_code bind(const endpoint_type& endpoint,
       boost::system::error_code& ec)
   {
- return this->service.bind(this->implementation, endpoint, ec);
+ return this->get_service().bind(this->get_implementation(), endpoint, ec);
   }
 
   /// Connect the socket to the specified endpoint.
@@ -546,11 +604,12 @@
     boost::system::error_code ec;
     if (!is_open())
     {
- this->service.open(this->implementation, peer_endpoint.protocol(), ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(),
+ peer_endpoint.protocol(), ec);
+ boost::asio::detail::throw_error(ec, "connect");
     }
- this->service.connect(this->implementation, peer_endpoint, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().connect(this->get_implementation(), peer_endpoint, ec);
+ boost::asio::detail::throw_error(ec, "connect");
   }
 
   /// Connect the socket to the specified endpoint.
@@ -586,14 +645,15 @@
   {
     if (!is_open())
     {
- if (this->service.open(this->implementation,
+ if (this->get_service().open(this->get_implementation(),
             peer_endpoint.protocol(), ec))
       {
         return ec;
       }
     }
 
- return this->service.connect(this->implementation, peer_endpoint, ec);
+ return this->get_service().connect(
+ this->get_implementation(), peer_endpoint, ec);
   }
 
   /// Start an asynchronous connect.
@@ -638,21 +698,28 @@
    * @endcode
    */
   template <typename ConnectHandler>
- void async_connect(const endpoint_type& peer_endpoint, ConnectHandler handler)
+ void async_connect(const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ConnectHandler.
+ BOOST_ASIO_CONNECT_HANDLER_CHECK(ConnectHandler, handler) type_check;
+
     if (!is_open())
     {
       boost::system::error_code ec;
- if (this->service.open(this->implementation,
- peer_endpoint.protocol(), ec))
+ const protocol_type protocol = peer_endpoint.protocol();
+ if (this->get_service().open(this->get_implementation(), protocol, ec))
       {
         this->get_io_service().post(
- boost::asio::detail::bind_handler(handler, ec));
+ boost::asio::detail::bind_handler(
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler), ec));
         return;
       }
     }
 
- this->service.async_connect(this->implementation, peer_endpoint, handler);
+ this->get_service().async_connect(this->get_implementation(),
+ peer_endpoint, BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set an option on the socket.
@@ -693,8 +760,8 @@
   void set_option(const SettableSocketOption& option)
   {
     boost::system::error_code ec;
- this->service.set_option(this->implementation, option, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().set_option(this->get_implementation(), option, ec);
+ boost::asio::detail::throw_error(ec, "set_option");
   }
 
   /// Set an option on the socket.
@@ -740,7 +807,8 @@
   boost::system::error_code set_option(const SettableSocketOption& option,
       boost::system::error_code& ec)
   {
- return this->service.set_option(this->implementation, option, ec);
+ return this->get_service().set_option(
+ this->get_implementation(), option, ec);
   }
 
   /// Get an option from the socket.
@@ -782,8 +850,8 @@
   void get_option(GettableSocketOption& option) const
   {
     boost::system::error_code ec;
- this->service.get_option(this->implementation, option, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().get_option(this->get_implementation(), option, ec);
+ boost::asio::detail::throw_error(ec, "get_option");
   }
 
   /// Get an option from the socket.
@@ -830,7 +898,8 @@
   boost::system::error_code get_option(GettableSocketOption& option,
       boost::system::error_code& ec) const
   {
- return this->service.get_option(this->implementation, option, ec);
+ return this->get_service().get_option(
+ this->get_implementation(), option, ec);
   }
 
   /// Perform an IO control command on the socket.
@@ -859,8 +928,8 @@
   void io_control(IoControlCommand& command)
   {
     boost::system::error_code ec;
- this->service.io_control(this->implementation, command, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().io_control(this->get_implementation(), command, ec);
+ boost::asio::detail::throw_error(ec, "io_control");
   }
 
   /// Perform an IO control command on the socket.
@@ -894,7 +963,338 @@
   boost::system::error_code io_control(IoControlCommand& command,
       boost::system::error_code& ec)
   {
- return this->service.io_control(this->implementation, command, ec);
+ return this->get_service().io_control(
+ this->get_implementation(), command, ec);
+ }
+
+ /// Gets the non-blocking mode of the socket.
+ /**
+ * @returns @c true if the socket's synchronous operations will fail with
+ * boost::asio::error::would_block if they are unable to perform the requested
+ * operation immediately. If @c false, synchronous operations will block
+ * until complete.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ bool non_blocking() const
+ {
+ return this->get_service().non_blocking(this->get_implementation());
+ }
+
+ /// Sets the non-blocking mode of the socket.
+ /**
+ * @param mode If @c true, the socket's synchronous operations will fail with
+ * boost::asio::error::would_block if they are unable to perform the requested
+ * operation immediately. If @c false, synchronous operations will block
+ * until complete.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ void non_blocking(bool mode)
+ {
+ boost::system::error_code ec;
+ this->get_service().non_blocking(this->get_implementation(), mode, ec);
+ boost::asio::detail::throw_error(ec, "non_blocking");
+ }
+
+ /// Sets the non-blocking mode of the socket.
+ /**
+ * @param mode If @c true, the socket's synchronous operations will fail with
+ * boost::asio::error::would_block if they are unable to perform the requested
+ * operation immediately. If @c false, synchronous operations will block
+ * until complete.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ boost::system::error_code non_blocking(
+ bool mode, boost::system::error_code& ec)
+ {
+ return this->get_service().non_blocking(
+ this->get_implementation(), mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native socket implementation.
+ /**
+ * This function is used to retrieve the non-blocking mode of the underlying
+ * native socket. This mode has no effect on the behaviour of the socket
+ * object's synchronous operations.
+ *
+ * @returns @c true if the underlying socket is in non-blocking mode and
+ * direct system calls may fail with boost::asio::error::would_block (or the
+ * equivalent system error).
+ *
+ * @note The current non-blocking mode is cached by the socket object.
+ * Consequently, the return value may be incorrect if the non-blocking mode
+ * was set directly on the native socket.
+ *
+ * @par Example
+ * This function is intended to allow the encapsulation of arbitrary
+ * non-blocking system calls as asynchronous operations, in a way that is
+ * transparent to the user of the socket object. The following example
+ * illustrates how Linux's @c sendfile system call might be encapsulated:
+ * @code template <typename Handler>
+ * struct sendfile_op
+ * {
+ * tcp::socket& sock_;
+ * int fd_;
+ * Handler handler_;
+ * off_t offset_;
+ * std::size_t total_bytes_transferred_;
+ *
+ * // Function call operator meeting WriteHandler requirements.
+ * // Used as the handler for the async_write_some operation.
+ * void operator()(boost::system::error_code ec, std::size_t)
+ * {
+ * // Put the underlying socket into non-blocking mode.
+ * if (!ec)
+ * if (!sock_.native_non_blocking())
+ * sock_.native_non_blocking(true, ec);
+ *
+ * if (!ec)
+ * {
+ * for (;;)
+ * {
+ * // Try the system call.
+ * errno = 0;
+ * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ * ec = boost::system::error_code(n < 0 ? errno : 0,
+ * boost::asio::error::get_system_category());
+ * total_bytes_transferred_ += ec ? 0 : n;
+ *
+ * // Retry operation immediately if interrupted by signal.
+ * if (ec == boost::asio::error::interrupted)
+ * continue;
+ *
+ * // Check if we need to run the operation again.
+ * if (ec == boost::asio::error::would_block
+ * || ec == boost::asio::error::try_again)
+ * {
+ * // We have to wait for the socket to become ready again.
+ * sock_.async_write_some(boost::asio::null_buffers(), *this);
+ * return;
+ * }
+ *
+ * if (ec || n == 0)
+ * {
+ * // An error occurred, or we have reached the end of the file.
+ * // Either way we must exit the loop so we can call the handler.
+ * break;
+ * }
+ *
+ * // Loop around to try calling sendfile again.
+ * }
+ * }
+ *
+ * // Pass result back to user's handler.
+ * handler_(ec, total_bytes_transferred_);
+ * }
+ * };
+ *
+ * template <typename Handler>
+ * void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ * {
+ * sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ * sock.async_write_some(boost::asio::null_buffers(), op);
+ * } @endcode
+ */
+ bool native_non_blocking() const
+ {
+ return this->get_service().native_non_blocking(this->get_implementation());
+ }
+
+ /// Sets the non-blocking mode of the native socket implementation.
+ /**
+ * This function is used to modify the non-blocking mode of the underlying
+ * native socket. It has no effect on the behaviour of the socket object's
+ * synchronous operations.
+ *
+ * @param mode If @c true, the underlying socket is put into non-blocking
+ * mode and direct system calls may fail with boost::asio::error::would_block
+ * (or the equivalent system error).
+ *
+ * @throws boost::system::system_error Thrown on failure. If the @c mode is
+ * @c false, but the current value of @c non_blocking() is @c true, this
+ * function fails with boost::asio::error::invalid_argument, as the
+ * combination does not make sense.
+ *
+ * @par Example
+ * This function is intended to allow the encapsulation of arbitrary
+ * non-blocking system calls as asynchronous operations, in a way that is
+ * transparent to the user of the socket object. The following example
+ * illustrates how Linux's @c sendfile system call might be encapsulated:
+ * @code template <typename Handler>
+ * struct sendfile_op
+ * {
+ * tcp::socket& sock_;
+ * int fd_;
+ * Handler handler_;
+ * off_t offset_;
+ * std::size_t total_bytes_transferred_;
+ *
+ * // Function call operator meeting WriteHandler requirements.
+ * // Used as the handler for the async_write_some operation.
+ * void operator()(boost::system::error_code ec, std::size_t)
+ * {
+ * // Put the underlying socket into non-blocking mode.
+ * if (!ec)
+ * if (!sock_.native_non_blocking())
+ * sock_.native_non_blocking(true, ec);
+ *
+ * if (!ec)
+ * {
+ * for (;;)
+ * {
+ * // Try the system call.
+ * errno = 0;
+ * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ * ec = boost::system::error_code(n < 0 ? errno : 0,
+ * boost::asio::error::get_system_category());
+ * total_bytes_transferred_ += ec ? 0 : n;
+ *
+ * // Retry operation immediately if interrupted by signal.
+ * if (ec == boost::asio::error::interrupted)
+ * continue;
+ *
+ * // Check if we need to run the operation again.
+ * if (ec == boost::asio::error::would_block
+ * || ec == boost::asio::error::try_again)
+ * {
+ * // We have to wait for the socket to become ready again.
+ * sock_.async_write_some(boost::asio::null_buffers(), *this);
+ * return;
+ * }
+ *
+ * if (ec || n == 0)
+ * {
+ * // An error occurred, or we have reached the end of the file.
+ * // Either way we must exit the loop so we can call the handler.
+ * break;
+ * }
+ *
+ * // Loop around to try calling sendfile again.
+ * }
+ * }
+ *
+ * // Pass result back to user's handler.
+ * handler_(ec, total_bytes_transferred_);
+ * }
+ * };
+ *
+ * template <typename Handler>
+ * void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ * {
+ * sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ * sock.async_write_some(boost::asio::null_buffers(), op);
+ * } @endcode
+ */
+ void native_non_blocking(bool mode)
+ {
+ boost::system::error_code ec;
+ this->get_service().native_non_blocking(
+ this->get_implementation(), mode, ec);
+ boost::asio::detail::throw_error(ec, "native_non_blocking");
+ }
+
+ /// Sets the non-blocking mode of the native socket implementation.
+ /**
+ * This function is used to modify the non-blocking mode of the underlying
+ * native socket. It has no effect on the behaviour of the socket object's
+ * synchronous operations.
+ *
+ * @param mode If @c true, the underlying socket is put into non-blocking
+ * mode and direct system calls may fail with boost::asio::error::would_block
+ * (or the equivalent system error).
+ *
+ * @param ec Set to indicate what error occurred, if any. If the @c mode is
+ * @c false, but the current value of @c non_blocking() is @c true, this
+ * function fails with boost::asio::error::invalid_argument, as the
+ * combination does not make sense.
+ *
+ * @par Example
+ * This function is intended to allow the encapsulation of arbitrary
+ * non-blocking system calls as asynchronous operations, in a way that is
+ * transparent to the user of the socket object. The following example
+ * illustrates how Linux's @c sendfile system call might be encapsulated:
+ * @code template <typename Handler>
+ * struct sendfile_op
+ * {
+ * tcp::socket& sock_;
+ * int fd_;
+ * Handler handler_;
+ * off_t offset_;
+ * std::size_t total_bytes_transferred_;
+ *
+ * // Function call operator meeting WriteHandler requirements.
+ * // Used as the handler for the async_write_some operation.
+ * void operator()(boost::system::error_code ec, std::size_t)
+ * {
+ * // Put the underlying socket into non-blocking mode.
+ * if (!ec)
+ * if (!sock_.native_non_blocking())
+ * sock_.native_non_blocking(true, ec);
+ *
+ * if (!ec)
+ * {
+ * for (;;)
+ * {
+ * // Try the system call.
+ * errno = 0;
+ * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ * ec = boost::system::error_code(n < 0 ? errno : 0,
+ * boost::asio::error::get_system_category());
+ * total_bytes_transferred_ += ec ? 0 : n;
+ *
+ * // Retry operation immediately if interrupted by signal.
+ * if (ec == boost::asio::error::interrupted)
+ * continue;
+ *
+ * // Check if we need to run the operation again.
+ * if (ec == boost::asio::error::would_block
+ * || ec == boost::asio::error::try_again)
+ * {
+ * // We have to wait for the socket to become ready again.
+ * sock_.async_write_some(boost::asio::null_buffers(), *this);
+ * return;
+ * }
+ *
+ * if (ec || n == 0)
+ * {
+ * // An error occurred, or we have reached the end of the file.
+ * // Either way we must exit the loop so we can call the handler.
+ * break;
+ * }
+ *
+ * // Loop around to try calling sendfile again.
+ * }
+ * }
+ *
+ * // Pass result back to user's handler.
+ * handler_(ec, total_bytes_transferred_);
+ * }
+ * };
+ *
+ * template <typename Handler>
+ * void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ * {
+ * sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ * sock.async_write_some(boost::asio::null_buffers(), op);
+ * } @endcode
+ */
+ boost::system::error_code native_non_blocking(
+ bool mode, boost::system::error_code& ec)
+ {
+ return this->get_service().native_non_blocking(
+ this->get_implementation(), mode, ec);
   }
 
   /// Get the local endpoint of the socket.
@@ -915,8 +1315,9 @@
   endpoint_type local_endpoint() const
   {
     boost::system::error_code ec;
- endpoint_type ep = this->service.local_endpoint(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ endpoint_type ep = this->get_service().local_endpoint(
+ this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "local_endpoint");
     return ep;
   }
 
@@ -943,7 +1344,7 @@
    */
   endpoint_type local_endpoint(boost::system::error_code& ec) const
   {
- return this->service.local_endpoint(this->implementation, ec);
+ return this->get_service().local_endpoint(this->get_implementation(), ec);
   }
 
   /// Get the remote endpoint of the socket.
@@ -964,8 +1365,9 @@
   endpoint_type remote_endpoint() const
   {
     boost::system::error_code ec;
- endpoint_type ep = this->service.remote_endpoint(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ endpoint_type ep = this->get_service().remote_endpoint(
+ this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "remote_endpoint");
     return ep;
   }
 
@@ -992,7 +1394,7 @@
    */
   endpoint_type remote_endpoint(boost::system::error_code& ec) const
   {
- return this->service.remote_endpoint(this->implementation, ec);
+ return this->get_service().remote_endpoint(this->get_implementation(), ec);
   }
 
   /// Disable sends or receives on the socket.
@@ -1015,8 +1417,8 @@
   void shutdown(shutdown_type what)
   {
     boost::system::error_code ec;
- this->service.shutdown(this->implementation, what, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().shutdown(this->get_implementation(), what, ec);
+ boost::asio::detail::throw_error(ec, "shutdown");
   }
 
   /// Disable sends or receives on the socket.
@@ -1044,7 +1446,7 @@
   boost::system::error_code shutdown(shutdown_type what,
       boost::system::error_code& ec)
   {
- return this->service.shutdown(this->implementation, what, ec);
+ return this->get_service().shutdown(this->get_implementation(), what, ec);
   }
 
 protected:

Modified: branches/release/boost/asio/basic_socket_acceptor.hpp
==============================================================================
--- branches/release/boost/asio/basic_socket_acceptor.hpp (original)
+++ branches/release/boost/asio/basic_socket_acceptor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,6 +18,7 @@
 #include <boost/asio/detail/config.hpp>
 #include <boost/asio/basic_io_object.hpp>
 #include <boost/asio/basic_socket.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/socket_acceptor_service.hpp>
@@ -55,8 +56,12 @@
     public socket_base
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of an
+ /// acceptor.
+ typedef typename SocketAcceptorService::native_handle_type native_type;
+
   /// The native representation of an acceptor.
- typedef typename SocketAcceptorService::native_type native_type;
+ typedef typename SocketAcceptorService::native_handle_type native_handle_type;
 
   /// The protocol type.
   typedef Protocol protocol_type;
@@ -96,8 +101,8 @@
     : basic_io_object<SocketAcceptorService>(io_service)
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, protocol, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(), protocol, ec);
+ boost::asio::detail::throw_error(ec, "open");
   }
 
   /// Construct an acceptor opened on the given endpoint.
@@ -132,19 +137,20 @@
     : basic_io_object<SocketAcceptorService>(io_service)
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, endpoint.protocol(), ec);
- boost::asio::detail::throw_error(ec);
+ const protocol_type protocol = endpoint.protocol();
+ this->get_service().open(this->get_implementation(), protocol, ec);
+ boost::asio::detail::throw_error(ec, "open");
     if (reuse_addr)
     {
- this->service.set_option(this->implementation,
+ this->get_service().set_option(this->get_implementation(),
           socket_base::reuse_address(true), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "set_option");
     }
- this->service.bind(this->implementation, endpoint, ec);
- boost::asio::detail::throw_error(ec);
- this->service.listen(this->implementation,
+ this->get_service().bind(this->get_implementation(), endpoint, ec);
+ boost::asio::detail::throw_error(ec, "bind");
+ this->get_service().listen(this->get_implementation(),
         socket_base::max_connections, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "listen");
   }
 
   /// Construct a basic_socket_acceptor on an existing native acceptor.
@@ -163,13 +169,49 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_socket_acceptor(boost::asio::io_service& io_service,
- const protocol_type& protocol, const native_type& native_acceptor)
+ const protocol_type& protocol, const native_handle_type& native_acceptor)
     : basic_io_object<SocketAcceptorService>(io_service)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, protocol, native_acceptor, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ protocol, native_acceptor, ec);
+ boost::asio::detail::throw_error(ec, "assign");
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_socket_acceptor from another.
+ /**
+ * This constructor moves an acceptor from one object to another.
+ *
+ * @param other The other basic_socket_acceptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_socket_acceptor(io_service&) constructor.
+ */
+ basic_socket_acceptor(basic_socket_acceptor&& other)
+ : basic_io_object<SocketAcceptorService>(
+ BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other))
+ {
+ }
+
+ /// Move-assign a basic_socket_acceptor from another.
+ /**
+ * This assignment operator moves an acceptor from one object to another.
+ *
+ * @param other The other basic_socket_acceptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_socket_acceptor(io_service&) constructor.
+ */
+ basic_socket_acceptor& operator=(basic_socket_acceptor&& other)
+ {
+ basic_io_object<SocketAcceptorService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other));
+ return *this;
   }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
 
   /// Open the acceptor using the specified protocol.
   /**
@@ -189,8 +231,8 @@
   void open(const protocol_type& protocol = protocol_type())
   {
     boost::system::error_code ec;
- this->service.open(this->implementation, protocol, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().open(this->get_implementation(), protocol, ec);
+ boost::asio::detail::throw_error(ec, "open");
   }
 
   /// Open the acceptor using the specified protocol.
@@ -216,7 +258,7 @@
   boost::system::error_code open(const protocol_type& protocol,
       boost::system::error_code& ec)
   {
- return this->service.open(this->implementation, protocol, ec);
+ return this->get_service().open(this->get_implementation(), protocol, ec);
   }
 
   /// Assigns an existing native acceptor to the acceptor.
@@ -229,11 +271,13 @@
    *
    * @throws boost::system::system_error Thrown on failure.
    */
- void assign(const protocol_type& protocol, const native_type& native_acceptor)
+ void assign(const protocol_type& protocol,
+ const native_handle_type& native_acceptor)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, protocol, native_acceptor, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ protocol, native_acceptor, ec);
+ boost::asio::detail::throw_error(ec, "assign");
   }
 
   /// Assigns an existing native acceptor to the acceptor.
@@ -247,16 +291,16 @@
    * @param ec Set to indicate what error occurred, if any.
    */
   boost::system::error_code assign(const protocol_type& protocol,
- const native_type& native_acceptor, boost::system::error_code& ec)
+ const native_handle_type& native_acceptor, boost::system::error_code& ec)
   {
- return this->service.assign(this->implementation,
+ return this->get_service().assign(this->get_implementation(),
         protocol, native_acceptor, ec);
   }
 
   /// Determine whether the acceptor is open.
   bool is_open() const
   {
- return this->service.is_open(this->implementation);
+ return this->get_service().is_open(this->get_implementation());
   }
 
   /// Bind the acceptor to the given local endpoint.
@@ -279,8 +323,8 @@
   void bind(const endpoint_type& endpoint)
   {
     boost::system::error_code ec;
- this->service.bind(this->implementation, endpoint, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().bind(this->get_implementation(), endpoint, ec);
+ boost::asio::detail::throw_error(ec, "bind");
   }
 
   /// Bind the acceptor to the given local endpoint.
@@ -308,7 +352,7 @@
   boost::system::error_code bind(const endpoint_type& endpoint,
       boost::system::error_code& ec)
   {
- return this->service.bind(this->implementation, endpoint, ec);
+ return this->get_service().bind(this->get_implementation(), endpoint, ec);
   }
 
   /// Place the acceptor into the state where it will listen for new
@@ -324,8 +368,8 @@
   void listen(int backlog = socket_base::max_connections)
   {
     boost::system::error_code ec;
- this->service.listen(this->implementation, backlog, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().listen(this->get_implementation(), backlog, ec);
+ boost::asio::detail::throw_error(ec, "listen");
   }
 
   /// Place the acceptor into the state where it will listen for new
@@ -352,7 +396,7 @@
    */
   boost::system::error_code listen(int backlog, boost::system::error_code& ec)
   {
- return this->service.listen(this->implementation, backlog, ec);
+ return this->get_service().listen(this->get_implementation(), backlog, ec);
   }
 
   /// Close the acceptor.
@@ -368,8 +412,8 @@
   void close()
   {
     boost::system::error_code ec;
- this->service.close(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().close(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "close");
   }
 
   /// Close the acceptor.
@@ -396,10 +440,10 @@
    */
   boost::system::error_code close(boost::system::error_code& ec)
   {
- return this->service.close(this->implementation, ec);
+ return this->get_service().close(this->get_implementation(), ec);
   }
 
- /// Get the native acceptor representation.
+ /// (Deprecated: Use native_handle().) Get the native acceptor representation.
   /**
    * This function may be used to obtain the underlying representation of the
    * acceptor. This is intended to allow access to native acceptor functionality
@@ -407,7 +451,18 @@
    */
   native_type native()
   {
- return this->service.native(this->implementation);
+ return this->get_service().native_handle(this->get_implementation());
+ }
+
+ /// Get the native acceptor representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * acceptor. This is intended to allow access to native acceptor functionality
+ * that is not otherwise provided.
+ */
+ native_handle_type native_handle()
+ {
+ return this->get_service().native_handle(this->get_implementation());
   }
 
   /// Cancel all asynchronous operations associated with the acceptor.
@@ -421,8 +476,8 @@
   void cancel()
   {
     boost::system::error_code ec;
- this->service.cancel(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().cancel(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "cancel");
   }
 
   /// Cancel all asynchronous operations associated with the acceptor.
@@ -435,7 +490,7 @@
    */
   boost::system::error_code cancel(boost::system::error_code& ec)
   {
- return this->service.cancel(this->implementation, ec);
+ return this->get_service().cancel(this->get_implementation(), ec);
   }
 
   /// Set an option on the acceptor.
@@ -463,8 +518,8 @@
   void set_option(const SettableSocketOption& option)
   {
     boost::system::error_code ec;
- this->service.set_option(this->implementation, option, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().set_option(this->get_implementation(), option, ec);
+ boost::asio::detail::throw_error(ec, "set_option");
   }
 
   /// Set an option on the acceptor.
@@ -497,7 +552,8 @@
   boost::system::error_code set_option(const SettableSocketOption& option,
       boost::system::error_code& ec)
   {
- return this->service.set_option(this->implementation, option, ec);
+ return this->get_service().set_option(
+ this->get_implementation(), option, ec);
   }
 
   /// Get an option from the acceptor.
@@ -526,8 +582,8 @@
   void get_option(GettableSocketOption& option)
   {
     boost::system::error_code ec;
- this->service.get_option(this->implementation, option, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().get_option(this->get_implementation(), option, ec);
+ boost::asio::detail::throw_error(ec, "get_option");
   }
 
   /// Get an option from the acceptor.
@@ -561,7 +617,189 @@
   boost::system::error_code get_option(GettableSocketOption& option,
       boost::system::error_code& ec)
   {
- return this->service.get_option(this->implementation, option, ec);
+ return this->get_service().get_option(
+ this->get_implementation(), option, ec);
+ }
+
+ /// Perform an IO control command on the acceptor.
+ /**
+ * This function is used to execute an IO control command on the acceptor.
+ *
+ * @param command The IO control command to be performed on the acceptor.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @sa IoControlCommand @n
+ * boost::asio::socket_base::non_blocking_io
+ *
+ * @par Example
+ * Getting the number of bytes ready to read:
+ * @code
+ * boost::asio::ip::tcp::acceptor acceptor(io_service);
+ * ...
+ * boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
+ * socket.io_control(command);
+ * @endcode
+ */
+ template <typename IoControlCommand>
+ void io_control(IoControlCommand& command)
+ {
+ boost::system::error_code ec;
+ this->get_service().io_control(this->get_implementation(), command, ec);
+ boost::asio::detail::throw_error(ec, "io_control");
+ }
+
+ /// Perform an IO control command on the acceptor.
+ /**
+ * This function is used to execute an IO control command on the acceptor.
+ *
+ * @param command The IO control command to be performed on the acceptor.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @sa IoControlCommand @n
+ * boost::asio::socket_base::non_blocking_io
+ *
+ * @par Example
+ * Getting the number of bytes ready to read:
+ * @code
+ * boost::asio::ip::tcp::acceptor acceptor(io_service);
+ * ...
+ * boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
+ * boost::system::error_code ec;
+ * socket.io_control(command, ec);
+ * if (ec)
+ * {
+ * // An error occurred.
+ * }
+ * @endcode
+ */
+ template <typename IoControlCommand>
+ boost::system::error_code io_control(IoControlCommand& command,
+ boost::system::error_code& ec)
+ {
+ return this->get_service().io_control(
+ this->get_implementation(), command, ec);
+ }
+
+ /// Gets the non-blocking mode of the acceptor.
+ /**
+ * @returns @c true if the acceptor's synchronous operations will fail with
+ * boost::asio::error::would_block if they are unable to perform the requested
+ * operation immediately. If @c false, synchronous operations will block
+ * until complete.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ bool non_blocking() const
+ {
+ return this->get_service().non_blocking(this->get_implementation());
+ }
+
+ /// Sets the non-blocking mode of the acceptor.
+ /**
+ * @param mode If @c true, the acceptor's synchronous operations will fail
+ * with boost::asio::error::would_block if they are unable to perform the
+ * requested operation immediately. If @c false, synchronous operations will
+ * block until complete.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ void non_blocking(bool mode)
+ {
+ boost::system::error_code ec;
+ this->get_service().non_blocking(this->get_implementation(), mode, ec);
+ boost::asio::detail::throw_error(ec, "non_blocking");
+ }
+
+ /// Sets the non-blocking mode of the acceptor.
+ /**
+ * @param mode If @c true, the acceptor's synchronous operations will fail
+ * with boost::asio::error::would_block if they are unable to perform the
+ * requested operation immediately. If @c false, synchronous operations will
+ * block until complete.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ boost::system::error_code non_blocking(
+ bool mode, boost::system::error_code& ec)
+ {
+ return this->get_service().non_blocking(
+ this->get_implementation(), mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native acceptor implementation.
+ /**
+ * This function is used to retrieve the non-blocking mode of the underlying
+ * native acceptor. This mode has no effect on the behaviour of the acceptor
+ * object's synchronous operations.
+ *
+ * @returns @c true if the underlying acceptor is in non-blocking mode and
+ * direct system calls may fail with boost::asio::error::would_block (or the
+ * equivalent system error).
+ *
+ * @note The current non-blocking mode is cached by the acceptor object.
+ * Consequently, the return value may be incorrect if the non-blocking mode
+ * was set directly on the native acceptor.
+ */
+ bool native_non_blocking() const
+ {
+ return this->get_service().native_non_blocking(this->get_implementation());
+ }
+
+ /// Sets the non-blocking mode of the native acceptor implementation.
+ /**
+ * This function is used to modify the non-blocking mode of the underlying
+ * native acceptor. It has no effect on the behaviour of the acceptor object's
+ * synchronous operations.
+ *
+ * @param mode If @c true, the underlying acceptor is put into non-blocking
+ * mode and direct system calls may fail with boost::asio::error::would_block
+ * (or the equivalent system error).
+ *
+ * @throws boost::system::system_error Thrown on failure. If the @c mode is
+ * @c false, but the current value of @c non_blocking() is @c true, this
+ * function fails with boost::asio::error::invalid_argument, as the
+ * combination does not make sense.
+ */
+ void native_non_blocking(bool mode)
+ {
+ boost::system::error_code ec;
+ this->get_service().native_non_blocking(
+ this->get_implementation(), mode, ec);
+ boost::asio::detail::throw_error(ec, "native_non_blocking");
+ }
+
+ /// Sets the non-blocking mode of the native acceptor implementation.
+ /**
+ * This function is used to modify the non-blocking mode of the underlying
+ * native acceptor. It has no effect on the behaviour of the acceptor object's
+ * synchronous operations.
+ *
+ * @param mode If @c true, the underlying acceptor is put into non-blocking
+ * mode and direct system calls may fail with boost::asio::error::would_block
+ * (or the equivalent system error).
+ *
+ * @param ec Set to indicate what error occurred, if any. If the @c mode is
+ * @c false, but the current value of @c non_blocking() is @c true, this
+ * function fails with boost::asio::error::invalid_argument, as the
+ * combination does not make sense.
+ */
+ boost::system::error_code native_non_blocking(
+ bool mode, boost::system::error_code& ec)
+ {
+ return this->get_service().native_non_blocking(
+ this->get_implementation(), mode, ec);
   }
 
   /// Get the local endpoint of the acceptor.
@@ -582,8 +820,9 @@
   endpoint_type local_endpoint() const
   {
     boost::system::error_code ec;
- endpoint_type ep = this->service.local_endpoint(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ endpoint_type ep = this->get_service().local_endpoint(
+ this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "local_endpoint");
     return ep;
   }
 
@@ -611,7 +850,7 @@
    */
   endpoint_type local_endpoint(boost::system::error_code& ec) const
   {
- return this->service.local_endpoint(this->implementation, ec);
+ return this->get_service().local_endpoint(this->get_implementation(), ec);
   }
 
   /// Accept a new connection.
@@ -636,8 +875,8 @@
   void accept(basic_socket<protocol_type, SocketService>& peer)
   {
     boost::system::error_code ec;
- this->service.accept(this->implementation, peer, 0, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().accept(this->get_implementation(), peer, 0, ec);
+ boost::asio::detail::throw_error(ec, "accept");
   }
 
   /// Accept a new connection.
@@ -668,7 +907,7 @@
       basic_socket<protocol_type, SocketService>& peer,
       boost::system::error_code& ec)
   {
- return this->service.accept(this->implementation, peer, 0, ec);
+ return this->get_service().accept(this->get_implementation(), peer, 0, ec);
   }
 
   /// Start an asynchronous accept.
@@ -711,9 +950,14 @@
    */
   template <typename SocketService, typename AcceptHandler>
   void async_accept(basic_socket<protocol_type, SocketService>& peer,
- AcceptHandler handler)
+ BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
   {
- this->service.async_accept(this->implementation, peer, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a AcceptHandler.
+ BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check;
+
+ this->get_service().async_accept(this->get_implementation(),
+ peer, 0, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
   }
 
   /// Accept a new connection and obtain the endpoint of the peer
@@ -744,8 +988,9 @@
       endpoint_type& peer_endpoint)
   {
     boost::system::error_code ec;
- this->service.accept(this->implementation, peer, &peer_endpoint, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().accept(this->get_implementation(),
+ peer, &peer_endpoint, ec);
+ boost::asio::detail::throw_error(ec, "accept");
   }
 
   /// Accept a new connection and obtain the endpoint of the peer
@@ -781,7 +1026,8 @@
       basic_socket<protocol_type, SocketService>& peer,
       endpoint_type& peer_endpoint, boost::system::error_code& ec)
   {
- return this->service.accept(this->implementation, peer, &peer_endpoint, ec);
+ return this->get_service().accept(
+ this->get_implementation(), peer, &peer_endpoint, ec);
   }
 
   /// Start an asynchronous accept.
@@ -812,10 +1058,14 @@
    */
   template <typename SocketService, typename AcceptHandler>
   void async_accept(basic_socket<protocol_type, SocketService>& peer,
- endpoint_type& peer_endpoint, AcceptHandler handler)
+ endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
   {
- this->service.async_accept(this->implementation,
- peer, &peer_endpoint, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a AcceptHandler.
+ BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check;
+
+ this->get_service().async_accept(this->get_implementation(), peer,
+ &peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/basic_socket_iostream.hpp
==============================================================================
--- branches/release/boost/asio/basic_socket_iostream.hpp (original)
+++ branches/release/boost/asio/basic_socket_iostream.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,34 +19,39 @@
 
 #if !defined(BOOST_NO_IOSTREAM)
 
-#include <boost/preprocessor/arithmetic/inc.hpp>
-#include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/utility/base_from_member.hpp>
 #include <boost/asio/basic_socket_streambuf.hpp>
 #include <boost/asio/stream_socket_service.hpp>
 
-#if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
-#define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5
-#endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
+#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+
+# include <boost/preprocessor/arithmetic/inc.hpp>
+# include <boost/preprocessor/repetition/enum_binary_params.hpp>
+# include <boost/preprocessor/repetition/enum_params.hpp>
+# include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+# if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
+# define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5
+# endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
 
 // A macro that should expand to:
 // template <typename T1, ..., typename Tn>
 // explicit basic_socket_iostream(T1 x1, ..., Tn xn)
 // : basic_iostream<char>(&this->boost::base_from_member<
-// basic_socket_streambuf<Protocol, StreamSocketService> >::member)
+// basic_socket_streambuf<Protocol, StreamSocketService,
+// Time, TimeTraits, TimerService> >::member)
 // {
 // if (rdbuf()->connect(x1, ..., xn) == 0)
 // this->setstate(std::ios_base::failbit);
 // }
 // This macro should only persist within this file.
 
-#define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \
+# define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \
   template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
   explicit basic_socket_iostream(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
     : std::basic_iostream<char>(&this->boost::base_from_member< \
- basic_socket_streambuf<Protocol, StreamSocketService> >::member) \
+ basic_socket_streambuf<Protocol, StreamSocketService, \
+ Time, TimeTraits, TimerService> >::member) \
   { \
     tie(this); \
     if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
@@ -63,7 +68,7 @@
 // }
 // This macro should only persist within this file.
 
-#define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \
+# define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \
   template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
   void connect(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
   { \
@@ -72,6 +77,8 @@
   } \
   /**/
 
+#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+
 #include <boost/asio/detail/push_options.hpp>
 
 namespace boost {
@@ -79,17 +86,31 @@
 
 /// Iostream interface for a socket.
 template <typename Protocol,
- typename StreamSocketService = stream_socket_service<Protocol> >
+ typename StreamSocketService = stream_socket_service<Protocol>,
+ typename Time = boost::posix_time::ptime,
+ typename TimeTraits = boost::asio::time_traits<Time>,
+ typename TimerService = deadline_timer_service<Time, TimeTraits> >
 class basic_socket_iostream
   : public boost::base_from_member<
- basic_socket_streambuf<Protocol, StreamSocketService> >,
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService> >,
     public std::basic_iostream<char>
 {
 public:
+ /// The endpoint type.
+ typedef typename Protocol::endpoint endpoint_type;
+
+ /// The time type.
+ typedef typename TimeTraits::time_type time_type;
+
+ /// The duration type.
+ typedef typename TimeTraits::duration_type duration_type;
+
   /// Construct a basic_socket_iostream without establishing a connection.
   basic_socket_iostream()
     : std::basic_iostream<char>(&this->boost::base_from_member<
- basic_socket_streambuf<Protocol, StreamSocketService> >::member)
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService> >::member)
   {
     tie(this);
   }
@@ -103,6 +124,17 @@
    */
   template <typename T1, ..., typename TN>
   explicit basic_socket_iostream(T1 t1, ..., TN tn);
+#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+ template <typename... T>
+ explicit basic_socket_iostream(T... x)
+ : std::basic_iostream<char>(&this->boost::base_from_member<
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService> >::member)
+ {
+ tie(this);
+ if (rdbuf()->connect(x...) == 0)
+ this->setstate(std::ios_base::failbit);
+ }
 #else
   BOOST_PP_REPEAT_FROM_TO(
       1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY),
@@ -118,6 +150,13 @@
    */
   template <typename T1, ..., typename TN>
   void connect(T1 t1, ..., TN tn);
+#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+ template <typename... T>
+ void connect(T... x)
+ {
+ if (rdbuf()->connect(x...) == 0)
+ this->setstate(std::ios_base::failbit);
+ }
 #else
   BOOST_PP_REPEAT_FROM_TO(
       1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY),
@@ -132,11 +171,77 @@
   }
 
   /// Return a pointer to the underlying streambuf.
- basic_socket_streambuf<Protocol, StreamSocketService>* rdbuf() const
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService>* rdbuf() const
   {
- return const_cast<basic_socket_streambuf<Protocol, StreamSocketService>*>(
+ return const_cast<basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService>*>(
         &this->boost::base_from_member<
- basic_socket_streambuf<Protocol, StreamSocketService> >::member);
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService> >::member);
+ }
+
+ /// Get the last error associated with the stream.
+ /**
+ * @return An \c error_code corresponding to the last error from the stream.
+ *
+ * @par Example
+ * To print the error associated with a failure to establish a connection:
+ * @code tcp::iostream s("www.boost.org", "http");
+ * if (!s)
+ * {
+ * std::cout << "Error: " << s.error().message() << std::endl;
+ * } @endcode
+ */
+ const boost::system::error_code& error() const
+ {
+ return rdbuf()->puberror();
+ }
+
+ /// Get the stream's expiry time as an absolute time.
+ /**
+ * @return An absolute time value representing the stream's expiry time.
+ */
+ time_type expires_at() const
+ {
+ return rdbuf()->expires_at();
+ }
+
+ /// Set the stream's expiry time as an absolute time.
+ /**
+ * This function sets the expiry time associated with the stream. Stream
+ * operations performed after this time (where the operations cannot be
+ * completed using the internal buffers) will fail with the error
+ * boost::asio::error::operation_aborted.
+ *
+ * @param expiry_time The expiry time to be used for the stream.
+ */
+ void expires_at(const time_type& expiry_time)
+ {
+ rdbuf()->expires_at(expiry_time);
+ }
+
+ /// Get the timer's expiry time relative to now.
+ /**
+ * @return A relative time value representing the stream's expiry time.
+ */
+ duration_type expires_from_now() const
+ {
+ return rdbuf()->expires_from_now();
+ }
+
+ /// Set the stream's expiry time relative to now.
+ /**
+ * This function sets the expiry time associated with the stream. Stream
+ * operations performed after this time (where the operations cannot be
+ * completed using the internal buffers) will fail with the error
+ * boost::asio::error::operation_aborted.
+ *
+ * @param expiry_time The expiry time to be used for the timer.
+ */
+ void expires_from_now(const duration_type& expiry_time)
+ {
+ rdbuf()->expires_from_now(expiry_time);
   }
 };
 
@@ -145,8 +250,10 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
-#undef BOOST_ASIO_PRIVATE_CTR_DEF
-#undef BOOST_ASIO_PRIVATE_CONNECT_DEF
+#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+# undef BOOST_ASIO_PRIVATE_CTR_DEF
+# undef BOOST_ASIO_PRIVATE_CONNECT_DEF
+#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
 
 #endif // defined(BOOST_NO_IOSTREAM)
 

Modified: branches/release/boost/asio/basic_socket_streambuf.hpp
==============================================================================
--- branches/release/boost/asio/basic_socket_streambuf.hpp (original)
+++ branches/release/boost/asio/basic_socket_streambuf.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -20,53 +20,64 @@
 #if !defined(BOOST_NO_IOSTREAM)
 
 #include <streambuf>
-#include <boost/array.hpp>
-#include <boost/preprocessor/arithmetic/inc.hpp>
-#include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/utility/base_from_member.hpp>
 #include <boost/asio/basic_socket.hpp>
+#include <boost/asio/deadline_timer_service.hpp>
+#include <boost/asio/detail/array.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/stream_socket_service.hpp>
+#include <boost/asio/time_traits.hpp>
 
-#if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY)
-#define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5
-#endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY)
+#include <boost/asio/detail/push_options.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
+#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+
+# include <boost/preprocessor/arithmetic/inc.hpp>
+# include <boost/preprocessor/repetition/enum_binary_params.hpp>
+# include <boost/preprocessor/repetition/enum_params.hpp>
+# include <boost/preprocessor/repetition/repeat_from_to.hpp>
+
+# if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY)
+# define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5
+# endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY)
 
 // A macro that should expand to:
 // template <typename T1, ..., typename Tn>
-// basic_socket_streambuf<Protocol, StreamSocketService>* connect(
+// basic_socket_streambuf<Protocol, StreamSocketService,
+// Time, TimeTraits, TimerService>* connect(
 // T1 x1, ..., Tn xn)
 // {
 // init_buffers();
-// boost::system::error_code ec;
-// this->basic_socket<Protocol, StreamSocketService>::close(ec);
+// this->basic_socket<Protocol, StreamSocketService>::close(ec_);
 // typedef typename Protocol::resolver resolver_type;
 // typedef typename resolver_type::query resolver_query;
 // resolver_query query(x1, ..., xn);
-// resolve_and_connect(query, ec);
-// return !ec ? this : 0;
+// resolve_and_connect(query);
+// return !ec_ ? this : 0;
 // }
 // This macro should only persist within this file.
 
-#define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \
+# define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \
   template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
- basic_socket_streambuf<Protocol, StreamSocketService>* connect( \
+ basic_socket_streambuf<Protocol, StreamSocketService, \
+ Time, TimeTraits, TimerService>* connect( \
       BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \
   { \
     init_buffers(); \
- boost::system::error_code ec; \
- this->basic_socket<Protocol, StreamSocketService>::close(ec); \
+ this->basic_socket<Protocol, StreamSocketService>::close(ec_); \
     typedef typename Protocol::resolver resolver_type; \
     typedef typename resolver_type::query resolver_query; \
     resolver_query query(BOOST_PP_ENUM_PARAMS(n, x)); \
- resolve_and_connect(query, ec); \
- return !ec ? this : 0; \
+ resolve_and_connect(query); \
+ return !ec_ ? this : 0; \
   } \
   /**/
 
+#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+
 #include <boost/asio/detail/push_options.hpp>
 
 namespace boost {
@@ -74,7 +85,10 @@
 
 /// Iostream streambuf for a socket.
 template <typename Protocol,
- typename StreamSocketService = stream_socket_service<Protocol> >
+ typename StreamSocketService = stream_socket_service<Protocol>,
+ typename Time = boost::posix_time::ptime,
+ typename TimeTraits = boost::asio::time_traits<Time>,
+ typename TimerService = deadline_timer_service<Time, TimeTraits> >
 class basic_socket_streambuf
   : public std::streambuf,
     private boost::base_from_member<io_service>,
@@ -84,11 +98,19 @@
   /// The endpoint type.
   typedef typename Protocol::endpoint endpoint_type;
 
+ /// The time type.
+ typedef typename TimeTraits::time_type time_type;
+
+ /// The duration type.
+ typedef typename TimeTraits::duration_type duration_type;
+
   /// Construct a basic_socket_streambuf without establishing a connection.
   basic_socket_streambuf()
     : basic_socket<Protocol, StreamSocketService>(
         boost::base_from_member<boost::asio::io_service>::member),
- unbuffered_(false)
+ unbuffered_(false),
+ timer_service_(0),
+ timer_state_(no_timer)
   {
     init_buffers();
   }
@@ -98,6 +120,8 @@
   {
     if (pptr() != pbase())
       overflow(traits_type::eof());
+
+ destroy_timer();
   }
 
   /// Establish a connection.
@@ -107,14 +131,30 @@
    * @return \c this if a connection was successfully established, a null
    * pointer otherwise.
    */
- basic_socket_streambuf<Protocol, StreamSocketService>* connect(
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService>* connect(
       const endpoint_type& endpoint)
   {
     init_buffers();
- boost::system::error_code ec;
- this->basic_socket<Protocol, StreamSocketService>::close(ec);
- this->basic_socket<Protocol, StreamSocketService>::connect(endpoint, ec);
- return !ec ? this : 0;
+
+ this->basic_socket<Protocol, StreamSocketService>::close(ec_);
+
+ if (timer_state_ == timer_has_expired)
+ {
+ ec_ = boost::asio::error::operation_aborted;
+ return 0;
+ }
+
+ io_handler handler = { this };
+ this->basic_socket<Protocol, StreamSocketService>::async_connect(
+ endpoint, handler);
+
+ ec_ = boost::asio::error::would_block;
+ this->get_service().get_io_service().reset();
+ do this->get_service().get_io_service().run_one();
+ while (ec_ == boost::asio::error::would_block);
+
+ return !ec_ ? this : 0;
   }
 
 #if defined(GENERATING_DOCUMENTATION)
@@ -130,6 +170,19 @@
   template <typename T1, ..., typename TN>
   basic_socket_streambuf<Protocol, StreamSocketService>* connect(
       T1 t1, ..., TN tn);
+#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+ template <typename... T>
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService>* connect(T... x)
+ {
+ init_buffers();
+ this->basic_socket<Protocol, StreamSocketService>::close(ec_);
+ typedef typename Protocol::resolver resolver_type;
+ typedef typename resolver_type::query resolver_query;
+ resolver_query query(x...);
+ resolve_and_connect(query);
+ return !ec_ ? this : 0;
+ }
 #else
   BOOST_PP_REPEAT_FROM_TO(
       1, BOOST_PP_INC(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY),
@@ -141,14 +194,85 @@
    * @return \c this if a connection was successfully established, a null
    * pointer otherwise.
    */
- basic_socket_streambuf<Protocol, StreamSocketService>* close()
+ basic_socket_streambuf<Protocol, StreamSocketService,
+ Time, TimeTraits, TimerService>* close()
   {
- boost::system::error_code ec;
     sync();
- this->basic_socket<Protocol, StreamSocketService>::close(ec);
- if (!ec)
+ this->basic_socket<Protocol, StreamSocketService>::close(ec_);
+ if (!ec_)
       init_buffers();
- return !ec ? this : 0;
+ return !ec_ ? this : 0;
+ }
+
+ /// Get the last error associated with the stream buffer.
+ /**
+ * @return An \c error_code corresponding to the last error from the stream
+ * buffer.
+ */
+ const boost::system::error_code& puberror() const
+ {
+ return error();
+ }
+
+ /// Get the stream buffer's expiry time as an absolute time.
+ /**
+ * @return An absolute time value representing the stream buffer's expiry
+ * time.
+ */
+ time_type expires_at() const
+ {
+ return timer_service_
+ ? timer_service_->expires_at(timer_implementation_)
+ : time_type();
+ }
+
+ /// Set the stream buffer's expiry time as an absolute time.
+ /**
+ * This function sets the expiry time associated with the stream. Stream
+ * operations performed after this time (where the operations cannot be
+ * completed using the internal buffers) will fail with the error
+ * boost::asio::error::operation_aborted.
+ *
+ * @param expiry_time The expiry time to be used for the stream.
+ */
+ void expires_at(const time_type& expiry_time)
+ {
+ construct_timer();
+
+ boost::system::error_code ec;
+ timer_service_->expires_at(timer_implementation_, expiry_time, ec);
+ boost::asio::detail::throw_error(ec, "expires_at");
+
+ start_timer();
+ }
+
+ /// Get the stream buffer's expiry time relative to now.
+ /**
+ * @return A relative time value representing the stream buffer's expiry time.
+ */
+ duration_type expires_from_now() const
+ {
+ return TimeTraits::subtract(expires_at(), TimeTraits::now());
+ }
+
+ /// Set the stream buffer's expiry time relative to now.
+ /**
+ * This function sets the expiry time associated with the stream. Stream
+ * operations performed after this time (where the operations cannot be
+ * completed using the internal buffers) will fail with the error
+ * boost::asio::error::operation_aborted.
+ *
+ * @param expiry_time The expiry time to be used for the timer.
+ */
+ void expires_from_now(const duration_type& expiry_time)
+ {
+ construct_timer();
+
+ boost::system::error_code ec;
+ timer_service_->expires_from_now(timer_implementation_, expiry_time, ec);
+ boost::asio::detail::throw_error(ec, "expires_from_now");
+
+ start_timer();
   }
 
 protected:
@@ -156,15 +280,26 @@
   {
     if (gptr() == egptr())
     {
- boost::system::error_code ec;
- std::size_t bytes_transferred = this->service.receive(
- this->implementation,
+ if (timer_state_ == timer_has_expired)
+ {
+ ec_ = boost::asio::error::operation_aborted;
+ return traits_type::eof();
+ }
+
+ io_handler handler = { this };
+ this->get_service().async_receive(this->get_implementation(),
           boost::asio::buffer(boost::asio::buffer(get_buffer_) + putback_max),
- 0, ec);
- if (ec)
+ 0, handler);
+
+ ec_ = boost::asio::error::would_block;
+ this->get_service().get_io_service().reset();
+ do this->get_service().get_io_service().run_one();
+ while (ec_ == boost::asio::error::would_block);
+ if (ec_)
         return traits_type::eof();
- setg(get_buffer_.begin(), get_buffer_.begin() + putback_max,
- get_buffer_.begin() + putback_max + bytes_transferred);
+
+ setg(&get_buffer_[0], &get_buffer_[0] + putback_max,
+ &get_buffer_[0] + putback_max + bytes_transferred_);
       return traits_type::to_int_type(*gptr());
     }
     else
@@ -184,13 +319,25 @@
       }
       else
       {
+ if (timer_state_ == timer_has_expired)
+ {
+ ec_ = boost::asio::error::operation_aborted;
+ return traits_type::eof();
+ }
+
         // Send the single character immediately.
- boost::system::error_code ec;
         char_type ch = traits_type::to_char_type(c);
- this->service.send(this->implementation,
- boost::asio::buffer(&ch, sizeof(char_type)), 0, ec);
- if (ec)
+ io_handler handler = { this };
+ this->get_service().async_send(this->get_implementation(),
+ boost::asio::buffer(&ch, sizeof(char_type)), 0, handler);
+
+ ec_ = boost::asio::error::would_block;
+ this->get_service().get_io_service().reset();
+ do this->get_service().get_io_service().run_one();
+ while (ec_ == boost::asio::error::would_block);
+ if (ec_)
           return traits_type::eof();
+
         return c;
       }
     }
@@ -201,15 +348,26 @@
         boost::asio::buffer(pbase(), pptr() - pbase());
       while (boost::asio::buffer_size(buffer) > 0)
       {
- boost::system::error_code ec;
- std::size_t bytes_transferred = this->service.send(
- this->implementation, boost::asio::buffer(buffer),
- 0, ec);
- if (ec)
+ if (timer_state_ == timer_has_expired)
+ {
+ ec_ = boost::asio::error::operation_aborted;
+ return traits_type::eof();
+ }
+
+ io_handler handler = { this };
+ this->get_service().async_send(this->get_implementation(),
+ boost::asio::buffer(buffer), 0, handler);
+
+ ec_ = boost::asio::error::would_block;
+ this->get_service().get_io_service().reset();
+ do this->get_service().get_io_service().run_one();
+ while (ec_ == boost::asio::error::would_block);
+ if (ec_)
           return traits_type::eof();
- buffer = buffer + bytes_transferred;
+
+ buffer = buffer + bytes_transferred_;
       }
- setp(put_buffer_.begin(), put_buffer_.end());
+ setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size());
 
       // If the new character is eof then our work here is done.
       if (traits_type::eq_int_type(c, traits_type::eof()))
@@ -239,45 +397,141 @@
     return 0;
   }
 
+ /// Get the last error associated with the stream buffer.
+ /**
+ * @return An \c error_code corresponding to the last error from the stream
+ * buffer.
+ */
+ virtual const boost::system::error_code& error() const
+ {
+ return ec_;
+ }
+
 private:
   void init_buffers()
   {
- setg(get_buffer_.begin(),
- get_buffer_.begin() + putback_max,
- get_buffer_.begin() + putback_max);
+ setg(&get_buffer_[0],
+ &get_buffer_[0] + putback_max,
+ &get_buffer_[0] + putback_max);
     if (unbuffered_)
       setp(0, 0);
     else
- setp(put_buffer_.begin(), put_buffer_.end());
+ setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size());
   }
 
   template <typename ResolverQuery>
- void resolve_and_connect(const ResolverQuery& query,
- boost::system::error_code& ec)
+ void resolve_and_connect(const ResolverQuery& query)
   {
     typedef typename Protocol::resolver resolver_type;
     typedef typename resolver_type::iterator iterator_type;
     resolver_type resolver(
         boost::base_from_member<boost::asio::io_service>::member);
- iterator_type i = resolver.resolve(query, ec);
- if (!ec)
+ iterator_type i = resolver.resolve(query, ec_);
+ if (!ec_)
     {
       iterator_type end;
- ec = boost::asio::error::host_not_found;
- while (ec && i != end)
+ ec_ = boost::asio::error::host_not_found;
+ while (ec_ && i != end)
       {
- this->basic_socket<Protocol, StreamSocketService>::close();
- this->basic_socket<Protocol, StreamSocketService>::connect(*i, ec);
+ this->basic_socket<Protocol, StreamSocketService>::close(ec_);
+
+ if (timer_state_ == timer_has_expired)
+ {
+ ec_ = boost::asio::error::operation_aborted;
+ return;
+ }
+
+ io_handler handler = { this };
+ this->basic_socket<Protocol, StreamSocketService>::async_connect(
+ *i, handler);
+
+ ec_ = boost::asio::error::would_block;
+ this->get_service().get_io_service().reset();
+ do this->get_service().get_io_service().run_one();
+ while (ec_ == boost::asio::error::would_block);
+
         ++i;
       }
     }
   }
 
+ struct io_handler;
+ friend struct io_handler;
+ struct io_handler
+ {
+ basic_socket_streambuf* this_;
+
+ void operator()(const boost::system::error_code& ec,
+ std::size_t bytes_transferred = 0)
+ {
+ this_->ec_ = ec;
+ this_->bytes_transferred_ = bytes_transferred;
+ }
+ };
+
+ struct timer_handler;
+ friend struct timer_handler;
+ struct timer_handler
+ {
+ basic_socket_streambuf* this_;
+
+ void operator()(const boost::system::error_code&)
+ {
+ time_type now = TimeTraits::now();
+
+ time_type expiry_time = this_->timer_service_->expires_at(
+ this_->timer_implementation_);
+
+ if (TimeTraits::less_than(now, expiry_time))
+ {
+ this_->timer_state_ = timer_is_pending;
+ this_->timer_service_->async_wait(this_->timer_implementation_, *this);
+ }
+ else
+ {
+ this_->timer_state_ = timer_has_expired;
+ boost::system::error_code ec;
+ this_->basic_socket<Protocol, StreamSocketService>::close(ec);
+ }
+ }
+ };
+
+ void construct_timer()
+ {
+ if (timer_service_ == 0)
+ {
+ TimerService& timer_service = use_service<TimerService>(
+ boost::base_from_member<boost::asio::io_service>::member);
+ timer_service.construct(timer_implementation_);
+ timer_service_ = &timer_service;
+ }
+ }
+
+ void destroy_timer()
+ {
+ if (timer_service_)
+ timer_service_->destroy(timer_implementation_);
+ }
+
+ void start_timer()
+ {
+ if (timer_state_ != timer_is_pending)
+ {
+ timer_handler handler = { this };
+ handler(boost::system::error_code());
+ }
+ }
+
   enum { putback_max = 8 };
   enum { buffer_size = 512 };
- boost::array<char, buffer_size> get_buffer_;
- boost::array<char, buffer_size> put_buffer_;
+ boost::asio::detail::array<char, buffer_size> get_buffer_;
+ boost::asio::detail::array<char, buffer_size> put_buffer_;
   bool unbuffered_;
+ boost::system::error_code ec_;
+ std::size_t bytes_transferred_;
+ TimerService* timer_service_;
+ typename TimerService::implementation_type timer_implementation_;
+ enum state { no_timer, timer_is_pending, timer_has_expired } timer_state_;
 };
 
 } // namespace asio
@@ -285,7 +539,9 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
-#undef BOOST_ASIO_PRIVATE_CONNECT_DEF
+#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+# undef BOOST_ASIO_PRIVATE_CONNECT_DEF
+#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: branches/release/boost/asio/basic_stream_socket.hpp
==============================================================================
--- branches/release/boost/asio/basic_stream_socket.hpp (original)
+++ branches/release/boost/asio/basic_stream_socket.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,6 +18,7 @@
 #include <boost/asio/detail/config.hpp>
 #include <cstddef>
 #include <boost/asio/basic_socket.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/stream_socket_service.hpp>
@@ -45,8 +46,12 @@
   : public basic_socket<Protocol, StreamSocketService>
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// socket.
+ typedef typename StreamSocketService::native_handle_type native_type;
+
   /// The native representation of a socket.
- typedef typename StreamSocketService::native_type native_type;
+ typedef typename StreamSocketService::native_handle_type native_handle_type;
 
   /// The protocol type.
   typedef Protocol protocol_type;
@@ -122,12 +127,47 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_stream_socket(boost::asio::io_service& io_service,
- const protocol_type& protocol, const native_type& native_socket)
+ const protocol_type& protocol, const native_handle_type& native_socket)
     : basic_socket<Protocol, StreamSocketService>(
         io_service, protocol, native_socket)
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_stream_socket from another.
+ /**
+ * This constructor moves a stream socket from one object to another.
+ *
+ * @param other The other basic_stream_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_socket(io_service&) constructor.
+ */
+ basic_stream_socket(basic_stream_socket&& other)
+ : basic_socket<Protocol, StreamSocketService>(
+ BOOST_ASIO_MOVE_CAST(basic_stream_socket)(other))
+ {
+ }
+
+ /// Move-assign a basic_stream_socket from another.
+ /**
+ * This assignment operator moves a stream socket from one object to another.
+ *
+ * @param other The other basic_stream_socket object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_socket(io_service&) constructor.
+ */
+ basic_stream_socket& operator=(basic_stream_socket&& other)
+ {
+ basic_socket<Protocol, StreamSocketService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_stream_socket)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Send some data on the socket.
   /**
    * This function is used to send data on the stream socket. The function
@@ -157,9 +197,9 @@
   std::size_t send(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send(
- this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "send");
     return s;
   }
 
@@ -195,9 +235,9 @@
       socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "send");
     return s;
   }
 
@@ -223,7 +263,8 @@
   std::size_t send(const ConstBufferSequence& buffers,
       socket_base::message_flags flags, boost::system::error_code& ec)
   {
- return this->service.send(this->implementation, buffers, flags, ec);
+ return this->get_service().send(
+ this->get_implementation(), buffers, flags, ec);
   }
 
   /// Start an asynchronous send.
@@ -262,9 +303,15 @@
    * std::vector.
    */
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(), buffers, 0,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Start an asynchronous send.
@@ -306,9 +353,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send(this->implementation, buffers, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(), buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data on the socket.
@@ -343,8 +396,9 @@
   std::size_t receive(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive(this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "receive");
     return s;
   }
 
@@ -383,9 +437,9 @@
       socket_base::message_flags flags)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive(
- this->implementation, buffers, flags, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
+ boost::asio::detail::throw_error(ec, "receive");
     return s;
   }
 
@@ -411,7 +465,8 @@
   std::size_t receive(const MutableBufferSequence& buffers,
       socket_base::message_flags flags, boost::system::error_code& ec)
   {
- return this->service.receive(this->implementation, buffers, flags, ec);
+ return this->get_service().receive(
+ this->get_implementation(), buffers, flags, ec);
   }
 
   /// Start an asynchronous receive.
@@ -452,9 +507,15 @@
    * std::vector.
    */
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Start an asynchronous receive.
@@ -498,9 +559,15 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive(this->implementation, buffers, flags, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(),
+ buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Write some data to the socket.
@@ -534,8 +601,9 @@
   std::size_t write_some(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.send(this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().send(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "write_some");
     return s;
   }
 
@@ -559,7 +627,7 @@
   std::size_t write_some(const ConstBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.send(this->implementation, buffers, 0, ec);
+ return this->get_service().send(this->get_implementation(), buffers, 0, ec);
   }
 
   /// Start an asynchronous write.
@@ -599,9 +667,14 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_send(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_send(this->get_implementation(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the socket.
@@ -636,8 +709,9 @@
   std::size_t read_some(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.receive(this->implementation, buffers, 0, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().receive(
+ this->get_implementation(), buffers, 0, ec);
+ boost::asio::detail::throw_error(ec, "read_some");
     return s;
   }
 
@@ -662,7 +736,8 @@
   std::size_t read_some(const MutableBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.receive(this->implementation, buffers, 0, ec);
+ return this->get_service().receive(
+ this->get_implementation(), buffers, 0, ec);
   }
 
   /// Start an asynchronous read.
@@ -703,9 +778,14 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_receive(this->implementation, buffers, 0, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_receive(this->get_implementation(),
+ buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/basic_streambuf.hpp
==============================================================================
--- branches/release/boost/asio/basic_streambuf.hpp (original)
+++ branches/release/boost/asio/basic_streambuf.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -130,9 +130,9 @@
    * of the streambuf's input sequence is 0.
    */
   explicit basic_streambuf(
- std::size_t max_size = (std::numeric_limits<std::size_t>::max)(),
+ std::size_t maximum_size = (std::numeric_limits<std::size_t>::max)(),
       const Allocator& allocator = Allocator())
- : max_size_(max_size),
+ : max_size_(maximum_size),
       buffer_(allocator)
   {
     std::size_t pend = (std::min<std::size_t>)(max_size_, buffer_delta);

Modified: branches/release/boost/asio/buffer.hpp
==============================================================================
--- branches/release/boost/asio/buffer.hpp (original)
+++ branches/release/boost/asio/buffer.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,6 +17,7 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <cstddef>
+#include <cstring>
 #include <string>
 #include <vector>
 #include <boost/detail/workaround.hpp>
@@ -68,6 +69,19 @@
  * The mutable_buffer class provides a safe representation of a buffer that can
  * be modified. It does not own the underlying data, and so is cheap to copy or
  * assign.
+ *
+ * @par Accessing Buffer Contents
+ *
+ * The contents of a buffer may be accessed using the @ref buffer_size
+ * and @ref buffer_cast functions:
+ *
+ * @code boost::asio::mutable_buffer b1 = ...;
+ * std::size_t s1 = boost::asio::buffer_size(b1);
+ * unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1);
+ * @endcode
+ *
+ * The boost::asio::buffer_cast function permits violations of type safety, so
+ * uses of it in application code should be carefully considered.
  */
 class mutable_buffer
 {
@@ -133,59 +147,6 @@
 
 } // namespace detail
 
-/// Cast a non-modifiable buffer to a specified pointer to POD type.
-/**
- * @relates mutable_buffer
- */
-template <typename PointerToPodType>
-inline PointerToPodType buffer_cast(const mutable_buffer& b)
-{
- return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
-}
-
-/// Get the number of bytes in a non-modifiable buffer.
-/**
- * @relates mutable_buffer
- */
-inline std::size_t buffer_size(const mutable_buffer& b)
-{
- return detail::buffer_size_helper(b);
-}
-
-/// Create a new modifiable buffer that is offset from the start of another.
-/**
- * @relates mutable_buffer
- */
-inline mutable_buffer operator+(const mutable_buffer& b, std::size_t start)
-{
- if (start > buffer_size(b))
- return mutable_buffer();
- char* new_data = buffer_cast<char*>(b) + start;
- std::size_t new_size = buffer_size(b) - start;
- return mutable_buffer(new_data, new_size
-#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- , b.get_debug_check()
-#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
- );
-}
-
-/// Create a new modifiable buffer that is offset from the start of another.
-/**
- * @relates mutable_buffer
- */
-inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b)
-{
- if (start > buffer_size(b))
- return mutable_buffer();
- char* new_data = buffer_cast<char*>(b) + start;
- std::size_t new_size = buffer_size(b) - start;
- return mutable_buffer(new_data, new_size
-#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- , b.get_debug_check()
-#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
- );
-}
-
 /// Adapts a single modifiable buffer so that it meets the requirements of the
 /// MutableBufferSequence concept.
 class mutable_buffers_1
@@ -228,6 +189,19 @@
  * The const_buffer class provides a safe representation of a buffer that cannot
  * be modified. It does not own the underlying data, and so is cheap to copy or
  * assign.
+ *
+ * @par Accessing Buffer Contents
+ *
+ * The contents of a buffer may be accessed using the @ref buffer_size
+ * and @ref buffer_cast functions:
+ *
+ * @code boost::asio::const_buffer b1 = ...;
+ * std::size_t s1 = boost::asio::buffer_size(b1);
+ * const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1);
+ * @endcode
+ *
+ * The boost::asio::buffer_cast function permits violations of type safety, so
+ * uses of it in application code should be carefully considered.
  */
 class const_buffer
 {
@@ -303,59 +277,6 @@
 
 } // namespace detail
 
-/// Cast a non-modifiable buffer to a specified pointer to POD type.
-/**
- * @relates const_buffer
- */
-template <typename PointerToPodType>
-inline PointerToPodType buffer_cast(const const_buffer& b)
-{
- return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
-}
-
-/// Get the number of bytes in a non-modifiable buffer.
-/**
- * @relates const_buffer
- */
-inline std::size_t buffer_size(const const_buffer& b)
-{
- return detail::buffer_size_helper(b);
-}
-
-/// Create a new non-modifiable buffer that is offset from the start of another.
-/**
- * @relates const_buffer
- */
-inline const_buffer operator+(const const_buffer& b, std::size_t start)
-{
- if (start > buffer_size(b))
- return const_buffer();
- const char* new_data = buffer_cast<const char*>(b) + start;
- std::size_t new_size = buffer_size(b) - start;
- return const_buffer(new_data, new_size
-#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- , b.get_debug_check()
-#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
- );
-}
-
-/// Create a new non-modifiable buffer that is offset from the start of another.
-/**
- * @relates const_buffer
- */
-inline const_buffer operator+(std::size_t start, const const_buffer& b)
-{
- if (start > buffer_size(b))
- return const_buffer();
- const char* new_data = buffer_cast<const char*>(b) + start;
- std::size_t new_size = buffer_size(b) - start;
- return const_buffer(new_data, new_size
-#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- , b.get_debug_check()
-#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
- );
-}
-
 /// Adapts a single non-modifiable buffer so that it meets the requirements of
 /// the ConstBufferSequence concept.
 class const_buffers_1
@@ -420,6 +341,163 @@
   mutable_buffer buf_;
 };
 
+/** @defgroup buffer_size boost::asio::buffer_size
+ *
+ * @brief The boost::asio::buffer_size function determines the total number of
+ * bytes in a buffer or buffer sequence.
+ */
+/*@{*/
+
+/// Get the number of bytes in a modifiable buffer.
+inline std::size_t buffer_size(const mutable_buffer& b)
+{
+ return detail::buffer_size_helper(b);
+}
+
+/// Get the number of bytes in a modifiable buffer.
+inline std::size_t buffer_size(const mutable_buffers_1& b)
+{
+ return detail::buffer_size_helper(b);
+}
+
+/// Get the number of bytes in a non-modifiable buffer.
+inline std::size_t buffer_size(const const_buffer& b)
+{
+ return detail::buffer_size_helper(b);
+}
+
+/// Get the number of bytes in a non-modifiable buffer.
+inline std::size_t buffer_size(const const_buffers_1& b)
+{
+ return detail::buffer_size_helper(b);
+}
+
+/// Get the total number of bytes in a buffer sequence.
+/**
+ * The @c BufferSequence template parameter may meet either of the @c
+ * ConstBufferSequence or @c MutableBufferSequence type requirements.
+ */
+template <typename BufferSequence>
+inline std::size_t buffer_size(const BufferSequence& b)
+{
+ std::size_t total_buffer_size = 0;
+
+ typename BufferSequence::const_iterator iter = b.begin();
+ typename BufferSequence::const_iterator end = b.end();
+ for (; iter != end; ++iter)
+ total_buffer_size += detail::buffer_size_helper(*iter);
+
+ return total_buffer_size;
+}
+
+/*@}*/
+
+/** @defgroup buffer_cast boost::asio::buffer_cast
+ *
+ * @brief The boost::asio::buffer_cast function is used to obtain a pointer to
+ * the underlying memory region associated with a buffer.
+ *
+ * @par Examples:
+ *
+ * To access the memory of a non-modifiable buffer, use:
+ * @code boost::asio::const_buffer b1 = ...;
+ * const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1);
+ * @endcode
+ *
+ * To access the memory of a modifiable buffer, use:
+ * @code boost::asio::mutable_buffer b2 = ...;
+ * unsigned char* p2 = boost::asio::buffer_cast<unsigned char*>(b2);
+ * @endcode
+ *
+ * The boost::asio::buffer_cast function permits violations of type safety, so
+ * uses of it in application code should be carefully considered.
+ */
+/*@{*/
+
+/// Cast a non-modifiable buffer to a specified pointer to POD type.
+template <typename PointerToPodType>
+inline PointerToPodType buffer_cast(const mutable_buffer& b)
+{
+ return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
+}
+
+/// Cast a non-modifiable buffer to a specified pointer to POD type.
+template <typename PointerToPodType>
+inline PointerToPodType buffer_cast(const const_buffer& b)
+{
+ return static_cast<PointerToPodType>(detail::buffer_cast_helper(b));
+}
+
+/*@}*/
+
+/// Create a new modifiable buffer that is offset from the start of another.
+/**
+ * @relates mutable_buffer
+ */
+inline mutable_buffer operator+(const mutable_buffer& b, std::size_t start)
+{
+ if (start > buffer_size(b))
+ return mutable_buffer();
+ char* new_data = buffer_cast<char*>(b) + start;
+ std::size_t new_size = buffer_size(b) - start;
+ return mutable_buffer(new_data, new_size
+#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+ , b.get_debug_check()
+#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
+ );
+}
+
+/// Create a new modifiable buffer that is offset from the start of another.
+/**
+ * @relates mutable_buffer
+ */
+inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b)
+{
+ if (start > buffer_size(b))
+ return mutable_buffer();
+ char* new_data = buffer_cast<char*>(b) + start;
+ std::size_t new_size = buffer_size(b) - start;
+ return mutable_buffer(new_data, new_size
+#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+ , b.get_debug_check()
+#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
+ );
+}
+
+/// Create a new non-modifiable buffer that is offset from the start of another.
+/**
+ * @relates const_buffer
+ */
+inline const_buffer operator+(const const_buffer& b, std::size_t start)
+{
+ if (start > buffer_size(b))
+ return const_buffer();
+ const char* new_data = buffer_cast<const char*>(b) + start;
+ std::size_t new_size = buffer_size(b) - start;
+ return const_buffer(new_data, new_size
+#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+ , b.get_debug_check()
+#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
+ );
+}
+
+/// Create a new non-modifiable buffer that is offset from the start of another.
+/**
+ * @relates const_buffer
+ */
+inline const_buffer operator+(std::size_t start, const const_buffer& b)
+{
+ if (start > buffer_size(b))
+ return const_buffer();
+ const char* new_data = buffer_cast<const char*>(b) + start;
+ std::size_t new_size = buffer_size(b) - start;
+ return const_buffer(new_data, new_size
+#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+ , b.get_debug_check()
+#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
+ );
+}
+
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
 namespace detail {
 
@@ -479,9 +557,9 @@
  * passed to the socket's write function. A buffer created for modifiable
  * memory also meets the requirements of the MutableBufferSequence concept.
  *
- * An individual buffer may be created from a builtin array, std::vector or
- * boost::array of POD elements. This helps prevent buffer overruns by
- * automatically determining the size of the buffer:
+ * An individual buffer may be created from a builtin array, std::vector,
+ * std::array or boost::array of POD elements. This helps prevent buffer
+ * overruns by automatically determining the size of the buffer:
  *
  * @code char d1[128];
  * size_t bytes_transferred = sock.receive(boost::asio::buffer(d1));
@@ -489,8 +567,11 @@
  * std::vector<char> d2(128);
  * bytes_transferred = sock.receive(boost::asio::buffer(d2));
  *
- * boost::array<char, 128> d3;
- * bytes_transferred = sock.receive(boost::asio::buffer(d3)); @endcode
+ * std::array<char, 128> d3;
+ * bytes_transferred = sock.receive(boost::asio::buffer(d3));
+ *
+ * boost::array<char, 128> d4;
+ * bytes_transferred = sock.receive(boost::asio::buffer(d4)); @endcode
  *
  * In all three cases above, the buffers created are exactly 128 bytes long.
  * Note that a vector is @e never automatically resized when creating or using
@@ -499,8 +580,8 @@
  *
  * @par Accessing Buffer Contents
  *
- * The contents of a buffer may be accessed using the boost::asio::buffer_size
- * and boost::asio::buffer_cast functions:
+ * The contents of a buffer may be accessed using the @ref buffer_size and
+ * @ref buffer_cast functions:
  *
  * @code boost::asio::mutable_buffer b1 = ...;
  * std::size_t s1 = boost::asio::buffer_size(b1);
@@ -513,6 +594,24 @@
  * The boost::asio::buffer_cast function permits violations of type safety, so
  * uses of it in application code should be carefully considered.
  *
+ * For convenience, the @ref buffer_size function also works on buffer
+ * sequences (that is, types meeting the ConstBufferSequence or
+ * MutableBufferSequence type requirements). In this case, the function returns
+ * the total size of all buffers in the sequence.
+ *
+ * @par Buffer Copying
+ *
+ * The @ref buffer_copy function may be used to copy raw bytes between
+ * individual buffers and buffer sequences.
+ *
+ * In particular, when used with the @ref buffer_size, the @ref buffer_copy
+ * function can be used to linearise a sequence of buffers. For example:
+ *
+ * @code vector<const_buffer> buffers = ...;
+ *
+ * vector<unsigned char> data(boost::asio::buffer_size(buffers));
+ * boost::asio::buffer_copy(boost::asio::buffer(data), buffers); @endcode
+ *
  * @par Buffer Invalidation
  *
  * A buffer object does not have any ownership of the memory it refers to. It
@@ -526,8 +625,8 @@
  * referring to the elements in the sequence (C++ Std, 23.2.4)
  *
  * For the boost::asio::buffer overloads that accept an argument of type
- * std::string, the buffer objects returned are invalidated according to the
- * rules defined for invalidation of references, pointers and iterators
+ * std::basic_string, the buffer objects returned are invalidated according to
+ * the rules defined for invalidation of references, pointers and iterators
  * referring to elements of the sequence (C++ Std, 21.3).
  *
  * @par Buffer Arithmetic
@@ -896,8 +995,105 @@
         ? data.size() * sizeof(PodType) : max_size_in_bytes));
 }
 
-/// Create a new modifiable buffer that represents the given POD vector.
-/**
+#if defined(BOOST_ASIO_HAS_STD_ARRAY) || defined(GENERATING_DOCUMENTATION)
+
+/// Create a new modifiable buffer that represents the given POD array.
+/**
+ * @returns A mutable_buffers_1 value equivalent to:
+ * @code mutable_buffers_1(
+ * data.data(),
+ * data.size() * sizeof(PodType)); @endcode
+ */
+template <typename PodType, std::size_t N>
+inline mutable_buffers_1 buffer(std::array<PodType, N>& data)
+{
+ return mutable_buffers_1(
+ mutable_buffer(data.data(), data.size() * sizeof(PodType)));
+}
+
+/// Create a new modifiable buffer that represents the given POD array.
+/**
+ * @returns A mutable_buffers_1 value equivalent to:
+ * @code mutable_buffers_1(
+ * data.data(),
+ * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode
+ */
+template <typename PodType, std::size_t N>
+inline mutable_buffers_1 buffer(std::array<PodType, N>& data,
+ std::size_t max_size_in_bytes)
+{
+ return mutable_buffers_1(
+ mutable_buffer(data.data(),
+ data.size() * sizeof(PodType) < max_size_in_bytes
+ ? data.size() * sizeof(PodType) : max_size_in_bytes));
+}
+
+/// Create a new non-modifiable buffer that represents the given POD array.
+/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * data.data(),
+ * data.size() * sizeof(PodType)); @endcode
+ */
+template <typename PodType, std::size_t N>
+inline const_buffers_1 buffer(std::array<const PodType, N>& data)
+{
+ return const_buffers_1(
+ const_buffer(data.data(), data.size() * sizeof(PodType)));
+}
+
+/// Create a new non-modifiable buffer that represents the given POD array.
+/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * data.data(),
+ * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode
+ */
+template <typename PodType, std::size_t N>
+inline const_buffers_1 buffer(std::array<const PodType, N>& data,
+ std::size_t max_size_in_bytes)
+{
+ return const_buffers_1(
+ const_buffer(data.data(),
+ data.size() * sizeof(PodType) < max_size_in_bytes
+ ? data.size() * sizeof(PodType) : max_size_in_bytes));
+}
+
+/// Create a new non-modifiable buffer that represents the given POD array.
+/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * data.data(),
+ * data.size() * sizeof(PodType)); @endcode
+ */
+template <typename PodType, std::size_t N>
+inline const_buffers_1 buffer(const std::array<PodType, N>& data)
+{
+ return const_buffers_1(
+ const_buffer(data.data(), data.size() * sizeof(PodType)));
+}
+
+/// Create a new non-modifiable buffer that represents the given POD array.
+/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * data.data(),
+ * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode
+ */
+template <typename PodType, std::size_t N>
+inline const_buffers_1 buffer(const std::array<PodType, N>& data,
+ std::size_t max_size_in_bytes)
+{
+ return const_buffers_1(
+ const_buffer(data.data(),
+ data.size() * sizeof(PodType) < max_size_in_bytes
+ ? data.size() * sizeof(PodType) : max_size_in_bytes));
+}
+
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) || defined(GENERATING_DOCUMENTATION)
+
+/// Create a new modifiable buffer that represents the given POD vector.
+/**
  * @returns A mutable_buffers_1 value equivalent to:
  * @code mutable_buffers_1(
  * data.size() ? &data[0] : 0,
@@ -997,16 +1193,20 @@
 
 /// Create a new non-modifiable buffer that represents the given string.
 /**
- * @returns <tt>const_buffers_1(data.data(), data.size())</tt>.
+ * @returns <tt>const_buffers_1(data.data(), data.size() * sizeof(Elem))</tt>.
  *
  * @note The buffer is invalidated by any non-const operation called on the
  * given string object.
  */
-inline const_buffers_1 buffer(const std::string& data)
+template <typename Elem, typename Traits, typename Allocator>
+inline const_buffers_1 buffer(
+ const std::basic_string<Elem, Traits, Allocator>& data)
 {
- return const_buffers_1(const_buffer(data.data(), data.size()
+ return const_buffers_1(const_buffer(data.data(), data.size() * sizeof(Elem)
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- , detail::buffer_debug_check<std::string::const_iterator>(data.begin())
+ , detail::buffer_debug_check<
+ typename std::basic_string<Elem, Traits, Allocator>::const_iterator
+ >(data.begin())
 #endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
         ));
 }
@@ -1016,26 +1216,924 @@
  * @returns A const_buffers_1 value equivalent to:
  * @code const_buffers_1(
  * data.data(),
- * min(data.size(), max_size_in_bytes)); @endcode
+ * min(data.size() * sizeof(Elem), max_size_in_bytes)); @endcode
  *
  * @note The buffer is invalidated by any non-const operation called on the
  * given string object.
  */
-inline const_buffers_1 buffer(const std::string& data,
+template <typename Elem, typename Traits, typename Allocator>
+inline const_buffers_1 buffer(
+ const std::basic_string<Elem, Traits, Allocator>& data,
     std::size_t max_size_in_bytes)
 {
   return const_buffers_1(
       const_buffer(data.data(),
- data.size() < max_size_in_bytes
- ? data.size() : max_size_in_bytes
+ data.size() * sizeof(Elem) < max_size_in_bytes
+ ? data.size() * sizeof(Elem) : max_size_in_bytes
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
- , detail::buffer_debug_check<std::string::const_iterator>(data.begin())
+ , detail::buffer_debug_check<
+ typename std::basic_string<Elem, Traits, Allocator>::const_iterator
+ >(data.begin())
 #endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
         ));
 }
 
 /*@}*/
 
+/** @defgroup buffer_copy boost::asio::buffer_copy
+ *
+ * @brief The boost::asio::buffer_copy function is used to copy bytes from a
+ * source buffer (or buffer sequence) to a target buffer (or buffer sequence).
+ *
+ * The @c buffer_copy function is available in two forms:
+ *
+ * @li A 2-argument form: @c buffer_copy(target, source)
+ *
+ * @li A 3-argument form: @c buffer_copy(target, source, max_bytes_to_copy)
+
+ * Both forms return the number of bytes actually copied. The number of bytes
+ * copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c If specified, @c max_bytes_to_copy.
+ *
+ * This prevents buffer overflow, regardless of the buffer sizes used in the
+ * copy operation.
+ */
+/*@{*/
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const const_buffer& source)
+{
+ using namespace std; // For memcpy.
+ std::size_t target_size = buffer_size(target);
+ std::size_t source_size = buffer_size(source);
+ std::size_t n = target_size < source_size ? target_size : source_size;
+ memcpy(buffer_cast<void*>(target), buffer_cast<const void*>(source), n);
+ return n;
+}
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const const_buffers_1& source)
+{
+ return buffer_copy(target, static_cast<const const_buffer&>(source));
+}
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const mutable_buffer& source)
+{
+ return buffer_copy(target, const_buffer(source));
+}
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const mutable_buffers_1& source)
+{
+ return buffer_copy(target, const_buffer(source));
+}
+
+/// Copies bytes from a source buffer sequence to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer sequence representing the memory
+ * regions from which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+template <typename ConstBufferSequence>
+std::size_t buffer_copy(const mutable_buffer& target,
+ const ConstBufferSequence& source)
+{
+ std::size_t total_bytes_copied = 0;
+
+ typename ConstBufferSequence::const_iterator source_iter = source.begin();
+ typename ConstBufferSequence::const_iterator source_end = source.end();
+
+ for (mutable_buffer target_buffer(target);
+ buffer_size(target_buffer) && source_iter != source_end; ++source_iter)
+ {
+ const_buffer source_buffer(*source_iter);
+ std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer);
+ total_bytes_copied += bytes_copied;
+ target_buffer = target_buffer + bytes_copied;
+ }
+
+ return total_bytes_copied;
+}
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const const_buffer& source)
+{
+ return buffer_copy(static_cast<const mutable_buffer&>(target), source);
+}
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const const_buffers_1& source)
+{
+ return buffer_copy(static_cast<const mutable_buffer&>(target),
+ static_cast<const const_buffer&>(source));
+}
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const mutable_buffer& source)
+{
+ return buffer_copy(static_cast<const mutable_buffer&>(target),
+ const_buffer(source));
+}
+
+/// Copies bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const mutable_buffers_1& source)
+{
+ return buffer_copy(static_cast<const mutable_buffer&>(target),
+ const_buffer(source));
+}
+
+/// Copies bytes from a source buffer sequence to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer sequence representing the memory
+ * regions from which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+template <typename ConstBufferSequence>
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const ConstBufferSequence& source)
+{
+ return buffer_copy(static_cast<const mutable_buffer&>(target), source);
+}
+
+/// Copies bytes from a source buffer to a target buffer sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+template <typename MutableBufferSequence>
+std::size_t buffer_copy(const MutableBufferSequence& target,
+ const const_buffer& source)
+{
+ std::size_t total_bytes_copied = 0;
+
+ typename MutableBufferSequence::const_iterator target_iter = target.begin();
+ typename MutableBufferSequence::const_iterator target_end = target.end();
+
+ for (const_buffer source_buffer(source);
+ buffer_size(source_buffer) && target_iter != target_end; ++target_iter)
+ {
+ mutable_buffer target_buffer(*target_iter);
+ std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer);
+ total_bytes_copied += bytes_copied;
+ source_buffer = source_buffer + bytes_copied;
+ }
+
+ return total_bytes_copied;
+}
+
+/// Copies bytes from a source buffer to a target buffer sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+template <typename MutableBufferSequence>
+inline std::size_t buffer_copy(const MutableBufferSequence& target,
+ const const_buffers_1& source)
+{
+ return buffer_copy(target, static_cast<const const_buffer&>(source));
+}
+
+/// Copies bytes from a source buffer to a target buffer sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+template <typename MutableBufferSequence>
+inline std::size_t buffer_copy(const MutableBufferSequence& target,
+ const mutable_buffer& source)
+{
+ return buffer_copy(target, const_buffer(source));
+}
+
+/// Copies bytes from a source buffer to a target buffer sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+template <typename MutableBufferSequence>
+inline std::size_t buffer_copy(const MutableBufferSequence& target,
+ const mutable_buffers_1& source)
+{
+ return buffer_copy(target, const_buffer(source));
+}
+
+/// Copies bytes from a source buffer sequence to a target buffer sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer sequence representing the memory
+ * regions from which the bytes will be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ */
+template <typename MutableBufferSequence, typename ConstBufferSequence>
+std::size_t buffer_copy(const MutableBufferSequence& target,
+ const ConstBufferSequence& source)
+{
+ std::size_t total_bytes_copied = 0;
+
+ typename MutableBufferSequence::const_iterator target_iter = target.begin();
+ typename MutableBufferSequence::const_iterator target_end = target.end();
+ std::size_t target_buffer_offset = 0;
+
+ typename ConstBufferSequence::const_iterator source_iter = source.begin();
+ typename ConstBufferSequence::const_iterator source_end = source.end();
+ std::size_t source_buffer_offset = 0;
+
+ while (target_iter != target_end && source_iter != source_end)
+ {
+ mutable_buffer target_buffer =
+ mutable_buffer(*target_iter) + target_buffer_offset;
+
+ const_buffer source_buffer =
+ const_buffer(*source_iter) + source_buffer_offset;
+
+ std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer);
+ total_bytes_copied += bytes_copied;
+
+ if (bytes_copied == buffer_size(target_buffer))
+ {
+ ++target_iter;
+ target_buffer_offset = 0;
+ }
+ else
+ target_buffer_offset += bytes_copied;
+
+ if (bytes_copied == buffer_size(source_buffer))
+ {
+ ++source_iter;
+ source_buffer_offset = 0;
+ }
+ else
+ source_buffer_offset += bytes_copied;
+ }
+
+ return total_bytes_copied;
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const const_buffer& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const const_buffers_1& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const mutable_buffer& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const mutable_buffers_1& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer sequence to a target
+/// buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer sequence representing the memory
+ * regions from which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+template <typename ConstBufferSequence>
+inline std::size_t buffer_copy(const mutable_buffer& target,
+ const ConstBufferSequence& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const const_buffer& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const const_buffers_1& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const mutable_buffer& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const mutable_buffers_1& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer sequence to a target
+/// buffer.
+/**
+ * @param target A modifiable buffer representing the memory region to which
+ * the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer sequence representing the memory
+ * regions from which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+template <typename ConstBufferSequence>
+inline std::size_t buffer_copy(const mutable_buffers_1& target,
+ const ConstBufferSequence& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(buffer(target, max_bytes_to_copy), source);
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer
+/// sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+template <typename MutableBufferSequence>
+inline std::size_t buffer_copy(const MutableBufferSequence& target,
+ const const_buffer& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(target, buffer(source, max_bytes_to_copy));
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer
+/// sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer representing the memory region from
+ * which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+template <typename MutableBufferSequence>
+inline std::size_t buffer_copy(const MutableBufferSequence& target,
+ const const_buffers_1& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(target, buffer(source, max_bytes_to_copy));
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer
+/// sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+template <typename MutableBufferSequence>
+inline std::size_t buffer_copy(const MutableBufferSequence& target,
+ const mutable_buffer& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(target, buffer(source, max_bytes_to_copy));
+}
+
+/// Copies a limited number of bytes from a source buffer to a target buffer
+/// sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A modifiable buffer representing the memory region from which
+ * the bytes will be copied. The contents of the source buffer will not be
+ * modified.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+template <typename MutableBufferSequence>
+inline std::size_t buffer_copy(const MutableBufferSequence& target,
+ const mutable_buffers_1& source, std::size_t max_bytes_to_copy)
+{
+ return buffer_copy(target, buffer(source, max_bytes_to_copy));
+}
+
+/// Copies a limited number of bytes from a source buffer sequence to a target
+/// buffer sequence.
+/**
+ * @param target A modifiable buffer sequence representing the memory regions to
+ * which the bytes will be copied.
+ *
+ * @param source A non-modifiable buffer sequence representing the memory
+ * regions from which the bytes will be copied.
+ *
+ * @param max_bytes_to_copy The maximum number of bytes to be copied.
+ *
+ * @returns The number of bytes copied.
+ *
+ * @note The number of bytes copied is the lesser of:
+ *
+ * @li @c buffer_size(target)
+ *
+ * @li @c buffer_size(source)
+ *
+ * @li @c max_bytes_to_copy
+ */
+template <typename MutableBufferSequence, typename ConstBufferSequence>
+std::size_t buffer_copy(const MutableBufferSequence& target,
+ const ConstBufferSequence& source, std::size_t max_bytes_to_copy)
+{
+ std::size_t total_bytes_copied = 0;
+
+ typename MutableBufferSequence::const_iterator target_iter = target.begin();
+ typename MutableBufferSequence::const_iterator target_end = target.end();
+ std::size_t target_buffer_offset = 0;
+
+ typename ConstBufferSequence::const_iterator source_iter = source.begin();
+ typename ConstBufferSequence::const_iterator source_end = source.end();
+ std::size_t source_buffer_offset = 0;
+
+ while (total_bytes_copied != max_bytes_to_copy
+ && target_iter != target_end && source_iter != source_end)
+ {
+ mutable_buffer target_buffer =
+ mutable_buffer(*target_iter) + target_buffer_offset;
+
+ const_buffer source_buffer =
+ const_buffer(*source_iter) + source_buffer_offset;
+
+ std::size_t bytes_copied = buffer_copy(target_buffer,
+ source_buffer, max_bytes_to_copy - total_bytes_copied);
+ total_bytes_copied += bytes_copied;
+
+ if (bytes_copied == buffer_size(target_buffer))
+ {
+ ++target_iter;
+ target_buffer_offset = 0;
+ }
+ else
+ target_buffer_offset += bytes_copied;
+
+ if (bytes_copied == buffer_size(source_buffer))
+ {
+ ++source_iter;
+ source_buffer_offset = 0;
+ }
+ else
+ source_buffer_offset += bytes_copied;
+ }
+
+ return total_bytes_copied;
+}
+
+/*@}*/
+
 } // namespace asio
 } // namespace boost
 

Modified: branches/release/boost/asio/buffered_read_stream.hpp
==============================================================================
--- branches/release/boost/asio/buffered_read_stream.hpp (original)
+++ branches/release/boost/asio/buffered_read_stream.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,7 +17,6 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <cstddef>
-#include <cstring>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/asio/buffered_read_stream_fwd.hpp>
 #include <boost/asio/buffer.hpp>
@@ -97,13 +96,6 @@
     return next_layer_.lowest_layer();
   }
 
- /// (Deprecated: use get_io_service().) Get the io_service associated with
- /// the object.
- boost::asio::io_service& io_service()
- {
- return next_layer_.get_io_service();
- }
-
   /// Get the io_service associated with the object.
   boost::asio::io_service& get_io_service()
   {
@@ -227,16 +219,7 @@
   template <typename MutableBufferSequence>
   std::size_t read_some(const MutableBufferSequence& buffers)
   {
- typename MutableBufferSequence::const_iterator iter = buffers.begin();
- typename MutableBufferSequence::const_iterator end = buffers.end();
- size_t total_buffer_size = 0;
- for (; iter != end; ++iter)
- {
- boost::asio::mutable_buffer buffer(*iter);
- total_buffer_size += boost::asio::buffer_size(buffer);
- }
-
- if (total_buffer_size == 0)
+ if (boost::asio::buffer_size(buffers) == 0)
       return 0;
 
     if (storage_.empty())
@@ -253,16 +236,7 @@
   {
     ec = boost::system::error_code();
 
- typename MutableBufferSequence::const_iterator iter = buffers.begin();
- typename MutableBufferSequence::const_iterator end = buffers.end();
- size_t total_buffer_size = 0;
- for (; iter != end; ++iter)
- {
- boost::asio::mutable_buffer buffer(*iter);
- total_buffer_size += boost::asio::buffer_size(buffer);
- }
-
- if (total_buffer_size == 0)
+ if (boost::asio::buffer_size(buffers) == 0)
       return 0;
 
     if (storage_.empty() && !fill(ec))
@@ -294,24 +268,8 @@
       }
       else
       {
- using namespace std; // For memcpy.
-
- std::size_t bytes_avail = storage_.size();
- std::size_t bytes_copied = 0;
-
- typename MutableBufferSequence::const_iterator iter = buffers_.begin();
- typename MutableBufferSequence::const_iterator end = buffers_.end();
- for (; iter != end && bytes_avail > 0; ++iter)
- {
- std::size_t max_length = buffer_size(*iter);
- std::size_t length = (max_length < bytes_avail)
- ? max_length : bytes_avail;
- memcpy(buffer_cast<void*>(*iter),
- storage_.data() + bytes_copied, length);
- bytes_copied += length;
- bytes_avail -= length;
- }
-
+ std::size_t bytes_copied = boost::asio::buffer_copy(
+ buffers_, storage_.data(), storage_.size());
         storage_.consume(bytes_copied);
         io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied));
       }
@@ -330,16 +288,7 @@
   void async_read_some(const MutableBufferSequence& buffers,
       ReadHandler handler)
   {
- typename MutableBufferSequence::const_iterator iter = buffers.begin();
- typename MutableBufferSequence::const_iterator end = buffers.end();
- size_t total_buffer_size = 0;
- for (; iter != end; ++iter)
- {
- boost::asio::mutable_buffer buffer(*iter);
- total_buffer_size += boost::asio::buffer_size(buffer);
- }
-
- if (total_buffer_size == 0)
+ if (boost::asio::buffer_size(buffers) == 0)
     {
       get_io_service().post(detail::bind_handler(
             handler, boost::system::error_code(), 0));
@@ -398,23 +347,8 @@
   template <typename MutableBufferSequence>
   std::size_t copy(const MutableBufferSequence& buffers)
   {
- using namespace std; // For memcpy.
-
- std::size_t bytes_avail = storage_.size();
- std::size_t bytes_copied = 0;
-
- typename MutableBufferSequence::const_iterator iter = buffers.begin();
- typename MutableBufferSequence::const_iterator end = buffers.end();
- for (; iter != end && bytes_avail > 0; ++iter)
- {
- std::size_t max_length = buffer_size(*iter);
- std::size_t length = (max_length < bytes_avail)
- ? max_length : bytes_avail;
- memcpy(buffer_cast<void*>(*iter), storage_.data() + bytes_copied, length);
- bytes_copied += length;
- bytes_avail -= length;
- }
-
+ std::size_t bytes_copied = boost::asio::buffer_copy(
+ buffers, storage_.data(), storage_.size());
     storage_.consume(bytes_copied);
     return bytes_copied;
   }
@@ -425,24 +359,7 @@
   template <typename MutableBufferSequence>
   std::size_t peek_copy(const MutableBufferSequence& buffers)
   {
- using namespace std; // For memcpy.
-
- std::size_t bytes_avail = storage_.size();
- std::size_t bytes_copied = 0;
-
- typename MutableBufferSequence::const_iterator iter = buffers.begin();
- typename MutableBufferSequence::const_iterator end = buffers.end();
- for (; iter != end && bytes_avail > 0; ++iter)
- {
- std::size_t max_length = buffer_size(*iter);
- std::size_t length = (max_length < bytes_avail)
- ? max_length : bytes_avail;
- memcpy(buffer_cast<void*>(*iter), storage_.data() + bytes_copied, length);
- bytes_copied += length;
- bytes_avail -= length;
- }
-
- return bytes_copied;
+ return boost::asio::buffer_copy(buffers, storage_.data(), storage_.size());
   }
 
   /// The next layer.

Modified: branches/release/boost/asio/buffered_stream.hpp
==============================================================================
--- branches/release/boost/asio/buffered_stream.hpp (original)
+++ branches/release/boost/asio/buffered_stream.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -87,13 +87,6 @@
     return stream_impl_.lowest_layer();
   }
 
- /// (Deprecated: use get_io_service().) Get the io_service associated with
- /// the object.
- boost::asio::io_service& io_service()
- {
- return stream_impl_.get_io_service();
- }
-
   /// Get the io_service associated with the object.
   boost::asio::io_service& get_io_service()
   {

Modified: branches/release/boost/asio/buffered_write_stream.hpp
==============================================================================
--- branches/release/boost/asio/buffered_write_stream.hpp (original)
+++ branches/release/boost/asio/buffered_write_stream.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,7 +17,6 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <cstddef>
-#include <cstring>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/asio/buffered_write_stream_fwd.hpp>
 #include <boost/asio/buffer.hpp>
@@ -98,13 +97,6 @@
     return next_layer_.lowest_layer();
   }
 
- /// (Deprecated: use get_io_service().) Get the io_service associated with
- /// the object.
- boost::asio::io_service& io_service()
- {
- return next_layer_.get_io_service();
- }
-
   /// Get the io_service associated with the object.
   boost::asio::io_service& get_io_service()
   {
@@ -184,16 +176,7 @@
   template <typename ConstBufferSequence>
   std::size_t write_some(const ConstBufferSequence& buffers)
   {
- typename ConstBufferSequence::const_iterator iter = buffers.begin();
- typename ConstBufferSequence::const_iterator end = buffers.end();
- size_t total_buffer_size = 0;
- for (; iter != end; ++iter)
- {
- boost::asio::const_buffer buffer(*iter);
- total_buffer_size += boost::asio::buffer_size(buffer);
- }
-
- if (total_buffer_size == 0)
+ if (boost::asio::buffer_size(buffers) == 0)
       return 0;
 
     if (storage_.size() == storage_.capacity())
@@ -210,16 +193,7 @@
   {
     ec = boost::system::error_code();
 
- typename ConstBufferSequence::const_iterator iter = buffers.begin();
- typename ConstBufferSequence::const_iterator end = buffers.end();
- size_t total_buffer_size = 0;
- for (; iter != end; ++iter)
- {
- boost::asio::const_buffer buffer(*iter);
- total_buffer_size += boost::asio::buffer_size(buffer);
- }
-
- if (total_buffer_size == 0)
+ if (boost::asio::buffer_size(buffers) == 0)
       return 0;
 
     if (storage_.size() == storage_.capacity() && !flush(ec))
@@ -251,25 +225,14 @@
       }
       else
       {
- using namespace std; // For memcpy.
-
         std::size_t orig_size = storage_.size();
         std::size_t space_avail = storage_.capacity() - orig_size;
- std::size_t bytes_copied = 0;
-
- typename ConstBufferSequence::const_iterator iter = buffers_.begin();
- typename ConstBufferSequence::const_iterator end = buffers_.end();
- for (; iter != end && space_avail > 0; ++iter)
- {
- std::size_t bytes_avail = buffer_size(*iter);
- std::size_t length = (bytes_avail < space_avail)
- ? bytes_avail : space_avail;
- storage_.resize(orig_size + bytes_copied + length);
- memcpy(storage_.data() + orig_size + bytes_copied,
- buffer_cast<const void*>(*iter), length);
- bytes_copied += length;
- space_avail -= length;
- }
+ std::size_t bytes_avail = boost::asio::buffer_size(buffers_);
+ std::size_t length = bytes_avail < space_avail
+ ? bytes_avail : space_avail;
+ storage_.resize(orig_size + length);
+ std::size_t bytes_copied = boost::asio::buffer_copy(
+ storage_.data(), buffers_, length);
 
         io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied));
       }
@@ -288,16 +251,7 @@
   void async_write_some(const ConstBufferSequence& buffers,
       WriteHandler handler)
   {
- typename ConstBufferSequence::const_iterator iter = buffers.begin();
- typename ConstBufferSequence::const_iterator end = buffers.end();
- size_t total_buffer_size = 0;
- for (; iter != end; ++iter)
- {
- boost::asio::const_buffer buffer(*iter);
- total_buffer_size += boost::asio::buffer_size(buffer);
- }
-
- if (total_buffer_size == 0)
+ if (boost::asio::buffer_size(buffers) == 0)
     {
       get_io_service().post(detail::bind_handler(
             handler, boost::system::error_code(), 0));
@@ -376,27 +330,12 @@
   template <typename ConstBufferSequence>
   std::size_t copy(const ConstBufferSequence& buffers)
   {
- using namespace std; // For memcpy.
-
     std::size_t orig_size = storage_.size();
     std::size_t space_avail = storage_.capacity() - orig_size;
- std::size_t bytes_copied = 0;
-
- typename ConstBufferSequence::const_iterator iter = buffers.begin();
- typename ConstBufferSequence::const_iterator end = buffers.end();
- for (; iter != end && space_avail > 0; ++iter)
- {
- std::size_t bytes_avail = buffer_size(*iter);
- std::size_t length = (bytes_avail < space_avail)
- ? bytes_avail : space_avail;
- storage_.resize(orig_size + bytes_copied + length);
- memcpy(storage_.data() + orig_size + bytes_copied,
- buffer_cast<const void*>(*iter), length);
- bytes_copied += length;
- space_avail -= length;
- }
-
- return bytes_copied;
+ std::size_t bytes_avail = boost::asio::buffer_size(buffers);
+ std::size_t length = bytes_avail < space_avail ? bytes_avail : space_avail;
+ storage_.resize(orig_size + length);
+ return boost::asio::buffer_copy(storage_.data(), buffers, length);
   }
 
   /// The next layer.

Modified: branches/release/boost/asio/buffers_iterator.hpp
==============================================================================
--- branches/release/boost/asio/buffers_iterator.hpp (original)
+++ branches/release/boost/asio/buffers_iterator.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,9 +17,9 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <cstddef>
+#include <iterator>
 #include <boost/assert.hpp>
 #include <boost/detail/workaround.hpp>
-#include <boost/iterator.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/type_traits/add_const.hpp>
 #include <boost/asio/buffer.hpp>
@@ -73,18 +73,47 @@
 /// A random access iterator over the bytes in a buffer sequence.
 template <typename BufferSequence, typename ByteType = char>
 class buffers_iterator
- : public boost::iterator<
- std::random_access_iterator_tag,
- typename detail::buffers_iterator_types<
- BufferSequence, ByteType>::byte_type>
 {
 private:
   typedef typename detail::buffers_iterator_types<
       BufferSequence, ByteType>::buffer_type buffer_type;
- typedef typename detail::buffers_iterator_types<
- BufferSequence, ByteType>::byte_type byte_type;
 
 public:
+ /// The type used for the distance between two iterators.
+ typedef std::ptrdiff_t difference_type;
+
+ /// The type of the value pointed to by the iterator.
+ typedef ByteType value_type;
+
+#if defined(GENERATING_DOCUMENTATION)
+ /// The type of the result of applying operator->() to the iterator.
+ /**
+ * If the buffer sequence stores buffer objects that are convertible to
+ * mutable_buffer, this is a pointer to a non-const ByteType. Otherwise, a
+ * pointer to a const ByteType.
+ */
+ typedef const_or_non_const_ByteType* pointer;
+#else // defined(GENERATING_DOCUMENTATION)
+ typedef typename detail::buffers_iterator_types<
+ BufferSequence, ByteType>::byte_type* pointer;
+#endif // defined(GENERATING_DOCUMENTATION)
+
+#if defined(GENERATING_DOCUMENTATION)
+ /// The type of the result of applying operator*() to the iterator.
+ /**
+ * If the buffer sequence stores buffer objects that are convertible to
+ * mutable_buffer, this is a reference to a non-const ByteType. Otherwise, a
+ * reference to a const ByteType.
+ */
+ typedef const_or_non_const_ByteType& reference;
+#else // defined(GENERATING_DOCUMENTATION)
+ typedef typename detail::buffers_iterator_types<
+ BufferSequence, ByteType>::byte_type& reference;
+#endif // defined(GENERATING_DOCUMENTATION)
+
+ /// The iterator category.
+ typedef std::random_access_iterator_tag iterator_category;
+
   /// Default constructor. Creates an iterator in an undefined state.
   buffers_iterator()
     : current_buffer_(),
@@ -136,19 +165,19 @@
   }
 
   /// Dereference an iterator.
- byte_type& operator*() const
+ reference operator*() const
   {
     return dereference();
   }
 
   /// Dereference an iterator.
- byte_type* operator->() const
+ pointer operator->() const
   {
     return &dereference();
   }
 
   /// Access an individual element.
- byte_type& operator[](std::ptrdiff_t difference) const
+ reference operator[](std::ptrdiff_t difference) const
   {
     buffers_iterator tmp(*this);
     tmp.advance(difference);
@@ -271,9 +300,9 @@
 
 private:
   // Dereference the iterator.
- byte_type& dereference() const
+ reference dereference() const
   {
- return buffer_cast<byte_type*>(current_buffer_)[current_buffer_position_];
+ return buffer_cast<pointer>(current_buffer_)[current_buffer_position_];
   }
 
   // Compare two iterators for equality.

Modified: branches/release/boost/asio/completion_condition.hpp
==============================================================================
--- branches/release/boost/asio/completion_condition.hpp (original)
+++ branches/release/boost/asio/completion_condition.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -76,6 +76,28 @@
   std::size_t minimum_;
 };
 
+class transfer_exactly_t
+{
+public:
+ typedef std::size_t result_type;
+
+ explicit transfer_exactly_t(std::size_t size)
+ : size_(size)
+ {
+ }
+
+ template <typename Error>
+ std::size_t operator()(const Error& err, std::size_t bytes_transferred)
+ {
+ return (!!err || bytes_transferred >= size_) ? 0 :
+ (size_ - bytes_transferred < default_max_transfer_size
+ ? size_ - bytes_transferred : std::size_t(default_max_transfer_size));
+ }
+
+private:
+ std::size_t size_;
+};
+
 } // namespace detail
 
 /**
@@ -154,6 +176,40 @@
 }
 #endif
 
+/// Return a completion condition function object that indicates that a read or
+/// write operation should continue until an exact number of bytes has been
+/// transferred, or until an error occurs.
+/**
+ * This function is used to create an object, of unspecified type, that meets
+ * CompletionCondition requirements.
+ *
+ * @par Example
+ * Reading until a buffer is full or contains exactly 64 bytes:
+ * @code
+ * boost::array<char, 128> buf;
+ * boost::system::error_code ec;
+ * std::size_t n = boost::asio::read(
+ * sock, boost::asio::buffer(buf),
+ * boost::asio::transfer_exactly(64), ec);
+ * if (ec)
+ * {
+ * // An error occurred.
+ * }
+ * else
+ * {
+ * // n == 64
+ * }
+ * @endcode
+ */
+#if defined(GENERATING_DOCUMENTATION)
+unspecified transfer_exactly(std::size_t size);
+#else
+inline detail::transfer_exactly_t transfer_exactly(std::size_t size)
+{
+ return detail::transfer_exactly_t(size);
+}
+#endif
+
 /*@}*/
 
 } // namespace asio

Added: branches/release/boost/asio/connect.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/connect.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,816 @@
+//
+// connect.hpp
+// ~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_CONNECT_HPP
+#define BOOST_ASIO_CONNECT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/basic_socket.hpp>
+#include <boost/asio/error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/**
+ * @defgroup connect boost::asio::connect
+ *
+ * @brief Establishes a socket connection by trying each endpoint in a sequence.
+ */
+/*@{*/
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @throws boost::system::system_error Thrown on failure. If the sequence is
+ * empty, the associated @c error_code is boost::asio::error::not_found.
+ * Otherwise, contains the error from the last connection attempt.
+ *
+ * @note This overload assumes that a default constructed object of type @c
+ * Iterator represents the end of the sequence. This is a valid assumption for
+ * iterator types such as @c boost::asio::ip::tcp::resolver::iterator.
+ *
+ * @par Example
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ * boost::asio::connect(s, r.resolve(q)); @endcode
+ */
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin);
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param ec Set to indicate what error occurred, if any. If the sequence is
+ * empty, set to boost::asio::error::not_found. Otherwise, contains the error
+ * from the last connection attempt.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @note This overload assumes that a default constructed object of type @c
+ * Iterator represents the end of the sequence. This is a valid assumption for
+ * iterator types such as @c boost::asio::ip::tcp::resolver::iterator.
+ *
+ * @par Example
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ * boost::system::error_code ec;
+ * boost::asio::connect(s, r.resolve(q), ec);
+ * if (ec)
+ * {
+ * // An error occurred.
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, boost::system::error_code& ec);
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param end An iterator pointing to the end of a sequence of endpoints.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @throws boost::system::system_error Thrown on failure. If the sequence is
+ * empty, the associated @c error_code is boost::asio::error::not_found.
+ * Otherwise, contains the error from the last connection attempt.
+ *
+ * @par Example
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::resolver::iterator i = r.resolve(q), end;
+ * tcp::socket s(io_service);
+ * boost::asio::connect(s, i, end); @endcode
+ */
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end);
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param end An iterator pointing to the end of a sequence of endpoints.
+ *
+ * @param ec Set to indicate what error occurred, if any. If the sequence is
+ * empty, set to boost::asio::error::not_found. Otherwise, contains the error
+ * from the last connection attempt.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @par Example
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::resolver::iterator i = r.resolve(q), end;
+ * tcp::socket s(io_service);
+ * boost::system::error_code ec;
+ * boost::asio::connect(s, i, end, ec);
+ * if (ec)
+ * {
+ * // An error occurred.
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end, boost::system::error_code& ec);
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param connect_condition A function object that is called prior to each
+ * connection attempt. The signature of the function object must be:
+ * @code Iterator connect_condition(
+ * const boost::system::error_code& ec,
+ * Iterator next); @endcode
+ * The @c ec parameter contains the result from the most recent connect
+ * operation. Before the first connection attempt, @c ec is always set to
+ * indicate success. The @c next parameter is an iterator pointing to the next
+ * endpoint to be tried. The function object should return the next iterator,
+ * but is permitted to return a different iterator so that endpoints may be
+ * skipped. The implementation guarantees that the function object will never
+ * be called with the end iterator.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @throws boost::system::system_error Thrown on failure. If the sequence is
+ * empty, the associated @c error_code is boost::asio::error::not_found.
+ * Otherwise, contains the error from the last connection attempt.
+ *
+ * @note This overload assumes that a default constructed object of type @c
+ * Iterator represents the end of the sequence. This is a valid assumption for
+ * iterator types such as @c boost::asio::ip::tcp::resolver::iterator.
+ *
+ * @par Example
+ * The following connect condition function object can be used to output
+ * information about the individual connection attempts:
+ * @code struct my_connect_condition
+ * {
+ * template <typename Iterator>
+ * Iterator operator()(
+ * const boost::system::error_code& ec,
+ * Iterator next)
+ * {
+ * if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ * std::cout << "Trying: " << next->endpoint() << std::endl;
+ * return next;
+ * }
+ * }; @endcode
+ * It would be used with the boost::asio::connect function as follows:
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ * tcp::resolver::iterator i = boost::asio::connect(
+ * s, r.resolve(q), my_connect_condition());
+ * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode
+ */
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, ConnectCondition connect_condition);
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param connect_condition A function object that is called prior to each
+ * connection attempt. The signature of the function object must be:
+ * @code Iterator connect_condition(
+ * const boost::system::error_code& ec,
+ * Iterator next); @endcode
+ * The @c ec parameter contains the result from the most recent connect
+ * operation. Before the first connection attempt, @c ec is always set to
+ * indicate success. The @c next parameter is an iterator pointing to the next
+ * endpoint to be tried. The function object should return the next iterator,
+ * but is permitted to return a different iterator so that endpoints may be
+ * skipped. The implementation guarantees that the function object will never
+ * be called with the end iterator.
+ *
+ * @param ec Set to indicate what error occurred, if any. If the sequence is
+ * empty, set to boost::asio::error::not_found. Otherwise, contains the error
+ * from the last connection attempt.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @note This overload assumes that a default constructed object of type @c
+ * Iterator represents the end of the sequence. This is a valid assumption for
+ * iterator types such as @c boost::asio::ip::tcp::resolver::iterator.
+ *
+ * @par Example
+ * The following connect condition function object can be used to output
+ * information about the individual connection attempts:
+ * @code struct my_connect_condition
+ * {
+ * template <typename Iterator>
+ * Iterator operator()(
+ * const boost::system::error_code& ec,
+ * Iterator next)
+ * {
+ * if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ * std::cout << "Trying: " << next->endpoint() << std::endl;
+ * return next;
+ * }
+ * }; @endcode
+ * It would be used with the boost::asio::connect function as follows:
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ * boost::system::error_code ec;
+ * tcp::resolver::iterator i = boost::asio::connect(
+ * s, r.resolve(q), my_connect_condition(), ec);
+ * if (ec)
+ * {
+ * // An error occurred.
+ * }
+ * else
+ * {
+ * std::cout << "Connected to: " << i->endpoint() << std::endl;
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin,
+ ConnectCondition connect_condition, boost::system::error_code& ec);
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param end An iterator pointing to the end of a sequence of endpoints.
+ *
+ * @param connect_condition A function object that is called prior to each
+ * connection attempt. The signature of the function object must be:
+ * @code Iterator connect_condition(
+ * const boost::system::error_code& ec,
+ * Iterator next); @endcode
+ * The @c ec parameter contains the result from the most recent connect
+ * operation. Before the first connection attempt, @c ec is always set to
+ * indicate success. The @c next parameter is an iterator pointing to the next
+ * endpoint to be tried. The function object should return the next iterator,
+ * but is permitted to return a different iterator so that endpoints may be
+ * skipped. The implementation guarantees that the function object will never
+ * be called with the end iterator.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @throws boost::system::system_error Thrown on failure. If the sequence is
+ * empty, the associated @c error_code is boost::asio::error::not_found.
+ * Otherwise, contains the error from the last connection attempt.
+ *
+ * @par Example
+ * The following connect condition function object can be used to output
+ * information about the individual connection attempts:
+ * @code struct my_connect_condition
+ * {
+ * template <typename Iterator>
+ * Iterator operator()(
+ * const boost::system::error_code& ec,
+ * Iterator next)
+ * {
+ * if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ * std::cout << "Trying: " << next->endpoint() << std::endl;
+ * return next;
+ * }
+ * }; @endcode
+ * It would be used with the boost::asio::connect function as follows:
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::resolver::iterator i = r.resolve(q), end;
+ * tcp::socket s(io_service);
+ * i = boost::asio::connect(s, i, end, my_connect_condition());
+ * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode
+ */
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin,
+ Iterator end, ConnectCondition connect_condition);
+
+/// Establishes a socket connection by trying each endpoint in a sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c connect member
+ * function, once for each endpoint in the sequence, until a connection is
+ * successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param end An iterator pointing to the end of a sequence of endpoints.
+ *
+ * @param connect_condition A function object that is called prior to each
+ * connection attempt. The signature of the function object must be:
+ * @code Iterator connect_condition(
+ * const boost::system::error_code& ec,
+ * Iterator next); @endcode
+ * The @c ec parameter contains the result from the most recent connect
+ * operation. Before the first connection attempt, @c ec is always set to
+ * indicate success. The @c next parameter is an iterator pointing to the next
+ * endpoint to be tried. The function object should return the next iterator,
+ * but is permitted to return a different iterator so that endpoints may be
+ * skipped. The implementation guarantees that the function object will never
+ * be called with the end iterator.
+ *
+ * @param ec Set to indicate what error occurred, if any. If the sequence is
+ * empty, set to boost::asio::error::not_found. Otherwise, contains the error
+ * from the last connection attempt.
+ *
+ * @returns On success, an iterator denoting the successfully connected
+ * endpoint. Otherwise, the end iterator.
+ *
+ * @par Example
+ * The following connect condition function object can be used to output
+ * information about the individual connection attempts:
+ * @code struct my_connect_condition
+ * {
+ * template <typename Iterator>
+ * Iterator operator()(
+ * const boost::system::error_code& ec,
+ * Iterator next)
+ * {
+ * if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ * std::cout << "Trying: " << next->endpoint() << std::endl;
+ * return next;
+ * }
+ * }; @endcode
+ * It would be used with the boost::asio::connect function as follows:
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::resolver::iterator i = r.resolve(q), end;
+ * tcp::socket s(io_service);
+ * boost::system::error_code ec;
+ * i = boost::asio::connect(s, i, end, my_connect_condition(), ec);
+ * if (ec)
+ * {
+ * // An error occurred.
+ * }
+ * else
+ * {
+ * std::cout << "Connected to: " << i->endpoint() << std::endl;
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end, ConnectCondition connect_condition,
+ boost::system::error_code& ec);
+
+/*@}*/
+
+/**
+ * @defgroup async_connect boost::asio::async_connect
+ *
+ * @brief Asynchronously establishes a socket connection by trying each
+ * endpoint in a sequence.
+ */
+/*@{*/
+
+/// Asynchronously establishes a socket connection by trying each endpoint in a
+/// sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c async_connect
+ * member function, once for each endpoint in the sequence, until a connection
+ * is successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param handler The handler to be called when the connect operation
+ * completes. Copies will be made of the handler as required. The function
+ * signature of the handler must be:
+ * @code void handler(
+ * // Result of operation. if the sequence is empty, set to
+ * // boost::asio::error::not_found. Otherwise, contains the
+ * // error from the last connection attempt.
+ * const boost::system::error_code& error,
+ *
+ * // On success, an iterator denoting the successfully
+ * // connected endpoint. Otherwise, the end iterator.
+ * Iterator iterator
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @note This overload assumes that a default constructed object of type @c
+ * Iterator represents the end of the sequence. This is a valid assumption for
+ * iterator types such as @c boost::asio::ip::tcp::resolver::iterator.
+ *
+ * @par Example
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ *
+ * // ...
+ *
+ * r.async_resolve(q, resolve_handler);
+ *
+ * // ...
+ *
+ * void resolve_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * if (!ec)
+ * {
+ * boost::asio::async_connect(s, i, connect_handler);
+ * }
+ * }
+ *
+ * // ...
+ *
+ * void connect_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * // ...
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ComposedConnectHandler>
+void async_connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
+
+/// Asynchronously establishes a socket connection by trying each endpoint in a
+/// sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c async_connect
+ * member function, once for each endpoint in the sequence, until a connection
+ * is successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param end An iterator pointing to the end of a sequence of endpoints.
+ *
+ * @param handler The handler to be called when the connect operation
+ * completes. Copies will be made of the handler as required. The function
+ * signature of the handler must be:
+ * @code void handler(
+ * // Result of operation. if the sequence is empty, set to
+ * // boost::asio::error::not_found. Otherwise, contains the
+ * // error from the last connection attempt.
+ * const boost::system::error_code& error,
+ *
+ * // On success, an iterator denoting the successfully
+ * // connected endpoint. Otherwise, the end iterator.
+ * Iterator iterator
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @par Example
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ *
+ * // ...
+ *
+ * r.async_resolve(q, resolve_handler);
+ *
+ * // ...
+ *
+ * void resolve_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * if (!ec)
+ * {
+ * tcp::resolver::iterator end;
+ * boost::asio::async_connect(s, i, end, connect_handler);
+ * }
+ * }
+ *
+ * // ...
+ *
+ * void connect_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * // ...
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ComposedConnectHandler>
+void async_connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
+
+/// Asynchronously establishes a socket connection by trying each endpoint in a
+/// sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c async_connect
+ * member function, once for each endpoint in the sequence, until a connection
+ * is successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param connect_condition A function object that is called prior to each
+ * connection attempt. The signature of the function object must be:
+ * @code Iterator connect_condition(
+ * const boost::system::error_code& ec,
+ * Iterator next); @endcode
+ * The @c ec parameter contains the result from the most recent connect
+ * operation. Before the first connection attempt, @c ec is always set to
+ * indicate success. The @c next parameter is an iterator pointing to the next
+ * endpoint to be tried. The function object should return the next iterator,
+ * but is permitted to return a different iterator so that endpoints may be
+ * skipped. The implementation guarantees that the function object will never
+ * be called with the end iterator.
+ *
+ * @param handler The handler to be called when the connect operation
+ * completes. Copies will be made of the handler as required. The function
+ * signature of the handler must be:
+ * @code void handler(
+ * // Result of operation. if the sequence is empty, set to
+ * // boost::asio::error::not_found. Otherwise, contains the
+ * // error from the last connection attempt.
+ * const boost::system::error_code& error,
+ *
+ * // On success, an iterator denoting the successfully
+ * // connected endpoint. Otherwise, the end iterator.
+ * Iterator iterator
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @note This overload assumes that a default constructed object of type @c
+ * Iterator represents the end of the sequence. This is a valid assumption for
+ * iterator types such as @c boost::asio::ip::tcp::resolver::iterator.
+ *
+ * @par Example
+ * The following connect condition function object can be used to output
+ * information about the individual connection attempts:
+ * @code struct my_connect_condition
+ * {
+ * template <typename Iterator>
+ * Iterator operator()(
+ * const boost::system::error_code& ec,
+ * Iterator next)
+ * {
+ * if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ * std::cout << "Trying: " << next->endpoint() << std::endl;
+ * return next;
+ * }
+ * }; @endcode
+ * It would be used with the boost::asio::connect function as follows:
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ *
+ * // ...
+ *
+ * r.async_resolve(q, resolve_handler);
+ *
+ * // ...
+ *
+ * void resolve_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * if (!ec)
+ * {
+ * boost::asio::async_connect(s, i,
+ * my_connect_condition(),
+ * connect_handler);
+ * }
+ * }
+ *
+ * // ...
+ *
+ * void connect_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * if (ec)
+ * {
+ * // An error occurred.
+ * }
+ * else
+ * {
+ * std::cout << "Connected to: " << i->endpoint() << std::endl;
+ * }
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+void async_connect(basic_socket<Protocol, SocketService>& s, Iterator begin,
+ ConnectCondition connect_condition,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
+
+/// Asynchronously establishes a socket connection by trying each endpoint in a
+/// sequence.
+/**
+ * This function attempts to connect a socket to one of a sequence of
+ * endpoints. It does this by repeated calls to the socket's @c async_connect
+ * member function, once for each endpoint in the sequence, until a connection
+ * is successfully established.
+ *
+ * @param s The socket to be connected. If the socket is already open, it will
+ * be closed.
+ *
+ * @param begin An iterator pointing to the start of a sequence of endpoints.
+ *
+ * @param end An iterator pointing to the end of a sequence of endpoints.
+ *
+ * @param connect_condition A function object that is called prior to each
+ * connection attempt. The signature of the function object must be:
+ * @code Iterator connect_condition(
+ * const boost::system::error_code& ec,
+ * Iterator next); @endcode
+ * The @c ec parameter contains the result from the most recent connect
+ * operation. Before the first connection attempt, @c ec is always set to
+ * indicate success. The @c next parameter is an iterator pointing to the next
+ * endpoint to be tried. The function object should return the next iterator,
+ * but is permitted to return a different iterator so that endpoints may be
+ * skipped. The implementation guarantees that the function object will never
+ * be called with the end iterator.
+ *
+ * @param handler The handler to be called when the connect operation
+ * completes. Copies will be made of the handler as required. The function
+ * signature of the handler must be:
+ * @code void handler(
+ * // Result of operation. if the sequence is empty, set to
+ * // boost::asio::error::not_found. Otherwise, contains the
+ * // error from the last connection attempt.
+ * const boost::system::error_code& error,
+ *
+ * // On success, an iterator denoting the successfully
+ * // connected endpoint. Otherwise, the end iterator.
+ * Iterator iterator
+ * ); @endcode
+ * Regardless of whether the asynchronous operation completes immediately or
+ * not, the handler will not be invoked from within this function. Invocation
+ * of the handler will be performed in a manner equivalent to using
+ * boost::asio::io_service::post().
+ *
+ * @par Example
+ * The following connect condition function object can be used to output
+ * information about the individual connection attempts:
+ * @code struct my_connect_condition
+ * {
+ * template <typename Iterator>
+ * Iterator operator()(
+ * const boost::system::error_code& ec,
+ * Iterator next)
+ * {
+ * if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ * std::cout << "Trying: " << next->endpoint() << std::endl;
+ * return next;
+ * }
+ * }; @endcode
+ * It would be used with the boost::asio::connect function as follows:
+ * @code tcp::resolver r(io_service);
+ * tcp::resolver::query q("host", "service");
+ * tcp::socket s(io_service);
+ *
+ * // ...
+ *
+ * r.async_resolve(q, resolve_handler);
+ *
+ * // ...
+ *
+ * void resolve_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * if (!ec)
+ * {
+ * tcp::resolver::iterator end;
+ * boost::asio::async_connect(s, i, end,
+ * my_connect_condition(),
+ * connect_handler);
+ * }
+ * }
+ *
+ * // ...
+ *
+ * void connect_handler(
+ * const boost::system::error_code& ec,
+ * tcp::resolver::iterator i)
+ * {
+ * if (ec)
+ * {
+ * // An error occurred.
+ * }
+ * else
+ * {
+ * std::cout << "Connected to: " << i->endpoint() << std::endl;
+ * }
+ * } @endcode
+ */
+template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+void async_connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end, ConnectCondition connect_condition,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
+
+/*@}*/
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/impl/connect.hpp>
+
+#endif

Modified: branches/release/boost/asio/datagram_socket_service.hpp
==============================================================================
--- branches/release/boost/asio/datagram_socket_service.hpp (original)
+++ branches/release/boost/asio/datagram_socket_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -68,11 +68,18 @@
   typedef typename service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native socket type.
+ /// (Deprecated: Use native_handle_type.) The native socket type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef typename service_impl_type::native_type native_type;
+ typedef typename service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native socket type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef typename service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new datagram socket service for the specified io_service.
@@ -83,18 +90,29 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new datagram socket implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new datagram socket implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another datagram socket implementation.
+ void move_assign(implementation_type& impl,
+ datagram_socket_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a datagram socket implementation.
   void destroy(implementation_type& impl)
   {
@@ -114,7 +132,7 @@
 
   /// Assign an existing native socket to a datagram socket.
   boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_type& native_socket,
+ const protocol_type& protocol, const native_handle_type& native_socket,
       boost::system::error_code& ec)
   {
     return service_impl_.assign(impl, protocol, native_socket, ec);
@@ -133,10 +151,16 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native socket implementation.
+ /// (Deprecated: Use native_handle().) Get the native socket implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native socket implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
   }
 
   /// Cancel all asynchronous operations associated with the socket.
@@ -177,9 +201,11 @@
   /// Start an asynchronous connect.
   template <typename ConnectHandler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, ConnectHandler handler)
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
- service_impl_.async_connect(impl, peer_endpoint, handler);
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set a socket option.
@@ -206,6 +232,32 @@
     return service_impl_.io_control(impl, command, ec);
   }
 
+ /// Gets the non-blocking mode of the socket.
+ bool non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.non_blocking(impl, mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.native_non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.native_non_blocking(impl, mode, ec);
+ }
+
   /// Get the local endpoint.
   endpoint_type local_endpoint(const implementation_type& impl,
       boost::system::error_code& ec) const
@@ -239,9 +291,11 @@
   /// Start an asynchronous send.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send(impl, buffers, flags, handler);
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Send a datagram to the specified endpoint.
@@ -257,9 +311,11 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(implementation_type& impl,
       const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send_to(impl, buffers, destination, flags, handler);
+ service_impl_.async_send_to(impl, buffers, destination, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data from the peer.
@@ -275,9 +331,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_receive(impl, buffers, flags, handler);
+ service_impl_.async_receive(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Receive a datagram with the endpoint of the sender.
@@ -294,13 +352,20 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(implementation_type& impl,
       const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags,
- handler);
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/deadline_timer_service.hpp
==============================================================================
--- branches/release/boost/asio/deadline_timer_service.hpp (original)
+++ branches/release/boost/asio/deadline_timer_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -72,12 +72,6 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new timer implementation.
   void construct(implementation_type& impl)
   {
@@ -96,6 +90,13 @@
     return service_impl_.cancel(impl, ec);
   }
 
+ /// Cancels one asynchronous wait operation associated with the timer.
+ std::size_t cancel_one(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.cancel_one(impl, ec);
+ }
+
   /// Get the expiry time for the timer as an absolute time.
   time_type expires_at(const implementation_type& impl) const
   {
@@ -130,12 +131,19 @@
 
   // Start an asynchronous wait on the timer.
   template <typename WaitHandler>
- void async_wait(implementation_type& impl, WaitHandler handler)
+ void async_wait(implementation_type& impl,
+ BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
   {
- service_impl_.async_wait(impl, handler);
+ service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Added: branches/release/boost/asio/detail/array.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/array.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,40 @@
+//
+// detail/array.hpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_ARRAY_HPP
+#define BOOST_ASIO_DETAIL_ARRAY_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+# include <array>
+#else // defined(BOOST_ASIO_HAS_STD_ARRAY)
+# include <boost/array.hpp>
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+using std::array;
+#else // defined(BOOST_ASIO_HAS_STD_ARRAY)
+using boost::array;
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#endif // BOOST_ASIO_DETAIL_ARRAY_HPP

Modified: branches/release/boost/asio/detail/array_fwd.hpp
==============================================================================
--- branches/release/boost/asio/detail/array_fwd.hpp (original)
+++ branches/release/boost/asio/detail/array_fwd.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -15,6 +15,8 @@
 # pragma once
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
+#include <boost/asio/detail/config.hpp>
+
 namespace boost {
 
 template<class T, std::size_t N>
@@ -22,4 +24,11 @@
 
 } // namespace boost
 
+// Standard library components can't be forward declared, so we'll have to
+// include the array header. Fortunately, it's fairly lightweight and doesn't
+// add significantly to the compile time.
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+# include <array>
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
+
 #endif // BOOST_ASIO_DETAIL_ARRAY_FWD_HPP

Added: branches/release/boost/asio/detail/atomic_count.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/atomic_count.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,40 @@
+//
+// detail/atomic_count.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP
+#define BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_STD_ATOMIC)
+# include <atomic>
+#else // defined(BOOST_ASIO_HAS_STD_ATOMIC)
+# include <boost/detail/atomic_count.hpp>
+#endif // defined(BOOST_ASIO_HAS_STD_ATOMIC)
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+#if defined(BOOST_ASIO_HAS_STD_ATOMIC)
+typedef std::atomic<long> atomic_count;
+#else // defined(BOOST_ASIO_HAS_STD_ATOMIC)
+typedef boost::detail::atomic_count atomic_count;
+#endif // defined(BOOST_ASIO_HAS_STD_ATOMIC)
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#endif // BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP

Modified: branches/release/boost/asio/detail/bind_handler.hpp
==============================================================================
--- branches/release/boost/asio/detail/bind_handler.hpp (original)
+++ branches/release/boost/asio/detail/bind_handler.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -35,6 +35,12 @@
   {
   }
 
+ binder1(Handler& handler, const Arg1& arg1)
+ : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ arg1_(arg1)
+ {
+ }
+
   void operator()()
   {
     handler_(static_cast<const Arg1&>(arg1_));
@@ -67,6 +73,14 @@
 }
 
 template <typename Function, typename Handler, typename Arg1>
+inline void asio_handler_invoke(Function& function,
+ binder1<Handler, Arg1>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1>
 inline void asio_handler_invoke(const Function& function,
     binder1<Handler, Arg1>* this_handler)
 {
@@ -75,7 +89,7 @@
 }
 
 template <typename Handler, typename Arg1>
-inline binder1<Handler, Arg1> bind_handler(const Handler& handler,
+inline binder1<Handler, Arg1> bind_handler(Handler handler,
     const Arg1& arg1)
 {
   return binder1<Handler, Arg1>(handler, arg1);
@@ -92,6 +106,13 @@
   {
   }
 
+ binder2(Handler& handler, const Arg1& arg1, const Arg2& arg2)
+ : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ arg1_(arg1),
+ arg2_(arg2)
+ {
+ }
+
   void operator()()
   {
     handler_(static_cast<const Arg1&>(arg1_),
@@ -126,6 +147,14 @@
 }
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2>
+inline void asio_handler_invoke(Function& function,
+ binder2<Handler, Arg1, Arg2>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2>
 inline void asio_handler_invoke(const Function& function,
     binder2<Handler, Arg1, Arg2>* this_handler)
 {
@@ -134,7 +163,7 @@
 }
 
 template <typename Handler, typename Arg1, typename Arg2>
-inline binder2<Handler, Arg1, Arg2> bind_handler(const Handler& handler,
+inline binder2<Handler, Arg1, Arg2> bind_handler(Handler handler,
     const Arg1& arg1, const Arg2& arg2)
 {
   return binder2<Handler, Arg1, Arg2>(handler, arg1, arg2);
@@ -153,6 +182,15 @@
   {
   }
 
+ binder3(Handler& handler, const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3)
+ : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ arg1_(arg1),
+ arg2_(arg2),
+ arg3_(arg3)
+ {
+ }
+
   void operator()()
   {
     handler_(static_cast<const Arg1&>(arg1_),
@@ -190,6 +228,15 @@
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2,
     typename Arg3>
+inline void asio_handler_invoke(Function& function,
+ binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2,
+ typename Arg3>
 inline void asio_handler_invoke(const Function& function,
     binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
 {
@@ -198,7 +245,7 @@
 }
 
 template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
-inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(const Handler& handler,
+inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(Handler handler,
     const Arg1& arg1, const Arg2& arg2, const Arg3& arg3)
 {
   return binder3<Handler, Arg1, Arg2, Arg3>(handler, arg1, arg2, arg3);
@@ -219,6 +266,16 @@
   {
   }
 
+ binder4(Handler& handler, const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3, const Arg4& arg4)
+ : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ arg1_(arg1),
+ arg2_(arg2),
+ arg3_(arg3),
+ arg4_(arg4)
+ {
+ }
+
   void operator()()
   {
     handler_(static_cast<const Arg1&>(arg1_),
@@ -260,6 +317,15 @@
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2,
     typename Arg3, typename Arg4>
+inline void asio_handler_invoke(Function& function,
+ binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2,
+ typename Arg3, typename Arg4>
 inline void asio_handler_invoke(const Function& function,
     binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
 {
@@ -270,7 +336,7 @@
 template <typename Handler, typename Arg1, typename Arg2, typename Arg3,
     typename Arg4>
 inline binder4<Handler, Arg1, Arg2, Arg3, Arg4> bind_handler(
- const Handler& handler, const Arg1& arg1, const Arg2& arg2,
+ Handler handler, const Arg1& arg1, const Arg2& arg2,
     const Arg3& arg3, const Arg4& arg4)
 {
   return binder4<Handler, Arg1, Arg2, Arg3, Arg4>(handler, arg1, arg2, arg3,
@@ -293,6 +359,17 @@
   {
   }
 
+ binder5(Handler& handler, const Arg1& arg1, const Arg2& arg2,
+ const Arg3& arg3, const Arg4& arg4, const Arg5& arg5)
+ : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ arg1_(arg1),
+ arg2_(arg2),
+ arg3_(arg3),
+ arg4_(arg4),
+ arg5_(arg5)
+ {
+ }
+
   void operator()()
   {
     handler_(static_cast<const Arg1&>(arg1_),
@@ -336,6 +413,15 @@
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2,
     typename Arg3, typename Arg4, typename Arg5>
+inline void asio_handler_invoke(Function& function,
+ binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2,
+ typename Arg3, typename Arg4, typename Arg5>
 inline void asio_handler_invoke(const Function& function,
     binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
 {
@@ -346,7 +432,7 @@
 template <typename Handler, typename Arg1, typename Arg2, typename Arg3,
     typename Arg4, typename Arg5>
 inline binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5> bind_handler(
- const Handler& handler, const Arg1& arg1, const Arg2& arg2,
+ Handler handler, const Arg1& arg1, const Arg2& arg2,
     const Arg3& arg3, const Arg4& arg4, const Arg5& arg5)
 {
   return binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>(handler, arg1, arg2,

Modified: branches/release/boost/asio/detail/buffer_sequence_adapter.hpp
==============================================================================
--- branches/release/boost/asio/detail/buffer_sequence_adapter.hpp (original)
+++ branches/release/boost/asio/detail/buffer_sequence_adapter.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -81,11 +81,11 @@
   : buffer_sequence_adapter_base
 {
 public:
- explicit buffer_sequence_adapter(const Buffers& buffers)
+ explicit buffer_sequence_adapter(const Buffers& buffer_sequence)
     : count_(0), total_buffer_size_(0)
   {
- typename Buffers::const_iterator iter = buffers.begin();
- typename Buffers::const_iterator end = buffers.end();
+ typename Buffers::const_iterator iter = buffer_sequence.begin();
+ typename Buffers::const_iterator end = buffer_sequence.end();
     for (; iter != end && count_ < max_buffers; ++iter, ++count_)
     {
       Buffer buffer(*iter);
@@ -109,10 +109,10 @@
     return total_buffer_size_ == 0;
   }
 
- static bool all_empty(const Buffers& buffers)
+ static bool all_empty(const Buffers& buffer_sequence)
   {
- typename Buffers::const_iterator iter = buffers.begin();
- typename Buffers::const_iterator end = buffers.end();
+ typename Buffers::const_iterator iter = buffer_sequence.begin();
+ typename Buffers::const_iterator end = buffer_sequence.end();
     std::size_t i = 0;
     for (; iter != end && i < max_buffers; ++iter, ++i)
       if (boost::asio::buffer_size(Buffer(*iter)) > 0)
@@ -120,10 +120,10 @@
     return true;
   }
 
- static void validate(const Buffers& buffers)
+ static void validate(const Buffers& buffer_sequence)
   {
- typename Buffers::const_iterator iter = buffers.begin();
- typename Buffers::const_iterator end = buffers.end();
+ typename Buffers::const_iterator iter = buffer_sequence.begin();
+ typename Buffers::const_iterator end = buffer_sequence.end();
     for (; iter != end; ++iter)
     {
       Buffer buffer(*iter);
@@ -131,10 +131,10 @@
     }
   }
 
- static Buffer first(const Buffers& buffers)
+ static Buffer first(const Buffers& buffer_sequence)
   {
- typename Buffers::const_iterator iter = buffers.begin();
- typename Buffers::const_iterator end = buffers.end();
+ typename Buffers::const_iterator iter = buffer_sequence.begin();
+ typename Buffers::const_iterator end = buffer_sequence.end();
     for (; iter != end; ++iter)
     {
       Buffer buffer(*iter);
@@ -159,10 +159,10 @@
 {
 public:
   explicit buffer_sequence_adapter(
- const boost::asio::mutable_buffers_1& buffers)
+ const boost::asio::mutable_buffers_1& buffer_sequence)
   {
- init_native_buffer(buffer_, Buffer(buffers));
- total_buffer_size_ = boost::asio::buffer_size(buffers);
+ init_native_buffer(buffer_, Buffer(buffer_sequence));
+ total_buffer_size_ = boost::asio::buffer_size(buffer_sequence);
   }
 
   native_buffer_type* buffers()
@@ -180,19 +180,19 @@
     return total_buffer_size_ == 0;
   }
 
- static bool all_empty(const boost::asio::mutable_buffers_1& buffers)
+ static bool all_empty(const boost::asio::mutable_buffers_1& buffer_sequence)
   {
- return boost::asio::buffer_size(buffers) == 0;
+ return boost::asio::buffer_size(buffer_sequence) == 0;
   }
 
- static void validate(const boost::asio::mutable_buffers_1& buffers)
+ static void validate(const boost::asio::mutable_buffers_1& buffer_sequence)
   {
- boost::asio::buffer_cast<const void*>(buffers);
+ boost::asio::buffer_cast<const void*>(buffer_sequence);
   }
 
- static Buffer first(const boost::asio::mutable_buffers_1& buffers)
+ static Buffer first(const boost::asio::mutable_buffers_1& buffer_sequence)
   {
- return Buffer(buffers);
+ return Buffer(buffer_sequence);
   }
 
 private:
@@ -206,10 +206,10 @@
 {
 public:
   explicit buffer_sequence_adapter(
- const boost::asio::const_buffers_1& buffers)
+ const boost::asio::const_buffers_1& buffer_sequence)
   {
- init_native_buffer(buffer_, Buffer(buffers));
- total_buffer_size_ = boost::asio::buffer_size(buffers);
+ init_native_buffer(buffer_, Buffer(buffer_sequence));
+ total_buffer_size_ = boost::asio::buffer_size(buffer_sequence);
   }
 
   native_buffer_type* buffers()
@@ -227,19 +227,19 @@
     return total_buffer_size_ == 0;
   }
 
- static bool all_empty(const boost::asio::const_buffers_1& buffers)
+ static bool all_empty(const boost::asio::const_buffers_1& buffer_sequence)
   {
- return boost::asio::buffer_size(buffers) == 0;
+ return boost::asio::buffer_size(buffer_sequence) == 0;
   }
 
- static void validate(const boost::asio::const_buffers_1& buffers)
+ static void validate(const boost::asio::const_buffers_1& buffer_sequence)
   {
- boost::asio::buffer_cast<const void*>(buffers);
+ boost::asio::buffer_cast<const void*>(buffer_sequence);
   }
 
- static Buffer first(const boost::asio::const_buffers_1& buffers)
+ static Buffer first(const boost::asio::const_buffers_1& buffer_sequence)
   {
- return Buffer(buffers);
+ return Buffer(buffer_sequence);
   }
 
 private:

Modified: branches/release/boost/asio/detail/buffered_stream_storage.hpp
==============================================================================
--- branches/release/boost/asio/detail/buffered_stream_storage.hpp (original)
+++ branches/release/boost/asio/detail/buffered_stream_storage.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,7 +16,8 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <cassert>
+#include <boost/asio/buffer.hpp>
+#include <boost/assert.hpp>
 #include <cstddef>
 #include <cstring>
 #include <vector>
@@ -37,10 +38,10 @@
   typedef std::size_t size_type;
 
   // Constructor.
- explicit buffered_stream_storage(std::size_t capacity)
+ explicit buffered_stream_storage(std::size_t buffer_capacity)
     : begin_offset_(0),
       end_offset_(0),
- buffer_(capacity)
+ buffer_(buffer_capacity)
   {
   }
 
@@ -52,15 +53,15 @@
   }
 
   // Return a pointer to the beginning of the unread data.
- byte_type* data()
+ mutable_buffer data()
   {
- return &buffer_[0] + begin_offset_;
+ return boost::asio::buffer(buffer_) + begin_offset_;
   }
 
   // Return a pointer to the beginning of the unread data.
- const byte_type* data() const
+ const_buffer data() const
   {
- return &buffer_[0] + begin_offset_;
+ return boost::asio::buffer(buffer_) + begin_offset_;
   }
 
   // Is there no unread data in the buffer.
@@ -78,7 +79,7 @@
   // Resize the buffer to the specified length.
   void resize(size_type length)
   {
- assert(length <= capacity());
+ BOOST_ASSERT(length <= capacity());
     if (begin_offset_ + length <= capacity())
     {
       end_offset_ = begin_offset_ + length;
@@ -101,7 +102,7 @@
   // Consume multiple bytes from the beginning of the buffer.
   void consume(size_type count)
   {
- assert(begin_offset_ + count <= end_offset_);
+ BOOST_ASSERT(begin_offset_ + count <= end_offset_);
     begin_offset_ += count;
     if (empty())
       clear();

Modified: branches/release/boost/asio/detail/completion_handler.hpp
==============================================================================
--- branches/release/boost/asio/detail/completion_handler.hpp (original)
+++ branches/release/boost/asio/detail/completion_handler.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -33,9 +33,9 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(completion_handler);
 
- completion_handler(Handler h)
+ completion_handler(Handler& h)
     : operation(&completion_handler::do_complete),
- handler_(h)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
   {
   }
 
@@ -46,13 +46,15 @@
     completion_handler* h(static_cast<completion_handler*>(base));
     ptr p = { boost::addressof(h->handler_), h, h };
 
+ BOOST_ASIO_HANDLER_COMPLETION((h));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
     // with the handler. Consequently, a local copy of the handler is required
     // to ensure that any owning sub-object remains valid until after we have
     // deallocated the memory here.
- Handler handler(h->handler_);
+ Handler handler(BOOST_ASIO_MOVE_CAST(Handler)(h->handler_));
     p.h = boost::addressof(handler);
     p.reset();
 
@@ -60,7 +62,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN(());
       boost_asio_handler_invoke_helpers::invoke(handler, handler);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/config.hpp
==============================================================================
--- branches/release/boost/asio/detail/config.hpp (original)
+++ branches/release/boost/asio/detail/config.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -46,6 +46,114 @@
 # define BOOST_ASIO_DECL
 #endif // !defined(BOOST_ASIO_DECL)
 
+// Support move construction and assignment on compilers known to allow it.
+#if !defined(BOOST_ASIO_DISABLE_MOVE)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_MOVE
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+#endif // !defined(BOOST_ASIO_DISABLE_MOVE)
+
+// If BOOST_ASIO_MOVE_CAST isn't defined, and move support is available, define
+// BOOST_ASIO_MOVE_ARG and BOOST_ASIO_MOVE_CAST to take advantage of rvalue
+// references and perfect forwarding.
+#if defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
+# define BOOST_ASIO_MOVE_ARG(type) type&&
+# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
+#endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
+
+// If BOOST_ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible
+// implementation. Note that older g++ and MSVC versions don't like it when you
+// pass a non-member function through a const reference, so for most compilers
+// we'll play it safe and stick with the old approach of passing the handler by
+// value.
+#if !defined(BOOST_ASIO_MOVE_CAST)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
+# define BOOST_ASIO_MOVE_ARG(type) const type&
+# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
+# define BOOST_ASIO_MOVE_ARG(type) type
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
+# elif defined(BOOST_MSVC)
+# if (_MSC_VER >= 1400)
+# define BOOST_ASIO_MOVE_ARG(type) const type&
+# else // (_MSC_VER >= 1400)
+# define BOOST_ASIO_MOVE_ARG(type) type
+# endif // (_MSC_VER >= 1400)
+# else
+# define BOOST_ASIO_MOVE_ARG(type) type
+# endif
+# define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&>
+#endif // !defined_BOOST_ASIO_MOVE_CAST
+
+// Support variadic templates on compilers known to allow it.
+#if !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_VARIADIC_TEMPLATES
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+#endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
+
+// Standard library support for system errors.
+#if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+#endif // !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
+
+// Standard library support for arrays.
+#if !defined(BOOST_ASIO_DISABLE_STD_ARRAY)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_ARRAY
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_MSVC)
+# if (_MSC_VER >= 1600)
+# define BOOST_ASIO_HAS_STD_ARRAY
+# endif // (_MSC_VER >= 1600)
+# endif // defined(BOOST_MSVC)
+#endif // !defined(BOOST_ASIO_DISABLE_STD_ARRAY)
+
+// Standard library support for shared_ptr and weak_ptr.
+#if !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_SHARED_PTR
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_MSVC)
+# if (_MSC_VER >= 1600)
+# define BOOST_ASIO_HAS_STD_SHARED_PTR
+# endif // (_MSC_VER >= 1600)
+# endif // defined(BOOST_MSVC)
+#endif // !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
+
+// Standard library support for atomic operations.
+#if !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_ATOMIC
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+#endif // !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
+
 // Windows: target OS version.
 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
@@ -202,4 +310,18 @@
 # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
 #endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
 
+// Can use sigaction() instead of signal().
+#if !defined(BOOST_ASIO_DISABLE_SIGACTION)
+# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+# define BOOST_ASIO_HAS_SIGACTION 1
+# endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+#endif // !defined(BOOST_ASIO_DISABLE_SIGACTION)
+
+// Can use signal().
+#if !defined(BOOST_ASIO_DISABLE_SIGNAL)
+# if !defined(UNDER_CE)
+# define BOOST_ASIO_HAS_SIGNAL 1
+# endif // !defined(UNDER_CE)
+#endif // !defined(BOOST_ASIO_DISABLE_SIGNAL)
+
 #endif // BOOST_ASIO_DETAIL_CONFIG_HPP

Modified: branches/release/boost/asio/detail/deadline_timer_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/deadline_timer_service.hpp (original)
+++ branches/release/boost/asio/detail/deadline_timer_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -100,12 +100,35 @@
       ec = boost::system::error_code();
       return 0;
     }
+
+ BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel"));
+
     std::size_t count = scheduler_.cancel_timer(timer_queue_, impl.timer_data);
     impl.might_have_pending_waits = false;
     ec = boost::system::error_code();
     return count;
   }
 
+ // Cancels one asynchronous wait operation associated with the timer.
+ std::size_t cancel_one(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ if (!impl.might_have_pending_waits)
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+ BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel_one"));
+
+ std::size_t count = scheduler_.cancel_timer(
+ timer_queue_, impl.timer_data, 1);
+ if (count == 0)
+ impl.might_have_pending_waits = false;
+ ec = boost::system::error_code();
+ return count;
+ }
+
   // Get the expiry time for the timer as an absolute time.
   time_type expires_at(const implementation_type& impl) const
   {
@@ -140,18 +163,17 @@
   void wait(implementation_type& impl, boost::system::error_code& ec)
   {
     time_type now = Time_Traits::now();
- while (Time_Traits::less_than(now, impl.expiry))
+ ec = boost::system::error_code();
+ while (Time_Traits::less_than(now, impl.expiry) && !ec)
     {
       boost::posix_time::time_duration timeout =
         Time_Traits::to_posix_duration(Time_Traits::subtract(impl.expiry, now));
       ::timeval tv;
       tv.tv_sec = timeout.total_seconds();
       tv.tv_usec = timeout.total_microseconds() % 1000000;
- boost::system::error_code ec;
       socket_ops::select(0, 0, 0, 0, &tv, ec);
       now = Time_Traits::now();
     }
- ec = boost::system::error_code();
   }
 
   // Start an asynchronous wait on the timer.
@@ -167,6 +189,8 @@
 
     impl.might_have_pending_waits = true;
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "deadline_timer", &impl, "async_wait"));
+
     scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p);
     p.v = p.p = 0;
   }

Modified: branches/release/boost/asio/detail/descriptor_ops.hpp
==============================================================================
--- branches/release/boost/asio/detail/descriptor_ops.hpp (original)
+++ branches/release/boost/asio/detail/descriptor_ops.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -40,7 +40,10 @@
   internal_non_blocking = 2,
 
   // Helper "state" used to determine whether the descriptor is non-blocking.
- non_blocking = user_set_non_blocking | internal_non_blocking
+ non_blocking = user_set_non_blocking | internal_non_blocking,
+
+ // The descriptor may have been dup()-ed.
+ possible_dup = 4
 };
 
 typedef unsigned char state_type;
@@ -60,8 +63,11 @@
 BOOST_ASIO_DECL int close(int d, state_type& state,
     boost::system::error_code& ec);
 
+BOOST_ASIO_DECL bool set_user_non_blocking(int d,
+ state_type& state, bool value, boost::system::error_code& ec);
+
 BOOST_ASIO_DECL bool set_internal_non_blocking(int d,
- state_type& state, boost::system::error_code& ec);
+ state_type& state, bool value, boost::system::error_code& ec);
 
 typedef iovec buf;
 

Modified: branches/release/boost/asio/detail/descriptor_read_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/descriptor_read_op.hpp (original)
+++ branches/release/boost/asio/detail/descriptor_read_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -68,10 +68,10 @@
   BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_read_op);
 
   descriptor_read_op(int descriptor,
- const MutableBufferSequence& buffers, Handler handler)
+ const MutableBufferSequence& buffers, Handler& handler)
     : descriptor_read_op_base<MutableBufferSequence>(
         descriptor, buffers, &descriptor_read_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -82,6 +82,8 @@
     descriptor_read_op* o(static_cast<descriptor_read_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -97,7 +99,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/descriptor_write_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/descriptor_write_op.hpp (original)
+++ branches/release/boost/asio/detail/descriptor_write_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -68,10 +68,10 @@
   BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_write_op);
 
   descriptor_write_op(int descriptor,
- const ConstBufferSequence& buffers, Handler handler)
+ const ConstBufferSequence& buffers, Handler& handler)
     : descriptor_write_op_base<ConstBufferSequence>(
         descriptor, buffers, &descriptor_write_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -82,6 +82,8 @@
     descriptor_write_op* o(static_cast<descriptor_write_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -97,7 +99,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/dev_poll_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/dev_poll_reactor.hpp (original)
+++ branches/release/boost/asio/detail/dev_poll_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,6 +19,7 @@
 
 #if defined(BOOST_ASIO_HAS_DEV_POLL)
 
+#include <boost/limits.hpp>
 #include <cstddef>
 #include <vector>
 #include <sys/devpoll.h>
@@ -63,6 +64,10 @@
   // Destroy all user-defined handler objects owned by the service.
   BOOST_ASIO_DECL void shutdown_service();
 
+ // Recreate internal descriptors following a fork.
+ BOOST_ASIO_DECL void fork_service(
+ boost::asio::io_service::fork_event fork_ev);
+
   // Initialise the task.
   BOOST_ASIO_DECL void init_task();
 
@@ -70,6 +75,17 @@
   // code on failure.
   BOOST_ASIO_DECL int register_descriptor(socket_type, per_descriptor_data&);
 
+ // Register a descriptor with an associated single operation. Returns 0 on
+ // success, system error code on failure.
+ BOOST_ASIO_DECL int register_internal_descriptor(
+ int op_type, socket_type descriptor,
+ per_descriptor_data& descriptor_data, reactor_op* op);
+
+ // Move descriptor registration from one descriptor_data object to another.
+ BOOST_ASIO_DECL void move_descriptor(socket_type descriptor,
+ per_descriptor_data& target_descriptor_data,
+ per_descriptor_data& source_descriptor_data);
+
   // Post a reactor operation for immediate completion.
   void post_immediate_completion(reactor_op* op)
   {
@@ -88,7 +104,12 @@
 
   // Cancel any operations that are running against the descriptor and remove
   // its registration from the reactor.
- BOOST_ASIO_DECL void close_descriptor(
+ BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor,
+ per_descriptor_data&, bool closing);
+
+ // Cancel any operations that are running against the descriptor and remove
+ // its registration from the reactor.
+ BOOST_ASIO_DECL void deregister_internal_descriptor(
       socket_type descriptor, per_descriptor_data&);
 
   // Add a new timer queue to the reactor.
@@ -110,7 +131,8 @@
   // number of operations that have been posted or dispatched.
   template <typename Time_Traits>
   std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer);
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
 
   // Run /dev/poll once until interrupted or events are ready to be dispatched.
   BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops);
@@ -140,6 +162,10 @@
   BOOST_ASIO_DECL void cancel_ops_unlocked(socket_type descriptor,
       const boost::system::error_code& ec);
 
+ // Helper class used to reregister descriptors after a fork.
+ class fork_helper;
+ friend class fork_helper;
+
   // Add a pending event entry for the given descriptor.
   BOOST_ASIO_DECL ::pollfd& add_pending_event_change(int descriptor);
 

Modified: branches/release/boost/asio/detail/epoll_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/epoll_reactor.hpp (original)
+++ branches/release/boost/asio/detail/epoll_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,6 +19,7 @@
 
 #if defined(BOOST_ASIO_HAS_EPOLL)
 
+#include <boost/limits.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/detail/epoll_reactor_fwd.hpp>
 #include <boost/asio/detail/mutex.hpp>
@@ -51,6 +52,7 @@
     friend class epoll_reactor;
     friend class object_pool_access;
     mutex mutex_;
+ int descriptor_;
     op_queue<reactor_op> op_queue_[max_ops];
     bool shutdown_;
     descriptor_state* next_;
@@ -69,6 +71,10 @@
   // Destroy all user-defined handler objects owned by the service.
   BOOST_ASIO_DECL void shutdown_service();
 
+ // Recreate internal descriptors following a fork.
+ BOOST_ASIO_DECL void fork_service(
+ boost::asio::io_service::fork_event fork_ev);
+
   // Initialise the task.
   BOOST_ASIO_DECL void init_task();
 
@@ -77,6 +83,17 @@
   BOOST_ASIO_DECL int register_descriptor(socket_type descriptor,
       per_descriptor_data& descriptor_data);
 
+ // Register a descriptor with an associated single operation. Returns 0 on
+ // success, system error code on failure.
+ BOOST_ASIO_DECL int register_internal_descriptor(
+ int op_type, socket_type descriptor,
+ per_descriptor_data& descriptor_data, reactor_op* op);
+
+ // Move descriptor registration from one descriptor_data object to another.
+ BOOST_ASIO_DECL void move_descriptor(socket_type descriptor,
+ per_descriptor_data& target_descriptor_data,
+ per_descriptor_data& source_descriptor_data);
+
   // Post a reactor operation for immediate completion.
   void post_immediate_completion(reactor_op* op)
   {
@@ -86,8 +103,8 @@
   // Start a new operation. The reactor operation will be performed when the
   // given descriptor is flagged as ready, or an error has occurred.
   BOOST_ASIO_DECL void start_op(int op_type, socket_type descriptor,
- per_descriptor_data& descriptor_data,
- reactor_op* op, bool allow_speculative);
+ per_descriptor_data& descriptor_data, reactor_op* op,
+ bool allow_speculative);
 
   // Cancel all operations associated with the given descriptor. The
   // handlers associated with the descriptor will be invoked with the
@@ -97,8 +114,12 @@
 
   // Cancel any operations that are running against the descriptor and remove
   // its registration from the reactor.
- BOOST_ASIO_DECL void close_descriptor(socket_type descriptor,
- per_descriptor_data& descriptor_data);
+ BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor,
+ per_descriptor_data& descriptor_data, bool closing);
+
+ // Remote the descriptor's registration from the reactor.
+ BOOST_ASIO_DECL void deregister_internal_descriptor(
+ socket_type descriptor, per_descriptor_data& descriptor_data);
 
   // Add a new timer queue to the reactor.
   template <typename Time_Traits>
@@ -119,7 +140,8 @@
   // number of operations that have been posted or dispatched.
   template <typename Time_Traits>
   std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer);
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
 
   // Run epoll once until interrupted or events are ready to be dispatched.
   BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops);
@@ -135,6 +157,9 @@
   // cannot be created.
   BOOST_ASIO_DECL static int do_epoll_create();
 
+ // Create the timerfd file descriptor. Does not throw.
+ BOOST_ASIO_DECL static int do_timerfd_create();
+
   // Helper function to add a new timer queue.
   BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue);
 

Modified: branches/release/boost/asio/detail/eventfd_select_interrupter.hpp
==============================================================================
--- branches/release/boost/asio/detail/eventfd_select_interrupter.hpp (original)
+++ branches/release/boost/asio/detail/eventfd_select_interrupter.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -35,6 +35,9 @@
   // Destructor.
   BOOST_ASIO_DECL ~eventfd_select_interrupter();
 
+ // Recreate the interrupter's descriptors. Used after a fork.
+ BOOST_ASIO_DECL void recreate();
+
   // Interrupt the select call.
   BOOST_ASIO_DECL void interrupt();
 
@@ -48,6 +51,12 @@
   }
 
 private:
+ // Open the descriptors. Throws on error.
+ BOOST_ASIO_DECL void open_descriptors();
+
+ // Close the descriptors.
+ BOOST_ASIO_DECL void close_descriptors();
+
   // The read end of a connection used to interrupt the select call. This file
   // descriptor is passed to select such that when it is time to stop, a single
   // 64bit value will be written on the other end of the connection and this

Modified: branches/release/boost/asio/detail/gcc_arm_fenced_block.hpp
==============================================================================
--- branches/release/boost/asio/detail/gcc_arm_fenced_block.hpp (original)
+++ branches/release/boost/asio/detail/gcc_arm_fenced_block.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -57,9 +57,14 @@
     || defined(__ARM_ARCH_6Z__) \
     || defined(__ARM_ARCH_6ZK__) \
     || defined(__ARM_ARCH_6T2__)
+# if defined(__thumb__)
+ // This is just a placeholder and almost certainly not sufficient.
+ __asm__ __volatile__ ("" : : : "memory");
+# else // defined(__thumb__)
     int a = 0, b = 0;
     __asm__ __volatile__ ("swp %0, %1, [%2]"
         : "=&r"(a) : "r"(1), "r"(&b) : "memory", "cc");
+# endif // defined(__thumb__)
 #else
     // ARMv7 and later.
     __asm__ __volatile__ ("dmb" : : : "memory");

Modified: branches/release/boost/asio/detail/handler_alloc_helpers.hpp
==============================================================================
--- branches/release/boost/asio/detail/handler_alloc_helpers.hpp (original)
+++ branches/release/boost/asio/detail/handler_alloc_helpers.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -35,7 +35,7 @@
   || BOOST_WORKAROUND(__GNUC__, < 3)
   return ::operator new(s);
 #else
- using namespace boost::asio;
+ using boost::asio::asio_handler_allocate;
   return asio_handler_allocate(s, boost::addressof(h));
 #endif
 }
@@ -47,7 +47,7 @@
   || BOOST_WORKAROUND(__GNUC__, < 3)
   ::operator delete(p);
 #else
- using namespace boost::asio;
+ using boost::asio::asio_handler_deallocate;
   asio_handler_deallocate(p, s, boost::addressof(h));
 #endif
 }

Modified: branches/release/boost/asio/detail/handler_invoke_helpers.hpp
==============================================================================
--- branches/release/boost/asio/detail/handler_invoke_helpers.hpp (original)
+++ branches/release/boost/asio/detail/handler_invoke_helpers.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -28,6 +28,19 @@
 namespace boost_asio_handler_invoke_helpers {
 
 template <typename Function, typename Context>
+inline void invoke(Function& function, Context& context)
+{
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
+ || BOOST_WORKAROUND(__GNUC__, < 3)
+ Function tmp(function);
+ tmp();
+#else
+ using boost::asio::asio_handler_invoke;
+ asio_handler_invoke(function, boost::addressof(context));
+#endif
+}
+
+template <typename Function, typename Context>
 inline void invoke(const Function& function, Context& context)
 {
 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
@@ -35,7 +48,7 @@
   Function tmp(function);
   tmp();
 #else
- using namespace boost::asio;
+ using boost::asio::asio_handler_invoke;
   asio_handler_invoke(function, boost::addressof(context));
 #endif
 }

Added: branches/release/boost/asio/detail/handler_tracking.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/handler_tracking.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,161 @@
+//
+// detail/handler_tracking.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP
+#define BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+# include <boost/cstdint.hpp>
+# include <boost/system/error_code.hpp>
+# include <boost/asio/detail/static_mutex.hpp>
+# include <boost/asio/detail/tss_ptr.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+
+class handler_tracking
+{
+public:
+ class completion;
+
+ // Base class for objects containing tracked handlers.
+ class tracked_handler
+ {
+ private:
+ // Only the handler_tracking class will have access to the id.
+ friend class handler_tracking;
+ friend class completion;
+ boost::uint64_t id_;
+
+ protected:
+ // Constructor initialises with no id.
+ tracked_handler() : id_(0) {}
+
+ // Prevent deletion through this type.
+ ~tracked_handler() {}
+ };
+
+ // Initialise the tracking system.
+ BOOST_ASIO_DECL static void init();
+
+ // Record the creation of a tracked handler.
+ BOOST_ASIO_DECL static void creation(tracked_handler* h,
+ const char* object_type, void* object, const char* op_name);
+
+ class completion
+ {
+ public:
+ // Constructor records that handler is to be invoked with no arguments.
+ BOOST_ASIO_DECL explicit completion(tracked_handler* h);
+
+ // Destructor records only when an exception is thrown from the handler, or
+ // if the memory is being freed without the handler having been invoked.
+ BOOST_ASIO_DECL ~completion();
+
+ // Records that handler is to be invoked with no arguments.
+ BOOST_ASIO_DECL void invocation_begin();
+
+ // Records that handler is to be invoked with one arguments.
+ BOOST_ASIO_DECL void invocation_begin(const boost::system::error_code& ec);
+
+ // Constructor records that handler is to be invoked with two arguments.
+ BOOST_ASIO_DECL void invocation_begin(
+ const boost::system::error_code& ec, std::size_t bytes_transferred);
+
+ // Constructor records that handler is to be invoked with two arguments.
+ BOOST_ASIO_DECL void invocation_begin(
+ const boost::system::error_code& ec, int signal_number);
+
+ // Constructor records that handler is to be invoked with two arguments.
+ BOOST_ASIO_DECL void invocation_begin(
+ const boost::system::error_code& ec, const char* arg);
+
+ // Record that handler invocation has ended.
+ BOOST_ASIO_DECL void invocation_end();
+
+ private:
+ friend class handler_tracking;
+ boost::uint64_t id_;
+ bool invoked_;
+ completion* next_;
+ };
+
+ // Record an operation that affects pending handlers.
+ BOOST_ASIO_DECL static void operation(const char* object_type,
+ void* object, const char* op_name);
+
+ // Write a line of output.
+ BOOST_ASIO_DECL static void write_line(const char* format, ...);
+
+private:
+ struct tracking_state;
+ BOOST_ASIO_DECL static tracking_state* get_state();
+};
+
+# define BOOST_ASIO_INHERIT_TRACKED_HANDLER \
+ : public boost::asio::detail::handler_tracking::tracked_handler
+
+# define BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER \
+ , public boost::asio::detail::handler_tracking::tracked_handler
+
+# define BOOST_ASIO_HANDLER_TRACKING_INIT \
+ boost::asio::detail::handler_tracking::init()
+
+# define BOOST_ASIO_HANDLER_CREATION(args) \
+ boost::asio::detail::handler_tracking::creation args
+
+# define BOOST_ASIO_HANDLER_COMPLETION(args) \
+ boost::asio::detail::handler_tracking::completion tracked_completion args
+
+# define BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args) \
+ tracked_completion.invocation_begin args
+
+# define BOOST_ASIO_HANDLER_INVOCATION_END \
+ tracked_completion.invocation_end()
+
+# define BOOST_ASIO_HANDLER_OPERATION(args) \
+ boost::asio::detail::handler_tracking::operation args
+
+#else // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+
+# define BOOST_ASIO_INHERIT_TRACKED_HANDLER
+# define BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER
+# define BOOST_ASIO_HANDLER_TRACKING_INIT (void)0
+# define BOOST_ASIO_HANDLER_CREATION(args) (void)0
+# define BOOST_ASIO_HANDLER_COMPLETION(args) (void)0
+# define BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args) (void)0
+# define BOOST_ASIO_HANDLER_INVOCATION_END (void)0
+# define BOOST_ASIO_HANDLER_OPERATION(args) (void)0
+
+#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/detail/impl/handler_tracking.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP

Added: branches/release/boost/asio/detail/handler_type_requirements.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/handler_type_requirements.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,362 @@
+//
+// detail/handler_type_requirements.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP
+#define BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+// Older versions of gcc have difficulty compiling the sizeof expressions where
+// we test the handler type requirements. We'll disable checking of handler type
+// requirements for those compilers, but otherwise enable it by default.
+#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
+# if !defined(__GNUC__) || (__GNUC__ >= 4)
+# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS 1
+# endif // !defined(__GNUC__) || (__GNUC__ >= 4)
+#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
+
+// With C++0x we can use a combination of enhanced SFINAE and static_assert to
+// generate better template error messages. As this technique is not yet widely
+// portable, we'll only enable it for tested compilers.
+#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_MSVC)
+# if (_MSC_VER >= 1600)
+# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1
+# endif // (_MSC_VER >= 1600)
+# endif // defined(BOOST_MSVC)
+#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+#if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
+
+# if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
+
+template <typename Handler>
+auto zero_arg_handler_test(Handler h, void*)
+ -> decltype(
+ sizeof(Handler(static_cast<const Handler&>(h))),
+ ((h)()),
+ char(0));
+
+template <typename Handler>
+char (&zero_arg_handler_test(Handler, ...))[2];
+
+template <typename Handler, typename Arg1>
+auto one_arg_handler_test(Handler h, Arg1* a1)
+ -> decltype(
+ sizeof(Handler(static_cast<const Handler&>(h))),
+ ((h)(*a1)),
+ char(0));
+
+template <typename Handler>
+char (&one_arg_handler_test(Handler h, ...))[2];
+
+template <typename Handler, typename Arg1, typename Arg2>
+auto two_arg_handler_test(Handler h, Arg1* a1, Arg2* a2)
+ -> decltype(
+ sizeof(Handler(static_cast<const Handler&>(h))),
+ ((h)(*a1, *a2)),
+ char(0));
+
+template <typename Handler>
+char (&two_arg_handler_test(Handler, ...))[2];
+
+# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) \
+ static_assert(expr, msg);
+
+# else // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
+
+# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg)
+
+# endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
+
+template <typename T> T& lvref();
+template <typename T> T& lvref(T);
+template <typename T> const T& clvref(T);
+template <typename T> char argbyv(T);
+
+template <int>
+struct handler_type_requirements
+{
+};
+
+#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::zero_arg_handler_test( \
+ handler, 0)) == 1, \
+ "CompletionHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)(), \
+ char(0))>
+
+#define BOOST_ASIO_READ_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::two_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0), \
+ static_cast<const std::size_t*>(0))) == 1, \
+ "ReadHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>(), \
+ boost::asio::detail::lvref<const std::size_t>()), \
+ char(0))>
+
+#define BOOST_ASIO_WRITE_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::two_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0), \
+ static_cast<const std::size_t*>(0))) == 1, \
+ "WriteHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>(), \
+ boost::asio::detail::lvref<const std::size_t>()), \
+ char(0))>
+
+#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::one_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0))) == 1, \
+ "AcceptHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>()), \
+ char(0))>
+
+#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::one_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0))) == 1, \
+ "ConnectHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>()), \
+ char(0))>
+
+#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \
+ handler_type, handler, iter_type) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::two_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0), \
+ static_cast<const iter_type*>(0))) == 1, \
+ "ComposedConnectHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>(), \
+ boost::asio::detail::lvref<const iter_type>()), \
+ char(0))>
+
+#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \
+ handler_type, handler, iter_type) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::two_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0), \
+ static_cast<const iter_type*>(0))) == 1, \
+ "ResolveHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>(), \
+ boost::asio::detail::lvref<const iter_type>()), \
+ char(0))>
+
+#define BOOST_ASIO_WAIT_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::one_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0))) == 1, \
+ "WaitHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>()), \
+ char(0))>
+
+#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::two_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0), \
+ static_cast<const int*>(0))) == 1, \
+ "SignalHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>(), \
+ boost::asio::detail::lvref<const int>()), \
+ char(0))>
+
+#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::one_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0))) == 1, \
+ "HandshakeHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>()), \
+ char(0))>
+
+#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \
+ handler_type, handler) \
+ \
+ BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
+ sizeof(boost::asio::detail::one_arg_handler_test( \
+ handler, \
+ static_cast<const boost::system::error_code*>(0))) == 1, \
+ "ShutdownHandler type requirements not met") \
+ \
+ typedef boost::asio::detail::handler_type_requirements< \
+ sizeof( \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
+ sizeof( \
+ boost::asio::detail::lvref(handler)( \
+ boost::asio::detail::lvref<const boost::system::error_code>()), \
+ char(0))>
+
+#else // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
+
+#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_READ_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_WRITE_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \
+ handler_type, handler, iter_type) \
+ typedef int
+
+#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \
+ handler_type, handler, iter_type) \
+ typedef int
+
+#define BOOST_ASIO_WAIT_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \
+ handler_type, handler) \
+ typedef int
+
+#endif // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#endif // BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP

Modified: branches/release/boost/asio/detail/hash_map.hpp
==============================================================================
--- branches/release/boost/asio/detail/hash_map.hpp (original)
+++ branches/release/boost/asio/detail/hash_map.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,7 +16,7 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <cassert>
+#include <boost/assert.hpp>
 #include <list>
 #include <utility>
 #include <boost/asio/detail/noncopyable.hpp>
@@ -117,9 +117,9 @@
       iterator it = buckets_[bucket].first;
       if (it == values_.end())
         return values_.end();
- iterator end = buckets_[bucket].last;
- ++end;
- while (it != end)
+ iterator end_it = buckets_[bucket].last;
+ ++end_it;
+ while (it != end_it)
       {
         if (it->first == k)
           return it;
@@ -138,9 +138,9 @@
       const_iterator it = buckets_[bucket].first;
       if (it == values_.end())
         return it;
- const_iterator end = buckets_[bucket].last;
- ++end;
- while (it != end)
+ const_iterator end_it = buckets_[bucket].last;
+ ++end_it;
+ while (it != end_it)
       {
         if (it->first == k)
           return it;
@@ -164,15 +164,15 @@
       ++size_;
       return std::pair<iterator, bool>(buckets_[bucket].last, true);
     }
- iterator end = buckets_[bucket].last;
- ++end;
- while (it != end)
+ iterator end_it = buckets_[bucket].last;
+ ++end_it;
+ while (it != end_it)
     {
       if (it->first == v.first)
         return std::pair<iterator, bool>(it, false);
       ++it;
     }
- buckets_[bucket].last = values_insert(end, v);
+ buckets_[bucket].last = values_insert(end_it, v);
     ++size_;
     return std::pair<iterator, bool>(buckets_[bucket].last, true);
   }
@@ -180,7 +180,7 @@
   // Erase an entry from the map.
   void erase(iterator it)
   {
- assert(it != values_.end());
+ BOOST_ASSERT(it != values_.end());
 
     size_t bucket = calculate_hash_value(it->first) % num_buckets_;
     bool is_first = (it == buckets_[bucket].first);
@@ -212,9 +212,9 @@
     size_ = 0;
 
     // Initialise all buckets to empty.
- iterator end = values_.end();
+ iterator end_it = values_.end();
     for (size_t i = 0; i < num_buckets_; ++i)
- buckets_[i].first = buckets_[i].last = end;
+ buckets_[i].first = buckets_[i].last = end_it;
   }
 
 private:
@@ -245,21 +245,21 @@
       return;
     num_buckets_ = num_buckets;
 
- iterator end = values_.end();
+ iterator end_iter = values_.end();
 
     // Update number of buckets and initialise all buckets to empty.
     bucket_type* tmp = new bucket_type[num_buckets_];
     delete[] buckets_;
     buckets_ = tmp;
     for (std::size_t i = 0; i < num_buckets_; ++i)
- buckets_[i].first = buckets_[i].last = end;
+ buckets_[i].first = buckets_[i].last = end_iter;
 
     // Put all values back into the hash.
     iterator iter = values_.begin();
- while (iter != end)
+ while (iter != end_iter)
     {
       std::size_t bucket = calculate_hash_value(iter->first) % num_buckets_;
- if (buckets_[bucket].last == end)
+ if (buckets_[bucket].last == end_iter)
       {
         buckets_[bucket].first = buckets_[bucket].last = iter++;
       }

Modified: branches/release/boost/asio/detail/impl/descriptor_ops.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/descriptor_ops.ipp (original)
+++ branches/release/boost/asio/detail/impl/descriptor_ops.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -43,8 +43,19 @@
   int result = 0;
   if (d != -1)
   {
- if (state & internal_non_blocking)
+ errno = 0;
+ result = error_wrapper(::close(d), ec);
+
+ if (result != 0
+ && (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again))
     {
+ // According to UNIX Network Programming Vol. 1, it is possible for
+ // close() to fail with EWOULDBLOCK under certain circumstances. What
+ // isn't clear is the state of the descriptor after this error. The one
+ // current OS where this behaviour is seen, Windows, says that the socket
+ // remains open. Therefore we'll put the descriptor back into blocking
+ // mode and have another attempt at closing it.
 #if defined(__SYMBIAN32__)
       int flags = ::fcntl(d, F_GETFL, 0);
       if (flags >= 0)
@@ -53,11 +64,11 @@
       ioctl_arg_type arg = 0;
       ::ioctl(d, FIONBIO, &arg);
 #endif // defined(__SYMBIAN32__)
- state &= ~internal_non_blocking;
- }
+ state &= ~non_blocking;
 
- errno = 0;
- result = error_wrapper(::close(d), ec);
+ errno = 0;
+ result = error_wrapper(::close(d), ec);
+ }
   }
 
   if (result == 0)
@@ -65,8 +76,49 @@
   return result;
 }
 
-bool set_internal_non_blocking(int d,
- state_type& state, boost::system::error_code& ec)
+bool set_user_non_blocking(int d, state_type& state,
+ bool value, boost::system::error_code& ec)
+{
+ if (d == -1)
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return false;
+ }
+
+ errno = 0;
+#if defined(__SYMBIAN32__)
+ int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec);
+ if (result >= 0)
+ {
+ errno = 0;
+ int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK));
+ result = error_wrapper(::fcntl(d, F_SETFL, flag), ec);
+ }
+#else // defined(__SYMBIAN32__)
+ ioctl_arg_type arg = (value ? 1 : 0);
+ int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec);
+#endif // defined(__SYMBIAN32__)
+
+ if (result >= 0)
+ {
+ ec = boost::system::error_code();
+ if (value)
+ state |= user_set_non_blocking;
+ else
+ {
+ // Clearing the user-set non-blocking mode always overrides any
+ // internally-set non-blocking flag. Any subsequent asynchronous
+ // operations will need to re-enable non-blocking I/O.
+ state &= ~(user_set_non_blocking | internal_non_blocking);
+ }
+ return true;
+ }
+
+ return false;
+}
+
+bool set_internal_non_blocking(int d, state_type& state,
+ bool value, boost::system::error_code& ec)
 {
   if (d == -1)
   {
@@ -74,23 +126,36 @@
     return false;
   }
 
+ if (!value && (state & user_set_non_blocking))
+ {
+ // It does not make sense to clear the internal non-blocking flag if the
+ // user still wants non-blocking behaviour. Return an error and let the
+ // caller figure out whether to update the user-set non-blocking flag.
+ ec = boost::asio::error::invalid_argument;
+ return false;
+ }
+
   errno = 0;
 #if defined(__SYMBIAN32__)
   int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec);
   if (result >= 0)
   {
     errno = 0;
- result = error_wrapper(::fcntl(d, F_SETFL, result | O_NONBLOCK), ec);
+ int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK));
+ result = error_wrapper(::fcntl(d, F_SETFL, flag), ec);
   }
 #else // defined(__SYMBIAN32__)
- ioctl_arg_type arg = 1;
+ ioctl_arg_type arg = (value ? 1 : 0);
   int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec);
 #endif // defined(__SYMBIAN32__)
 
   if (result >= 0)
   {
     ec = boost::system::error_code();
- state |= internal_non_blocking;
+ if (value)
+ state |= internal_non_blocking;
+ else
+ state &= ~internal_non_blocking;
     return true;
   }
 

Modified: branches/release/boost/asio/detail/impl/dev_poll_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/impl/dev_poll_reactor.hpp (original)
+++ branches/release/boost/asio/detail/impl/dev_poll_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -58,11 +58,12 @@
 
 template <typename Time_Traits>
 std::size_t dev_poll_reactor::cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer)
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled)
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
   op_queue<operation> ops;
- std::size_t n = queue.cancel_timer(timer, ops);
+ std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
   lock.unlock();
   io_service_.post_deferred_completions(ops);
   return n;

Modified: branches/release/boost/asio/detail/impl/dev_poll_reactor.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/dev_poll_reactor.ipp (original)
+++ branches/release/boost/asio/detail/impl/dev_poll_reactor.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,6 +19,7 @@
 
 #if defined(BOOST_ASIO_HAS_DEV_POLL)
 
+#include <boost/assert.hpp>
 #include <boost/asio/detail/dev_poll_reactor.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
@@ -38,7 +39,7 @@
     shutdown_(false)
 {
   // Add the interrupter's descriptor to /dev/poll.
- ::pollfd ev = { 0 };
+ ::pollfd ev = { 0, 0, 0 };
   ev.fd = interrupter_.read_descriptor();
   ev.events = POLLIN | POLLERR;
   ev.revents = 0;
@@ -63,8 +64,68 @@
     op_queue_[i].get_all_operations(ops);
 
   timer_queues_.get_all_timers(ops);
+
+ io_service_.abandon_operations(ops);
 }
 
+// Helper class to re-register all descriptors with /dev/poll.
+class dev_poll_reactor::fork_helper
+{
+public:
+ fork_helper(dev_poll_reactor* reactor, short events)
+ : reactor_(reactor), events_(events)
+ {
+ }
+
+ bool set(int descriptor)
+ {
+ ::pollfd& ev = reactor_->add_pending_event_change(descriptor);
+ ev.events = events_;
+ return true;
+ }
+
+private:
+ dev_poll_reactor* reactor_;
+ short events_;
+};
+
+void dev_poll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev)
+{
+ if (fork_ev == boost::asio::io_service::fork_child)
+ {
+ detail::mutex::scoped_lock lock(mutex_);
+
+ if (dev_poll_fd_ != -1)
+ ::close(dev_poll_fd_);
+ dev_poll_fd_ = -1;
+ dev_poll_fd_ = do_dev_poll_create();
+
+ interrupter_.recreate();
+
+ // Add the interrupter's descriptor to /dev/poll.
+ ::pollfd ev = { 0, 0, 0 };
+ ev.fd = interrupter_.read_descriptor();
+ ev.events = POLLIN | POLLERR;
+ ev.revents = 0;
+ ::write(dev_poll_fd_, &ev, sizeof(ev));
+
+ // Re-register all descriptors with /dev/poll. The changes will be written
+ // to the /dev/poll descriptor the next time the reactor is run.
+ op_queue<operation> ops;
+ fork_helper read_op_helper(this, POLLERR | POLLHUP | POLLIN);
+ op_queue_[read_op].get_descriptors(read_op_helper, ops);
+ fork_helper write_op_helper(this, POLLERR | POLLHUP | POLLOUT);
+ op_queue_[write_op].get_descriptors(write_op_helper, ops);
+ fork_helper except_op_helper(this, POLLERR | POLLHUP | POLLPRI);
+ op_queue_[except_op].get_descriptors(except_op_helper, ops);
+ interrupter_.interrupt();
+
+ // The ops op_queue will always be empty because the fork_helper's set()
+ // member function never returns false.
+ BOOST_ASSERT(ops.empty());
+ }
+}
+
 void dev_poll_reactor::init_task()
 {
   io_service_.init_task();
@@ -75,6 +136,32 @@
   return 0;
 }
 
+int dev_poll_reactor::register_internal_descriptor(int op_type,
+ socket_type descriptor, per_descriptor_data&, reactor_op* op)
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+
+ op_queue_[op_type].enqueue_operation(descriptor, op);
+ ::pollfd& ev = add_pending_event_change(descriptor);
+ ev.events = POLLERR | POLLHUP;
+ switch (op_type)
+ {
+ case read_op: ev.events |= POLLIN; break;
+ case write_op: ev.events |= POLLOUT; break;
+ case except_op: ev.events |= POLLPRI; break;
+ default: break;
+ }
+ interrupter_.interrupt();
+
+ return 0;
+}
+
+void dev_poll_reactor::move_descriptor(socket_type,
+ dev_poll_reactor::per_descriptor_data&,
+ dev_poll_reactor::per_descriptor_data&)
+{
+}
+
 void dev_poll_reactor::start_op(int op_type, socket_type descriptor,
     dev_poll_reactor::per_descriptor_data&,
     reactor_op* op, bool allow_speculative)
@@ -129,8 +216,8 @@
   cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted);
 }
 
-void dev_poll_reactor::close_descriptor(socket_type descriptor,
- dev_poll_reactor::per_descriptor_data&)
+void dev_poll_reactor::deregister_descriptor(socket_type descriptor,
+ dev_poll_reactor::per_descriptor_data&, bool)
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
 
@@ -143,6 +230,26 @@
   cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted);
 }
 
+void dev_poll_reactor::deregister_internal_descriptor(
+ socket_type descriptor, dev_poll_reactor::per_descriptor_data&)
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+
+ // Remove the descriptor from /dev/poll. Since this function is only called
+ // during a fork, we can apply the change immediately.
+ ::pollfd ev = { 0, 0, 0 };
+ ev.fd = descriptor;
+ ev.events = POLLREMOVE;
+ ev.revents = 0;
+ ::write(dev_poll_fd_, &ev, sizeof(ev));
+
+ // Destroy all operations associated with the descriptor.
+ op_queue<operation> ops;
+ boost::system::error_code ec;
+ for (int i = 0; i < max_ops; ++i)
+ op_queue_[i].cancel_operations(descriptor, ops, ec);
+}
+
 void dev_poll_reactor::run(bool block, op_queue<operation>& ops)
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
@@ -179,8 +286,8 @@
   lock.unlock();
 
   // Block on the /dev/poll descriptor.
- ::pollfd events[128] = { { 0 } };
- ::dvpoll dp = { 0 };
+ ::pollfd events[128] = { { 0, 0, 0 } };
+ ::dvpoll dp = { 0, 0, 0 };
   dp.dp_fds = events;
   dp.dp_nfds = 128;
   dp.dp_timeout = timeout;
@@ -228,7 +335,7 @@
         // The poll operation can produce POLLHUP or POLLERR events when there
         // is no operation pending, so if we do not remove the descriptor we
         // can end up in a tight polling loop.
- ::pollfd ev = { 0 };
+ ::pollfd ev = { 0, 0, 0 };
         ev.fd = descriptor;
         ev.events = POLLREMOVE;
         ev.revents = 0;
@@ -236,7 +343,7 @@
       }
       else
       {
- ::pollfd ev = { 0 };
+ ::pollfd ev = { 0, 0, 0 };
         ev.fd = descriptor;
         ev.events = POLLERR | POLLHUP;
         if (more_reads)

Modified: branches/release/boost/asio/detail/impl/epoll_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/impl/epoll_reactor.hpp (original)
+++ branches/release/boost/asio/detail/impl/epoll_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -56,11 +56,12 @@
 
 template <typename Time_Traits>
 std::size_t epoll_reactor::cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer)
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled)
 {
   mutex::scoped_lock lock(mutex_);
   op_queue<operation> ops;
- std::size_t n = queue.cancel_timer(timer, ops);
+ std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
   lock.unlock();
   io_service_.post_deferred_completions(ops);
   return n;

Modified: branches/release/boost/asio/detail/impl/epoll_reactor.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/epoll_reactor.ipp (original)
+++ branches/release/boost/asio/detail/impl/epoll_reactor.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -40,11 +40,7 @@
     io_service_(use_service<io_service_impl>(io_service)),
     mutex_(),
     epoll_fd_(do_epoll_create()),
-#if defined(BOOST_ASIO_HAS_TIMERFD)
- timer_fd_(timerfd_create(CLOCK_MONOTONIC, 0)),
-#else // defined(BOOST_ASIO_HAS_TIMERFD)
- timer_fd_(-1),
-#endif // defined(BOOST_ASIO_HAS_TIMERFD)
+ timer_fd_(do_timerfd_create()),
     interrupter_(),
     shutdown_(false)
 {
@@ -66,7 +62,8 @@
 
 epoll_reactor::~epoll_reactor()
 {
- close(epoll_fd_);
+ if (epoll_fd_ != -1)
+ close(epoll_fd_);
   if (timer_fd_ != -1)
     close(timer_fd_);
 }
@@ -88,6 +85,59 @@
   }
 
   timer_queues_.get_all_timers(ops);
+
+ io_service_.abandon_operations(ops);
+}
+
+void epoll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev)
+{
+ if (fork_ev == boost::asio::io_service::fork_child)
+ {
+ if (epoll_fd_ != -1)
+ ::close(epoll_fd_);
+ epoll_fd_ = -1;
+ epoll_fd_ = do_epoll_create();
+
+ if (timer_fd_ != -1)
+ ::close(timer_fd_);
+ timer_fd_ = -1;
+ timer_fd_ = do_timerfd_create();
+
+ interrupter_.recreate();
+
+ // Add the interrupter's descriptor to epoll.
+ epoll_event ev = { 0, { 0 } };
+ ev.events = EPOLLIN | EPOLLERR | EPOLLET;
+ ev.data.ptr = &interrupter_;
+ epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev);
+ interrupter_.interrupt();
+
+ // Add the timer descriptor to epoll.
+ if (timer_fd_ != -1)
+ {
+ ev.events = EPOLLIN | EPOLLERR;
+ ev.data.ptr = &timer_fd_;
+ epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev);
+ }
+
+ update_timeout();
+
+ // Re-register all descriptors with epoll.
+ mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_);
+ for (descriptor_state* state = registered_descriptors_.first();
+ state != 0; state = state->next_)
+ {
+ ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET;
+ ev.data.ptr = state;
+ int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, state->descriptor_, &ev);
+ if (result != 0)
+ {
+ boost::system::error_code ec(errno,
+ boost::asio::error::get_system_category());
+ boost::asio::detail::throw_error(ec, "epoll re-registration");
+ }
+ }
+ }
 }
 
 void epoll_reactor::init_task()
@@ -101,7 +151,31 @@
   mutex::scoped_lock lock(registered_descriptors_mutex_);
 
   descriptor_data = registered_descriptors_.alloc();
+ descriptor_data->descriptor_ = descriptor;
+ descriptor_data->shutdown_ = false;
+
+ lock.unlock();
+
+ epoll_event ev = { 0, { 0 } };
+ ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET;
+ ev.data.ptr = descriptor_data;
+ int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev);
+ if (result != 0)
+ return errno;
+
+ return 0;
+}
+
+int epoll_reactor::register_internal_descriptor(
+ int op_type, socket_type descriptor,
+ epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op)
+{
+ mutex::scoped_lock lock(registered_descriptors_mutex_);
+
+ descriptor_data = registered_descriptors_.alloc();
+ descriptor_data->descriptor_ = descriptor;
   descriptor_data->shutdown_ = false;
+ descriptor_data->op_queue_[op_type].push(op);
 
   lock.unlock();
 
@@ -115,6 +189,14 @@
   return 0;
 }
 
+void epoll_reactor::move_descriptor(socket_type,
+ epoll_reactor::per_descriptor_data& target_descriptor_data,
+ epoll_reactor::per_descriptor_data& source_descriptor_data)
+{
+ target_descriptor_data = source_descriptor_data;
+ source_descriptor_data = 0;
+}
+
 void epoll_reactor::start_op(int op_type, socket_type descriptor,
     epoll_reactor::per_descriptor_data& descriptor_data,
     reactor_op* op, bool allow_speculative)
@@ -185,8 +267,8 @@
   io_service_.post_deferred_completions(ops);
 }
 
-void epoll_reactor::close_descriptor(socket_type,
- epoll_reactor::per_descriptor_data& descriptor_data)
+void epoll_reactor::deregister_descriptor(socket_type descriptor,
+ epoll_reactor::per_descriptor_data& descriptor_data, bool closing)
 {
   if (!descriptor_data)
     return;
@@ -196,8 +278,16 @@
 
   if (!descriptor_data->shutdown_)
   {
- // Remove the descriptor from the set of known descriptors. The descriptor
- // will be automatically removed from the epoll set when it is closed.
+ if (closing)
+ {
+ // The descriptor will be automatically removed from the epoll set when
+ // it is closed.
+ }
+ else
+ {
+ epoll_event ev = { 0, { 0 } };
+ epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev);
+ }
 
     op_queue<operation> ops;
     for (int i = 0; i < max_ops; ++i)
@@ -210,6 +300,7 @@
       }
     }
 
+ descriptor_data->descriptor_ = -1;
     descriptor_data->shutdown_ = true;
 
     descriptor_lock.unlock();
@@ -223,6 +314,36 @@
   }
 }
 
+void epoll_reactor::deregister_internal_descriptor(socket_type descriptor,
+ epoll_reactor::per_descriptor_data& descriptor_data)
+{
+ if (!descriptor_data)
+ return;
+
+ mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
+ mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_);
+
+ if (!descriptor_data->shutdown_)
+ {
+ epoll_event ev = { 0, { 0 } };
+ epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev);
+
+ op_queue<operation> ops;
+ for (int i = 0; i < max_ops; ++i)
+ ops.push(descriptor_data->op_queue_[i]);
+
+ descriptor_data->descriptor_ = -1;
+ descriptor_data->shutdown_ = true;
+
+ descriptor_lock.unlock();
+
+ registered_descriptors_.free(descriptor_data);
+ descriptor_data = 0;
+
+ descriptors_lock.unlock();
+ }
+}
+
 void epoll_reactor::run(bool block, op_queue<operation>& ops)
 {
   // Calculate a timeout only if timerfd is not used.
@@ -323,14 +444,51 @@
 
 int epoll_reactor::do_epoll_create()
 {
- int fd = epoll_create(epoll_size);
+#if defined(EPOLL_CLOEXEC)
+ int fd = epoll_create1(EPOLL_CLOEXEC);
+#else // defined(EPOLL_CLOEXEC)
+ int fd = -1;
+ errno = EINVAL;
+#endif // defined(EPOLL_CLOEXEC)
+
+ if (fd == -1 && errno == EINVAL)
+ {
+ fd = epoll_create(epoll_size);
+ if (fd != -1)
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ }
+
   if (fd == -1)
   {
     boost::system::error_code ec(errno,
         boost::asio::error::get_system_category());
     boost::asio::detail::throw_error(ec, "epoll");
   }
+
+ return fd;
+}
+
+int epoll_reactor::do_timerfd_create()
+{
+#if defined(BOOST_ASIO_HAS_TIMERFD)
+# if defined(TFD_CLOEXEC)
+ int fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
+# else // defined(TFD_CLOEXEC)
+ int fd = -1;
+ errno = EINVAL;
+# endif // defined(TFD_CLOEXEC)
+
+ if (fd == -1 && errno == EINVAL)
+ {
+ fd = timerfd_create(CLOCK_MONOTONIC, 0);
+ if (fd != -1)
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ }
+
   return fd;
+#else // defined(BOOST_ASIO_HAS_TIMERFD)
+ return -1;
+#endif // defined(BOOST_ASIO_HAS_TIMERFD)
 }
 
 void epoll_reactor::do_add_timer_queue(timer_queue_base& queue)

Modified: branches/release/boost/asio/detail/impl/eventfd_select_interrupter.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/eventfd_select_interrupter.ipp (original)
+++ branches/release/boost/asio/detail/impl/eventfd_select_interrupter.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -40,24 +40,48 @@
 
 eventfd_select_interrupter::eventfd_select_interrupter()
 {
+ open_descriptors();
+}
+
+void eventfd_select_interrupter::open_descriptors()
+{
 #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
   write_descriptor_ = read_descriptor_ = syscall(__NR_eventfd, 0);
-#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
- write_descriptor_ = read_descriptor_ = ::eventfd(0, 0);
-#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
   if (read_descriptor_ != -1)
   {
     ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
+ ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
   }
- else
+#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
+# if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK)
+ write_descriptor_ = read_descriptor_ =
+ ::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
+# else // defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK)
+ errno = EINVAL;
+ write_descriptor_ = read_descriptor_ = -1;
+# endif // defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK)
+ if (read_descriptor_ == -1 && errno == EINVAL)
+ {
+ write_descriptor_ = read_descriptor_ = ::eventfd(0, 0);
+ if (read_descriptor_ != -1)
+ {
+ ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
+ ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
+ }
+ }
+#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
+
+ if (read_descriptor_ == -1)
   {
     int pipe_fds[2];
     if (pipe(pipe_fds) == 0)
     {
       read_descriptor_ = pipe_fds[0];
       ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
+ ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
       write_descriptor_ = pipe_fds[1];
       ::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK);
+ ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC);
     }
     else
     {
@@ -70,12 +94,27 @@
 
 eventfd_select_interrupter::~eventfd_select_interrupter()
 {
+ close_descriptors();
+}
+
+void eventfd_select_interrupter::close_descriptors()
+{
   if (write_descriptor_ != -1 && write_descriptor_ != read_descriptor_)
     ::close(write_descriptor_);
   if (read_descriptor_ != -1)
     ::close(read_descriptor_);
 }
 
+void eventfd_select_interrupter::recreate()
+{
+ close_descriptors();
+
+ write_descriptor_ = -1;
+ read_descriptor_ = -1;
+
+ open_descriptors();
+}
+
 void eventfd_select_interrupter::interrupt()
 {
   uint64_t counter(1UL);

Added: branches/release/boost/asio/detail/impl/handler_tracking.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/impl/handler_tracking.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,299 @@
+//
+// detail/impl/handler_tracking.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP
+#define BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+
+#include <cstdarg>
+#include <cstdio>
+#include <boost/asio/detail/handler_tracking.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <boost/asio/detail/pop_options.hpp>
+
+#if !defined(BOOST_WINDOWS)
+# include <unistd.h>
+#endif // !defined(BOOST_WINDOWS)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+struct handler_tracking::tracking_state
+{
+ static_mutex mutex_;
+ boost::uint64_t next_id_;
+ tss_ptr<completion>* current_completion_;
+};
+
+handler_tracking::tracking_state* handler_tracking::get_state()
+{
+ static tracking_state state = { BOOST_ASIO_STATIC_MUTEX_INIT, 1, 0 };
+ return &state;
+}
+
+void handler_tracking::init()
+{
+ static tracking_state* state = get_state();
+
+ state->mutex_.init();
+
+ static_mutex::scoped_lock lock(state->mutex_);
+ if (state->current_completion_ == 0)
+ state->current_completion_ = new tss_ptr<completion>;
+}
+
+void handler_tracking::creation(handler_tracking::tracked_handler* h,
+ const char* object_type, void* object, const char* op_name)
+{
+ static tracking_state* state = get_state();
+
+ static_mutex::scoped_lock lock(state->mutex_);
+ h->id_ = state->next_id_++;
+ lock.unlock();
+
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ boost::uint64_t current_id = 0;
+ if (completion* current_completion = *state->current_completion_)
+ current_id = current_completion->id_;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|%I64u*%I64u|%.20s@%p.%.50s\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|%llu*%llu|%.20s@%p.%.50s\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+ current_id, h->id_, object_type, object, op_name);
+}
+
+handler_tracking::completion::completion(handler_tracking::tracked_handler* h)
+ : id_(h->id_),
+ invoked_(false),
+ next_(*get_state()->current_completion_)
+{
+ *get_state()->current_completion_ = this;
+}
+
+handler_tracking::completion::~completion()
+{
+ if (id_)
+ {
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|%c%I64u|\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|%c%llu|\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+ invoked_ ? '!' : '~', id_);
+ }
+
+ *get_state()->current_completion_ = next_;
+}
+
+void handler_tracking::completion::invocation_begin()
+{
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|>%I64u|\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|>%llu|\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_);
+
+ invoked_ = true;
+}
+
+void handler_tracking::completion::invocation_begin(
+ const boost::system::error_code& ec)
+{
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|>%llu|ec=%.20s:%d\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+ id_, ec.category().name(), ec.value());
+
+ invoked_ = true;
+}
+
+void handler_tracking::completion::invocation_begin(
+ const boost::system::error_code& ec, std::size_t bytes_transferred)
+{
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,bytes_transferred=%I64u\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,bytes_transferred=%llu\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+ id_, ec.category().name(), ec.value(),
+ static_cast<boost::uint64_t>(bytes_transferred));
+
+ invoked_ = true;
+}
+
+void handler_tracking::completion::invocation_begin(
+ const boost::system::error_code& ec, int signal_number)
+{
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,signal_number=%d\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,signal_number=%d\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+ id_, ec.category().name(), ec.value(), signal_number);
+
+ invoked_ = true;
+}
+
+void handler_tracking::completion::invocation_begin(
+ const boost::system::error_code& ec, const char* arg)
+{
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,%.50s\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,%.50s\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+ id_, ec.category().name(), ec.value(), arg);
+
+ invoked_ = true;
+}
+
+void handler_tracking::completion::invocation_end()
+{
+ if (id_)
+ {
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|<%I64u|\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|<%llu|\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_);
+
+ id_ = 0;
+ }
+}
+
+void handler_tracking::operation(const char* object_type,
+ void* object, const char* op_name)
+{
+ static tracking_state* state = get_state();
+
+ boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
+ boost::posix_time::time_duration now =
+ boost::posix_time::microsec_clock::universal_time() - epoch;
+
+ unsigned long long current_id = 0;
+ if (completion* current_completion = *state->current_completion_)
+ current_id = current_completion->id_;
+
+ write_line(
+#if defined(BOOST_WINDOWS)
+ "@asio|%I64u.%06I64u|%I64u|%.20s@%p.%.50s\n",
+#else // defined(BOOST_WINDOWS)
+ "@asio|%llu.%06llu|%llu|%.20s@%p.%.50s\n",
+#endif // defined(BOOST_WINDOWS)
+ static_cast<boost::uint64_t>(now.total_seconds()),
+ static_cast<boost::uint64_t>(now.total_microseconds() % 1000000),
+ current_id, object_type, object, op_name);
+}
+
+void handler_tracking::write_line(const char* format, ...)
+{
+ using namespace std; // For sprintf (or equivalent).
+
+ va_list args;
+ va_start(args, format);
+
+ char line[256] = "";
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+ int length = vsprintf_s(line, sizeof(line), format, args);
+#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+ int length = vsprintf(line, format, args);
+#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+
+ va_end(args);
+
+#if defined(BOOST_WINDOWS)
+ HANDLE stderr_handle = ::GetStdHandle(STD_ERROR_HANDLE);
+ DWORD bytes_written = 0;
+ ::WriteFile(stderr_handle, line, length, &bytes_written, 0);
+#else // defined(BOOST_WINDOWS)
+ ::write(STDERR_FILENO, line, length);
+#endif // defined(BOOST_WINDOWS)
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+
+#endif // BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP

Modified: branches/release/boost/asio/detail/impl/kqueue_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/impl/kqueue_reactor.hpp (original)
+++ branches/release/boost/asio/detail/impl/kqueue_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -60,11 +60,12 @@
 
 template <typename Time_Traits>
 std::size_t kqueue_reactor::cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer)
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled)
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
   op_queue<operation> ops;
- std::size_t n = queue.cancel_timer(timer, ops);
+ std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
   lock.unlock();
   io_service_.post_deferred_completions(ops);
   return n;

Modified: branches/release/boost/asio/detail/impl/kqueue_reactor.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/kqueue_reactor.ipp (original)
+++ branches/release/boost/asio/detail/impl/kqueue_reactor.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -75,6 +75,47 @@
   }
 
   timer_queues_.get_all_timers(ops);
+
+ io_service_.abandon_operations(ops);
+}
+
+void kqueue_reactor::fork_service(boost::asio::io_service::fork_event fork_ev)
+{
+ if (fork_ev == boost::asio::io_service::fork_child)
+ {
+ // The kqueue descriptor is automatically closed in the child.
+ kqueue_fd_ = -1;
+ kqueue_fd_ = do_kqueue_create();
+
+ interrupter_.recreate();
+
+ // Re-register all descriptors with kqueue.
+ mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_);
+ for (descriptor_state* state = registered_descriptors_.first();
+ state != 0; state = state->next_)
+ {
+ struct kevent events[2];
+ int num_events = 0;
+
+ if (!state->op_queue_[read_op].empty())
+ BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_,
+ EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, state);
+ else if (!state->op_queue_[except_op].empty())
+ BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_,
+ EVFILT_READ, EV_ADD | EV_CLEAR, EV_OOBAND, 0, state);
+
+ if (!state->op_queue_[write_op].empty())
+ BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_,
+ EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, state);
+
+ if (num_events && ::kevent(kqueue_fd_, events, num_events, 0, 0, 0) == -1)
+ {
+ boost::system::error_code error(errno,
+ boost::asio::error::get_system_category());
+ boost::asio::detail::throw_error(error);
+ }
+ }
+ }
 }
 
 void kqueue_reactor::init_task()
@@ -82,17 +123,58 @@
   io_service_.init_task();
 }
 
-int kqueue_reactor::register_descriptor(socket_type,
+int kqueue_reactor::register_descriptor(socket_type descriptor,
     kqueue_reactor::per_descriptor_data& descriptor_data)
 {
   mutex::scoped_lock lock(registered_descriptors_mutex_);
 
   descriptor_data = registered_descriptors_.alloc();
+ descriptor_data->descriptor_ = descriptor;
+ descriptor_data->shutdown_ = false;
+
+ return 0;
+}
+
+int kqueue_reactor::register_internal_descriptor(
+ int op_type, socket_type descriptor,
+ kqueue_reactor::per_descriptor_data& descriptor_data, reactor_op* op)
+{
+ mutex::scoped_lock lock(registered_descriptors_mutex_);
+
+ descriptor_data = registered_descriptors_.alloc();
+ descriptor_data->descriptor_ = descriptor;
   descriptor_data->shutdown_ = false;
+ descriptor_data->op_queue_[op_type].push(op);
+
+ struct kevent event;
+ switch (op_type)
+ {
+ case read_op:
+ BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ,
+ EV_ADD | EV_CLEAR, 0, 0, descriptor_data);
+ break;
+ case write_op:
+ BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_WRITE,
+ EV_ADD | EV_CLEAR, 0, 0, descriptor_data);
+ break;
+ case except_op:
+ BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ,
+ EV_ADD | EV_CLEAR, EV_OOBAND, 0, descriptor_data);
+ break;
+ }
+ ::kevent(kqueue_fd_, &event, 1, 0, 0, 0);
 
   return 0;
 }
 
+void kqueue_reactor::move_descriptor(socket_type,
+ kqueue_reactor::per_descriptor_data& target_descriptor_data,
+ kqueue_reactor::per_descriptor_data& source_descriptor_data)
+{
+ target_descriptor_data = source_descriptor_data;
+ source_descriptor_data = 0;
+}
+
 void kqueue_reactor::start_op(int op_type, socket_type descriptor,
     kqueue_reactor::per_descriptor_data& descriptor_data,
     reactor_op* op, bool allow_speculative)
@@ -187,8 +269,8 @@
   io_service_.post_deferred_completions(ops);
 }
 
-void kqueue_reactor::close_descriptor(socket_type,
- kqueue_reactor::per_descriptor_data& descriptor_data)
+void kqueue_reactor::deregister_descriptor(socket_type descriptor,
+ kqueue_reactor::per_descriptor_data& descriptor_data, bool closing)
 {
   if (!descriptor_data)
     return;
@@ -198,8 +280,20 @@
 
   if (!descriptor_data->shutdown_)
   {
- // Remove the descriptor from the set of known descriptors. The descriptor
- // will be automatically removed from the kqueue set when it is closed.
+ if (closing)
+ {
+ // The descriptor will be automatically removed from the kqueue when it
+ // is closed.
+ }
+ else
+ {
+ struct kevent events[2];
+ BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor,
+ EVFILT_READ, EV_DELETE, 0, 0, 0);
+ BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor,
+ EVFILT_WRITE, EV_DELETE, 0, 0, 0);
+ ::kevent(kqueue_fd_, events, 2, 0, 0, 0);
+ }
 
     op_queue<operation> ops;
     for (int i = 0; i < max_ops; ++i)
@@ -212,6 +306,7 @@
       }
     }
 
+ descriptor_data->descriptor_ = -1;
     descriptor_data->shutdown_ = true;
 
     descriptor_lock.unlock();
@@ -225,6 +320,40 @@
   }
 }
 
+void kqueue_reactor::deregister_internal_descriptor(socket_type descriptor,
+ kqueue_reactor::per_descriptor_data& descriptor_data)
+{
+ if (!descriptor_data)
+ return;
+
+ mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
+ mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_);
+
+ if (!descriptor_data->shutdown_)
+ {
+ struct kevent events[2];
+ BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor,
+ EVFILT_READ, EV_DELETE, 0, 0, 0);
+ BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor,
+ EVFILT_WRITE, EV_DELETE, 0, 0, 0);
+ ::kevent(kqueue_fd_, events, 2, 0, 0, 0);
+
+ op_queue<operation> ops;
+ for (int i = 0; i < max_ops; ++i)
+ ops.push(descriptor_data->op_queue_[i]);
+
+ descriptor_data->descriptor_ = -1;
+ descriptor_data->shutdown_ = true;
+
+ descriptor_lock.unlock();
+
+ registered_descriptors_.free(descriptor_data);
+ descriptor_data = 0;
+
+ descriptors_lock.unlock();
+ }
+}
+
 void kqueue_reactor::run(bool block, op_queue<operation>& ops)
 {
   mutex::scoped_lock lock(mutex_);

Modified: branches/release/boost/asio/detail/impl/pipe_select_interrupter.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/pipe_select_interrupter.ipp (original)
+++ branches/release/boost/asio/detail/impl/pipe_select_interrupter.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -38,6 +38,11 @@
 
 pipe_select_interrupter::pipe_select_interrupter()
 {
+ open_descriptors();
+}
+
+void pipe_select_interrupter::open_descriptors()
+{
   int pipe_fds[2];
   if (pipe(pipe_fds) == 0)
   {
@@ -45,6 +50,11 @@
     ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
     write_descriptor_ = pipe_fds[1];
     ::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK);
+
+#if defined(FD_CLOEXEC)
+ ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
+ ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC);
+#endif // defined(FD_CLOEXEC)
   }
   else
   {
@@ -56,12 +66,27 @@
 
 pipe_select_interrupter::~pipe_select_interrupter()
 {
+ close_descriptors();
+}
+
+void pipe_select_interrupter::close_descriptors()
+{
   if (read_descriptor_ != -1)
     ::close(read_descriptor_);
   if (write_descriptor_ != -1)
     ::close(write_descriptor_);
 }
 
+void pipe_select_interrupter::recreate()
+{
+ close_descriptors();
+
+ write_descriptor_ = -1;
+ read_descriptor_ = -1;
+
+ open_descriptors();
+}
+
 void pipe_select_interrupter::interrupt()
 {
   char byte = 0;

Modified: branches/release/boost/asio/detail/impl/reactive_descriptor_service.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/reactive_descriptor_service.ipp (original)
+++ branches/release/boost/asio/detail/impl/reactive_descriptor_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -46,11 +46,47 @@
   impl.state_ = 0;
 }
 
+void reactive_descriptor_service::move_construct(
+ reactive_descriptor_service::implementation_type& impl,
+ reactive_descriptor_service::implementation_type& other_impl)
+{
+ impl.descriptor_ = other_impl.descriptor_;
+ other_impl.descriptor_ = -1;
+
+ impl.state_ = other_impl.state_;
+ other_impl.state_ = 0;
+
+ reactor_.move_descriptor(impl.descriptor_,
+ impl.reactor_data_, other_impl.reactor_data_);
+}
+
+void reactive_descriptor_service::move_assign(
+ reactive_descriptor_service::implementation_type& impl,
+ reactive_descriptor_service& other_service,
+ reactive_descriptor_service::implementation_type& other_impl)
+{
+ destroy(impl);
+
+ impl.descriptor_ = other_impl.descriptor_;
+ other_impl.descriptor_ = -1;
+
+ impl.state_ = other_impl.state_;
+ other_impl.state_ = 0;
+
+ other_service.reactor_.move_descriptor(impl.descriptor_,
+ impl.reactor_data_, other_impl.reactor_data_);
+}
+
 void reactive_descriptor_service::destroy(
     reactive_descriptor_service::implementation_type& impl)
 {
   if (is_open(impl))
- reactor_.close_descriptor(impl.descriptor_, impl.reactor_data_);
+ {
+ BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "close"));
+
+ reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_,
+ (impl.state_ & descriptor_ops::possible_dup) == 0);
+ }
 
   boost::system::error_code ignored_ec;
   descriptor_ops::close(impl.descriptor_, impl.state_, ignored_ec);
@@ -58,7 +94,7 @@
 
 boost::system::error_code reactive_descriptor_service::assign(
     reactive_descriptor_service::implementation_type& impl,
- const native_type& native_descriptor, boost::system::error_code& ec)
+ const native_handle_type& native_descriptor, boost::system::error_code& ec)
 {
   if (is_open(impl))
   {
@@ -75,7 +111,7 @@
   }
 
   impl.descriptor_ = native_descriptor;
- impl.state_ = 0;
+ impl.state_ = descriptor_ops::possible_dup;
   ec = boost::system::error_code();
   return ec;
 }
@@ -85,14 +121,43 @@
     boost::system::error_code& ec)
 {
   if (is_open(impl))
- reactor_.close_descriptor(impl.descriptor_, impl.reactor_data_);
+ {
+ BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "close"));
 
- if (descriptor_ops::close(impl.descriptor_, impl.state_, ec) == 0)
- construct(impl);
+ reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_,
+ (impl.state_ & descriptor_ops::possible_dup) == 0);
+ }
+
+ descriptor_ops::close(impl.descriptor_, impl.state_, ec);
+
+ // The descriptor is closed by the OS even if close() returns an error.
+ //
+ // (Actually, POSIX says the state of the descriptor is unspecified. On
+ // Linux the descriptor is apparently closed anyway; e.g. see
+ // http://lkml.org/lkml/2005/9/10/129
+ // We'll just have to assume that other OSes follow the same behaviour.)
+ construct(impl);
 
   return ec;
 }
 
+reactive_descriptor_service::native_handle_type
+reactive_descriptor_service::release(
+ reactive_descriptor_service::implementation_type& impl)
+{
+ native_handle_type descriptor = impl.descriptor_;
+
+ if (is_open(impl))
+ {
+ BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "release"));
+
+ reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, false);
+ construct(impl);
+ }
+
+ return descriptor;
+}
+
 boost::system::error_code reactive_descriptor_service::cancel(
     reactive_descriptor_service::implementation_type& impl,
     boost::system::error_code& ec)
@@ -103,6 +168,8 @@
     return ec;
   }
 
+ BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "cancel"));
+
   reactor_.cancel_ops(impl.descriptor_, impl.reactor_data_);
   ec = boost::system::error_code();
   return ec;
@@ -110,16 +177,16 @@
 
 void reactive_descriptor_service::start_op(
     reactive_descriptor_service::implementation_type& impl,
- int op_type, reactor_op* op, bool non_blocking, bool noop)
+ int op_type, reactor_op* op, bool is_non_blocking, bool noop)
 {
   if (!noop)
   {
     if ((impl.state_ & descriptor_ops::non_blocking) ||
         descriptor_ops::set_internal_non_blocking(
- impl.descriptor_, impl.state_, op->ec_))
+ impl.descriptor_, impl.state_, true, op->ec_))
     {
       reactor_.start_op(op_type, impl.descriptor_,
- impl.reactor_data_, op, non_blocking);
+ impl.reactor_data_, op, is_non_blocking);
       return;
     }
   }

Modified: branches/release/boost/asio/detail/impl/reactive_serial_port_service.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/reactive_serial_port_service.ipp (original)
+++ branches/release/boost/asio/detail/impl/reactive_serial_port_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -113,7 +113,7 @@
   termios ios;
   errno = 0;
   descriptor_ops::error_wrapper(::tcgetattr(
- descriptor_service_.native(impl), &ios), ec);
+ descriptor_service_.native_handle(impl), &ios), ec);
   if (ec)
     return ec;
 
@@ -122,7 +122,7 @@
 
   errno = 0;
   descriptor_ops::error_wrapper(::tcsetattr(
- descriptor_service_.native(impl), TCSANOW, &ios), ec);
+ descriptor_service_.native_handle(impl), TCSANOW, &ios), ec);
   return ec;
 }
 
@@ -134,7 +134,7 @@
   termios ios;
   errno = 0;
   descriptor_ops::error_wrapper(::tcgetattr(
- descriptor_service_.native(impl), &ios), ec);
+ descriptor_service_.native_handle(impl), &ios), ec);
   if (ec)
     return ec;
 

Modified: branches/release/boost/asio/detail/impl/reactive_socket_service_base.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/reactive_socket_service_base.ipp (original)
+++ branches/release/boost/asio/detail/impl/reactive_socket_service_base.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -45,12 +45,46 @@
   impl.state_ = 0;
 }
 
+void reactive_socket_service_base::base_move_construct(
+ reactive_socket_service_base::base_implementation_type& impl,
+ reactive_socket_service_base::base_implementation_type& other_impl)
+{
+ impl.socket_ = other_impl.socket_;
+ other_impl.socket_ = invalid_socket;
+
+ impl.state_ = other_impl.state_;
+ other_impl.state_ = 0;
+
+ reactor_.move_descriptor(impl.socket_,
+ impl.reactor_data_, other_impl.reactor_data_);
+}
+
+void reactive_socket_service_base::base_move_assign(
+ reactive_socket_service_base::base_implementation_type& impl,
+ reactive_socket_service_base& other_service,
+ reactive_socket_service_base::base_implementation_type& other_impl)
+{
+ destroy(impl);
+
+ impl.socket_ = other_impl.socket_;
+ other_impl.socket_ = invalid_socket;
+
+ impl.state_ = other_impl.state_;
+ other_impl.state_ = 0;
+
+ other_service.reactor_.move_descriptor(impl.socket_,
+ impl.reactor_data_, other_impl.reactor_data_);
+}
+
 void reactive_socket_service_base::destroy(
     reactive_socket_service_base::base_implementation_type& impl)
 {
   if (impl.socket_ != invalid_socket)
   {
- reactor_.close_descriptor(impl.socket_, impl.reactor_data_);
+ BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close"));
+
+ reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
+ (impl.state_ & socket_ops::possible_dup) == 0);
 
     boost::system::error_code ignored_ec;
     socket_ops::close(impl.socket_, impl.state_, true, ignored_ec);
@@ -62,10 +96,24 @@
     boost::system::error_code& ec)
 {
   if (is_open(impl))
- reactor_.close_descriptor(impl.socket_, impl.reactor_data_);
+ {
+ BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close"));
 
- if (socket_ops::close(impl.socket_, impl.state_, false, ec) == 0)
- construct(impl);
+ reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
+ (impl.state_ & socket_ops::possible_dup) == 0);
+ }
+
+ socket_ops::close(impl.socket_, impl.state_, false, ec);
+
+ // The descriptor is closed by the OS even if close() returns an error.
+ //
+ // (Actually, POSIX says the state of the descriptor is unspecified. On
+ // Linux the descriptor is apparently closed anyway; e.g. see
+ // http://lkml.org/lkml/2005/9/10/129
+ // We'll just have to assume that other OSes follow the same behaviour. The
+ // known exception is when Windows's closesocket() function fails with
+ // WSAEWOULDBLOCK, but this case is handled inside socket_ops::close().
+ construct(impl);
 
   return ec;
 }
@@ -80,6 +128,8 @@
     return ec;
   }
 
+ BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "cancel"));
+
   reactor_.cancel_ops(impl.socket_, impl.reactor_data_);
   ec = boost::system::error_code();
   return ec;
@@ -119,7 +169,7 @@
 
 boost::system::error_code reactive_socket_service_base::do_assign(
     reactive_socket_service_base::base_implementation_type& impl, int type,
- const reactive_socket_service_base::native_type& native_socket,
+ const reactive_socket_service_base::native_handle_type& native_socket,
     boost::system::error_code& ec)
 {
   if (is_open(impl))
@@ -143,22 +193,23 @@
   case SOCK_DGRAM: impl.state_ = socket_ops::datagram_oriented; break;
   default: impl.state_ = 0; break;
   }
+ impl.state_ |= socket_ops::possible_dup;
   ec = boost::system::error_code();
   return ec;
 }
 
 void reactive_socket_service_base::start_op(
     reactive_socket_service_base::base_implementation_type& impl,
- int op_type, reactor_op* op, bool non_blocking, bool noop)
+ int op_type, reactor_op* op, bool is_non_blocking, bool noop)
 {
   if (!noop)
   {
     if ((impl.state_ & socket_ops::non_blocking)
         || socket_ops::set_internal_non_blocking(
- impl.socket_, impl.state_, op->ec_))
+ impl.socket_, impl.state_, true, op->ec_))
     {
       reactor_.start_op(op_type, impl.socket_,
- impl.reactor_data_, op, non_blocking);
+ impl.reactor_data_, op, is_non_blocking);
       return;
     }
   }
@@ -185,7 +236,7 @@
 {
   if ((impl.state_ & socket_ops::non_blocking)
       || socket_ops::set_internal_non_blocking(
- impl.socket_, impl.state_, op->ec_))
+ impl.socket_, impl.state_, true, op->ec_))
   {
     if (socket_ops::connect(impl.socket_, addr, addrlen, op->ec_) != 0)
     {

Modified: branches/release/boost/asio/detail/impl/resolver_service_base.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/resolver_service_base.ipp (original)
+++ branches/release/boost/asio/detail/impl/resolver_service_base.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -53,10 +53,10 @@
 void resolver_service_base::shutdown_service()
 {
   work_.reset();
- if (work_io_service_)
+ if (work_io_service_.get())
   {
     work_io_service_->stop();
- if (work_thread_)
+ if (work_thread_.get())
     {
       work_thread_->join();
       work_thread_.reset();
@@ -65,6 +65,25 @@
   }
 }
 
+void resolver_service_base::fork_service(
+ boost::asio::io_service::fork_event fork_ev)
+{
+ if (work_thread_.get())
+ {
+ if (fork_ev == boost::asio::io_service::fork_prepare)
+ {
+ work_io_service_->stop();
+ work_thread_->join();
+ }
+ else
+ {
+ work_io_service_->reset();
+ work_thread_.reset(new boost::asio::detail::thread(
+ work_io_service_runner(*work_io_service_)));
+ }
+ }
+}
+
 void resolver_service_base::construct(
     resolver_service_base::implementation_type& impl)
 {
@@ -72,13 +91,18 @@
 }
 
 void resolver_service_base::destroy(
- resolver_service_base::implementation_type&)
+ resolver_service_base::implementation_type& impl)
 {
+ BOOST_ASIO_HANDLER_OPERATION(("resolver", &impl, "cancel"));
+
+ impl.reset();
 }
 
 void resolver_service_base::cancel(
     resolver_service_base::implementation_type& impl)
 {
+ BOOST_ASIO_HANDLER_OPERATION(("resolver", &impl, "cancel"));
+
   impl.reset(static_cast<void*>(0), socket_ops::noop_deleter());
 }
 
@@ -92,7 +116,7 @@
 void resolver_service_base::start_work_thread()
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
- if (!work_thread_)
+ if (!work_thread_.get())
   {
     work_thread_.reset(new boost::asio::detail::thread(
           work_io_service_runner(*work_io_service_)));

Modified: branches/release/boost/asio/detail/impl/select_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/impl/select_reactor.hpp (original)
+++ branches/release/boost/asio/detail/impl/select_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -62,11 +62,12 @@
 
 template <typename Time_Traits>
 std::size_t select_reactor::cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer)
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled)
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
   op_queue<operation> ops;
- std::size_t n = queue.cancel_timer(timer, ops);
+ std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
   lock.unlock();
   io_service_.post_deferred_completions(ops);
   return n;

Modified: branches/release/boost/asio/detail/impl/select_reactor.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/select_reactor.ipp (original)
+++ branches/release/boost/asio/detail/impl/select_reactor.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -82,6 +82,14 @@
     op_queue_[i].get_all_operations(ops);
 
   timer_queues_.get_all_timers(ops);
+
+ io_service_.abandon_operations(ops);
+}
+
+void select_reactor::fork_service(boost::asio::io_service::fork_event fork_ev)
+{
+ if (fork_ev == boost::asio::io_service::fork_child)
+ interrupter_.recreate();
 }
 
 void select_reactor::init_task()
@@ -95,6 +103,24 @@
   return 0;
 }
 
+int select_reactor::register_internal_descriptor(
+ int op_type, socket_type descriptor,
+ select_reactor::per_descriptor_data&, reactor_op* op)
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+
+ op_queue_[op_type].enqueue_operation(descriptor, op);
+ interrupter_.interrupt();
+
+ return 0;
+}
+
+void select_reactor::move_descriptor(socket_type,
+ select_reactor::per_descriptor_data&,
+ select_reactor::per_descriptor_data&)
+{
+}
+
 void select_reactor::start_op(int op_type, socket_type descriptor,
     select_reactor::per_descriptor_data&, reactor_op* op, bool)
 {
@@ -119,13 +145,22 @@
   cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted);
 }
 
-void select_reactor::close_descriptor(socket_type descriptor,
- select_reactor::per_descriptor_data&)
+void select_reactor::deregister_descriptor(socket_type descriptor,
+ select_reactor::per_descriptor_data&, bool)
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
   cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted);
 }
 
+void select_reactor::deregister_internal_descriptor(
+ socket_type descriptor, select_reactor::per_descriptor_data&)
+{
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ op_queue<operation> ops;
+ for (int i = 0; i < max_ops; ++i)
+ op_queue_[i].cancel_operations(descriptor, ops);
+}
+
 void select_reactor::run(bool block, op_queue<operation>& ops)
 {
   boost::asio::detail::mutex::scoped_lock lock(mutex_);

Modified: branches/release/boost/asio/detail/impl/service_registry.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/service_registry.ipp (original)
+++ branches/release/boost/asio/detail/impl/service_registry.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,6 +17,7 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <boost/throw_exception.hpp>
+#include <vector>
 #include <boost/asio/detail/service_registry.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -52,6 +53,35 @@
   }
 }
 
+void service_registry::notify_fork(boost::asio::io_service::fork_event fork_ev)
+{
+ // Make a copy of all of the services while holding the lock. We don't want
+ // to hold the lock while calling into each service, as it may try to call
+ // back into this class.
+ std::vector<boost::asio::io_service::service*> services;
+ {
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ boost::asio::io_service::service* service = first_service_;
+ while (service)
+ {
+ services.push_back(service);
+ service = service->next_;
+ }
+ }
+
+ // If processing the fork_prepare event, we want to go in reverse order of
+ // service registration, which happens to be the existing order of the
+ // services in the vector. For the other events we want to go in the other
+ // direction.
+ std::size_t num_services = services.size();
+ if (fork_ev == boost::asio::io_service::fork_prepare)
+ for (std::size_t i = 0; i < num_services; ++i)
+ services[i]->fork_service(fork_ev);
+ else
+ for (std::size_t i = num_services; i > 0; --i)
+ services[i - 1]->fork_service(fork_ev);
+}
+
 void service_registry::init_key(boost::asio::io_service::service::key& key,
     const boost::asio::io_service::id& id)
 {
@@ -121,7 +151,7 @@
     const boost::asio::io_service::service::key& key,
     boost::asio::io_service::service* new_service)
 {
- if (&owner_ != &new_service->io_service())
+ if (&owner_ != &new_service->get_io_service())
     boost::throw_exception(invalid_service_owner());
 
   boost::asio::detail::mutex::scoped_lock lock(mutex_);

Added: branches/release/boost/asio/detail/impl/signal_set_service.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/impl/signal_set_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,592 @@
+//
+// detail/impl/signal_set_service.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP
+#define BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#include <cstring>
+#include <boost/asio/detail/reactor.hpp>
+#include <boost/asio/detail/signal_blocker.hpp>
+#include <boost/asio/detail/signal_set_service.hpp>
+#include <boost/asio/detail/static_mutex.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+struct signal_state
+{
+ // Mutex used for protecting global state.
+ static_mutex mutex_;
+
+ // The read end of the pipe used for signal notifications.
+ int read_descriptor_;
+
+ // The write end of the pipe used for signal notifications.
+ int write_descriptor_;
+
+ // Whether the signal state has been prepared for a fork.
+ bool fork_prepared_;
+
+ // The head of a linked list of all signal_set_service instances.
+ class signal_set_service* service_list_;
+
+ // A count of the number of objects that are registered for each signal.
+ std::size_t registration_count_[max_signal_number];
+};
+
+signal_state* get_signal_state()
+{
+ static signal_state state = {
+ BOOST_ASIO_STATIC_MUTEX_INIT, -1, -1, false, 0, { 0 } };
+ return &state;
+}
+
+void asio_signal_handler(int signal_number)
+{
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ signal_set_service::deliver_signal(signal_number);
+#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ int saved_errno = errno;
+ signal_state* state = get_signal_state();
+ int result = ::write(state->write_descriptor_,
+ &signal_number, sizeof(signal_number));
+ (void)result;
+ errno = saved_errno;
+#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+
+#if defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION)
+ signal(signal_number, asio_signal_handler);
+#endif // defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION)
+}
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+class signal_set_service::pipe_read_op : public reactor_op
+{
+public:
+ pipe_read_op()
+ : reactor_op(&pipe_read_op::do_perform, pipe_read_op::do_complete)
+ {
+ }
+
+ static bool do_perform(reactor_op*)
+ {
+ signal_state* state = get_signal_state();
+
+ int fd = state->read_descriptor_;
+ int signal_number = 0;
+ while (::read(fd, &signal_number, sizeof(int)) == sizeof(int))
+ if (signal_number >= 0 && signal_number < max_signal_number)
+ signal_set_service::deliver_signal(signal_number);
+
+ return false;
+ }
+
+ static void do_complete(io_service_impl* /*owner*/, operation* base,
+ boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/)
+ {
+ pipe_read_op* o(static_cast<pipe_read_op*>(base));
+ delete o;
+ }
+};
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+
+signal_set_service::signal_set_service(
+ boost::asio::io_service& io_service)
+ : io_service_(boost::asio::use_service<io_service_impl>(io_service)),
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ reactor_(boost::asio::use_service<reactor>(io_service)),
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ next_(0),
+ prev_(0)
+{
+ get_signal_state()->mutex_.init();
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ reactor_.init_task();
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+
+ for (int i = 0; i < max_signal_number; ++i)
+ registrations_[i] = 0;
+
+ add_service(this);
+}
+
+signal_set_service::~signal_set_service()
+{
+ remove_service(this);
+}
+
+void signal_set_service::shutdown_service()
+{
+ remove_service(this);
+
+ op_queue<operation> ops;
+
+ for (int i = 0; i < max_signal_number; ++i)
+ {
+ registration* reg = registrations_[i];
+ while (reg)
+ {
+ ops.push(*reg->queue_);
+ reg = reg->next_in_table_;
+ }
+ }
+
+ io_service_.abandon_operations(ops);
+}
+
+void signal_set_service::fork_service(
+ boost::asio::io_service::fork_event fork_ev)
+{
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ switch (fork_ev)
+ {
+ case boost::asio::io_service::fork_prepare:
+ reactor_.deregister_internal_descriptor(
+ state->read_descriptor_, reactor_data_);
+ state->fork_prepared_ = true;
+ break;
+ case boost::asio::io_service::fork_parent:
+ state->fork_prepared_ = false;
+ reactor_.register_internal_descriptor(reactor::read_op,
+ state->read_descriptor_, reactor_data_, new pipe_read_op);
+ break;
+ case boost::asio::io_service::fork_child:
+ if (state->fork_prepared_)
+ {
+ boost::asio::detail::signal_blocker blocker;
+ close_descriptors();
+ open_descriptors();
+ state->fork_prepared_ = false;
+ }
+ reactor_.register_internal_descriptor(reactor::read_op,
+ state->read_descriptor_, reactor_data_, new pipe_read_op);
+ break;
+ default:
+ break;
+ }
+#else // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ (void)fork_ev;
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+}
+
+void signal_set_service::construct(
+ signal_set_service::implementation_type& impl)
+{
+ impl.signals_ = 0;
+}
+
+void signal_set_service::destroy(
+ signal_set_service::implementation_type& impl)
+{
+ boost::system::error_code ignored_ec;
+ clear(impl, ignored_ec);
+ cancel(impl, ignored_ec);
+}
+
+boost::system::error_code signal_set_service::add(
+ signal_set_service::implementation_type& impl,
+ int signal_number, boost::system::error_code& ec)
+{
+ // Check that the signal number is valid.
+ if (signal_number < 0 || signal_number > max_signal_number)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ // Find the appropriate place to insert the registration.
+ registration** insertion_point = &impl.signals_;
+ registration* next = impl.signals_;
+ while (next && next->signal_number_ < signal_number)
+ {
+ insertion_point = &next->next_in_set_;
+ next = next->next_in_set_;
+ }
+
+ // Only do something if the signal is not already registered.
+ if (next == 0 || next->signal_number_ != signal_number)
+ {
+ registration* new_registration = new registration;
+
+#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION)
+ // Register for the signal if we're the first.
+ if (state->registration_count_[signal_number] == 0)
+ {
+# if defined(BOOST_ASIO_HAS_SIGACTION)
+ using namespace std; // For memset.
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = asio_signal_handler;
+ sigfillset(&sa.sa_mask);
+ if (::sigaction(signal_number, &sa, 0) == -1)
+# else // defined(BOOST_ASIO_HAS_SIGACTION)
+ if (::signal(signal_number, asio_signal_handler) == SIG_ERR)
+# endif // defined(BOOST_ASIO_HAS_SIGACTION)
+ {
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ec = boost::asio::error::invalid_argument;
+# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ec = boost::system::error_code(errno,
+ boost::asio::error::get_system_category());
+# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ delete new_registration;
+ return ec;
+ }
+ }
+#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION)
+
+ // Record the new registration in the set.
+ new_registration->signal_number_ = signal_number;
+ new_registration->queue_ = &impl.queue_;
+ new_registration->next_in_set_ = next;
+ *insertion_point = new_registration;
+
+ // Insert registration into the registration table.
+ new_registration->next_in_table_ = registrations_[signal_number];
+ if (registrations_[signal_number])
+ registrations_[signal_number]->prev_in_table_ = new_registration;
+ registrations_[signal_number] = new_registration;
+
+ ++state->registration_count_[signal_number];
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+boost::system::error_code signal_set_service::remove(
+ signal_set_service::implementation_type& impl,
+ int signal_number, boost::system::error_code& ec)
+{
+ // Check that the signal number is valid.
+ if (signal_number < 0 || signal_number > max_signal_number)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ // Find the signal number in the list of registrations.
+ registration** deletion_point = &impl.signals_;
+ registration* reg = impl.signals_;
+ while (reg && reg->signal_number_ < signal_number)
+ {
+ deletion_point = &reg->next_in_set_;
+ reg = reg->next_in_set_;
+ }
+
+ if (reg != 0 && reg->signal_number_ == signal_number)
+ {
+#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION)
+ // Set signal handler back to the default if we're the last.
+ if (state->registration_count_[signal_number] == 1)
+ {
+# if defined(BOOST_ASIO_HAS_SIGACTION)
+ using namespace std; // For memset.
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_DFL;
+ if (::sigaction(signal_number, &sa, 0) == -1)
+# else // defined(BOOST_ASIO_HAS_SIGACTION)
+ if (::signal(signal_number, SIG_DFL) == SIG_ERR)
+# endif // defined(BOOST_ASIO_HAS_SIGACTION)
+ {
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ec = boost::asio::error::invalid_argument;
+# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ec = boost::system::error_code(errno,
+ boost::asio::error::get_system_category());
+# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ return ec;
+ }
+ }
+#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION)
+
+ // Remove the registration from the set.
+ *deletion_point = reg->next_in_set_;
+
+ // Remove the registration from the registration table.
+ if (registrations_[signal_number] == reg)
+ registrations_[signal_number] = reg->next_in_table_;
+ if (reg->prev_in_table_)
+ reg->prev_in_table_->next_in_table_ = reg->next_in_table_;
+ if (reg->next_in_table_)
+ reg->next_in_table_->prev_in_table_ = reg->prev_in_table_;
+
+ --state->registration_count_[signal_number];
+
+ delete reg;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+boost::system::error_code signal_set_service::clear(
+ signal_set_service::implementation_type& impl,
+ boost::system::error_code& ec)
+{
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ while (registration* reg = impl.signals_)
+ {
+#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION)
+ // Set signal handler back to the default if we're the last.
+ if (state->registration_count_[reg->signal_number_] == 1)
+ {
+# if defined(BOOST_ASIO_HAS_SIGACTION)
+ using namespace std; // For memset.
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_DFL;
+ if (::sigaction(reg->signal_number_, &sa, 0) == -1)
+# else // defined(BOOST_ASIO_HAS_SIGACTION)
+ if (::signal(reg->signal_number_, SIG_DFL) == SIG_ERR)
+# endif // defined(BOOST_ASIO_HAS_SIGACTION)
+ {
+# if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ec = boost::asio::error::invalid_argument;
+# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ec = boost::system::error_code(errno,
+ boost::asio::error::get_system_category());
+# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ return ec;
+ }
+ }
+#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION)
+
+ // Remove the registration from the registration table.
+ if (registrations_[reg->signal_number_] == reg)
+ registrations_[reg->signal_number_] = reg->next_in_table_;
+ if (reg->prev_in_table_)
+ reg->prev_in_table_->next_in_table_ = reg->next_in_table_;
+ if (reg->next_in_table_)
+ reg->next_in_table_->prev_in_table_ = reg->prev_in_table_;
+
+ --state->registration_count_[reg->signal_number_];
+
+ impl.signals_ = reg->next_in_set_;
+ delete reg;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+boost::system::error_code signal_set_service::cancel(
+ signal_set_service::implementation_type& impl,
+ boost::system::error_code& ec)
+{
+ BOOST_ASIO_HANDLER_OPERATION(("signal_set", &impl, "cancel"));
+
+ op_queue<operation> ops;
+ {
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ while (signal_op* op = impl.queue_.front())
+ {
+ op->ec_ = boost::asio::error::operation_aborted;
+ impl.queue_.pop();
+ ops.push(op);
+ }
+ }
+
+ io_service_.post_deferred_completions(ops);
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void signal_set_service::deliver_signal(int signal_number)
+{
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ signal_set_service* service = state->service_list_;
+ while (service)
+ {
+ op_queue<operation> ops;
+
+ registration* reg = service->registrations_[signal_number];
+ while (reg)
+ {
+ if (reg->queue_->empty())
+ {
+ ++reg->undelivered_;
+ }
+ else
+ {
+ while (signal_op* op = reg->queue_->front())
+ {
+ op->signal_number_ = signal_number;
+ reg->queue_->pop();
+ ops.push(op);
+ }
+ }
+
+ reg = reg->next_in_table_;
+ }
+
+ service->io_service_.post_deferred_completions(ops);
+
+ service = service->next_;
+ }
+}
+
+void signal_set_service::add_service(signal_set_service* service)
+{
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ // If this is the first service to be created, open a new pipe.
+ if (state->service_list_ == 0)
+ open_descriptors();
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+
+ // Insert service into linked list of all services.
+ service->next_ = state->service_list_;
+ service->prev_ = 0;
+ if (state->service_list_)
+ state->service_list_->prev_ = service;
+ state->service_list_ = service;
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ // Register for pipe readiness notifications.
+ service->reactor_.register_internal_descriptor(reactor::read_op,
+ state->read_descriptor_, service->reactor_data_, new pipe_read_op);
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+}
+
+void signal_set_service::remove_service(signal_set_service* service)
+{
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ if (service->next_ || service->prev_ || state->service_list_ == service)
+ {
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ // Disable the pipe readiness notifications.
+ service->reactor_.deregister_descriptor(
+ state->read_descriptor_, service->reactor_data_, false);
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+
+ // Remove service from linked list of all services.
+ if (state->service_list_ == service)
+ state->service_list_ = service->next_;
+ if (service->prev_)
+ service->prev_->next_ = service->next_;
+ if (service->next_)
+ service->next_->prev_= service->prev_;
+ service->next_ = 0;
+ service->prev_ = 0;
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ // If this is the last service to be removed, close the pipe.
+ if (state->service_list_ == 0)
+ close_descriptors();
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ }
+}
+
+void signal_set_service::open_descriptors()
+{
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ signal_state* state = get_signal_state();
+
+ int pipe_fds[2];
+ if (::pipe(pipe_fds) == 0)
+ {
+ state->read_descriptor_ = pipe_fds[0];
+ ::fcntl(state->read_descriptor_, F_SETFL, O_NONBLOCK);
+
+ state->write_descriptor_ = pipe_fds[1];
+ ::fcntl(state->write_descriptor_, F_SETFL, O_NONBLOCK);
+
+#if defined(FD_CLOEXEC)
+ ::fcntl(state->read_descriptor_, F_SETFD, FD_CLOEXEC);
+ ::fcntl(state->write_descriptor_, F_SETFD, FD_CLOEXEC);
+#endif // defined(FD_CLOEXEC)
+ }
+ else
+ {
+ boost::system::error_code ec(errno,
+ boost::asio::error::get_system_category());
+ boost::asio::detail::throw_error(ec, "signal_set_service pipe");
+ }
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+}
+
+void signal_set_service::close_descriptors()
+{
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ signal_state* state = get_signal_state();
+
+ if (state->read_descriptor_ != -1)
+ ::close(state->read_descriptor_);
+ state->read_descriptor_ = -1;
+
+ if (state->write_descriptor_ != -1)
+ ::close(state->write_descriptor_);
+ state->write_descriptor_ = -1;
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+}
+
+void signal_set_service::start_wait_op(
+ signal_set_service::implementation_type& impl, signal_op* op)
+{
+ io_service_.work_started();
+
+ signal_state* state = get_signal_state();
+ static_mutex::scoped_lock lock(state->mutex_);
+
+ registration* reg = impl.signals_;
+ while (reg)
+ {
+ if (reg->undelivered_ > 0)
+ {
+ --reg->undelivered_;
+ io_service_.post_deferred_completion(op);
+ return;
+ }
+
+ reg = reg->next_in_set_;
+ }
+
+ impl.queue_.push(op);
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP

Modified: branches/release/boost/asio/detail/impl/socket_ops.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/socket_ops.ipp (original)
+++ branches/release/boost/asio/detail/impl/socket_ops.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -278,28 +278,9 @@
   int result = 0;
   if (s != invalid_socket)
   {
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- if ((state & non_blocking) && (state & user_set_linger))
- {
- ioctl_arg_type arg = 0;
- ::ioctlsocket(s, FIONBIO, &arg);
- state &= ~non_blocking;
- }
-#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- if (state & non_blocking)
- {
-#if defined(__SYMBIAN32__)
- int flags = ::fcntl(s, F_GETFL, 0);
- if (flags >= 0)
- ::fcntl(s, F_SETFL, flags & ~O_NONBLOCK);
-#else // defined(__SYMBIAN32__)
- ioctl_arg_type arg = 0;
- ::ioctl(s, FIONBIO, &arg);
-#endif // defined(__SYMBIAN32__)
- state &= ~non_blocking;
- }
-#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
-
+ // We don't want the destructor to block, so set the socket to linger in
+ // the background. If the user doesn't like this behaviour then they need
+ // to explicitly close the socket.
     if (destruction && (state & user_set_linger))
     {
       ::linger opt;
@@ -316,6 +297,39 @@
 #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     result = error_wrapper(::close(s), ec);
 #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+
+ if (result != 0
+ && (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again))
+ {
+ // According to UNIX Network Programming Vol. 1, it is possible for
+ // close() to fail with EWOULDBLOCK under certain circumstances. What
+ // isn't clear is the state of the descriptor after this error. The one
+ // current OS where this behaviour is seen, Windows, says that the socket
+ // remains open. Therefore we'll put the descriptor back into blocking
+ // mode and have another attempt at closing it.
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ioctl_arg_type arg = 0;
+ ::ioctlsocket(s, FIONBIO, &arg);
+#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+# if defined(__SYMBIAN32__)
+ int flags = ::fcntl(s, F_GETFL, 0);
+ if (flags >= 0)
+ ::fcntl(s, F_SETFL, flags & ~O_NONBLOCK);
+# else // defined(__SYMBIAN32__)
+ ioctl_arg_type arg = 0;
+ ::ioctl(s, FIONBIO, &arg);
+# endif // defined(__SYMBIAN32__)
+#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ state &= ~non_blocking;
+
+ clear_last_error();
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ result = error_wrapper(::closesocket(s), ec);
+#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ result = error_wrapper(::close(s), ec);
+#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ }
   }
 
   if (result == 0)
@@ -323,8 +337,52 @@
   return result;
 }
 
+bool set_user_non_blocking(socket_type s,
+ state_type& state, bool value, boost::system::error_code& ec)
+{
+ if (s == invalid_socket)
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return false;
+ }
+
+ clear_last_error();
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ ioctl_arg_type arg = (value ? 1 : 0);
+ int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec);
+#elif defined(__SYMBIAN32__)
+ int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec);
+ if (result >= 0)
+ {
+ clear_last_error();
+ int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK));
+ result = error_wrapper(::fcntl(s, F_SETFL, flag), ec);
+ }
+#else
+ ioctl_arg_type arg = (value ? 1 : 0);
+ int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec);
+#endif
+
+ if (result >= 0)
+ {
+ ec = boost::system::error_code();
+ if (value)
+ state |= user_set_non_blocking;
+ else
+ {
+ // Clearing the user-set non-blocking mode always overrides any
+ // internally-set non-blocking flag. Any subsequent asynchronous
+ // operations will need to re-enable non-blocking I/O.
+ state &= ~(user_set_non_blocking | internal_non_blocking);
+ }
+ return true;
+ }
+
+ return false;
+}
+
 bool set_internal_non_blocking(socket_type s,
- state_type& state, boost::system::error_code& ec)
+ state_type& state, bool value, boost::system::error_code& ec)
 {
   if (s == invalid_socket)
   {
@@ -332,26 +390,39 @@
     return false;
   }
 
+ if (!value && (state & user_set_non_blocking))
+ {
+ // It does not make sense to clear the internal non-blocking flag if the
+ // user still wants non-blocking behaviour. Return an error and let the
+ // caller figure out whether to update the user-set non-blocking flag.
+ ec = boost::asio::error::invalid_argument;
+ return false;
+ }
+
   clear_last_error();
 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- ioctl_arg_type arg = 1;
+ ioctl_arg_type arg = (value ? 1 : 0);
   int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec);
 #elif defined(__SYMBIAN32__)
   int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec);
   if (result >= 0)
   {
     clear_last_error();
- result = error_wrapper(::fcntl(s, F_SETFL, result | O_NONBLOCK), ec);
+ int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK));
+ result = error_wrapper(::fcntl(s, F_SETFL, flag), ec);
   }
 #else
- ioctl_arg_type arg = 1;
+ ioctl_arg_type arg = (value ? 1 : 0);
   int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec);
 #endif
 
   if (result >= 0)
   {
     ec = boost::system::error_code();
- state |= internal_non_blocking;
+ if (value)
+ state |= internal_non_blocking;
+ else
+ state &= ~internal_non_blocking;
     return true;
   }
 
@@ -863,6 +934,116 @@
 
 #endif // defined(BOOST_ASIO_HAS_IOCP)
 
+int recvmsg(socket_type s, buf* bufs, size_t count,
+ int in_flags, int& out_flags, boost::system::error_code& ec)
+{
+ clear_last_error();
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ out_flags = 0;
+ return socket_ops::recv(s, bufs, count, in_flags, ec);
+#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ msghdr msg = msghdr();
+ msg.msg_iov = bufs;
+ msg.msg_iovlen = count;
+ int result = error_wrapper(::recvmsg(s, &msg, in_flags), ec);
+ if (result >= 0)
+ {
+ ec = boost::system::error_code();
+ out_flags = msg.msg_flags;
+ }
+ else
+ out_flags = 0;
+ return result;
+#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+}
+
+size_t sync_recvmsg(socket_type s, state_type state,
+ buf* bufs, size_t count, int in_flags, int& out_flags,
+ boost::system::error_code& ec)
+{
+ if (s == invalid_socket)
+ {
+ ec = boost::asio::error::bad_descriptor;
+ return 0;
+ }
+
+ // Read some data.
+ for (;;)
+ {
+ // Try to complete the operation without blocking.
+ int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec);
+
+ // Check if operation succeeded.
+ if (bytes >= 0)
+ return bytes;
+
+ // Operation failed.
+ if ((state & user_set_non_blocking)
+ || (ec != boost::asio::error::would_block
+ && ec != boost::asio::error::try_again))
+ return 0;
+
+ // Wait for socket to become ready.
+ if (socket_ops::poll_read(s, ec) < 0)
+ return 0;
+ }
+}
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+
+void complete_iocp_recvmsg(
+ const weak_cancel_token_type& cancel_token,
+ boost::system::error_code& ec)
+{
+ // Map non-portable errors to their portable counterparts.
+ if (ec.value() == ERROR_NETNAME_DELETED)
+ {
+ if (cancel_token.expired())
+ ec = boost::asio::error::operation_aborted;
+ else
+ ec = boost::asio::error::connection_reset;
+ }
+ else if (ec.value() == ERROR_PORT_UNREACHABLE)
+ {
+ ec = boost::asio::error::connection_refused;
+ }
+}
+
+#else // defined(BOOST_ASIO_HAS_IOCP)
+
+bool non_blocking_recvmsg(socket_type s,
+ buf* bufs, size_t count, int in_flags, int& out_flags,
+ boost::system::error_code& ec, size_t& bytes_transferred)
+{
+ for (;;)
+ {
+ // Read some data.
+ int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec);
+
+ // Retry operation if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ return false;
+
+ // Operation is complete.
+ if (bytes >= 0)
+ {
+ ec = boost::system::error_code();
+ bytes_transferred = bytes;
+ }
+ else
+ bytes_transferred = 0;
+
+ return true;
+ }
+}
+
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
 int send(socket_type s, const buf* bufs, size_t count, int flags,
     boost::system::error_code& ec)
 {
@@ -1680,7 +1861,8 @@
     using namespace std; // For strcat and sprintf.
     char if_name[IF_NAMESIZE + 1] = "%";
     const in6_addr_type* ipv6_address = static_cast<const in6_addr_type*>(src);
- bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address);
+ bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe)
+ && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80));
     if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0)
       sprintf(if_name + 1, "%lu", scope_id);
     strcat(dest, if_name);
@@ -1764,7 +1946,8 @@
     if (const char* if_name = strchr(src, '%'))
     {
       in6_addr_type* ipv6_address = static_cast<in6_addr_type*>(dest);
- bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address);
+ bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe)
+ && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80));
       if (is_link_local)
         *scope_id = if_nametoindex(if_name + 1);
       if (*scope_id == 0)

Modified: branches/release/boost/asio/detail/impl/socket_select_interrupter.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/socket_select_interrupter.ipp (original)
+++ branches/release/boost/asio/detail/impl/socket_select_interrupter.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -36,6 +36,11 @@
 
 socket_select_interrupter::socket_select_interrupter()
 {
+ open_descriptors();
+}
+
+void socket_select_interrupter::open_descriptors()
+{
   boost::system::error_code ec;
   socket_holder acceptor(socket_ops::socket(
         AF_INET, SOCK_STREAM, IPPROTO_TCP, ec));
@@ -110,6 +115,11 @@
 
 socket_select_interrupter::~socket_select_interrupter()
 {
+ close_descriptors();
+}
+
+void socket_select_interrupter::close_descriptors()
+{
   boost::system::error_code ec;
   socket_ops::state_type state = socket_ops::internal_non_blocking;
   if (read_descriptor_ != invalid_socket)
@@ -118,6 +128,16 @@
     socket_ops::close(write_descriptor_, state, true, ec);
 }
 
+void socket_select_interrupter::recreate()
+{
+ close_descriptors();
+
+ write_descriptor_ = invalid_socket;
+ read_descriptor_ = invalid_socket;
+
+ open_descriptors();
+}
+
 void socket_select_interrupter::interrupt()
 {
   char byte = 0;

Modified: branches/release/boost/asio/detail/impl/strand_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/impl/strand_service.hpp (original)
+++ branches/release/boost/asio/detail/impl/strand_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -73,19 +73,14 @@
       sizeof(op), handler), 0 };
   p.p = new (p.v) op(handler);
 
- // If we are running inside the io_service, and no other handler is queued
- // or running, then the handler can run immediately.
- bool can_dispatch = call_stack<io_service_impl>::contains(&io_service_);
- impl->mutex_.lock();
- bool first = (++impl->count_ == 1);
- if (can_dispatch && first)
- {
- // Immediate invocation is allowed.
- impl->mutex_.unlock();
+ BOOST_ASIO_HANDLER_CREATION((p.p, "strand", impl, "dispatch"));
 
- // Memory must be releaesed before any upcall is made.
- p.reset();
+ bool dispatch_immediately = do_dispatch(impl, p.p);
+ operation* o = p.p;
+ p.v = p.p = 0;
 
+ if (dispatch_immediately)
+ {
     // Indicate that this strand is executing on the current thread.
     call_stack<strand_impl>::context ctx(impl);
 
@@ -93,20 +88,9 @@
     on_dispatch_exit on_exit = { &io_service_, impl };
     (void)on_exit;
 
- boost::asio::detail::fenced_block b;
- boost_asio_handler_invoke_helpers::invoke(handler, handler);
- return;
+ completion_handler<Handler>::do_complete(
+ &io_service_, o, boost::system::error_code(), 0);
   }
-
- // Immediate invocation is not allowed, so enqueue for later.
- impl->queue_.push(p.p);
- impl->mutex_.unlock();
- p.v = p.p = 0;
-
- // The first handler to be enqueued is responsible for scheduling the
- // strand.
- if (first)
- io_service_.post_immediate_completion(impl);
 }
 
 // Request the io_service to invoke the given handler and return immediately.
@@ -121,16 +105,10 @@
       sizeof(op), handler), 0 };
   p.p = new (p.v) op(handler);
 
- // Add the handler to the queue.
- impl->mutex_.lock();
- bool first = (++impl->count_ == 1);
- impl->queue_.push(p.p);
- impl->mutex_.unlock();
- p.v = p.p = 0;
+ BOOST_ASIO_HANDLER_CREATION((p.p, "strand", impl, "post"));
 
- // The first handler to be enqueue is responsible for scheduling the strand.
- if (first)
- io_service_.post_immediate_completion(impl);
+ do_post(impl, p.p);
+ p.v = p.p = 0;
 }
 
 } // namespace detail

Modified: branches/release/boost/asio/detail/impl/strand_service.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/strand_service.ipp (original)
+++ branches/release/boost/asio/detail/impl/strand_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -70,11 +70,50 @@
 
   boost::asio::detail::mutex::scoped_lock lock(mutex_);
 
- if (!implementations_[index])
+ if (!implementations_[index].get())
     implementations_[index].reset(new strand_impl);
   impl = implementations_[index].get();
 }
 
+bool strand_service::do_dispatch(implementation_type& impl, operation* op)
+{
+ // If we are running inside the io_service, and no other handler is queued
+ // or running, then the handler can run immediately.
+ bool can_dispatch = call_stack<io_service_impl>::contains(&io_service_);
+ impl->mutex_.lock();
+ bool first = (++impl->count_ == 1);
+ if (can_dispatch && first)
+ {
+ // Immediate invocation is allowed.
+ impl->mutex_.unlock();
+ return true;
+ }
+
+ // Immediate invocation is not allowed, so enqueue for later.
+ impl->queue_.push(op);
+ impl->mutex_.unlock();
+
+ // The first handler to be enqueued is responsible for scheduling the
+ // strand.
+ if (first)
+ io_service_.post_immediate_completion(impl);
+
+ return false;
+}
+
+void strand_service::do_post(implementation_type& impl, operation* op)
+{
+ // Add the handler to the queue.
+ impl->mutex_.lock();
+ bool first = (++impl->count_ == 1);
+ impl->queue_.push(op);
+ impl->mutex_.unlock();
+
+ // The first handler to be enqueue is responsible for scheduling the strand.
+ if (first)
+ io_service_.post_immediate_completion(impl);
+}
+
 void strand_service::do_complete(io_service_impl* owner, operation* base,
     boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/)
 {

Modified: branches/release/boost/asio/detail/impl/task_io_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/impl/task_io_service.hpp (original)
+++ branches/release/boost/asio/detail/impl/task_io_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -36,7 +36,19 @@
     boost_asio_handler_invoke_helpers::invoke(handler, handler);
   }
   else
- post(handler);
+ {
+ // Allocate and construct an operation to wrap the handler.
+ typedef completion_handler<Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch"));
+
+ post_immediate_completion(p.p);
+ p.v = p.p = 0;
+ }
 }
 
 template <typename Handler>
@@ -49,6 +61,8 @@
       sizeof(op), handler), 0 };
   p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "post"));
+
   post_immediate_completion(p.p);
   p.v = p.p = 0;
 }

Modified: branches/release/boost/asio/detail/impl/task_io_service.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/task_io_service.ipp (original)
+++ branches/release/boost/asio/detail/impl/task_io_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -74,6 +74,7 @@
     shutdown_(false),
     first_idle_thread_(0)
 {
+ BOOST_ASIO_HANDLER_TRACKING_INIT;
 }
 
 void task_io_service::init(std::size_t /*concurrency_hint*/)
@@ -194,6 +195,12 @@
   stop_all_threads(lock);
 }
 
+bool task_io_service::stopped() const
+{
+ mutex::scoped_lock lock(mutex_);
+ return stopped_;
+}
+
 void task_io_service::reset()
 {
   mutex::scoped_lock lock(mutex_);
@@ -224,6 +231,13 @@
   }
 }
 
+void task_io_service::abandon_operations(
+ op_queue<task_io_service::operation>& ops)
+{
+ op_queue<task_io_service::operation> ops2;
+ ops2.push(ops);
+}
+
 std::size_t task_io_service::do_one(mutex::scoped_lock& lock,
     task_io_service::idle_thread_info* this_idle_thread)
 {

Modified: branches/release/boost/asio/detail/impl/timer_queue.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/timer_queue.ipp (original)
+++ branches/release/boost/asio/detail/impl/timer_queue.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -71,9 +71,9 @@
 }
 
 std::size_t timer_queue<time_traits<boost::posix_time::ptime> >::cancel_timer(
- per_timer_data& timer, op_queue<operation>& ops)
+ per_timer_data& timer, op_queue<operation>& ops, std::size_t max_cancelled)
 {
- return impl_.cancel_timer(timer, ops);
+ return impl_.cancel_timer(timer, ops, max_cancelled);
 }
 
 } // namespace detail

Modified: branches/release/boost/asio/detail/impl/win_iocp_handle_service.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/win_iocp_handle_service.ipp (original)
+++ branches/release/boost/asio/detail/impl/win_iocp_handle_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -100,6 +100,64 @@
   impl_list_ = &impl;
 }
 
+void win_iocp_handle_service::move_construct(
+ win_iocp_handle_service::implementation_type& impl,
+ win_iocp_handle_service::implementation_type& other_impl)
+{
+ impl.handle_ = other_impl.handle_;
+ other_impl.handle_ = INVALID_HANDLE_VALUE;
+
+ impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_;
+ other_impl.safe_cancellation_thread_id_ = 0;
+
+ // Insert implementation into linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ impl.next_ = impl_list_;
+ impl.prev_ = 0;
+ if (impl_list_)
+ impl_list_->prev_ = &impl;
+ impl_list_ = &impl;
+}
+
+void win_iocp_handle_service::move_assign(
+ win_iocp_handle_service::implementation_type& impl,
+ win_iocp_handle_service& other_service,
+ win_iocp_handle_service::implementation_type& other_impl)
+{
+ close_for_destruction(impl);
+
+ if (this != &other_service)
+ {
+ // Remove implementation from linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ if (impl_list_ == &impl)
+ impl_list_ = impl.next_;
+ if (impl.prev_)
+ impl.prev_->next_ = impl.next_;
+ if (impl.next_)
+ impl.next_->prev_= impl.prev_;
+ impl.next_ = 0;
+ impl.prev_ = 0;
+ }
+
+ impl.handle_ = other_impl.handle_;
+ other_impl.handle_ = INVALID_HANDLE_VALUE;
+
+ impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_;
+ other_impl.safe_cancellation_thread_id_ = 0;
+
+ if (this != &other_service)
+ {
+ // Insert implementation into linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_);
+ impl.next_ = other_service.impl_list_;
+ impl.prev_ = 0;
+ if (other_service.impl_list_)
+ other_service.impl_list_->prev_ = &impl;
+ other_service.impl_list_ = &impl;
+ }
+}
+
 void win_iocp_handle_service::destroy(
     win_iocp_handle_service::implementation_type& impl)
 {
@@ -119,7 +177,7 @@
 
 boost::system::error_code win_iocp_handle_service::assign(
     win_iocp_handle_service::implementation_type& impl,
- const native_type& native_handle, boost::system::error_code& ec)
+ const native_handle_type& handle, boost::system::error_code& ec)
 {
   if (is_open(impl))
   {
@@ -127,10 +185,10 @@
     return ec;
   }
 
- if (iocp_service_.register_handle(native_handle, ec))
+ if (iocp_service_.register_handle(handle, ec))
     return ec;
 
- impl.handle_ = native_handle;
+ impl.handle_ = handle;
   ec = boost::system::error_code();
   return ec;
 }
@@ -141,19 +199,27 @@
 {
   if (is_open(impl))
   {
+ BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "close"));
+
     if (!::CloseHandle(impl.handle_))
     {
       DWORD last_error = ::GetLastError();
       ec = boost::system::error_code(last_error,
           boost::asio::error::get_system_category());
- return ec;
+ }
+ else
+ {
+ ec = boost::system::error_code();
     }
 
     impl.handle_ = INVALID_HANDLE_VALUE;
     impl.safe_cancellation_thread_id_ = 0;
   }
+ else
+ {
+ ec = boost::system::error_code();
+ }
 
- ec = boost::system::error_code();
   return ec;
 }
 
@@ -164,8 +230,12 @@
   if (!is_open(impl))
   {
     ec = boost::asio::error::bad_descriptor;
+ return ec;
   }
- else if (FARPROC cancel_io_ex_ptr = ::GetProcAddress(
+
+ BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "cancel"));
+
+ if (FARPROC cancel_io_ex_ptr = ::GetProcAddress(
         ::GetModuleHandleA("KERNEL32"), "CancelIoEx"))
   {
     // The version of Windows supports cancellation from any thread.
@@ -437,6 +507,8 @@
 {
   if (is_open(impl))
   {
+ BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "close"));
+
     ::CloseHandle(impl.handle_);
     impl.handle_ = INVALID_HANDLE_VALUE;
     impl.safe_cancellation_thread_id_ = 0;

Modified: branches/release/boost/asio/detail/impl/win_iocp_io_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/impl/win_iocp_io_service.hpp (original)
+++ branches/release/boost/asio/detail/impl/win_iocp_io_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -40,7 +40,19 @@
     boost_asio_handler_invoke_helpers::invoke(handler, handler);
   }
   else
- post(handler);
+ {
+ // Allocate and construct an operation to wrap the handler.
+ typedef completion_handler<Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch"));
+
+ post_immediate_completion(p.p);
+ p.v = p.p = 0;
+ }
 }
 
 template <typename Handler>
@@ -53,6 +65,8 @@
       sizeof(op), handler), 0 };
   p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "post"));
+
   post_immediate_completion(p.p);
   p.v = p.p = 0;
 }
@@ -93,7 +107,8 @@
 
 template <typename Time_Traits>
 std::size_t win_iocp_io_service::cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer)
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled)
 {
   // If the service has been shut down we silently ignore the cancellation.
   if (::InterlockedExchangeAdd(&shutdown_, 0) != 0)
@@ -101,7 +116,7 @@
 
   mutex::scoped_lock lock(dispatch_mutex_);
   op_queue<win_iocp_operation> ops;
- std::size_t n = queue.cancel_timer(timer, ops);
+ std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
   post_deferred_completions(ops);
   return n;
 }

Modified: branches/release/boost/asio/detail/impl/win_iocp_io_service.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/win_iocp_io_service.ipp (original)
+++ branches/release/boost/asio/detail/impl/win_iocp_io_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -70,6 +70,7 @@
     shutdown_(0),
     dispatch_required_(0)
 {
+ BOOST_ASIO_HANDLER_TRACKING_INIT;
 }
 
 void win_iocp_io_service::init(size_t concurrency_hint)
@@ -89,7 +90,7 @@
 {
   ::InterlockedExchange(&shutdown_, 1);
 
- if (timer_thread_)
+ if (timer_thread_.get())
   {
     LARGE_INTEGER timeout;
     timeout.QuadPart = 1;
@@ -125,7 +126,7 @@
     }
   }
 
- if (timer_thread_)
+ if (timer_thread_.get())
     timer_thread_->join();
 }
 
@@ -262,6 +263,17 @@
   }
 }
 
+void win_iocp_io_service::abandon_operations(
+ op_queue<win_iocp_operation>& ops)
+{
+ while (win_iocp_operation* op = ops.front())
+ {
+ ops.pop();
+ ::InterlockedDecrement(&outstanding_work_);
+ op->destroy();
+ }
+}
+
 void win_iocp_io_service::on_pending(win_iocp_operation* op)
 {
   if (::InterlockedCompareExchange(&op->ready_, 1, 0) == 1)
@@ -455,7 +467,7 @@
         &timeout, max_timeout_msec, 0, 0, FALSE);
   }
 
- if (!timer_thread_)
+ if (!timer_thread_.get())
   {
     timer_thread_function thread_function = { this };
     timer_thread_.reset(new thread(thread_function, 65536));
@@ -471,7 +483,7 @@
 
 void win_iocp_io_service::update_timeout()
 {
- if (timer_thread_)
+ if (timer_thread_.get())
   {
     // There's no point updating the waitable timer if the new timeout period
     // exceeds the maximum timeout. In that case, we might as well wait for the

Modified: branches/release/boost/asio/detail/impl/win_iocp_serial_port_service.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/win_iocp_serial_port_service.ipp (original)
+++ branches/release/boost/asio/detail/impl/win_iocp_serial_port_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -127,7 +127,7 @@
   ::DCB dcb;
   memset(&dcb, 0, sizeof(DCB));
   dcb.DCBlength = sizeof(DCB);
- if (!::GetCommState(handle_service_.native(impl), &dcb))
+ if (!::GetCommState(handle_service_.native_handle(impl), &dcb))
   {
     DWORD last_error = ::GetLastError();
     ec = boost::system::error_code(last_error,
@@ -138,7 +138,7 @@
   if (store(option, dcb, ec))
     return ec;
 
- if (!::SetCommState(handle_service_.native(impl), &dcb))
+ if (!::SetCommState(handle_service_.native_handle(impl), &dcb))
   {
     DWORD last_error = ::GetLastError();
     ec = boost::system::error_code(last_error,
@@ -160,7 +160,7 @@
   ::DCB dcb;
   memset(&dcb, 0, sizeof(DCB));
   dcb.DCBlength = sizeof(DCB);
- if (!::GetCommState(handle_service_.native(impl), &dcb))
+ if (!::GetCommState(handle_service_.native_handle(impl), &dcb))
   {
     DWORD last_error = ::GetLastError();
     ec = boost::system::error_code(last_error,

Modified: branches/release/boost/asio/detail/impl/win_iocp_socket_service_base.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/win_iocp_socket_service_base.ipp (original)
+++ branches/release/boost/asio/detail/impl/win_iocp_socket_service_base.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -69,6 +69,80 @@
   impl_list_ = &impl;
 }
 
+void win_iocp_socket_service_base::base_move_construct(
+ win_iocp_socket_service_base::base_implementation_type& impl,
+ win_iocp_socket_service_base::base_implementation_type& other_impl)
+{
+ impl.socket_ = other_impl.socket_;
+ other_impl.socket_ = invalid_socket;
+
+ impl.state_ = other_impl.state_;
+ other_impl.state_ = 0;
+
+ impl.cancel_token_ = other_impl.cancel_token_;
+ other_impl.cancel_token_.reset();
+
+#if defined(BOOST_ASIO_ENABLE_CANCELIO)
+ impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_;
+ other_impl.safe_cancellation_thread_id_ = 0;
+#endif // defined(BOOST_ASIO_ENABLE_CANCELIO)
+
+ // Insert implementation into linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ impl.next_ = impl_list_;
+ impl.prev_ = 0;
+ if (impl_list_)
+ impl_list_->prev_ = &impl;
+ impl_list_ = &impl;
+}
+
+void win_iocp_socket_service_base::base_move_assign(
+ win_iocp_socket_service_base::base_implementation_type& impl,
+ win_iocp_socket_service_base& other_service,
+ win_iocp_socket_service_base::base_implementation_type& other_impl)
+{
+ close_for_destruction(impl);
+
+ if (this != &other_service)
+ {
+ // Remove implementation from linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(mutex_);
+ if (impl_list_ == &impl)
+ impl_list_ = impl.next_;
+ if (impl.prev_)
+ impl.prev_->next_ = impl.next_;
+ if (impl.next_)
+ impl.next_->prev_= impl.prev_;
+ impl.next_ = 0;
+ impl.prev_ = 0;
+ }
+
+ impl.socket_ = other_impl.socket_;
+ other_impl.socket_ = invalid_socket;
+
+ impl.state_ = other_impl.state_;
+ other_impl.state_ = 0;
+
+ impl.cancel_token_ = other_impl.cancel_token_;
+ other_impl.cancel_token_.reset();
+
+#if defined(BOOST_ASIO_ENABLE_CANCELIO)
+ impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_;
+ other_impl.safe_cancellation_thread_id_ = 0;
+#endif // defined(BOOST_ASIO_ENABLE_CANCELIO)
+
+ if (this != &other_service)
+ {
+ // Insert implementation into linked list of all implementations.
+ boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_);
+ impl.next_ = other_service.impl_list_;
+ impl.prev_ = 0;
+ if (other_service.impl_list_)
+ other_service.impl_list_->prev_ = &impl;
+ other_service.impl_list_ = &impl;
+ }
+}
+
 void win_iocp_socket_service_base::destroy(
     win_iocp_socket_service_base::base_implementation_type& impl)
 {
@@ -92,6 +166,8 @@
 {
   if (is_open(impl))
   {
+ BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close"));
+
     // Check if the reactor was created, in which case we need to close the
     // socket on the reactor as well to cancel any operations that might be
     // running there.
@@ -99,18 +175,17 @@
           interlocked_compare_exchange_pointer(
             reinterpret_cast<void**>(&reactor_), 0, 0));
     if (r)
- r->close_descriptor(impl.socket_, impl.reactor_data_);
+ r->deregister_descriptor(impl.socket_, impl.reactor_data_, true);
   }
 
- if (socket_ops::close(impl.socket_, impl.state_, false, ec) == 0)
- {
- impl.socket_ = invalid_socket;
- impl.state_ = 0;
- impl.cancel_token_.reset();
+ socket_ops::close(impl.socket_, impl.state_, false, ec);
+
+ impl.socket_ = invalid_socket;
+ impl.state_ = 0;
+ impl.cancel_token_.reset();
 #if defined(BOOST_ASIO_ENABLE_CANCELIO)
- impl.safe_cancellation_thread_id_ = 0;
+ impl.safe_cancellation_thread_id_ = 0;
 #endif // defined(BOOST_ASIO_ENABLE_CANCELIO)
- }
 
   return ec;
 }
@@ -124,7 +199,10 @@
     ec = boost::asio::error::bad_descriptor;
     return ec;
   }
- else if (FARPROC cancel_io_ex_ptr = ::GetProcAddress(
+
+ BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "cancel"));
+
+ if (FARPROC cancel_io_ex_ptr = ::GetProcAddress(
         ::GetModuleHandleA("KERNEL32"), "CancelIoEx"))
   {
     // The version of Windows supports cancellation from any thread.
@@ -474,7 +552,7 @@
 
   if ((impl.state_ & socket_ops::non_blocking) != 0
       || socket_ops::set_internal_non_blocking(
- impl.socket_, impl.state_, op->ec_))
+ impl.socket_, impl.state_, true, op->ec_))
   {
     if (socket_ops::connect(impl.socket_, addr, addrlen, op->ec_) != 0)
     {
@@ -497,6 +575,8 @@
 {
   if (is_open(impl))
   {
+ BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close"));
+
     // Check if the reactor was created, in which case we need to close the
     // socket on the reactor as well to cancel any operations that might be
     // running there.
@@ -504,7 +584,7 @@
           interlocked_compare_exchange_pointer(
             reinterpret_cast<void**>(&reactor_), 0, 0));
     if (r)
- r->close_descriptor(impl.socket_, impl.reactor_data_);
+ r->deregister_descriptor(impl.socket_, impl.reactor_data_, true);
   }
 
   boost::system::error_code ignored_ec;

Added: branches/release/boost/asio/detail/impl/win_static_mutex.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/impl/win_static_mutex.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,120 @@
+//
+// detail/impl/win_static_mutex.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP
+#define BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_WINDOWS)
+
+#include <cstdio>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/detail/win_static_mutex.hpp>
+#include <boost/asio/error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+void win_static_mutex::init()
+{
+ int error = do_init();
+ boost::system::error_code ec(error,
+ boost::asio::error::get_system_category());
+ boost::asio::detail::throw_error(ec, "static_mutex");
+}
+
+int win_static_mutex::do_init()
+{
+ using namespace std; // For sprintf.
+ wchar_t mutex_name[128];
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+ swprintf_s(mutex_name, 128,
+#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+ swprintf(mutex_name,
+#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+ L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p",
+ static_cast<unsigned int>(::GetCurrentProcessId()), this);
+
+ HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name);
+ DWORD last_error = ::GetLastError();
+ if (mutex == 0)
+ return ::GetLastError();
+
+ if (last_error == ERROR_ALREADY_EXISTS)
+ ::WaitForSingleObject(mutex, INFINITE);
+
+ if (initialised_)
+ {
+ ::ReleaseMutex(mutex);
+ ::CloseHandle(mutex);
+ return 0;
+ }
+
+#if defined(__MINGW32__)
+ // Not sure if MinGW supports structured exception handling, so for now
+ // we'll just call the Windows API and hope.
+# if defined(UNDER_CE)
+ ::InitializeCriticalSection(&crit_section_);
+# else
+ if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000))
+ {
+ last_error = ::GetLastError();
+ ::ReleaseMutex(mutex);
+ ::CloseHandle(mutex);
+ return last_error;
+ }
+# endif
+#else
+ __try
+ {
+# if defined(UNDER_CE)
+ ::InitializeCriticalSection(&crit_section_);
+# else
+ if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000))
+ {
+ last_error = ::GetLastError();
+ ::ReleaseMutex(mutex);
+ ::CloseHandle(mutex);
+ return last_error;
+ }
+# endif
+ }
+ __except(GetExceptionCode() == STATUS_NO_MEMORY
+ ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
+ {
+ ::ReleaseMutex(mutex);
+ ::CloseHandle(mutex);
+ return ERROR_OUTOFMEMORY;
+ }
+#endif
+
+ initialised_ = true;
+ ::ReleaseMutex(mutex);
+ ::CloseHandle(mutex);
+ return 0;
+}
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_WINDOWS)
+
+#endif // BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP

Modified: branches/release/boost/asio/detail/impl/win_thread.ipp
==============================================================================
--- branches/release/boost/asio/detail/impl/win_thread.ipp (original)
+++ branches/release/boost/asio/detail/impl/win_thread.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -102,12 +102,12 @@
 
 unsigned int __stdcall win_thread_function(void* arg)
 {
- std::auto_ptr<win_thread::func_base> func(
- static_cast<win_thread::func_base*>(arg));
+ win_thread::auto_func_base_ptr func = {
+ static_cast<win_thread::func_base*>(arg) };
 
- ::SetEvent(func->entry_event_);
+ ::SetEvent(func.ptr->entry_event_);
 
- func->run();
+ func.ptr->run();
 
   // Signal that the thread has finished its work, but rather than returning go
   // to sleep to put the thread into a well known state. If the thread is being
@@ -115,8 +115,9 @@
   // TerminateThread (to avoid a deadlock in DllMain). Otherwise, the SleepEx
   // call will be interrupted using QueueUserAPC and the thread will shut down
   // cleanly.
- HANDLE exit_event = func->exit_event_;
- func.reset();
+ HANDLE exit_event = func.ptr->exit_event_;
+ delete func.ptr;
+ func.ptr = 0;
   ::SetEvent(exit_event);
   ::SleepEx(INFINITE, TRUE);
 

Modified: branches/release/boost/asio/detail/io_control.hpp
==============================================================================
--- branches/release/boost/asio/detail/io_control.hpp (original)
+++ branches/release/boost/asio/detail/io_control.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -46,7 +46,7 @@
   // Get the name of the IO control command.
   int name() const
   {
- return FIONBIO;
+ return static_cast<int>(FIONBIO);
   }
 
   // Set the value of the I/O control command.
@@ -96,7 +96,7 @@
   // Get the name of the IO control command.
   int name() const
   {
- return FIONREAD;
+ return static_cast<int>(FIONREAD);
   }
 
   // Set the value of the I/O control command.

Modified: branches/release/boost/asio/detail/kqueue_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/kqueue_reactor.hpp (original)
+++ branches/release/boost/asio/detail/kqueue_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -20,6 +20,7 @@
 
 #if defined(BOOST_ASIO_HAS_KQUEUE)
 
+#include <boost/limits.hpp>
 #include <cstddef>
 #include <sys/types.h>
 #include <sys/event.h>
@@ -62,6 +63,7 @@
     friend class kqueue_reactor;
     friend class object_pool_access;
     mutex mutex_;
+ int descriptor_;
     op_queue<reactor_op> op_queue_[max_ops];
     bool shutdown_;
     descriptor_state* next_;
@@ -80,6 +82,10 @@
   // Destroy all user-defined handler objects owned by the service.
   BOOST_ASIO_DECL void shutdown_service();
 
+ // Recreate internal descriptors following a fork.
+ BOOST_ASIO_DECL void fork_service(
+ boost::asio::io_service::fork_event fork_ev);
+
   // Initialise the task.
   BOOST_ASIO_DECL void init_task();
 
@@ -88,6 +94,17 @@
   BOOST_ASIO_DECL int register_descriptor(socket_type descriptor,
       per_descriptor_data& descriptor_data);
 
+ // Register a descriptor with an associated single operation. Returns 0 on
+ // success, system error code on failure.
+ BOOST_ASIO_DECL int register_internal_descriptor(
+ int op_type, socket_type descriptor,
+ per_descriptor_data& descriptor_data, reactor_op* op);
+
+ // Move descriptor registration from one descriptor_data object to another.
+ BOOST_ASIO_DECL void move_descriptor(socket_type descriptor,
+ per_descriptor_data& target_descriptor_data,
+ per_descriptor_data& source_descriptor_data);
+
   // Post a reactor operation for immediate completion.
   void post_immediate_completion(reactor_op* op)
   {
@@ -108,8 +125,12 @@
 
   // Cancel any operations that are running against the descriptor and remove
   // its registration from the reactor.
- BOOST_ASIO_DECL void close_descriptor(socket_type descriptor,
- per_descriptor_data& descriptor_data);
+ BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor,
+ per_descriptor_data& descriptor_data, bool closing);
+
+ // Remote the descriptor's registration from the reactor.
+ BOOST_ASIO_DECL void deregister_internal_descriptor(
+ socket_type descriptor, per_descriptor_data& descriptor_data);
 
   // Add a new timer queue to the reactor.
   template <typename Time_Traits>
@@ -130,7 +151,8 @@
   // number of operations that have been posted or dispatched.
   template <typename Time_Traits>
   std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer);
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
 
   // Run the kqueue loop.
   BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops);

Added: branches/release/boost/asio/detail/null_static_mutex.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/null_static_mutex.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,62 @@
+//
+// detail/null_static_mutex.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
+#define BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS)
+
+#include <boost/asio/detail/scoped_lock.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+struct null_static_mutex
+{
+ typedef boost::asio::detail::scoped_lock<null_static_mutex> scoped_lock;
+
+ // Initialise the mutex.
+ void init()
+ {
+ }
+
+ // Lock the mutex.
+ void lock()
+ {
+ }
+
+ // Unlock the mutex.
+ void unlock()
+ {
+ }
+
+ int unused_;
+};
+
+#define BOOST_ASIO_NULL_STATIC_MUTEX_INIT { 0 }
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS)
+
+#endif // BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP

Modified: branches/release/boost/asio/detail/old_win_sdk_compat.hpp
==============================================================================
--- branches/release/boost/asio/detail/old_win_sdk_compat.hpp (original)
+++ branches/release/boost/asio/detail/old_win_sdk_compat.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -85,14 +85,6 @@
   unsigned int ipv6mr_interface;
 };
 
-#if !defined(IN6ADDR_ANY_INIT)
-# define IN6ADDR_ANY_INIT { 0 }
-#endif
-
-#if !defined(IN6ADDR_LOOPBACK_INIT)
-# define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
-#endif
-
 struct addrinfo_emulation
 {
   int ai_flags;
@@ -201,122 +193,6 @@
 # define IPV6_LEAVE_GROUP 13
 #endif
 
-inline int IN6_IS_ADDR_UNSPECIFIED(const in6_addr_emulation* a)
-{
- return ((a->s6_addr[0] == 0)
- && (a->s6_addr[1] == 0)
- && (a->s6_addr[2] == 0)
- && (a->s6_addr[3] == 0)
- && (a->s6_addr[4] == 0)
- && (a->s6_addr[5] == 0)
- && (a->s6_addr[6] == 0)
- && (a->s6_addr[7] == 0)
- && (a->s6_addr[8] == 0)
- && (a->s6_addr[9] == 0)
- && (a->s6_addr[10] == 0)
- && (a->s6_addr[11] == 0)
- && (a->s6_addr[12] == 0)
- && (a->s6_addr[13] == 0)
- && (a->s6_addr[14] == 0)
- && (a->s6_addr[15] == 0));
-}
-
-inline int IN6_IS_ADDR_LOOPBACK(const in6_addr_emulation* a)
-{
- return ((a->s6_addr[0] == 0)
- && (a->s6_addr[1] == 0)
- && (a->s6_addr[2] == 0)
- && (a->s6_addr[3] == 0)
- && (a->s6_addr[4] == 0)
- && (a->s6_addr[5] == 0)
- && (a->s6_addr[6] == 0)
- && (a->s6_addr[7] == 0)
- && (a->s6_addr[8] == 0)
- && (a->s6_addr[9] == 0)
- && (a->s6_addr[10] == 0)
- && (a->s6_addr[11] == 0)
- && (a->s6_addr[12] == 0)
- && (a->s6_addr[13] == 0)
- && (a->s6_addr[14] == 0)
- && (a->s6_addr[15] == 1));
-}
-
-inline int IN6_IS_ADDR_MULTICAST(const in6_addr_emulation* a)
-{
- return (a->s6_addr[0] == 0xff);
-}
-
-inline int IN6_IS_ADDR_LINKLOCAL(const in6_addr_emulation* a)
-{
- return ((a->s6_addr[0] == 0xfe) && ((a->s6_addr[1] & 0xc0) == 0x80));
-}
-
-inline int IN6_IS_ADDR_SITELOCAL(const in6_addr_emulation* a)
-{
- return ((a->s6_addr[0] == 0xfe) && ((a->s6_addr[1] & 0xc0) == 0xc0));
-}
-
-inline int IN6_IS_ADDR_V4MAPPED(const in6_addr_emulation* a)
-{
- return ((a->s6_addr[0] == 0)
- && (a->s6_addr[1] == 0)
- && (a->s6_addr[2] == 0)
- && (a->s6_addr[3] == 0)
- && (a->s6_addr[4] == 0)
- && (a->s6_addr[5] == 0)
- && (a->s6_addr[6] == 0)
- && (a->s6_addr[7] == 0)
- && (a->s6_addr[8] == 0)
- && (a->s6_addr[9] == 0)
- && (a->s6_addr[10] == 0xff)
- && (a->s6_addr[11] == 0xff));
-}
-
-inline int IN6_IS_ADDR_V4COMPAT(const in6_addr_emulation* a)
-{
- return ((a->s6_addr[0] == 0)
- && (a->s6_addr[1] == 0)
- && (a->s6_addr[2] == 0)
- && (a->s6_addr[3] == 0)
- && (a->s6_addr[4] == 0)
- && (a->s6_addr[5] == 0)
- && (a->s6_addr[6] == 0)
- && (a->s6_addr[7] == 0)
- && (a->s6_addr[8] == 0)
- && (a->s6_addr[9] == 0)
- && (a->s6_addr[10] == 0xff)
- && (a->s6_addr[11] == 0xff)
- && !((a->s6_addr[12] == 0)
- && (a->s6_addr[13] == 0)
- && (a->s6_addr[14] == 0)
- && ((a->s6_addr[15] == 0) || (a->s6_addr[15] == 1))));
-}
-
-inline int IN6_IS_ADDR_MC_NODELOCAL(const in6_addr_emulation* a)
-{
- return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 1);
-}
-
-inline int IN6_IS_ADDR_MC_LINKLOCAL(const in6_addr_emulation* a)
-{
- return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 2);
-}
-
-inline int IN6_IS_ADDR_MC_SITELOCAL(const in6_addr_emulation* a)
-{
- return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 5);
-}
-
-inline int IN6_IS_ADDR_MC_ORGLOCAL(const in6_addr_emulation* a)
-{
- return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 8);
-}
-
-inline int IN6_IS_ADDR_MC_GLOBAL(const in6_addr_emulation* a)
-{
- return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 0xe);
-}
-
 } // namespace detail
 } // namespace asio
 } // namespace boost

Modified: branches/release/boost/asio/detail/pipe_select_interrupter.hpp
==============================================================================
--- branches/release/boost/asio/detail/pipe_select_interrupter.hpp (original)
+++ branches/release/boost/asio/detail/pipe_select_interrupter.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -37,6 +37,9 @@
   // Destructor.
   BOOST_ASIO_DECL ~pipe_select_interrupter();
 
+ // Recreate the interrupter's descriptors. Used after a fork.
+ BOOST_ASIO_DECL void recreate();
+
   // Interrupt the select call.
   BOOST_ASIO_DECL void interrupt();
 
@@ -50,6 +53,12 @@
   }
 
 private:
+ // Open the descriptors. Throws on error.
+ BOOST_ASIO_DECL void open_descriptors();
+
+ // Close the descriptors.
+ BOOST_ASIO_DECL void close_descriptors();
+
   // The read end of a connection used to interrupt the select call. This file
   // descriptor is passed to select such that when it is time to stop, a single
   // byte will be written on the other end of the connection and this

Added: branches/release/boost/asio/detail/posix_static_mutex.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/posix_static_mutex.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,66 @@
+//
+// detail/posix_static_mutex.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP
+#define BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_ASIO_DISABLE_THREADS)
+
+#include <pthread.h>
+#include <boost/asio/detail/scoped_lock.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+struct posix_static_mutex
+{
+ typedef boost::asio::detail::scoped_lock<posix_static_mutex> scoped_lock;
+
+ // Initialise the mutex.
+ void init()
+ {
+ // Nothing to do.
+ }
+
+ // Lock the mutex.
+ void lock()
+ {
+ (void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL.
+ }
+
+ // Unlock the mutex.
+ void unlock()
+ {
+ (void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL.
+ }
+
+ ::pthread_mutex_t mutex_;
+};
+
+#define BOOST_ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER }
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_HAS_PTHREADS) && !defined(BOOST_ASIO_DISABLE_THREADS)
+
+#endif // BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP

Modified: branches/release/boost/asio/detail/posix_thread.hpp
==============================================================================
--- branches/release/boost/asio/detail/posix_thread.hpp (original)
+++ branches/release/boost/asio/detail/posix_thread.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -39,7 +39,7 @@
 public:
   // Constructor.
   template <typename Function>
- posix_thread(Function f)
+ posix_thread(Function f, unsigned int = 0)
     : joined_(false)
   {
     start_thread(new func<Function>(f));

Modified: branches/release/boost/asio/detail/reactive_descriptor_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_descriptor_service.hpp (original)
+++ branches/release/boost/asio/detail/reactive_descriptor_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -42,7 +42,7 @@
 {
 public:
   // The native type of a descriptor.
- typedef int native_type;
+ typedef int native_handle_type;
 
   // The implementation type of the descriptor.
   class implementation_type
@@ -80,12 +80,22 @@
   // Construct a new descriptor implementation.
   BOOST_ASIO_DECL void construct(implementation_type& impl);
 
+ // Move-construct a new descriptor implementation.
+ BOOST_ASIO_DECL void move_construct(implementation_type& impl,
+ implementation_type& other_impl);
+
+ // Move-assign from another descriptor implementation.
+ BOOST_ASIO_DECL void move_assign(implementation_type& impl,
+ reactive_descriptor_service& other_service,
+ implementation_type& other_impl);
+
   // Destroy a descriptor implementation.
   BOOST_ASIO_DECL void destroy(implementation_type& impl);
 
   // Assign a native descriptor to a descriptor implementation.
   BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl,
- const native_type& native_descriptor, boost::system::error_code& ec);
+ const native_handle_type& native_descriptor,
+ boost::system::error_code& ec);
 
   // Determine whether the descriptor is open.
   bool is_open(const implementation_type& impl) const
@@ -98,11 +108,14 @@
       boost::system::error_code& ec);
 
   // Get the native descriptor representation.
- native_type native(const implementation_type& impl) const
+ native_handle_type native_handle(const implementation_type& impl) const
   {
     return impl.descriptor_;
   }
 
+ // Release ownership of the native descriptor representation.
+ BOOST_ASIO_DECL native_handle_type release(implementation_type& impl);
+
   // Cancel all operations associated with the descriptor.
   BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl,
       boost::system::error_code& ec);
@@ -117,6 +130,36 @@
     return ec;
   }
 
+ // Gets the non-blocking mode of the descriptor.
+ bool non_blocking(const implementation_type& impl) const
+ {
+ return (impl.state_ & descriptor_ops::user_set_non_blocking) != 0;
+ }
+
+ // Sets the non-blocking mode of the descriptor.
+ boost::system::error_code non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ descriptor_ops::set_user_non_blocking(
+ impl.descriptor_, impl.state_, mode, ec);
+ return ec;
+ }
+
+ // Gets the non-blocking mode of the native descriptor implementation.
+ bool native_non_blocking(const implementation_type& impl) const
+ {
+ return (impl.state_ & descriptor_ops::internal_non_blocking) != 0;
+ }
+
+ // Sets the non-blocking mode of the native descriptor implementation.
+ boost::system::error_code native_non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ descriptor_ops::set_internal_non_blocking(
+ impl.descriptor_, impl.state_, mode, ec);
+ return ec;
+ }
+
   // Write some data to the descriptor.
   template <typename ConstBufferSequence>
   size_t write_some(implementation_type& impl,
@@ -152,6 +195,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.descriptor_, buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_write_some"));
+
     start_op(impl, reactor::write_op, p.p, true,
         buffer_sequence_adapter<boost::asio::const_buffer,
           ConstBufferSequence>::all_empty(buffers));
@@ -170,6 +215,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor",
+ &impl, "async_write_some(null_buffers)"));
+
     start_op(impl, reactor::write_op, p.p, false, false);
     p.v = p.p = 0;
   }
@@ -209,6 +257,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.descriptor_, buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_read_some"));
+
     start_op(impl, reactor::read_op, p.p, true,
         buffer_sequence_adapter<boost::asio::mutable_buffer,
           MutableBufferSequence>::all_empty(buffers));
@@ -227,6 +277,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor",
+ &impl, "async_read_some(null_buffers)"));
+
     start_op(impl, reactor::read_op, p.p, false, false);
     p.v = p.p = 0;
   }
@@ -234,7 +287,7 @@
 private:
   // Start the asynchronous operation.
   BOOST_ASIO_DECL void start_op(implementation_type& impl, int op_type,
- reactor_op* op, bool non_blocking, bool noop);
+ reactor_op* op, bool is_non_blocking, bool noop);
 
   // The selector that performs event demultiplexing for the service.
   reactor& reactor_;

Modified: branches/release/boost/asio/detail/reactive_null_buffers_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_null_buffers_op.hpp (original)
+++ branches/release/boost/asio/detail/reactive_null_buffers_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -34,10 +34,10 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_null_buffers_op);
 
- reactive_null_buffers_op(Handler handler)
+ reactive_null_buffers_op(Handler& handler)
     : reactor_op(&reactive_null_buffers_op::do_perform,
         &reactive_null_buffers_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -53,6 +53,8 @@
     reactive_null_buffers_op* o(static_cast<reactive_null_buffers_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -68,7 +70,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/reactive_serial_port_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_serial_port_service.hpp (original)
+++ branches/release/boost/asio/detail/reactive_serial_port_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -39,7 +39,7 @@
 {
 public:
   // The native type of a serial port.
- typedef reactive_descriptor_service::native_type native_type;
+ typedef reactive_descriptor_service::native_handle_type native_handle_type;
 
   // The implementation type of the serial port.
   typedef reactive_descriptor_service::implementation_type implementation_type;
@@ -56,6 +56,22 @@
     descriptor_service_.construct(impl);
   }
 
+ // Move-construct a new serial port implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ descriptor_service_.move_construct(impl, other_impl);
+ }
+
+ // Move-assign from another serial port implementation.
+ void move_assign(implementation_type& impl,
+ reactive_serial_port_service& other_service,
+ implementation_type& other_impl)
+ {
+ descriptor_service_.move_assign(impl,
+ other_service.descriptor_service_, other_impl);
+ }
+
   // Destroy a serial port implementation.
   void destroy(implementation_type& impl)
   {
@@ -68,7 +84,8 @@
 
   // Assign a native descriptor to a serial port implementation.
   boost::system::error_code assign(implementation_type& impl,
- const native_type& native_descriptor, boost::system::error_code& ec)
+ const native_handle_type& native_descriptor,
+ boost::system::error_code& ec)
   {
     return descriptor_service_.assign(impl, native_descriptor, ec);
   }
@@ -87,9 +104,9 @@
   }
 
   // Get the native serial port representation.
- native_type native(implementation_type& impl)
+ native_handle_type native_handle(implementation_type& impl)
   {
- return descriptor_service_.native(impl);
+ return descriptor_service_.native_handle(impl);
   }
 
   // Cancel all operations associated with the serial port.
@@ -125,7 +142,7 @@
   {
     errno = 0;
     descriptor_ops::error_wrapper(::tcsendbreak(
- descriptor_service_.native(impl), 0), ec);
+ descriptor_service_.native_handle(impl), 0), ec);
     return ec;
   }
 

Modified: branches/release/boost/asio/detail/reactive_socket_accept_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_accept_op.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_accept_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -87,10 +87,10 @@
 
   reactive_socket_accept_op(socket_type socket,
       socket_ops::state_type state, Socket& peer, const Protocol& protocol,
- typename Protocol::endpoint* peer_endpoint, Handler handler)
+ typename Protocol::endpoint* peer_endpoint, Handler& handler)
     : reactive_socket_accept_op_base<Socket, Protocol>(socket, state, peer,
         protocol, peer_endpoint, &reactive_socket_accept_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -101,6 +101,8 @@
     reactive_socket_accept_op* o(static_cast<reactive_socket_accept_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -116,7 +118,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/reactive_socket_connect_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_connect_op.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_connect_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -56,10 +56,10 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_connect_op);
 
- reactive_socket_connect_op(socket_type socket, Handler handler)
+ reactive_socket_connect_op(socket_type socket, Handler& handler)
     : reactive_socket_connect_op_base(socket,
         &reactive_socket_connect_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -71,6 +71,8 @@
       (static_cast<reactive_socket_connect_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -86,7 +88,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/reactive_socket_recv_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_recv_op.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_recv_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -54,7 +54,7 @@
 
     return socket_ops::non_blocking_recv(o->socket_,
         bufs.buffers(), bufs.count(), o->flags_,
- (o->state_ & socket_ops::stream_oriented),
+ (o->state_ & socket_ops::stream_oriented) != 0,
         o->ec_, o->bytes_transferred_);
   }
 
@@ -74,10 +74,10 @@
 
   reactive_socket_recv_op(socket_type socket,
       socket_ops::state_type state, const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler handler)
+ socket_base::message_flags flags, Handler& handler)
     : reactive_socket_recv_op_base<MutableBufferSequence>(socket, state,
         buffers, flags, &reactive_socket_recv_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -88,6 +88,8 @@
     reactive_socket_recv_op* o(static_cast<reactive_socket_recv_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -103,7 +105,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/reactive_socket_recvfrom_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_recvfrom_op.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_recvfrom_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -82,11 +82,11 @@
 
   reactive_socket_recvfrom_op(socket_type socket, int protocol_type,
       const MutableBufferSequence& buffers, Endpoint& endpoint,
- socket_base::message_flags flags, Handler handler)
+ socket_base::message_flags flags, Handler& handler)
     : reactive_socket_recvfrom_op_base<MutableBufferSequence, Endpoint>(
         socket, protocol_type, buffers, endpoint, flags,
         &reactive_socket_recvfrom_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -98,6 +98,8 @@
         static_cast<reactive_socket_recvfrom_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -113,7 +115,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Added: branches/release/boost/asio/detail/reactive_socket_recvmsg_op.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/reactive_socket_recvmsg_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,126 @@
+//
+// detail/reactive_socket_recvmsg_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP
+#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/utility/addressof.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/reactor_op.hpp>
+#include <boost/asio/detail/socket_ops.hpp>
+#include <boost/asio/socket_base.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename MutableBufferSequence>
+class reactive_socket_recvmsg_op_base : public reactor_op
+{
+public:
+ reactive_socket_recvmsg_op_base(socket_type socket,
+ const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, func_type complete_func)
+ : reactor_op(&reactive_socket_recvmsg_op_base::do_perform, complete_func),
+ socket_(socket),
+ buffers_(buffers),
+ in_flags_(in_flags),
+ out_flags_(out_flags)
+ {
+ }
+
+ static bool do_perform(reactor_op* base)
+ {
+ reactive_socket_recvmsg_op_base* o(
+ static_cast<reactive_socket_recvmsg_op_base*>(base));
+
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence> bufs(o->buffers_);
+
+ return socket_ops::non_blocking_recvmsg(o->socket_,
+ bufs.buffers(), bufs.count(),
+ o->in_flags_, o->out_flags_,
+ o->ec_, o->bytes_transferred_);
+ }
+
+private:
+ socket_type socket_;
+ MutableBufferSequence buffers_;
+ socket_base::message_flags in_flags_;
+ socket_base::message_flags& out_flags_;
+};
+
+template <typename MutableBufferSequence, typename Handler>
+class reactive_socket_recvmsg_op :
+ public reactive_socket_recvmsg_op_base<MutableBufferSequence>
+{
+public:
+ BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_recvmsg_op);
+
+ reactive_socket_recvmsg_op(socket_type socket,
+ const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, Handler& handler)
+ : reactive_socket_recvmsg_op_base<MutableBufferSequence>(socket, buffers,
+ in_flags, out_flags, &reactive_socket_recvmsg_op::do_complete),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
+ static void do_complete(io_service_impl* owner, operation* base,
+ boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/)
+ {
+ // Take ownership of the handler object.
+ reactive_socket_recvmsg_op* o(
+ static_cast<reactive_socket_recvmsg_op*>(base));
+ ptr p = { boost::addressof(o->handler_), o, o };
+
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
+ // Make a copy of the handler so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the handler may be the true owner of the memory associated
+ // with the handler. Consequently, a local copy of the handler is required
+ // to ensure that any owning sub-object remains valid until after we have
+ // deallocated the memory here.
+ detail::binder2<Handler, boost::system::error_code, std::size_t>
+ handler(o->handler_, o->ec_, o->bytes_transferred_);
+ p.h = boost::addressof(handler.handler_);
+ p.reset();
+
+ // Make the upcall if required.
+ if (owner)
+ {
+ boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
+ boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
+ }
+ }
+
+private:
+ Handler handler_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP

Modified: branches/release/boost/asio/detail/reactive_socket_send_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_send_op.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_send_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -71,10 +71,10 @@
 
   reactive_socket_send_op(socket_type socket,
       const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler handler)
+ socket_base::message_flags flags, Handler& handler)
     : reactive_socket_send_op_base<ConstBufferSequence>(socket,
         buffers, flags, &reactive_socket_send_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -85,6 +85,8 @@
     reactive_socket_send_op* o(static_cast<reactive_socket_send_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -100,7 +102,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/reactive_socket_sendto_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_sendto_op.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_sendto_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -74,10 +74,10 @@
 
   reactive_socket_sendto_op(socket_type socket,
       const ConstBufferSequence& buffers, const Endpoint& endpoint,
- socket_base::message_flags flags, Handler handler)
+ socket_base::message_flags flags, Handler& handler)
     : reactive_socket_sendto_op_base<ConstBufferSequence, Endpoint>(socket,
         buffers, endpoint, flags, &reactive_socket_sendto_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -88,6 +88,8 @@
     reactive_socket_sendto_op* o(static_cast<reactive_socket_sendto_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -103,7 +105,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/reactive_socket_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_service.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -56,7 +56,7 @@
   typedef typename Protocol::endpoint endpoint_type;
 
   // The native type of a socket.
- typedef socket_type native_type;
+ typedef socket_type native_handle_type;
 
   // The implementation type of the socket.
   struct implementation_type :
@@ -78,6 +78,27 @@
   {
   }
 
+ // Move-construct a new socket implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ this->base_move_construct(impl, other_impl);
+
+ impl.protocol_ = other_impl.protocol_;
+ other_impl.protocol_ = endpoint_type().protocol();
+ }
+
+ // Move-assign from another socket implementation.
+ void move_assign(implementation_type& impl,
+ reactive_socket_service_base& other_service,
+ implementation_type& other_impl)
+ {
+ this->base_move_assign(impl, other_service, other_impl);
+
+ impl.protocol_ = other_impl.protocol_;
+ other_impl.protocol_ = endpoint_type().protocol();
+ }
+
   // Open a new socket implementation.
   boost::system::error_code open(implementation_type& impl,
       const protocol_type& protocol, boost::system::error_code& ec)
@@ -90,7 +111,7 @@
 
   // Assign a native socket to a socket implementation.
   boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_type& native_socket,
+ const protocol_type& protocol, const native_handle_type& native_socket,
       boost::system::error_code& ec)
   {
     if (!do_assign(impl, protocol.type(), native_socket, ec))
@@ -99,7 +120,7 @@
   }
 
   // Get the native socket representation.
- native_type native(implementation_type& impl)
+ native_handle_type native_handle(implementation_type& impl)
   {
     return impl.socket_;
   }
@@ -204,6 +225,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to"));
+
     start_op(impl, reactor::write_op, p.p, true, false);
     p.v = p.p = 0;
   }
@@ -220,6 +243,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_send_to(null_buffers)"));
+
     start_op(impl, reactor::write_op, p.p, false, false);
     p.v = p.p = 0;
   }
@@ -274,10 +300,13 @@
     typename op::ptr p = { boost::addressof(handler),
       boost_asio_handler_alloc_helpers::allocate(
         sizeof(op), handler), 0 };
- int protocol_type = impl.protocol_.type();
- p.p = new (p.v) op(impl.socket_, protocol_type,
+ int protocol = impl.protocol_.type();
+ p.p = new (p.v) op(impl.socket_, protocol,
         buffers, sender_endpoint, flags, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_receive_from"));
+
     start_op(impl,
         (flags & socket_base::message_out_of_band)
           ? reactor::except_op : reactor::read_op,
@@ -298,6 +327,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_receive_from(null_buffers)"));
+
     // Reset endpoint since it can be given no sensible value at this time.
     sender_endpoint = endpoint_type();
 
@@ -351,6 +383,8 @@
     p.p = new (p.v) op(impl.socket_, impl.state_, peer,
         impl.protocol_, peer_endpoint, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept"));
+
     start_accept_op(impl, p.p, peer.is_open());
     p.v = p.p = 0;
   }
@@ -376,6 +410,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.socket_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect"));
+
     start_connect_op(impl, p.p, peer_endpoint.data(), peer_endpoint.size());
     p.v = p.p = 0;
   }

Modified: branches/release/boost/asio/detail/reactive_socket_service_base.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_socket_service_base.hpp (original)
+++ branches/release/boost/asio/detail/reactive_socket_service_base.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -27,6 +27,7 @@
 #include <boost/asio/detail/buffer_sequence_adapter.hpp>
 #include <boost/asio/detail/reactive_null_buffers_op.hpp>
 #include <boost/asio/detail/reactive_socket_recv_op.hpp>
+#include <boost/asio/detail/reactive_socket_recvmsg_op.hpp>
 #include <boost/asio/detail/reactive_socket_send_op.hpp>
 #include <boost/asio/detail/reactor.hpp>
 #include <boost/asio/detail/reactor_op.hpp>
@@ -44,7 +45,7 @@
 {
 public:
   // The native type of a socket.
- typedef socket_type native_type;
+ typedef socket_type native_handle_type;
 
   // The implementation type of the socket.
   struct base_implementation_type
@@ -69,6 +70,15 @@
   // Construct a new socket implementation.
   BOOST_ASIO_DECL void construct(base_implementation_type& impl);
 
+ // Move-construct a new socket implementation.
+ BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl,
+ base_implementation_type& other_impl);
+
+ // Move-assign from another socket implementation.
+ BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl,
+ reactive_socket_service_base& other_service,
+ base_implementation_type& other_impl);
+
   // Destroy a socket implementation.
   BOOST_ASIO_DECL void destroy(base_implementation_type& impl);
 
@@ -83,7 +93,7 @@
       base_implementation_type& impl, boost::system::error_code& ec);
 
   // Get the native socket representation.
- native_type native(base_implementation_type& impl)
+ native_handle_type native_handle(base_implementation_type& impl)
   {
     return impl.socket_;
   }
@@ -124,7 +134,35 @@
     return ec;
   }
 
- /// Disable sends or receives on the socket.
+ // Gets the non-blocking mode of the socket.
+ bool non_blocking(const base_implementation_type& impl) const
+ {
+ return (impl.state_ & socket_ops::user_set_non_blocking) != 0;
+ }
+
+ // Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(base_implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ socket_ops::set_user_non_blocking(impl.socket_, impl.state_, mode, ec);
+ return ec;
+ }
+
+ // Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const base_implementation_type& impl) const
+ {
+ return (impl.state_ & socket_ops::internal_non_blocking) != 0;
+ }
+
+ // Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(base_implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ socket_ops::set_internal_non_blocking(impl.socket_, impl.state_, mode, ec);
+ return ec;
+ }
+
+ // Disable sends or receives on the socket.
   boost::system::error_code shutdown(base_implementation_type& impl,
       socket_base::shutdown_type what, boost::system::error_code& ec)
   {
@@ -169,6 +207,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.socket_, buffers, flags, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send"));
+
     start_op(impl, reactor::write_op, p.p, true,
         ((impl.state_ & socket_ops::stream_oriented)
           && buffer_sequence_adapter<boost::asio::const_buffer,
@@ -188,6 +228,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_send(null_buffers)"));
+
     start_op(impl, reactor::write_op, p.p, false, false);
     p.v = p.p = 0;
   }
@@ -229,6 +272,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive"));
+
     start_op(impl,
         (flags & socket_base::message_out_of_band)
           ? reactor::except_op : reactor::read_op,
@@ -251,6 +296,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_receive(null_buffers)"));
+
     start_op(impl,
         (flags & socket_base::message_out_of_band)
           ? reactor::except_op : reactor::read_op,
@@ -258,6 +306,87 @@
     p.v = p.p = 0;
   }
 
+ // Receive some data with associated flags. Returns the number of bytes
+ // received.
+ template <typename MutableBufferSequence>
+ size_t receive_with_flags(base_implementation_type& impl,
+ const MutableBufferSequence& buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, boost::system::error_code& ec)
+ {
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence> bufs(buffers);
+
+ return socket_ops::sync_recvmsg(impl.socket_, impl.state_,
+ bufs.buffers(), bufs.count(), in_flags, out_flags, ec);
+ }
+
+ // Wait until data can be received without blocking.
+ size_t receive_with_flags(base_implementation_type& impl,
+ const null_buffers&, socket_base::message_flags,
+ socket_base::message_flags& out_flags, boost::system::error_code& ec)
+ {
+ // Wait for socket to become ready.
+ socket_ops::poll_read(impl.socket_, ec);
+
+ // Clear out_flags, since we cannot give it any other sensible value when
+ // performing a null_buffers operation.
+ out_flags = 0;
+
+ return 0;
+ }
+
+ // Start an asynchronous receive. The buffer for the data being received
+ // must be valid for the lifetime of the asynchronous operation.
+ template <typename MutableBufferSequence, typename Handler>
+ void async_receive_with_flags(base_implementation_type& impl,
+ const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, Handler handler)
+ {
+ // Allocate and construct an operation to wrap the handler.
+ typedef reactive_socket_recvmsg_op<MutableBufferSequence, Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(impl.socket_, buffers, in_flags, out_flags, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_receive_with_flags"));
+
+ start_op(impl,
+ (in_flags & socket_base::message_out_of_band)
+ ? reactor::except_op : reactor::read_op,
+ p.p, (in_flags & socket_base::message_out_of_band) == 0, false);
+ p.v = p.p = 0;
+ }
+
+ // Wait until data can be received without blocking.
+ template <typename Handler>
+ void async_receive_with_flags(base_implementation_type& impl,
+ const null_buffers&, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, Handler handler)
+ {
+ // Allocate and construct an operation to wrap the handler.
+ typedef reactive_null_buffers_op<Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl,
+ "async_receive_with_flags(null_buffers)"));
+
+ // Clear out_flags, since we cannot give it any other sensible value when
+ // performing a null_buffers operation.
+ out_flags = 0;
+
+ start_op(impl,
+ (in_flags & socket_base::message_out_of_band)
+ ? reactor::except_op : reactor::read_op,
+ p.p, false, false);
+ p.v = p.p = 0;
+ }
+
 protected:
   // Open a new socket implementation.
   BOOST_ASIO_DECL boost::system::error_code do_open(
@@ -267,11 +396,11 @@
   // Assign a native socket to a socket implementation.
   BOOST_ASIO_DECL boost::system::error_code do_assign(
       base_implementation_type& impl, int type,
- const native_type& native_socket, boost::system::error_code& ec);
+ const native_handle_type& native_socket, boost::system::error_code& ec);
 
   // Start the asynchronous read or write operation.
   BOOST_ASIO_DECL void start_op(base_implementation_type& impl, int op_type,
- reactor_op* op, bool non_blocking, bool noop);
+ reactor_op* op, bool is_non_blocking, bool noop);
 
   // Start the asynchronous accept operation.
   BOOST_ASIO_DECL void start_accept_op(base_implementation_type& impl,

Modified: branches/release/boost/asio/detail/resolve_endpoint_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/resolve_endpoint_op.hpp (original)
+++ branches/release/boost/asio/detail/resolve_endpoint_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -43,12 +43,12 @@
   typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type;
 
   resolve_endpoint_op(socket_ops::weak_cancel_token_type cancel_token,
- const endpoint_type& endpoint, io_service_impl& ios, Handler handler)
+ const endpoint_type& endpoint, io_service_impl& ios, Handler& handler)
     : operation(&resolve_endpoint_op::do_complete),
       cancel_token_(cancel_token),
       endpoint_(endpoint),
       io_service_impl_(ios),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -81,6 +81,8 @@
       // The operation has been returned to the main io_service. The completion
       // handler is ready to be delivered.
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
       // Make a copy of the handler so that the memory can be deallocated
       // before the upcall is made. Even if we're not about to make an upcall,
       // a sub-object of the handler may be the true owner of the memory
@@ -95,7 +97,9 @@
       if (owner)
       {
         boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, "..."));
         boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
       }
     }
   }

Modified: branches/release/boost/asio/detail/resolve_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/resolve_op.hpp (original)
+++ branches/release/boost/asio/detail/resolve_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -44,12 +44,12 @@
   typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type;
 
   resolve_op(socket_ops::weak_cancel_token_type cancel_token,
- const query_type& query, io_service_impl& ios, Handler handler)
+ const query_type& query, io_service_impl& ios, Handler& handler)
     : operation(&resolve_op::do_complete),
       cancel_token_(cancel_token),
       query_(query),
       io_service_impl_(ios),
- handler_(handler),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
       addrinfo_(0)
   {
   }
@@ -86,6 +86,8 @@
       // The operation has been returned to the main io_service. The completion
       // handler is ready to be delivered.
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
       // Make a copy of the handler so that the memory can be deallocated
       // before the upcall is made. Even if we're not about to make an upcall,
       // a sub-object of the handler may be the true owner of the memory
@@ -105,7 +107,9 @@
       if (owner)
       {
         boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, "..."));
         boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
       }
     }
   }

Modified: branches/release/boost/asio/detail/resolver_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/resolver_service.hpp (original)
+++ branches/release/boost/asio/detail/resolver_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -67,8 +67,8 @@
 
   // Asynchronously resolve a query to a list of entries.
   template <typename Handler>
- void async_resolve(implementation_type& impl, const query_type& query,
- Handler handler)
+ void async_resolve(implementation_type& impl,
+ const query_type& query, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef resolve_op<Protocol, Handler> op;
@@ -77,6 +77,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl, query, io_service_impl_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve"));
+
     start_resolve_op(p.p);
     p.v = p.p = 0;
   }
@@ -97,8 +99,8 @@
 
   // Asynchronously resolve an endpoint to a list of entries.
   template <typename Handler>
- void async_resolve(implementation_type& impl, const endpoint_type& endpoint,
- Handler handler)
+ void async_resolve(implementation_type& impl,
+ const endpoint_type& endpoint, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef resolve_endpoint_op<Protocol, Handler> op;
@@ -107,6 +109,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl, endpoint, io_service_impl_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve"));
+
     start_resolve_op(p.p);
     p.v = p.p = 0;
   }

Modified: branches/release/boost/asio/detail/resolver_service_base.hpp
==============================================================================
--- branches/release/boost/asio/detail/resolver_service_base.hpp (original)
+++ branches/release/boost/asio/detail/resolver_service_base.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,7 +16,6 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <boost/scoped_ptr.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/detail/mutex.hpp>
@@ -24,6 +23,7 @@
 #include <boost/asio/detail/operation.hpp>
 #include <boost/asio/detail/socket_ops.hpp>
 #include <boost/asio/detail/socket_types.hpp>
+#include <boost/asio/detail/scoped_ptr.hpp>
 #include <boost/asio/detail/thread.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -48,6 +48,10 @@
   // Destroy all user-defined handler objects owned by the service.
   BOOST_ASIO_DECL void shutdown_service();
 
+ // Perform any fork-related housekeeping.
+ BOOST_ASIO_DECL void fork_service(
+ boost::asio::io_service::fork_event fork_ev);
+
   // Construct a new resolver implementation.
   BOOST_ASIO_DECL void construct(implementation_type& impl);
 
@@ -100,16 +104,16 @@
   boost::asio::detail::mutex mutex_;
 
   // Private io_service used for performing asynchronous host resolution.
- boost::scoped_ptr<boost::asio::io_service> work_io_service_;
+ boost::asio::detail::scoped_ptr<boost::asio::io_service> work_io_service_;
 
   // The work io_service implementation used to post completions.
   io_service_impl& work_io_service_impl_;
 
   // Work for the private io_service to perform.
- boost::scoped_ptr<boost::asio::io_service::work> work_;
+ boost::asio::detail::scoped_ptr<boost::asio::io_service::work> work_;
 
   // Thread used for running the work io_service's run loop.
- boost::scoped_ptr<boost::asio::detail::thread> work_thread_;
+ boost::asio::detail::scoped_ptr<boost::asio::detail::thread> work_thread_;
 };
 
 } // namespace detail

Added: branches/release/boost/asio/detail/scoped_ptr.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/scoped_ptr.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,81 @@
+//
+// detail/scoped_ptr.hpp
+// ~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_SCOPED_PTR_HPP
+#define BOOST_ASIO_DETAIL_SCOPED_PTR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename T>
+class scoped_ptr
+{
+public:
+ // Constructor.
+ explicit scoped_ptr(T* p = 0)
+ : p_(p)
+ {
+ }
+
+ // Destructor.
+ ~scoped_ptr()
+ {
+ delete p_;
+ }
+
+ // Access.
+ T* get()
+ {
+ return p_;
+ }
+
+ // Access.
+ T* operator->()
+ {
+ return p_;
+ }
+
+ // Dereference.
+ T& operator*()
+ {
+ return *p_;
+ }
+
+ // Reset pointer.
+ void reset(T* p = 0)
+ {
+ delete p_;
+ p_ = p;
+ }
+
+private:
+ // Disallow copying and assignment.
+ scoped_ptr(const scoped_ptr&);
+ scoped_ptr& operator=(const scoped_ptr&);
+
+ T* p_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_SCOPED_PTR_HPP

Modified: branches/release/boost/asio/detail/select_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/select_reactor.hpp (original)
+++ branches/release/boost/asio/detail/select_reactor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -22,6 +22,7 @@
       && !defined(BOOST_ASIO_HAS_EPOLL) \
       && !defined(BOOST_ASIO_HAS_KQUEUE))
 
+#include <boost/limits.hpp>
 #include <cstddef>
 #include <boost/asio/detail/mutex.hpp>
 #include <boost/asio/detail/op_queue.hpp>
@@ -72,6 +73,10 @@
   // Destroy all user-defined handler objects owned by the service.
   BOOST_ASIO_DECL void shutdown_service();
 
+ // Recreate internal descriptors following a fork.
+ BOOST_ASIO_DECL void fork_service(
+ boost::asio::io_service::fork_event fork_ev);
+
   // Initialise the task, but only if the reactor is not in its own thread.
   BOOST_ASIO_DECL void init_task();
 
@@ -79,6 +84,12 @@
   // code on failure.
   BOOST_ASIO_DECL int register_descriptor(socket_type, per_descriptor_data&);
 
+ // Register a descriptor with an associated single operation. Returns 0 on
+ // success, system error code on failure.
+ BOOST_ASIO_DECL int register_internal_descriptor(
+ int op_type, socket_type descriptor,
+ per_descriptor_data& descriptor_data, reactor_op* op);
+
   // Post a reactor operation for immediate completion.
   void post_immediate_completion(reactor_op* op)
   {
@@ -97,8 +108,17 @@
 
   // Cancel any operations that are running against the descriptor and remove
   // its registration from the reactor.
- BOOST_ASIO_DECL void close_descriptor(socket_type descriptor,
- per_descriptor_data&);
+ BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor,
+ per_descriptor_data&, bool closing);
+
+ // Remote the descriptor's registration from the reactor.
+ BOOST_ASIO_DECL void deregister_internal_descriptor(
+ socket_type descriptor, per_descriptor_data& descriptor_data);
+
+ // Move descriptor registration from one descriptor_data object to another.
+ BOOST_ASIO_DECL void move_descriptor(socket_type descriptor,
+ per_descriptor_data& target_descriptor_data,
+ per_descriptor_data& source_descriptor_data);
 
   // Add a new timer queue to the reactor.
   template <typename Time_Traits>
@@ -119,7 +139,8 @@
   // number of operations that have been posted or dispatched.
   template <typename Time_Traits>
   std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer);
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
 
   // Run select once until interrupted or events are ready to be dispatched.
   BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops);

Modified: branches/release/boost/asio/detail/service_registry.hpp
==============================================================================
--- branches/release/boost/asio/detail/service_registry.hpp (original)
+++ branches/release/boost/asio/detail/service_registry.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -58,6 +58,9 @@
   // Destructor.
   BOOST_ASIO_DECL ~service_registry();
 
+ // Notify all services of a fork event.
+ BOOST_ASIO_DECL void notify_fork(boost::asio::io_service::fork_event fork_ev);
+
   // Get the service object corresponding to the specified service type. Will
   // create a new service object automatically if no such object already
   // exists. Ownership of the service object is not transferred to the caller.

Modified: branches/release/boost/asio/detail/shared_ptr.hpp
==============================================================================
--- branches/release/boost/asio/detail/shared_ptr.hpp (original)
+++ branches/release/boost/asio/detail/shared_ptr.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,21 +17,21 @@
 
 #include <boost/asio/detail/config.hpp>
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 # include <memory>
-#else
+#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 # include <boost/shared_ptr.hpp>
-#endif
+#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 
 namespace boost {
 namespace asio {
 namespace detail {
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 using std::shared_ptr;
-#else
+#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 using boost::shared_ptr;
-#endif
+#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 
 } // namespace detail
 } // namespace asio

Added: branches/release/boost/asio/detail/signal_handler.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/signal_handler.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,82 @@
+//
+// detail/signal_handler.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP
+#define BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/signal_op.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename Handler>
+class signal_handler : public signal_op
+{
+public:
+ BOOST_ASIO_DEFINE_HANDLER_PTR(signal_handler);
+
+ signal_handler(Handler& h)
+ : signal_op(&signal_handler::do_complete),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
+ {
+ }
+
+ static void do_complete(io_service_impl* owner, operation* base,
+ boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/)
+ {
+ // Take ownership of the handler object.
+ signal_handler* h(static_cast<signal_handler*>(base));
+ ptr p = { boost::addressof(h->handler_), h, h };
+
+ BOOST_ASIO_HANDLER_COMPLETION((h));
+
+ // Make a copy of the handler so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the handler may be the true owner of the memory associated
+ // with the handler. Consequently, a local copy of the handler is required
+ // to ensure that any owning sub-object remains valid until after we have
+ // deallocated the memory here.
+ detail::binder2<Handler, boost::system::error_code, int>
+ handler(h->handler_, h->ec_, h->signal_number_);
+ p.h = boost::addressof(handler.handler_);
+ p.reset();
+
+ // Make the upcall if required.
+ if (owner)
+ {
+ boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
+ boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
+ }
+ }
+
+private:
+ Handler handler_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP

Added: branches/release/boost/asio/detail/signal_op.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/signal_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,51 @@
+//
+// detail/signal_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_SIGNAL_OP_HPP
+#define BOOST_ASIO_DETAIL_SIGNAL_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/operation.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class signal_op
+ : public operation
+{
+public:
+ // The error code to be passed to the completion handler.
+ boost::system::error_code ec_;
+
+ // The signal number to be passed to the completion handler.
+ int signal_number_;
+
+protected:
+ signal_op(func_type func)
+ : operation(func),
+ signal_number_(0)
+ {
+ }
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_SIGNAL_OP_HPP

Added: branches/release/boost/asio/detail/signal_set_service.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/signal_set_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,213 @@
+//
+// detail/signal_set_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP
+#define BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#include <csignal>
+#include <cstddef>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/op_queue.hpp>
+#include <boost/asio/detail/signal_handler.hpp>
+#include <boost/asio/detail/signal_op.hpp>
+#include <boost/asio/detail/socket_types.hpp>
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+# include <boost/asio/detail/reactor.hpp>
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+#if defined(NSIG) && (NSIG > 0)
+enum { max_signal_number = NSIG };
+#else
+enum { max_signal_number = 128 };
+#endif
+
+extern BOOST_ASIO_DECL struct signal_state* get_signal_state();
+
+extern "C" BOOST_ASIO_DECL void asio_signal_handler(int signal_number);
+
+class signal_set_service
+{
+public:
+ // Type used for tracking an individual signal registration.
+ class registration
+ {
+ public:
+ // Default constructor.
+ registration()
+ : signal_number_(0),
+ queue_(0),
+ undelivered_(0),
+ next_in_table_(0),
+ prev_in_table_(0),
+ next_in_set_(0)
+ {
+ }
+
+ private:
+ // Only this service will have access to the internal values.
+ friend class signal_set_service;
+
+ // The signal number that is registered.
+ int signal_number_;
+
+ // The waiting signal handlers.
+ op_queue<signal_op>* queue_;
+
+ // The number of undelivered signals.
+ std::size_t undelivered_;
+
+ // Pointers to adjacent registrations in the registrations_ table.
+ registration* next_in_table_;
+ registration* prev_in_table_;
+
+ // Link to next registration in the signal set.
+ registration* next_in_set_;
+ };
+
+ // The implementation type of the signal_set.
+ class implementation_type
+ {
+ public:
+ // Default constructor.
+ implementation_type()
+ : signals_(0)
+ {
+ }
+
+ private:
+ // Only this service will have access to the internal values.
+ friend class signal_set_service;
+
+ // The pending signal handlers.
+ op_queue<signal_op> queue_;
+
+ // Linked list of registered signals.
+ registration* signals_;
+ };
+
+ // Constructor.
+ BOOST_ASIO_DECL signal_set_service(boost::asio::io_service& io_service);
+
+ // Destructor.
+ BOOST_ASIO_DECL ~signal_set_service();
+
+ // Destroy all user-defined handler objects owned by the service.
+ BOOST_ASIO_DECL void shutdown_service();
+
+ // Perform fork-related housekeeping.
+ BOOST_ASIO_DECL void fork_service(
+ boost::asio::io_service::fork_event fork_ev);
+
+ // Construct a new signal_set implementation.
+ BOOST_ASIO_DECL void construct(implementation_type& impl);
+
+ // Destroy a signal_set implementation.
+ BOOST_ASIO_DECL void destroy(implementation_type& impl);
+
+ // Add a signal to a signal_set.
+ BOOST_ASIO_DECL boost::system::error_code add(implementation_type& impl,
+ int signal_number, boost::system::error_code& ec);
+
+ // Remove a signal to a signal_set.
+ BOOST_ASIO_DECL boost::system::error_code remove(implementation_type& impl,
+ int signal_number, boost::system::error_code& ec);
+
+ // Remove all signals from a signal_set.
+ BOOST_ASIO_DECL boost::system::error_code clear(implementation_type& impl,
+ boost::system::error_code& ec);
+
+ // Cancel all operations associated with the signal set.
+ BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl,
+ boost::system::error_code& ec);
+
+ // Start an asynchronous operation to wait for a signal to be delivered.
+ template <typename Handler>
+ void async_wait(implementation_type& impl, Handler handler)
+ {
+ // Allocate and construct an operation to wrap the handler.
+ typedef signal_handler<Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "signal_set", &impl, "async_wait"));
+
+ start_wait_op(impl, p.p);
+ p.v = p.p = 0;
+ }
+
+ // Deliver notification that a particular signal occurred.
+ BOOST_ASIO_DECL static void deliver_signal(int signal_number);
+
+private:
+ // Helper function to add a service to the global signal state.
+ BOOST_ASIO_DECL static void add_service(signal_set_service* service);
+
+ // Helper function to remove a service from the global signal state.
+ BOOST_ASIO_DECL static void remove_service(signal_set_service* service);
+
+ // Helper function to create the pipe descriptors.
+ BOOST_ASIO_DECL static void open_descriptors();
+
+ // Helper function to close the pipe descriptors.
+ BOOST_ASIO_DECL static void close_descriptors();
+
+ // Helper function to start a wait operation.
+ BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, signal_op* op);
+
+ // The io_service instance used for dispatching handlers.
+ io_service_impl& io_service_;
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ // The type used for registering for pipe reactor notifications.
+ class pipe_read_op;
+
+ // The reactor used for waiting for pipe readiness.
+ reactor& reactor_;
+
+ // The per-descriptor reactor data used for the pipe.
+ reactor::per_descriptor_data reactor_data_;
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+
+ // A mapping from signal number to the registered signal sets.
+ registration* registrations_[max_signal_number];
+
+ // Pointers to adjacent services in linked list.
+ signal_set_service* next_;
+ signal_set_service* prev_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/detail/impl/signal_set_service.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP

Modified: branches/release/boost/asio/detail/socket_ops.hpp
==============================================================================
--- branches/release/boost/asio/detail/socket_ops.hpp (original)
+++ branches/release/boost/asio/detail/socket_ops.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -51,7 +51,10 @@
   stream_oriented = 16,
 
   // The socket is datagram-oriented.
- datagram_oriented = 32
+ datagram_oriented = 32,
+
+ // The socket may have been dup()-ed.
+ possible_dup = 64
 };
 
 typedef unsigned char state_type;
@@ -88,8 +91,11 @@
 BOOST_ASIO_DECL int close(socket_type s, state_type& state,
     bool destruction, boost::system::error_code& ec);
 
+BOOST_ASIO_DECL bool set_user_non_blocking(socket_type s,
+ state_type& state, bool value, boost::system::error_code& ec);
+
 BOOST_ASIO_DECL bool set_internal_non_blocking(socket_type s,
- state_type& state, boost::system::error_code& ec);
+ state_type& state, bool value, boost::system::error_code& ec);
 
 BOOST_ASIO_DECL int shutdown(socket_type s,
     int what, boost::system::error_code& ec);
@@ -166,6 +172,27 @@
 
 #endif // defined(BOOST_ASIO_HAS_IOCP)
 
+BOOST_ASIO_DECL int recvmsg(socket_type s, buf* bufs, size_t count,
+ int in_flags, int& out_flags, boost::system::error_code& ec);
+
+BOOST_ASIO_DECL size_t sync_recvmsg(socket_type s, state_type state,
+ buf* bufs, size_t count, int in_flags, int& out_flags,
+ boost::system::error_code& ec);
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+
+BOOST_ASIO_DECL void complete_iocp_recvmsg(
+ const weak_cancel_token_type& cancel_token,
+ boost::system::error_code& ec);
+
+#else // defined(BOOST_ASIO_HAS_IOCP)
+
+BOOST_ASIO_DECL bool non_blocking_recvmsg(socket_type s,
+ buf* bufs, size_t count, int in_flags, int& out_flags,
+ boost::system::error_code& ec, size_t& bytes_transferred);
+
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
 BOOST_ASIO_DECL int send(socket_type s, const buf* bufs,
     size_t count, int flags, boost::system::error_code& ec);
 

Modified: branches/release/boost/asio/detail/socket_select_interrupter.hpp
==============================================================================
--- branches/release/boost/asio/detail/socket_select_interrupter.hpp (original)
+++ branches/release/boost/asio/detail/socket_select_interrupter.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -38,6 +38,9 @@
   // Destructor.
   BOOST_ASIO_DECL ~socket_select_interrupter();
 
+ // Recreate the interrupter's descriptors. Used after a fork.
+ BOOST_ASIO_DECL void recreate();
+
   // Interrupt the select call.
   BOOST_ASIO_DECL void interrupt();
 
@@ -51,6 +54,12 @@
   }
 
 private:
+ // Open the descriptors. Throws on error.
+ BOOST_ASIO_DECL void open_descriptors();
+
+ // Close the descriptors.
+ BOOST_ASIO_DECL void close_descriptors();
+
   // The read end of a connection used to interrupt the select call. This file
   // descriptor is passed to select such that when it is time to stop, a single
   // byte will be written on the other end of the connection and this

Modified: branches/release/boost/asio/detail/socket_types.hpp
==============================================================================
--- branches/release/boost/asio/detail/socket_types.hpp (original)
+++ branches/release/boost/asio/detail/socket_types.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -113,6 +113,7 @@
 const int message_peek = MSG_PEEK;
 const int message_out_of_band = MSG_OOB;
 const int message_do_not_route = MSG_DONTROUTE;
+const int message_end_of_record = 0; // Not supported on Windows.
 # if defined (_WIN32_WINNT)
 const int max_iov_len = 64;
 # else
@@ -156,6 +157,7 @@
 const int message_peek = MSG_PEEK;
 const int message_out_of_band = MSG_OOB;
 const int message_do_not_route = MSG_DONTROUTE;
+const int message_end_of_record = MSG_EOR;
 # if defined(IOV_MAX)
 const int max_iov_len = IOV_MAX;
 # else

Added: branches/release/boost/asio/detail/static_mutex.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/static_mutex.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,49 @@
+//
+// detail/static_mutex.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP
+#define BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS)
+# include <boost/asio/detail/null_static_mutex.hpp>
+#elif defined(BOOST_WINDOWS)
+# include <boost/asio/detail/win_static_mutex.hpp>
+#elif defined(BOOST_HAS_PTHREADS)
+# include <boost/asio/detail/posix_static_mutex.hpp>
+#else
+# error Only Windows and POSIX are supported!
+#endif
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS)
+typedef null_static_mutex static_mutex;
+# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_NULL_STATIC_MUTEX_INIT
+#elif defined(BOOST_WINDOWS)
+typedef win_static_mutex static_mutex;
+# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_WIN_STATIC_MUTEX_INIT
+#elif defined(BOOST_HAS_PTHREADS)
+typedef posix_static_mutex static_mutex;
+# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_POSIX_STATIC_MUTEX_INIT
+#endif
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#endif // BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP

Modified: branches/release/boost/asio/detail/strand_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/strand_service.hpp (original)
+++ branches/release/boost/asio/detail/strand_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,11 +16,11 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <boost/scoped_ptr.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/detail/mutex.hpp>
 #include <boost/asio/detail/op_queue.hpp>
 #include <boost/asio/detail/operation.hpp>
+#include <boost/asio/detail/scoped_ptr.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -87,6 +87,13 @@
   void post(implementation_type& impl, Handler handler);
 
 private:
+ // Helper function to dispatch a handler. Returns true if the handler should
+ // be dispatched immediately.
+ BOOST_ASIO_DECL bool do_dispatch(implementation_type& impl, operation* op);
+
+ // Helper fiunction to post a handler.
+ BOOST_ASIO_DECL void do_post(implementation_type& impl, operation* op);
+
   BOOST_ASIO_DECL static void do_complete(io_service_impl* owner,
       operation* base, boost::system::error_code ec,
       std::size_t bytes_transferred);
@@ -100,8 +107,8 @@
   // Number of implementations shared between all strand objects.
   enum { num_implementations = 193 };
 
- // The head of a linked list of all implementations.
- boost::scoped_ptr<strand_impl> implementations_[num_implementations];
+ // Pool of implementations.
+ scoped_ptr<strand_impl> implementations_[num_implementations];
 
   // Extra value used when hashing to prevent recycled memory locations from
   // getting the same strand implementation.

Modified: branches/release/boost/asio/detail/task_io_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/task_io_service.hpp (original)
+++ branches/release/boost/asio/detail/task_io_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,9 +19,9 @@
 
 #if !defined(BOOST_ASIO_HAS_IOCP)
 
-#include <boost/detail/atomic_count.hpp>
 #include <boost/system/error_code.hpp>
 #include <boost/asio/io_service.hpp>
+#include <boost/asio/detail/atomic_count.hpp>
 #include <boost/asio/detail/mutex.hpp>
 #include <boost/asio/detail/op_queue.hpp>
 #include <boost/asio/detail/reactor_fwd.hpp>
@@ -67,6 +67,9 @@
   // Interrupt the event processing loop.
   BOOST_ASIO_DECL void stop();
 
+ // Determine whether the io_service is stopped.
+ BOOST_ASIO_DECL bool stopped() const;
+
   // Reset in preparation for a subsequent run invocation.
   BOOST_ASIO_DECL void reset();
 
@@ -103,6 +106,10 @@
   // that work_started() was previously called for each operation.
   BOOST_ASIO_DECL void post_deferred_completions(op_queue<operation>& ops);
 
+ // Process unfinished operations as part of a shutdown_service operation.
+ // Assumes that work_started() was previously called for the operations.
+ BOOST_ASIO_DECL void abandon_operations(op_queue<operation>& ops);
+
 private:
   // Structure containing information about an idle thread.
   struct idle_thread_info;
@@ -132,7 +139,7 @@
   struct work_finished_on_block_exit;
 
   // Mutex to protect access to internal data.
- mutex mutex_;
+ mutable mutex mutex_;
 
   // The task to be run by this service.
   reactor* task_;
@@ -147,7 +154,7 @@
   bool task_interrupted_;
 
   // The count of unfinished work.
- boost::detail::atomic_count outstanding_work_;
+ atomic_count outstanding_work_;
 
   // The queue of handlers that are ready to be delivered.
   op_queue<operation> op_queue_;

Modified: branches/release/boost/asio/detail/task_io_service_operation.hpp
==============================================================================
--- branches/release/boost/asio/detail/task_io_service_operation.hpp (original)
+++ branches/release/boost/asio/detail/task_io_service_operation.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,6 +16,7 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/system/error_code.hpp>
+#include <boost/asio/detail/handler_tracking.hpp>
 #include <boost/asio/detail/op_queue.hpp>
 #include <boost/asio/detail/task_io_service_fwd.hpp>
 
@@ -27,7 +28,7 @@
 
 // Base class for all operations. A function pointer is used instead of virtual
 // functions to avoid the associated overhead.
-class task_io_service_operation
+class task_io_service_operation BOOST_ASIO_INHERIT_TRACKED_HANDLER
 {
 public:
   void complete(task_io_service& owner)

Modified: branches/release/boost/asio/detail/timer_queue.hpp
==============================================================================
--- branches/release/boost/asio/detail/timer_queue.hpp (original)
+++ branches/release/boost/asio/detail/timer_queue.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -183,20 +183,23 @@
     heap_.clear();
   }
 
- // Cancel and dequeue the timers with the given token.
- std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops)
+ // Cancel and dequeue operations for the given timer.
+ std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)())
   {
     std::size_t num_cancelled = 0;
     if (timer.prev_ != 0 || &timer == timers_)
     {
- while (timer_op* op = timer.op_queue_.front())
+ while (timer_op* op = (num_cancelled != max_cancelled)
+ ? timer.op_queue_.front() : 0)
       {
         op->ec_ = boost::asio::error::operation_aborted;
         timer.op_queue_.pop();
         ops.push(op);
         ++num_cancelled;
       }
- remove_timer(timer);
+ if (timer.op_queue_.empty())
+ remove_timer(timer);
     }
     return num_cancelled;
   }
@@ -354,9 +357,10 @@
   // Dequeue all timers.
   BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops);
 
- // Cancel and dequeue the timers with the given token.
+ // Cancel and dequeue operations for the given timer.
   BOOST_ASIO_DECL std::size_t cancel_timer(
- per_timer_data& timer, op_queue<operation>& ops);
+ per_timer_data& timer, op_queue<operation>& ops,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
 
 private:
   timer_queue<forwarding_posix_time_traits> impl_;

Modified: branches/release/boost/asio/detail/wait_handler.hpp
==============================================================================
--- branches/release/boost/asio/detail/wait_handler.hpp (original)
+++ branches/release/boost/asio/detail/wait_handler.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -33,9 +33,9 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(wait_handler);
 
- wait_handler(Handler h)
+ wait_handler(Handler& h)
     : timer_op(&wait_handler::do_complete),
- handler_(h)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
   {
   }
 
@@ -46,6 +46,8 @@
     wait_handler* h(static_cast<wait_handler*>(base));
     ptr p = { boost::addressof(h->handler_), h, h };
 
+ BOOST_ASIO_HANDLER_COMPLETION((h));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -61,7 +63,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/weak_ptr.hpp
==============================================================================
--- branches/release/boost/asio/detail/weak_ptr.hpp (original)
+++ branches/release/boost/asio/detail/weak_ptr.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,23 +16,22 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <boost/version.hpp>
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 # include <memory>
-#else
+#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 # include <boost/weak_ptr.hpp>
-#endif
+#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 
 namespace boost {
 namespace asio {
 namespace detail {
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 using std::weak_ptr;
-#else
+#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 using boost::weak_ptr;
-#endif
+#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
 
 } // namespace detail
 } // namespace asio

Modified: branches/release/boost/asio/detail/win_iocp_handle_read_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_handle_read_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_handle_read_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -41,10 +41,11 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_read_op);
 
- win_iocp_handle_read_op(const MutableBufferSequence& buffers, Handler handler)
+ win_iocp_handle_read_op(
+ const MutableBufferSequence& buffers, Handler& handler)
     : operation(&win_iocp_handle_read_op::do_complete),
       buffers_(buffers),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -55,6 +56,8 @@
     win_iocp_handle_read_op* o(static_cast<win_iocp_handle_read_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
     if (owner)
     {
@@ -83,7 +86,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/win_iocp_handle_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_handle_service.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_handle_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -41,7 +41,7 @@
 {
 public:
   // The native type of a stream handle.
- typedef HANDLE native_type;
+ typedef HANDLE native_handle_type;
 
   // The implementation type of the stream handle.
   class implementation_type
@@ -61,7 +61,7 @@
     friend class win_iocp_handle_service;
 
     // The native stream handle representation.
- native_type handle_;
+ native_handle_type handle_;
 
     // The ID of the thread from which it is safe to cancel asynchronous
     // operations. 0 means no asynchronous operations have been started yet.
@@ -82,12 +82,21 @@
   // Construct a new handle implementation.
   BOOST_ASIO_DECL void construct(implementation_type& impl);
 
+ // Move-construct a new handle implementation.
+ BOOST_ASIO_DECL void move_construct(implementation_type& impl,
+ implementation_type& other_impl);
+
+ // Move-assign from another handle implementation.
+ BOOST_ASIO_DECL void move_assign(implementation_type& impl,
+ win_iocp_handle_service& other_service,
+ implementation_type& other_impl);
+
   // Destroy a handle implementation.
   BOOST_ASIO_DECL void destroy(implementation_type& impl);
 
   // Assign a native handle to a handle implementation.
   BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl,
- const native_type& native_handle, boost::system::error_code& ec);
+ const native_handle_type& handle, boost::system::error_code& ec);
 
   // Determine whether the handle is open.
   bool is_open(const implementation_type& impl) const
@@ -100,7 +109,7 @@
       boost::system::error_code& ec);
 
   // Get the native handle representation.
- native_type native(const implementation_type& impl) const
+ native_handle_type native_handle(const implementation_type& impl) const
   {
     return impl.handle_;
   }
@@ -136,7 +145,19 @@
   void async_write_some(implementation_type& impl,
       const ConstBufferSequence& buffers, Handler handler)
   {
- async_write_some_at(impl, 0, buffers, handler);
+ // Allocate and construct an operation to wrap the handler.
+ typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(buffers, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some"));
+
+ start_write_op(impl, 0,
+ buffer_sequence_adapter<boost::asio::const_buffer,
+ ConstBufferSequence>::first(buffers), p.p);
+ p.v = p.p = 0;
   }
 
   // Start an asynchronous write at a specified offset. The data being written
@@ -152,6 +173,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some_at"));
+
     start_write_op(impl, offset,
         buffer_sequence_adapter<boost::asio::const_buffer,
           ConstBufferSequence>::first(buffers), p.p);
@@ -184,7 +207,19 @@
   void async_read_some(implementation_type& impl,
       const MutableBufferSequence& buffers, Handler handler)
   {
- async_read_some_at(impl, 0, buffers, handler);
+ // Allocate and construct an operation to wrap the handler.
+ typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(buffers, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some"));
+
+ start_read_op(impl, 0,
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence>::first(buffers), p.p);
+ p.v = p.p = 0;
   }
 
   // Start an asynchronous read at a specified offset. The buffer for the data
@@ -201,6 +236,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some_at"));
+
     start_read_op(impl, offset,
         buffer_sequence_adapter<boost::asio::mutable_buffer,
           MutableBufferSequence>::first(buffers), p.p);

Modified: branches/release/boost/asio/detail/win_iocp_handle_write_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_handle_write_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_handle_write_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -41,10 +41,10 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_write_op);
 
- win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler handler)
+ win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler& handler)
     : operation(&win_iocp_handle_write_op::do_complete),
       buffers_(buffers),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -55,6 +55,8 @@
     win_iocp_handle_write_op* o(static_cast<win_iocp_handle_write_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
     if (owner)
     {
@@ -79,7 +81,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/win_iocp_io_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_io_service.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_io_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,10 +19,11 @@
 
 #if defined(BOOST_ASIO_HAS_IOCP)
 
-#include <boost/scoped_ptr.hpp>
+#include <boost/limits.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/detail/mutex.hpp>
 #include <boost/asio/detail/op_queue.hpp>
+#include <boost/asio/detail/scoped_ptr.hpp>
 #include <boost/asio/detail/socket_types.hpp>
 #include <boost/asio/detail/timer_op.hpp>
 #include <boost/asio/detail/timer_queue_base.hpp>
@@ -76,6 +77,12 @@
   // Stop the event processing loop.
   BOOST_ASIO_DECL void stop();
 
+ // Determine whether the io_service is stopped.
+ bool stopped() const
+ {
+ return ::InterlockedExchangeAdd(&stopped_, 0) != 0;
+ }
+
   // Reset in preparation for a subsequent run invocation.
   void reset()
   {
@@ -120,6 +127,10 @@
   BOOST_ASIO_DECL void post_deferred_completions(
       op_queue<win_iocp_operation>& ops);
 
+ // Process unfinished operations as part of a shutdown_service operation.
+ // Assumes that work_started() was previously called for the operations.
+ BOOST_ASIO_DECL void abandon_operations(op_queue<operation>& ops);
+
   // Called after starting an overlapped I/O operation that did not complete
   // immediately. The caller must have already called work_started() prior to
   // starting the operation.
@@ -156,7 +167,8 @@
   // handlers that have been posted or dispatched.
   template <typename Time_Traits>
   std::size_t cancel_timer(timer_queue<Time_Traits>& queue,
- typename timer_queue<Time_Traits>::per_timer_data& timer);
+ typename timer_queue<Time_Traits>::per_timer_data& timer,
+ std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
 
 private:
 #if defined(WINVER) && (WINVER < 0x0500)
@@ -199,7 +211,7 @@
   long outstanding_work_;
 
   // Flag to indicate whether the event loop has been stopped.
- long stopped_;
+ mutable long stopped_;
 
   // Flag to indicate whether the service has been shut down.
   long shutdown_;
@@ -233,7 +245,7 @@
   friend struct timer_thread_function;
 
   // Background thread used for processing timeouts.
- boost::scoped_ptr<thread> timer_thread_;
+ scoped_ptr<thread> timer_thread_;
 
   // A waitable timer object used for waiting for timeouts.
   auto_handle waitable_timer_;

Modified: branches/release/boost/asio/detail/win_iocp_null_buffers_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_null_buffers_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_null_buffers_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -42,11 +42,11 @@
   BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_null_buffers_op);
 
   win_iocp_null_buffers_op(socket_ops::weak_cancel_token_type cancel_token,
- Handler handler)
+ Handler& handler)
     : reactor_op(&win_iocp_null_buffers_op::do_perform,
         &win_iocp_null_buffers_op::do_complete),
       cancel_token_(cancel_token),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -62,6 +62,8 @@
     win_iocp_null_buffers_op* o(static_cast<win_iocp_null_buffers_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // The reactor may have stored a result in the operation object.
     if (o->ec_)
       ec = o->ec_;
@@ -94,7 +96,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/win_iocp_operation.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_operation.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_operation.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,6 +19,7 @@
 
 #if defined(BOOST_ASIO_HAS_IOCP)
 
+#include <boost/asio/detail/handler_tracking.hpp>
 #include <boost/asio/detail/op_queue.hpp>
 #include <boost/asio/detail/win_iocp_io_service_fwd.hpp>
 #include <boost/system/error_code.hpp>
@@ -33,6 +34,7 @@
 // functions to avoid the associated overhead.
 class win_iocp_operation
   : public OVERLAPPED
+ BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER
 {
 public:
   void complete(win_iocp_io_service& owner,

Modified: branches/release/boost/asio/detail/win_iocp_overlapped_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_overlapped_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_overlapped_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -39,9 +39,9 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_overlapped_op);
 
- win_iocp_overlapped_op(Handler handler)
+ win_iocp_overlapped_op(Handler& handler)
     : operation(&win_iocp_overlapped_op::do_complete),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -52,6 +52,8 @@
     win_iocp_overlapped_op* o(static_cast<win_iocp_overlapped_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -67,7 +69,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_overlapped_ptr.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -47,11 +47,11 @@
   // Construct an win_iocp_overlapped_ptr to contain the specified handler.
   template <typename Handler>
   explicit win_iocp_overlapped_ptr(
- boost::asio::io_service& io_service, Handler handler)
+ boost::asio::io_service& io_service, BOOST_ASIO_MOVE_ARG(Handler) handler)
     : ptr_(0),
       iocp_service_(0)
   {
- this->reset(io_service, handler);
+ this->reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler));
   }
 
   // Destructor automatically frees the OVERLAPPED object unless released.
@@ -82,6 +82,10 @@
       boost_asio_handler_alloc_helpers::allocate(
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "io_service",
+ &io_service.impl_, "overlapped"));
+
     io_service.impl_.work_started();
     reset();
     ptr_ = p.p;

Modified: branches/release/boost/asio/detail/win_iocp_serial_port_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_serial_port_service.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_serial_port_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -36,7 +36,7 @@
 {
 public:
   // The native type of a serial port.
- typedef win_iocp_handle_service::native_type native_type;
+ typedef win_iocp_handle_service::native_handle_type native_handle_type;
 
   // The implementation type of the serial port.
   typedef win_iocp_handle_service::implementation_type implementation_type;
@@ -54,6 +54,22 @@
     handle_service_.construct(impl);
   }
 
+ // Move-construct a new serial port implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ handle_service_.move_construct(impl, other_impl);
+ }
+
+ // Move-assign from another serial port implementation.
+ void move_assign(implementation_type& impl,
+ win_iocp_serial_port_service& other_service,
+ implementation_type& other_impl)
+ {
+ handle_service_.move_assign(impl,
+ other_service.handle_service_, other_impl);
+ }
+
   // Destroy a serial port implementation.
   void destroy(implementation_type& impl)
   {
@@ -66,9 +82,9 @@
 
   // Assign a native handle to a serial port implementation.
   boost::system::error_code assign(implementation_type& impl,
- const native_type& native_handle, boost::system::error_code& ec)
+ const native_handle_type& handle, boost::system::error_code& ec)
   {
- return handle_service_.assign(impl, native_handle, ec);
+ return handle_service_.assign(impl, handle, ec);
   }
 
   // Determine whether the serial port is open.
@@ -85,9 +101,9 @@
   }
 
   // Get the native serial port representation.
- native_type native(implementation_type& impl)
+ native_handle_type native_handle(implementation_type& impl)
   {
- return handle_service_.native(impl);
+ return handle_service_.native_handle(impl);
   }
 
   // Cancel all operations associated with the handle.

Modified: branches/release/boost/asio/detail/win_iocp_socket_accept_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_socket_accept_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_socket_accept_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -45,7 +45,7 @@
   win_iocp_socket_accept_op(win_iocp_socket_service_base& socket_service,
       socket_type socket, Socket& peer, const Protocol& protocol,
       typename Protocol::endpoint* peer_endpoint,
- bool enable_connection_aborted, Handler handler)
+ bool enable_connection_aborted, Handler& handler)
     : operation(&win_iocp_socket_accept_op::do_complete),
       socket_service_(socket_service),
       socket_(socket),
@@ -53,7 +53,7 @@
       protocol_(protocol),
       peer_endpoint_(peer_endpoint),
       enable_connection_aborted_(enable_connection_aborted),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -107,7 +107,7 @@
       if (!ec)
       {
         o->peer_.assign(o->protocol_,
- typename Socket::native_type(
+ typename Socket::native_handle_type(
               o->new_socket_.get(), peer_endpoint), ec);
         if (!ec)
           o->new_socket_.release();
@@ -118,6 +118,8 @@
         *o->peer_endpoint_ = peer_endpoint;
     }
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
     // Make a copy of the handler so that the memory can be deallocated before
     // the upcall is made. Even if we're not about to make an upcall, a
     // sub-object of the handler may be the true owner of the memory associated
@@ -133,7 +135,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/win_iocp_socket_recv_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_socket_recv_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_socket_recv_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -43,12 +43,12 @@
 
   win_iocp_socket_recv_op(socket_ops::state_type state,
       socket_ops::weak_cancel_token_type cancel_token,
- const MutableBufferSequence& buffers, Handler handler)
+ const MutableBufferSequence& buffers, Handler& handler)
     : operation(&win_iocp_socket_recv_op::do_complete),
       state_(state),
       cancel_token_(cancel_token),
       buffers_(buffers),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -59,6 +59,8 @@
     win_iocp_socket_recv_op* o(static_cast<win_iocp_socket_recv_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
     // Check whether buffers are still valid.
     if (owner)
@@ -88,7 +90,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -43,13 +43,13 @@
 
   win_iocp_socket_recvfrom_op(Endpoint& endpoint,
       socket_ops::weak_cancel_token_type cancel_token,
- const MutableBufferSequence& buffers, Handler handler)
+ const MutableBufferSequence& buffers, Handler& handler)
     : operation(&win_iocp_socket_recvfrom_op::do_complete),
       endpoint_(endpoint),
       endpoint_size_(static_cast<int>(endpoint.capacity())),
       cancel_token_(cancel_token),
       buffers_(buffers),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -66,6 +66,8 @@
         static_cast<win_iocp_socket_recvfrom_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
     // Check whether buffers are still valid.
     if (owner)
@@ -95,7 +97,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Added: branches/release/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,115 @@
+//
+// detail/win_iocp_socket_recvmsg_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP
+#define BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+
+#include <boost/utility/addressof.hpp>
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+#include <boost/asio/detail/fenced_block.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/operation.hpp>
+#include <boost/asio/detail/socket_ops.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/socket_base.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename MutableBufferSequence, typename Handler>
+class win_iocp_socket_recvmsg_op : public operation
+{
+public:
+ BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_recvmsg_op);
+
+ win_iocp_socket_recvmsg_op(
+ socket_ops::weak_cancel_token_type cancel_token,
+ const MutableBufferSequence& buffers,
+ socket_base::message_flags& out_flags, Handler& handler)
+ : operation(&win_iocp_socket_recvmsg_op::do_complete),
+ cancel_token_(cancel_token),
+ buffers_(buffers),
+ out_flags_(out_flags),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
+ static void do_complete(io_service_impl* owner, operation* base,
+ boost::system::error_code ec, std::size_t bytes_transferred)
+ {
+ // Take ownership of the operation object.
+ win_iocp_socket_recvmsg_op* o(
+ static_cast<win_iocp_socket_recvmsg_op*>(base));
+ ptr p = { boost::addressof(o->handler_), o, o };
+
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
+#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+ // Check whether buffers are still valid.
+ if (owner)
+ {
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence>::validate(o->buffers_);
+ }
+#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
+
+ socket_ops::complete_iocp_recvmsg(o->cancel_token_, ec);
+ o->out_flags_ = 0;
+
+ // Make a copy of the handler so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the handler may be the true owner of the memory associated
+ // with the handler. Consequently, a local copy of the handler is required
+ // to ensure that any owning sub-object remains valid until after we have
+ // deallocated the memory here.
+ detail::binder2<Handler, boost::system::error_code, std::size_t>
+ handler(o->handler_, ec, bytes_transferred);
+ p.h = boost::addressof(handler.handler_);
+ p.reset();
+
+ // Make the upcall if required.
+ if (owner)
+ {
+ boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
+ boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
+ }
+ }
+
+private:
+ socket_ops::weak_cancel_token_type cancel_token_;
+ MutableBufferSequence buffers_;
+ socket_base::message_flags& out_flags_;
+ Handler handler_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
+#endif // BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP

Modified: branches/release/boost/asio/detail/win_iocp_socket_send_op.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_socket_send_op.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_socket_send_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -42,11 +42,11 @@
   BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_send_op);
 
   win_iocp_socket_send_op(socket_ops::weak_cancel_token_type cancel_token,
- const ConstBufferSequence& buffers, Handler handler)
+ const ConstBufferSequence& buffers, Handler& handler)
     : operation(&win_iocp_socket_send_op::do_complete),
       cancel_token_(cancel_token),
       buffers_(buffers),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -57,6 +57,8 @@
     win_iocp_socket_send_op* o(static_cast<win_iocp_socket_send_op*>(base));
     ptr p = { boost::addressof(o->handler_), o, o };
 
+ BOOST_ASIO_HANDLER_COMPLETION((o));
+
 #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
     // Check whether buffers are still valid.
     if (owner)
@@ -83,7 +85,9 @@
     if (owner)
     {
       boost::asio::detail::fenced_block b;
+ BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
       boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
+ BOOST_ASIO_HANDLER_INVOCATION_END;
     }
   }
 

Modified: branches/release/boost/asio/detail/win_iocp_socket_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_socket_service.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_socket_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -61,16 +61,16 @@
   typedef typename Protocol::endpoint endpoint_type;
 
   // The native type of a socket.
- class native_type
+ class native_handle_type
   {
   public:
- native_type(socket_type s)
+ native_handle_type(socket_type s)
       : socket_(s),
         have_remote_endpoint_(false)
     {
     }
 
- native_type(socket_type s, const endpoint_type& ep)
+ native_handle_type(socket_type s, const endpoint_type& ep)
       : socket_(s),
         have_remote_endpoint_(true),
         remote_endpoint_(ep)
@@ -133,6 +133,39 @@
   {
   }
 
+ // Move-construct a new socket implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ this->base_move_construct(impl, other_impl);
+
+ impl.protocol_ = other_impl.protocol_;
+ other_impl.protocol_ = endpoint_type().protocol();
+
+ impl.have_remote_endpoint_ = other_impl.have_remote_endpoint_;
+ other_impl.have_remote_endpoint_ = false;
+
+ impl.remote_endpoint_ = other_impl.remote_endpoint_;
+ other_impl.remote_endpoint_ = endpoint_type();
+ }
+
+ // Move-assign from another socket implementation.
+ void move_assign(implementation_type& impl,
+ win_iocp_socket_service_base& other_service,
+ implementation_type& other_impl)
+ {
+ this->base_move_assign(impl, other_service, other_impl);
+
+ impl.protocol_ = other_impl.protocol_;
+ other_impl.protocol_ = endpoint_type().protocol();
+
+ impl.have_remote_endpoint_ = other_impl.have_remote_endpoint_;
+ other_impl.have_remote_endpoint_ = false;
+
+ impl.remote_endpoint_ = other_impl.remote_endpoint_;
+ other_impl.remote_endpoint_ = endpoint_type();
+ }
+
   // Open a new socket implementation.
   boost::system::error_code open(implementation_type& impl,
       const protocol_type& protocol, boost::system::error_code& ec)
@@ -149,7 +182,7 @@
 
   // Assign a native socket to a socket implementation.
   boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_type& native_socket,
+ const protocol_type& protocol, const native_handle_type& native_socket,
       boost::system::error_code& ec)
   {
     if (!do_assign(impl, protocol.type(), native_socket, ec))
@@ -162,11 +195,11 @@
   }
 
   // Get the native socket representation.
- native_type native(implementation_type& impl)
+ native_handle_type native_handle(implementation_type& impl)
   {
     if (impl.have_remote_endpoint_)
- return native_type(impl.socket_, impl.remote_endpoint_);
- return native_type(impl.socket_);
+ return native_handle_type(impl.socket_, impl.remote_endpoint_);
+ return native_handle_type(impl.socket_);
   }
 
   // Bind the socket to the specified local endpoint.
@@ -267,6 +300,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to"));
+
     buffer_sequence_adapter<boost::asio::const_buffer,
         ConstBufferSequence> bufs(buffers);
 
@@ -288,6 +323,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_send_to(null_buffers)"));
+
     start_reactor_op(impl, reactor::write_op, p.p);
     p.v = p.p = 0;
   }
@@ -344,6 +382,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(sender_endp, impl.cancel_token_, buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive_from"));
+
     buffer_sequence_adapter<boost::asio::mutable_buffer,
         MutableBufferSequence> bufs(buffers);
 
@@ -365,6 +405,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl,
+ "async_receive_from(null_buffers)"));
+
     // Reset endpoint since it can be given no sensible value at this time.
     sender_endpoint = endpoint_type();
 
@@ -417,6 +460,8 @@
     p.p = new (p.v) op(*this, impl.socket_, peer, impl.protocol_,
         peer_endpoint, enable_connection_aborted, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept"));
+
     start_accept_op(impl, peer.is_open(), p.p->new_socket(),
         impl.protocol_.family(), impl.protocol_.type(),
         impl.protocol_.protocol(), p.p->output_buffer(),
@@ -445,6 +490,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.socket_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect"));
+
     start_connect_op(impl, p.p, peer_endpoint.data(),
         static_cast<int>(peer_endpoint.size()));
     p.v = p.p = 0;

Modified: branches/release/boost/asio/detail/win_iocp_socket_service_base.hpp
==============================================================================
--- branches/release/boost/asio/detail/win_iocp_socket_service_base.hpp (original)
+++ branches/release/boost/asio/detail/win_iocp_socket_service_base.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -40,6 +40,7 @@
 #include <boost/asio/detail/win_iocp_null_buffers_op.hpp>
 #include <boost/asio/detail/win_iocp_socket_send_op.hpp>
 #include <boost/asio/detail/win_iocp_socket_recv_op.hpp>
+#include <boost/asio/detail/win_iocp_socket_recvmsg_op.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -93,6 +94,15 @@
   // Construct a new socket implementation.
   BOOST_ASIO_DECL void construct(base_implementation_type& impl);
 
+ // Move-construct a new socket implementation.
+ BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl,
+ base_implementation_type& other_impl);
+
+ // Move-assign from another socket implementation.
+ BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl,
+ win_iocp_socket_service_base& other_service,
+ base_implementation_type& other_impl);
+
   // Destroy a socket implementation.
   BOOST_ASIO_DECL void destroy(base_implementation_type& impl);
 
@@ -142,7 +152,35 @@
     return ec;
   }
 
- /// Disable sends or receives on the socket.
+ // Gets the non-blocking mode of the socket.
+ bool non_blocking(const base_implementation_type& impl) const
+ {
+ return (impl.state_ & socket_ops::user_set_non_blocking) != 0;
+ }
+
+ // Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(base_implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ socket_ops::set_user_non_blocking(impl.socket_, impl.state_, mode, ec);
+ return ec;
+ }
+
+ // Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const base_implementation_type& impl) const
+ {
+ return (impl.state_ & socket_ops::internal_non_blocking) != 0;
+ }
+
+ // Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(base_implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ socket_ops::set_internal_non_blocking(impl.socket_, impl.state_, mode, ec);
+ return ec;
+ }
+
+ // Disable sends or receives on the socket.
   boost::system::error_code shutdown(base_implementation_type& impl,
       socket_base::shutdown_type what, boost::system::error_code& ec)
   {
@@ -187,6 +225,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send"));
+
     buffer_sequence_adapter<boost::asio::const_buffer,
         ConstBufferSequence> bufs(buffers);
 
@@ -208,6 +248,9 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_send(null_buffers)"));
+
     start_reactor_op(impl, reactor::write_op, p.p);
     p.v = p.p = 0;
   }
@@ -249,6 +292,8 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.state_, impl.cancel_token_, buffers, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive"));
+
     buffer_sequence_adapter<boost::asio::mutable_buffer,
         MutableBufferSequence> bufs(buffers);
 
@@ -270,10 +315,90 @@
         sizeof(op), handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_receive(null_buffers)"));
+
     start_null_buffers_receive_op(impl, flags, p.p);
     p.v = p.p = 0;
   }
 
+ // Receive some data with associated flags. Returns the number of bytes
+ // received.
+ template <typename MutableBufferSequence>
+ size_t receive_with_flags(base_implementation_type& impl,
+ const MutableBufferSequence& buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, boost::system::error_code& ec)
+ {
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence> bufs(buffers);
+
+ return socket_ops::sync_recvmsg(impl.socket_, impl.state_,
+ bufs.buffers(), bufs.count(), in_flags, out_flags, ec);
+ }
+
+ // Wait until data can be received without blocking.
+ size_t receive_with_flags(base_implementation_type& impl,
+ const null_buffers&, socket_base::message_flags,
+ socket_base::message_flags& out_flags, boost::system::error_code& ec)
+ {
+ // Wait for socket to become ready.
+ socket_ops::poll_read(impl.socket_, ec);
+
+ // Clear out_flags, since we cannot give it any other sensible value when
+ // performing a null_buffers operation.
+ out_flags = 0;
+
+ return 0;
+ }
+
+ // Start an asynchronous receive. The buffer for the data being received
+ // must be valid for the lifetime of the asynchronous operation.
+ template <typename MutableBufferSequence, typename Handler>
+ void async_receive_with_flags(base_implementation_type& impl,
+ const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, Handler handler)
+ {
+ // Allocate and construct an operation to wrap the handler.
+ typedef win_iocp_socket_recvmsg_op<MutableBufferSequence, Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(impl.cancel_token_, buffers, out_flags, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket",
+ &impl, "async_receive_with_flags"));
+
+ buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence> bufs(buffers);
+
+ start_receive_op(impl, bufs.buffers(), bufs.count(), in_flags, false, p.p);
+ p.v = p.p = 0;
+ }
+
+ // Wait until data can be received without blocking.
+ template <typename Handler>
+ void async_receive_with_flags(base_implementation_type& impl,
+ const null_buffers&, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, Handler handler)
+ {
+ // Allocate and construct an operation to wrap the handler.
+ typedef win_iocp_null_buffers_op<Handler> op;
+ typename op::ptr p = { boost::addressof(handler),
+ boost_asio_handler_alloc_helpers::allocate(
+ sizeof(op), handler), 0 };
+ p.p = new (p.v) op(impl.cancel_token_, handler);
+
+ BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl,
+ "async_receive_with_flags(null_buffers)"));
+
+ // Reset out_flags since it can be given no sensible value at this time.
+ out_flags = 0;
+
+ start_null_buffers_receive_op(impl, in_flags, p.p);
+ p.v = p.p = 0;
+ }
+
   // Helper function to restart an asynchronous accept operation.
   BOOST_ASIO_DECL void restart_accept_op(socket_type s,
       socket_holder& new_socket, int family, int type, int protocol,

Added: branches/release/boost/asio/detail/win_static_mutex.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/detail/win_static_mutex.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,72 @@
+//
+// detail/win_static_mutex.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP
+#define BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_WINDOWS)
+
+#include <boost/asio/detail/scoped_lock.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+struct win_static_mutex
+{
+ typedef boost::asio::detail::scoped_lock<win_static_mutex> scoped_lock;
+
+ // Initialise the mutex.
+ BOOST_ASIO_DECL void init();
+
+ // Initialisation must be performed in a separate function to the "public"
+ // init() function since the compiler does not support the use of structured
+ // exceptions and C++ exceptions in the same function.
+ BOOST_ASIO_DECL int do_init();
+
+ // Lock the mutex.
+ void lock()
+ {
+ ::EnterCriticalSection(&crit_section_);
+ }
+
+ // Unlock the mutex.
+ void unlock()
+ {
+ ::LeaveCriticalSection(&crit_section_);
+ }
+
+ bool initialised_;
+ ::CRITICAL_SECTION crit_section_;
+};
+
+#define BOOST_ASIO_WIN_STATIC_MUTEX_INIT { false, { 0, 0, 0, 0, 0, 0 } }
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/detail/impl/win_static_mutex.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // defined(BOOST_WINDOWS)
+
+#endif // BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP

Modified: branches/release/boost/asio/detail/wince_thread.hpp
==============================================================================
--- branches/release/boost/asio/detail/wince_thread.hpp (original)
+++ branches/release/boost/asio/detail/wince_thread.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -39,7 +39,7 @@
 public:
   // Constructor.
   template <typename Function>
- wince_thread(Function f)
+ wince_thread(Function f, unsigned int = 0)
   {
     std::auto_ptr<func_base> arg(new func<Function>(f));
     DWORD thread_id = 0;

Modified: branches/release/boost/asio/detail/wrapped_handler.hpp
==============================================================================
--- branches/release/boost/asio/detail/wrapped_handler.hpp (original)
+++ branches/release/boost/asio/detail/wrapped_handler.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -31,12 +31,26 @@
 public:
   typedef void result_type;
 
- wrapped_handler(Dispatcher dispatcher, Handler handler)
+ wrapped_handler(Dispatcher dispatcher, Handler& handler)
     : dispatcher_(dispatcher),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ wrapped_handler(const wrapped_handler& other)
+ : dispatcher_(other.dispatcher_),
+ handler_(other.handler_)
+ {
+ }
+
+ wrapped_handler(wrapped_handler&& other)
+ : dispatcher_(other.dispatcher_),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   void operator()()
   {
     dispatcher_.dispatch(handler_);
@@ -126,11 +140,31 @@
 class rewrapped_handler
 {
 public:
+ explicit rewrapped_handler(Handler& handler, const Context& context)
+ : context_(context),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
   explicit rewrapped_handler(const Handler& handler, const Context& context)
- : handler_(handler),
- context_(context)
+ : context_(context),
+ handler_(handler)
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ rewrapped_handler(const rewrapped_handler& other)
+ : context_(other.context_),
+ handler_(other.handler_)
+ {
+ }
+
+ rewrapped_handler(rewrapped_handler&& other)
+ : context_(BOOST_ASIO_MOVE_CAST(Context)(other.context_)),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_))
   {
   }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
   void operator()()
   {
@@ -143,8 +177,8 @@
   }
 
 //private:
- Handler handler_;
   Context context_;
+ Handler handler_;
 };
 
 template <typename Dispatcher, typename Handler>
@@ -164,6 +198,15 @@
 }
 
 template <typename Function, typename Dispatcher, typename Handler>
+inline void asio_handler_invoke(Function& function,
+ wrapped_handler<Dispatcher, Handler>* this_handler)
+{
+ this_handler->dispatcher_.dispatch(
+ rewrapped_handler<Function, Handler>(
+ function, this_handler->handler_));
+}
+
+template <typename Function, typename Dispatcher, typename Handler>
 inline void asio_handler_invoke(const Function& function,
     wrapped_handler<Dispatcher, Handler>* this_handler)
 {
@@ -189,6 +232,14 @@
 }
 
 template <typename Function, typename Handler, typename Context>
+inline void asio_handler_invoke(Function& function,
+ rewrapped_handler<Handler, Context>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->context_);
+}
+
+template <typename Function, typename Handler, typename Context>
 inline void asio_handler_invoke(const Function& function,
     rewrapped_handler<Handler, Context>* this_handler)
 {

Modified: branches/release/boost/asio/error.hpp
==============================================================================
--- branches/release/boost/asio/error.hpp (original)
+++ branches/release/boost/asio/error.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -211,10 +211,6 @@
   fd_set_failure
 };
 
-enum ssl_errors
-{
-};
-
 inline const boost::system::error_category& get_system_category()
 {
   return boost::system::system_category();
@@ -245,9 +241,6 @@
 extern BOOST_ASIO_DECL
 const boost::system::error_category& get_misc_category();
 
-extern BOOST_ASIO_DECL
-const boost::system::error_category& get_ssl_category();
-
 static const boost::system::error_category& system_category
   = boost::asio::error::get_system_category();
 static const boost::system::error_category& netdb_category
@@ -256,12 +249,12 @@
   = boost::asio::error::get_addrinfo_category();
 static const boost::system::error_category& misc_category
   = boost::asio::error::get_misc_category();
-static const boost::system::error_category& ssl_category
- = boost::asio::error::get_ssl_category();
 
 } // namespace error
 } // namespace asio
+} // namespace boost
 
+namespace boost {
 namespace system {
 
 template<> struct is_error_code_enum<boost::asio::error::basic_errors>
@@ -284,13 +277,10 @@
   static const bool value = true;
 };
 
-template<> struct is_error_code_enum<boost::asio::error::ssl_errors>
-{
- static const bool value = true;
-};
-
 } // namespace system
+} // namespace boost
 
+namespace boost {
 namespace asio {
 namespace error {
 
@@ -318,12 +308,6 @@
       static_cast<int>(e), get_misc_category());
 }
 
-inline boost::system::error_code make_error_code(ssl_errors e)
-{
- return boost::system::error_code(
- static_cast<int>(e), get_ssl_category());
-}
-
 } // namespace error
 } // namespace asio
 } // namespace boost

Added: branches/release/boost/asio/impl/connect.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/impl/connect.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,391 @@
+//
+// impl/connect.hpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_IMPL_CONNECT_HPP
+#define BOOST_ASIO_IMPL_CONNECT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/bind_handler.hpp>
+#include <boost/asio/detail/consuming_buffers.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+namespace detail
+{
+ struct default_connect_condition
+ {
+ template <typename Iterator>
+ Iterator operator()(const boost::system::error_code&, Iterator next)
+ {
+ return next;
+ }
+ };
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin)
+{
+ boost::system::error_code ec;
+ Iterator result = connect(s, begin, ec);
+ boost::asio::detail::throw_error(ec, "connect");
+ return result;
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+inline Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, boost::system::error_code& ec)
+{
+ return connect(s, begin, Iterator(), detail::default_connect_condition(), ec);
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end)
+{
+ boost::system::error_code ec;
+ Iterator result = connect(s, begin, end, ec);
+ boost::asio::detail::throw_error(ec, "connect");
+ return result;
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+inline Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end, boost::system::error_code& ec)
+{
+ return connect(s, begin, end, detail::default_connect_condition(), ec);
+}
+
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, ConnectCondition connect_condition)
+{
+ boost::system::error_code ec;
+ Iterator result = connect(s, begin, connect_condition, ec);
+ boost::asio::detail::throw_error(ec, "connect");
+ return result;
+}
+
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+inline Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, ConnectCondition connect_condition,
+ boost::system::error_code& ec)
+{
+ return connect(s, begin, Iterator(), connect_condition, ec);
+}
+
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end, ConnectCondition connect_condition)
+{
+ boost::system::error_code ec;
+ Iterator result = connect(s, begin, end, connect_condition, ec);
+ boost::asio::detail::throw_error(ec, "connect");
+ return result;
+}
+
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end, ConnectCondition connect_condition,
+ boost::system::error_code& ec)
+{
+ ec = boost::system::error_code();
+
+ for (Iterator iter = begin; iter != end; ++iter)
+ {
+ iter = connect_condition(ec, iter);
+ if (iter != end)
+ {
+ s.close(ec);
+ s.connect(*iter, ec);
+ if (!ec)
+ return iter;
+ }
+ }
+
+ if (!ec)
+ ec = boost::asio::error::not_found;
+
+ return end;
+}
+
+namespace detail
+{
+ // Enable the empty base class optimisation for the connect condition.
+ template <typename ConnectCondition>
+ class base_from_connect_condition
+ {
+ protected:
+ explicit base_from_connect_condition(
+ const ConnectCondition& connect_condition)
+ : connect_condition_(connect_condition)
+ {
+ }
+
+ template <typename Iterator>
+ void check_condition(const boost::system::error_code& ec,
+ Iterator& iter, Iterator& end)
+ {
+ if (iter != end)
+ iter = connect_condition_(ec, static_cast<const Iterator&>(iter));
+ }
+
+ private:
+ ConnectCondition connect_condition_;
+ };
+
+ // The default_connect_condition implementation is essentially a no-op. This
+ // template specialisation lets us eliminate all costs associated with it.
+ template <>
+ class base_from_connect_condition<default_connect_condition>
+ {
+ protected:
+ explicit base_from_connect_condition(const default_connect_condition&)
+ {
+ }
+
+ template <typename Iterator>
+ void check_condition(const boost::system::error_code&, Iterator&, Iterator&)
+ {
+ }
+ };
+
+ template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ class connect_op : base_from_connect_condition<ConnectCondition>
+ {
+ public:
+ connect_op(basic_socket<Protocol, SocketService>& sock,
+ const Iterator& begin, const Iterator& end,
+ const ConnectCondition& connect_condition,
+ ComposedConnectHandler& handler)
+ : base_from_connect_condition<ConnectCondition>(connect_condition),
+ socket_(sock),
+ iter_(begin),
+ end_(end),
+ handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ connect_op(const connect_op& other)
+ : base_from_connect_condition<ConnectCondition>(other),
+ socket_(other.socket_),
+ iter_(other.iter_),
+ end_(other.end_),
+ handler_(other.handler_)
+ {
+ }
+
+ connect_op(connect_op&& other)
+ : base_from_connect_condition<ConnectCondition>(other),
+ socket_(other.socket_),
+ iter_(other.iter_),
+ end_(other.end_),
+ handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ void operator()(boost::system::error_code ec, int start = 0)
+ {
+ switch (start)
+ {
+ case 1:
+ for (;;)
+ {
+ this->check_condition(ec, iter_, end_);
+
+ if (iter_ != end_)
+ {
+ socket_.close(ec);
+ socket_.async_connect(*iter_,
+ BOOST_ASIO_MOVE_CAST(connect_op)(*this));
+ return;
+ }
+
+ if (start)
+ {
+ ec = boost::asio::error::not_found;
+ socket_.get_io_service().post(detail::bind_handler(*this, ec));
+ return;
+ }
+
+ default:
+
+ if (iter_ == end_)
+ break;
+
+ if (!socket_.is_open())
+ {
+ ec = boost::asio::error::operation_aborted;
+ break;
+ }
+
+ if (!ec)
+ break;
+
+ ++iter_;
+ }
+
+ handler_(static_cast<const boost::system::error_code&>(ec),
+ static_cast<const Iterator&>(iter_));
+ }
+ }
+
+ //private:
+ basic_socket<Protocol, SocketService>& socket_;
+ Iterator iter_;
+ Iterator end_;
+ ComposedConnectHandler handler_;
+ };
+
+ template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ inline void* asio_handler_allocate(std::size_t size,
+ connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>* this_handler)
+ {
+ return boost_asio_handler_alloc_helpers::allocate(
+ size, this_handler->handler_);
+ }
+
+ template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ inline void asio_handler_deallocate(void* pointer, std::size_t size,
+ connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>* this_handler)
+ {
+ boost_asio_handler_alloc_helpers::deallocate(
+ pointer, size, this_handler->handler_);
+ }
+
+ template <typename Function, typename Protocol,
+ typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ inline void asio_handler_invoke(Function& function,
+ connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename Protocol,
+ typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ inline void asio_handler_invoke(const Function& function,
+ connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ inline connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>
+ make_connect_op(basic_socket<Protocol, SocketService>& sock,
+ const Iterator& begin, const Iterator& end,
+ const ConnectCondition& connect_condition,
+ ComposedConnectHandler handler)
+ {
+ return connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>(
+ sock, begin, end, connect_condition, handler);
+ }
+} // namespace detail
+
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ComposedConnectHandler>
+inline void async_connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ComposedConnectHandler.
+ BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+ ComposedConnectHandler, handler, Iterator) type_check;
+
+ detail::make_connect_op(s, begin, Iterator(),
+ detail::default_connect_condition(),
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
+ boost::system::error_code(), 1);
+}
+
+template <typename Protocol, typename SocketService,
+ typename Iterator, typename ComposedConnectHandler>
+inline void async_connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ComposedConnectHandler.
+ BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+ ComposedConnectHandler, handler, Iterator) type_check;
+
+ detail::make_connect_op(s, begin, end,
+ detail::default_connect_condition(),
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
+ boost::system::error_code(), 1);
+}
+
+template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+inline void async_connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, ConnectCondition connect_condition,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ComposedConnectHandler.
+ BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+ ComposedConnectHandler, handler, Iterator) type_check;
+
+ detail::make_connect_op(s, begin, Iterator(), connect_condition,
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
+ boost::system::error_code(), 1);
+}
+
+template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+void async_connect(basic_socket<Protocol, SocketService>& s,
+ Iterator begin, Iterator end, ConnectCondition connect_condition,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ComposedConnectHandler.
+ BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+ ComposedConnectHandler, handler, Iterator) type_check;
+
+ detail::make_connect_op(s, begin, end, connect_condition,
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
+ boost::system::error_code(), 1);
+}
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_IMPL_CONNECT_HPP

Modified: branches/release/boost/asio/impl/error.ipp
==============================================================================
--- branches/release/boost/asio/impl/error.ipp (original)
+++ branches/release/boost/asio/impl/error.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,8 +16,6 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <boost/cerrno.hpp>
-#include <boost/system/error_code.hpp>
 #include <boost/asio/error.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -122,30 +120,6 @@
   return instance;
 }
 
-namespace detail {
-
-class ssl_category : public boost::system::error_category
-{
-public:
- const char* name() const
- {
- return "asio.ssl";
- }
-
- std::string message(int) const
- {
- return "asio.ssl error";
- }
-};
-
-} // namespace detail
-
-const boost::system::error_category& get_ssl_category()
-{
- static detail::ssl_category instance;
- return instance;
-}
-
 } // namespace error
 } // namespace asio
 } // namespace boost

Modified: branches/release/boost/asio/impl/io_service.hpp
==============================================================================
--- branches/release/boost/asio/impl/io_service.hpp (original)
+++ branches/release/boost/asio/impl/io_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -15,6 +15,7 @@
 # pragma once
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/service_registry.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -68,16 +69,25 @@
 namespace boost {
 namespace asio {
 
-template <typename Handler>
-inline void io_service::dispatch(Handler handler)
+template <typename CompletionHandler>
+inline void io_service::dispatch(
+ BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
 {
- impl_.dispatch(handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a CompletionHandler.
+ BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
+
+ impl_.dispatch(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
 }
 
-template <typename Handler>
-inline void io_service::post(Handler handler)
+template <typename CompletionHandler>
+inline void io_service::post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
 {
- impl_.post(handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a CompletionHandler.
+ BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
+
+ impl_.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
 }
 
 template <typename Handler>
@@ -108,21 +118,11 @@
   io_service_.impl_.work_finished();
 }
 
-inline boost::asio::io_service& io_service::work::io_service()
-{
- return io_service_;
-}
-
 inline boost::asio::io_service& io_service::work::get_io_service()
 {
   return io_service_;
 }
 
-inline boost::asio::io_service& io_service::service::io_service()
-{
- return owner_;
-}
-
 inline boost::asio::io_service& io_service::service::get_io_service()
 {
   return owner_;

Modified: branches/release/boost/asio/impl/io_service.ipp
==============================================================================
--- branches/release/boost/asio/impl/io_service.ipp (original)
+++ branches/release/boost/asio/impl/io_service.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -108,11 +108,21 @@
   impl_.stop();
 }
 
+bool io_service::stopped() const
+{
+ return impl_.stopped();
+}
+
 void io_service::reset()
 {
   impl_.reset();
 }
 
+void io_service::notify_fork(boost::asio::io_service::fork_event event)
+{
+ service_registry_->notify_fork(event);
+}
+
 io_service::service::service(boost::asio::io_service& owner)
   : owner_(owner),
     next_(0)
@@ -123,6 +133,10 @@
 {
 }
 
+void io_service::service::fork_service(boost::asio::io_service::fork_event)
+{
+}
+
 service_already_exists::service_already_exists()
   : std::logic_error("Service already exists.")
 {

Modified: branches/release/boost/asio/impl/read.hpp
==============================================================================
--- branches/release/boost/asio/impl/read.hpp (original)
+++ branches/release/boost/asio/impl/read.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -23,6 +23,7 @@
 #include <boost/asio/detail/consuming_buffers.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 
@@ -58,10 +59,17 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read(s, buffers, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read");
   return bytes_transferred;
 }
 
+template <typename SyncReadStream, typename MutableBufferSequence>
+inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
+ boost::system::error_code& ec)
+{
+ return read(s, buffers, transfer_all(), ec);
+}
+
 template <typename SyncReadStream, typename MutableBufferSequence,
     typename CompletionCondition>
 inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
@@ -69,7 +77,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read(s, buffers, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read");
   return bytes_transferred;
 }
 
@@ -104,10 +112,18 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read(s, b, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read");
   return bytes_transferred;
 }
 
+template <typename SyncReadStream, typename Allocator>
+inline std::size_t read(SyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec)
+{
+ return read(s, b, transfer_all(), ec);
+}
+
 template <typename SyncReadStream, typename Allocator,
     typename CompletionCondition>
 inline std::size_t read(SyncReadStream& s,
@@ -116,7 +132,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read(s, b, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read");
   return bytes_transferred;
 }
 
@@ -131,16 +147,36 @@
   {
   public:
     read_op(AsyncReadStream& stream, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition, ReadHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         stream_(stream),
         buffers_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_op(const read_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
     {
     }
 
+ read_op(read_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -150,7 +186,8 @@
         buffers_.prepare(this->check_for_completion(ec, total_transferred_));
         for (;;)
         {
- stream_.async_read_some(buffers_, *this);
+ stream_.async_read_some(buffers_,
+ BOOST_ASIO_MOVE_CAST(read_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -181,17 +218,36 @@
   public:
     read_op(AsyncReadStream& stream,
         const boost::asio::mutable_buffers_1& buffers,
- CompletionCondition completion_condition,
- ReadHandler handler)
+ CompletionCondition completion_condition, ReadHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         stream_(stream),
         buffer_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_op(const read_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
     {
     }
 
+ read_op(read_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -202,8 +258,9 @@
         n = this->check_for_completion(ec, total_transferred_);
         for (;;)
         {
- stream_.async_read_some(boost::asio::buffer(
- buffer_ + total_transferred_, n), *this);
+ stream_.async_read_some(
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(read_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -246,6 +303,17 @@
   template <typename Function, typename AsyncReadStream,
       typename MutableBufferSequence, typename CompletionCondition,
       typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_op<AsyncReadStream, MutableBufferSequence,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream,
+ typename MutableBufferSequence, typename CompletionCondition,
+ typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_op<AsyncReadStream, MutableBufferSequence,
         CompletionCondition, ReadHandler>* this_handler)
@@ -253,25 +321,47 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename MutableBufferSequence,
+ typename CompletionCondition, typename ReadHandler>
+ inline read_op<AsyncReadStream, MutableBufferSequence,
+ CompletionCondition, ReadHandler>
+ make_read_op(AsyncReadStream& s, const MutableBufferSequence& buffers,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_op<AsyncReadStream, MutableBufferSequence, CompletionCondition,
+ ReadHandler>(s, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- detail::read_op<AsyncReadStream, MutableBufferSequence,
- CompletionCondition, ReadHandler>(
- s, buffers, completion_condition, handler)(
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_op(
+ s, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename ReadHandler>
 inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- async_read(s, buffers, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_op(
+ s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #if !defined(BOOST_NO_IOSTREAM)
@@ -286,16 +376,36 @@
   public:
     read_streambuf_op(AsyncReadStream& stream,
         basic_streambuf<Allocator>& streambuf,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition, ReadHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         stream_(stream),
         streambuf_(streambuf),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_streambuf_op(const read_streambuf_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_streambuf_op(read_streambuf_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -307,7 +417,8 @@
         bytes_available = read_size_helper(streambuf_, max_size);
         for (;;)
         {
- stream_.async_read_some(streambuf_.prepare(bytes_available), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_available),
+ BOOST_ASIO_MOVE_CAST(read_streambuf_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           streambuf_.commit(bytes_transferred);
@@ -350,6 +461,16 @@
 
   template <typename Function, typename AsyncReadStream,
       typename Allocator, typename CompletionCondition, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_streambuf_op<AsyncReadStream, Allocator,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream,
+ typename Allocator, typename CompletionCondition, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_streambuf_op<AsyncReadStream, Allocator,
         CompletionCondition, ReadHandler>* this_handler)
@@ -357,25 +478,48 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator,
+ typename CompletionCondition, typename ReadHandler>
+ inline read_streambuf_op<AsyncReadStream, Allocator,
+ CompletionCondition, ReadHandler>
+ make_read_streambuf_op(
+ AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_streambuf_op<AsyncReadStream, Allocator, CompletionCondition,
+ ReadHandler>(s, b, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- detail::read_streambuf_op<AsyncReadStream,
- Allocator, CompletionCondition, ReadHandler>(
- s, b, completion_condition, handler)(
- boost::system::error_code(), 0, 1);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_streambuf_op(
+ s, b, completion_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 inline void async_read(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b, ReadHandler handler)
+ boost::asio::basic_streambuf<Allocator>& b,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- async_read(s, b, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_streambuf_op(
+ s, b, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #endif // !defined(BOOST_NO_IOSTREAM)

Modified: branches/release/boost/asio/impl/read_at.hpp
==============================================================================
--- branches/release/boost/asio/impl/read_at.hpp (original)
+++ branches/release/boost/asio/impl/read_at.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -23,6 +23,7 @@
 #include <boost/asio/detail/consuming_buffers.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 
@@ -62,10 +63,18 @@
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_at(
       d, offset, buffers, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_at");
   return bytes_transferred;
 }
 
+template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence>
+inline std::size_t read_at(SyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, const MutableBufferSequence& buffers,
+ boost::system::error_code& ec)
+{
+ return read_at(d, offset, buffers, transfer_all(), ec);
+}
+
 template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence,
     typename CompletionCondition>
 inline std::size_t read_at(SyncRandomAccessReadDevice& d,
@@ -75,7 +84,7 @@
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_at(
       d, offset, buffers, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_at");
   return bytes_transferred;
 }
 
@@ -112,10 +121,18 @@
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_at(
       d, offset, b, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_at");
   return bytes_transferred;
 }
 
+template <typename SyncRandomAccessReadDevice, typename Allocator>
+inline std::size_t read_at(SyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec)
+{
+ return read_at(d, offset, b, transfer_all(), ec);
+}
+
 template <typename SyncRandomAccessReadDevice, typename Allocator,
     typename CompletionCondition>
 inline std::size_t read_at(SyncRandomAccessReadDevice& d,
@@ -125,7 +142,7 @@
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_at(
       d, offset, b, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_at");
   return bytes_transferred;
 }
 
@@ -142,17 +159,39 @@
   public:
     read_at_op(AsyncRandomAccessReadDevice& device,
         boost::uint64_t offset, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition, ReadHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         device_(device),
         offset_(offset),
         buffers_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_at_op(const read_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_at_op(read_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -162,8 +201,8 @@
         buffers_.prepare(this->check_for_completion(ec, total_transferred_));
         for (;;)
         {
- device_.async_read_some_at(
- offset_ + total_transferred_, buffers_, *this);
+ device_.async_read_some_at(offset_ + total_transferred_,
+ buffers_, BOOST_ASIO_MOVE_CAST(read_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -195,17 +234,39 @@
   public:
     read_at_op(AsyncRandomAccessReadDevice& device,
         boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition, ReadHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         device_(device),
         offset_(offset),
         buffer_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_at_op(const read_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
     {
     }
 
+ read_at_op(read_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -217,7 +278,8 @@
         for (;;)
         {
           device_.async_read_some_at(offset_ + total_transferred_,
- boost::asio::buffer(buffer_ + total_transferred_, n), *this);
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(read_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -263,6 +325,17 @@
   template <typename Function, typename AsyncRandomAccessReadDevice,
       typename MutableBufferSequence, typename CompletionCondition,
       typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncRandomAccessReadDevice,
+ typename MutableBufferSequence, typename CompletionCondition,
+ typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
         CompletionCondition, ReadHandler>* this_handler)
@@ -270,17 +343,36 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncRandomAccessReadDevice,
+ typename MutableBufferSequence, typename CompletionCondition,
+ typename ReadHandler>
+ inline read_at_op<AsyncRandomAccessReadDevice,
+ MutableBufferSequence, CompletionCondition, ReadHandler>
+ make_read_at_op(AsyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, const MutableBufferSequence& buffers,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_at_op<AsyncRandomAccessReadDevice,
+ MutableBufferSequence, CompletionCondition, ReadHandler>(
+ d, offset, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- detail::read_at_op<AsyncRandomAccessReadDevice,
- MutableBufferSequence, CompletionCondition, ReadHandler>(
- d, offset, buffers, completion_condition, handler)(
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_at_op(
+ d, offset, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -288,9 +380,16 @@
     typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- async_read_at(d, offset, buffers, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_at_op(
+ d, offset, buffers, transfer_all(),
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #if !defined(BOOST_NO_IOSTREAM)
@@ -305,16 +404,38 @@
   public:
     read_at_streambuf_op(AsyncRandomAccessReadDevice& device,
         boost::uint64_t offset, basic_streambuf<Allocator>& streambuf,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition, ReadHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         device_(device),
         offset_(offset),
         streambuf_(streambuf),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_at_streambuf_op(const read_at_streambuf_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_at_streambuf_op(read_at_streambuf_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
     {
     }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
@@ -328,7 +449,8 @@
         for (;;)
         {
           device_.async_read_some_at(offset_ + total_transferred_,
- streambuf_.prepare(bytes_available), *this);
+ streambuf_.prepare(bytes_available),
+ BOOST_ASIO_MOVE_CAST(read_at_streambuf_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           streambuf_.commit(bytes_transferred);
@@ -372,6 +494,16 @@
 
   template <typename Function, typename AsyncRandomAccessReadDevice,
       typename Allocator, typename CompletionCondition, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncRandomAccessReadDevice,
+ typename Allocator, typename CompletionCondition, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
         CompletionCondition, ReadHandler>* this_handler)
@@ -379,17 +511,35 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncRandomAccessReadDevice, typename Allocator,
+ typename CompletionCondition, typename ReadHandler>
+ inline read_at_streambuf_op<AsyncRandomAccessReadDevice,
+ Allocator, CompletionCondition, ReadHandler>
+ make_read_at_streambuf_op(AsyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_at_streambuf_op<AsyncRandomAccessReadDevice,
+ Allocator, CompletionCondition, ReadHandler>(
+ d, offset, b, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessReadDevice, typename Allocator,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- detail::read_at_streambuf_op<AsyncRandomAccessReadDevice,
- Allocator, CompletionCondition, ReadHandler>(
- d, offset, b, completion_condition, handler)(
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_at_streambuf_op(
+ d, offset, b, completion_condition,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -397,9 +547,16 @@
     typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- async_read_at(d, offset, b, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_at_streambuf_op(
+ d, offset, b, transfer_all(),
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #endif // !defined(BOOST_NO_IOSTREAM)

Modified: branches/release/boost/asio/impl/read_until.hpp
==============================================================================
--- branches/release/boost/asio/impl/read_until.hpp (original)
+++ branches/release/boost/asio/impl/read_until.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -25,6 +25,7 @@
 #include <boost/asio/detail/bind_handler.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -38,7 +39,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_until(s, b, delim, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_until");
   return bytes_transferred;
 }
 
@@ -56,11 +57,11 @@
     typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
     const_buffers_type buffers = b.data();
     iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position;
+ iterator start_pos = begin + search_position;
     iterator end = iterator::end(buffers);
 
     // Look for a match.
- iterator iter = std::find(start, end, delim);
+ iterator iter = std::find(start_pos, end, delim);
     if (iter != end)
     {
       // Found a match. We're done.
@@ -94,7 +95,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_until(s, b, delim, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_until");
   return bytes_transferred;
 }
 
@@ -147,12 +148,12 @@
     typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
     const_buffers_type buffers = b.data();
     iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position;
+ iterator start_pos = begin + search_position;
     iterator end = iterator::end(buffers);
 
     // Look for a match.
     std::pair<iterator, bool> result = detail::partial_search(
- start, end, delim.begin(), delim.end());
+ start_pos, end, delim.begin(), delim.end());
     if (result.first != end)
     {
       if (result.second)
@@ -194,7 +195,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_until(s, b, expr, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_until");
   return bytes_transferred;
 }
 
@@ -212,14 +213,14 @@
     typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
     const_buffers_type buffers = b.data();
     iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position;
+ iterator start_pos = begin + search_position;
     iterator end = iterator::end(buffers);
 
     // Look for a match.
     boost::match_results<iterator,
       typename std::vector<boost::sub_match<iterator> >::allocator_type>
         match_results;
- if (regex_search(start, end, match_results, expr,
+ if (regex_search(start_pos, end, match_results, expr,
           boost::match_default | boost::match_partial))
     {
       if (match_results[0].matched)
@@ -270,11 +271,11 @@
     typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
     const_buffers_type buffers = b.data();
     iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position;
+ iterator start_pos = begin + search_position;
     iterator end = iterator::end(buffers);
 
     // Look for a match.
- std::pair<iterator, bool> result = match_condition(start, end);
+ std::pair<iterator, bool> result = match_condition(start_pos, end);
     if (result.second)
     {
       // Full match. We're done.
@@ -314,7 +315,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = read_until(s, b, match_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "read_until");
   return bytes_transferred;
 }
 
@@ -326,15 +327,35 @@
   public:
     read_until_delim_op(AsyncReadStream& stream,
         boost::asio::basic_streambuf<Allocator>& streambuf,
- char delim, ReadHandler handler)
+ char delim, ReadHandler& handler)
       : stream_(stream),
         streambuf_(streambuf),
         delim_(delim),
         search_position_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_delim_op(const read_until_delim_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(other.delim_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_delim_op(read_until_delim_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(other.delim_),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -352,11 +373,11 @@
             typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
             const_buffers_type buffers = streambuf_.data();
             iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position_;
+ iterator start_pos = begin + search_position_;
             iterator end = iterator::end(buffers);
 
             // Look for a match.
- iterator iter = std::find(start, end, delim_);
+ iterator iter = std::find(start_pos, end, delim_);
             if (iter != end)
             {
               // Found a match. We're done.
@@ -385,7 +406,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_delim_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -432,6 +454,16 @@
 
   template <typename Function, typename AsyncReadStream, typename Allocator,
       typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_delim_op<AsyncReadStream,
+ Allocator, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream, typename Allocator,
+ typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_delim_op<AsyncReadStream,
         Allocator, ReadHandler>* this_handler)
@@ -439,16 +471,30 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
+ inline read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>
+ make_read_until_delim_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ char delim, ReadHandler handler)
+ {
+ return read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>(
+ s, b, delim, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b, char delim, ReadHandler handler)
+ boost::asio::basic_streambuf<Allocator>& b, char delim,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- detail::read_until_delim_op<
- AsyncReadStream, Allocator, ReadHandler>(
- s, b, delim, handler)(
- boost::system::error_code(), 0, 1);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_until_delim_op(
+ s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 namespace detail
@@ -459,15 +505,35 @@
   public:
     read_until_delim_string_op(AsyncReadStream& stream,
         boost::asio::basic_streambuf<Allocator>& streambuf,
- const std::string& delim, ReadHandler handler)
+ const std::string& delim, ReadHandler& handler)
       : stream_(stream),
         streambuf_(streambuf),
         delim_(delim),
         search_position_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_delim_string_op(const read_until_delim_string_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(other.delim_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_delim_string_op(read_until_delim_string_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(BOOST_ASIO_MOVE_CAST(std::string)(other.delim_)),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -485,12 +551,12 @@
             typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
             const_buffers_type buffers = streambuf_.data();
             iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position_;
+ iterator start_pos = begin + search_position_;
             iterator end = iterator::end(buffers);
 
             // Look for a match.
             std::pair<iterator, bool> result = detail::partial_search(
- start, end, delim_.begin(), delim_.end());
+ start_pos, end, delim_.begin(), delim_.end());
             if (result.first != end && result.second)
             {
               // Full match. We're done.
@@ -529,7 +595,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_delim_string_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -576,6 +643,16 @@
 
   template <typename Function, typename AsyncReadStream,
       typename Allocator, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_delim_string_op<AsyncReadStream,
+ Allocator, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream,
+ typename Allocator, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_delim_string_op<AsyncReadStream,
         Allocator, ReadHandler>* this_handler)
@@ -583,17 +660,30 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
+ inline read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>
+ make_read_until_delim_string_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ const std::string& delim, ReadHandler handler)
+ {
+ return read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>(
+ s, b, delim, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const std::string& delim,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- detail::read_until_delim_string_op<
- AsyncReadStream, Allocator, ReadHandler>(
- s, b, delim, handler)(
- boost::system::error_code(), 0, 1);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_until_delim_string_op(
+ s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 namespace detail
@@ -605,15 +695,35 @@
   public:
     read_until_expr_op(AsyncReadStream& stream,
         boost::asio::basic_streambuf<Allocator>& streambuf,
- const boost::regex& expr, ReadHandler handler)
+ const boost::regex& expr, ReadHandler& handler)
       : stream_(stream),
         streambuf_(streambuf),
         expr_(expr),
         search_position_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_expr_op(const read_until_expr_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ expr_(other.expr_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_expr_op(read_until_expr_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ expr_(other.expr_),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -631,14 +741,14 @@
             typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
             const_buffers_type buffers = streambuf_.data();
             iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position_;
+ iterator start_pos = begin + search_position_;
             iterator end = iterator::end(buffers);
 
             // Look for a match.
             boost::match_results<iterator,
               typename std::vector<boost::sub_match<iterator> >::allocator_type>
                 match_results;
- bool match = regex_search(start, end, match_results, expr_,
+ bool match = regex_search(start_pos, end, match_results, expr_,
                 boost::match_default | boost::match_partial);
             if (match && match_results[0].matched)
             {
@@ -678,7 +788,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_expr_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -727,6 +838,16 @@
 
   template <typename Function, typename AsyncReadStream, typename Allocator,
       typename RegEx, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_expr_op<AsyncReadStream,
+ Allocator, RegEx, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream, typename Allocator,
+ typename RegEx, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_expr_op<AsyncReadStream,
         Allocator, RegEx, ReadHandler>* this_handler)
@@ -734,17 +855,31 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator,
+ typename RegEx, typename ReadHandler>
+ inline read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>
+ make_read_until_expr_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ const boost::regex& expr, ReadHandler handler)
+ {
+ return read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>(
+ s, b, expr, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
- detail::read_until_expr_op<AsyncReadStream,
- Allocator, boost::regex, ReadHandler>(
- s, b, expr, handler)(
- boost::system::error_code(), 0, 1);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_until_expr_op(
+ s, b, expr, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 namespace detail
@@ -756,15 +891,35 @@
   public:
     read_until_match_op(AsyncReadStream& stream,
         boost::asio::basic_streambuf<Allocator>& streambuf,
- MatchCondition match_condition, ReadHandler handler)
+ MatchCondition match_condition, ReadHandler& handler)
       : stream_(stream),
         streambuf_(streambuf),
         match_condition_(match_condition),
         search_position_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_match_op(const read_until_match_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ match_condition_(other.match_condition_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_match_op(read_until_match_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ match_condition_(other.match_condition_),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -782,11 +937,11 @@
             typedef boost::asio::buffers_iterator<const_buffers_type> iterator;
             const_buffers_type buffers = streambuf_.data();
             iterator begin = iterator::begin(buffers);
- iterator start = begin + search_position_;
+ iterator start_pos = begin + search_position_;
             iterator end = iterator::end(buffers);
 
             // Look for a match.
- std::pair<iterator, bool> result = match_condition_(start, end);
+ std::pair<iterator, bool> result = match_condition_(start_pos, end);
             if (result.second)
             {
               // Full match. We're done.
@@ -825,7 +980,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_match_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -874,6 +1030,16 @@
 
   template <typename Function, typename AsyncReadStream, typename Allocator,
       typename MatchCondition, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_match_op<AsyncReadStream,
+ Allocator, MatchCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream, typename Allocator,
+ typename MatchCondition, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_match_op<AsyncReadStream,
         Allocator, MatchCondition, ReadHandler>* this_handler)
@@ -881,19 +1047,35 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator,
+ typename MatchCondition, typename ReadHandler>
+ inline read_until_match_op<AsyncReadStream, Allocator,
+ MatchCondition, ReadHandler>
+ make_read_until_match_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ MatchCondition match_condition, ReadHandler handler)
+ {
+ return read_until_match_op<AsyncReadStream,
+ Allocator, MatchCondition, ReadHandler>(
+ s, b, match_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator,
     typename MatchCondition, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- MatchCondition match_condition, ReadHandler handler,
+ MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
     typename boost::enable_if<is_match_condition<MatchCondition> >::type*)
 {
- detail::read_until_match_op<
- AsyncReadStream, Allocator, MatchCondition, ReadHandler>(
- s, b, match_condition, handler)(
- boost::system::error_code(), 0, 1);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::make_read_until_match_op(
+ s, b, match_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 } // namespace asio

Modified: branches/release/boost/asio/impl/src.hpp
==============================================================================
--- branches/release/boost/asio/impl/src.hpp (original)
+++ branches/release/boost/asio/impl/src.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -26,6 +26,7 @@
 #include <boost/asio/detail/impl/dev_poll_reactor.ipp>
 #include <boost/asio/detail/impl/epoll_reactor.ipp>
 #include <boost/asio/detail/impl/eventfd_select_interrupter.ipp>
+#include <boost/asio/detail/impl/handler_tracking.ipp>
 #include <boost/asio/detail/impl/kqueue_reactor.ipp>
 #include <boost/asio/detail/impl/pipe_select_interrupter.ipp>
 #include <boost/asio/detail/impl/posix_event.ipp>
@@ -38,6 +39,7 @@
 #include <boost/asio/detail/impl/resolver_service_base.ipp>
 #include <boost/asio/detail/impl/select_reactor.ipp>
 #include <boost/asio/detail/impl/service_registry.ipp>
+#include <boost/asio/detail/impl/signal_set_service.ipp>
 #include <boost/asio/detail/impl/socket_ops.ipp>
 #include <boost/asio/detail/impl/socket_select_interrupter.ipp>
 #include <boost/asio/detail/impl/strand_service.ipp>
@@ -51,6 +53,7 @@
 #include <boost/asio/detail/impl/win_iocp_socket_service_base.ipp>
 #include <boost/asio/detail/impl/win_event.ipp>
 #include <boost/asio/detail/impl/win_mutex.ipp>
+#include <boost/asio/detail/impl/win_static_mutex.ipp>
 #include <boost/asio/detail/impl/win_thread.ipp>
 #include <boost/asio/detail/impl/win_tss_ptr.ipp>
 #include <boost/asio/detail/impl/winsock_init.ipp>

Modified: branches/release/boost/asio/impl/write.hpp
==============================================================================
--- branches/release/boost/asio/impl/write.hpp (original)
+++ branches/release/boost/asio/impl/write.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -22,6 +22,7 @@
 #include <boost/asio/detail/consuming_buffers.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -56,10 +57,17 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write");
   return bytes_transferred;
 }
 
+template <typename SyncWriteStream, typename ConstBufferSequence>
+inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
+ boost::system::error_code& ec)
+{
+ return write(s, buffers, transfer_all(), ec);
+}
+
 template <typename SyncWriteStream, typename ConstBufferSequence,
     typename CompletionCondition>
 inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
@@ -67,7 +75,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = write(s, buffers, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write");
   return bytes_transferred;
 }
 
@@ -90,10 +98,18 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = write(s, b, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write");
   return bytes_transferred;
 }
 
+template <typename SyncWriteStream, typename Allocator>
+inline std::size_t write(SyncWriteStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec)
+{
+ return write(s, b, transfer_all(), ec);
+}
+
 template <typename SyncWriteStream, typename Allocator,
     typename CompletionCondition>
 inline std::size_t write(SyncWriteStream& s,
@@ -102,7 +118,7 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = write(s, b, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write");
   return bytes_transferred;
 }
 
@@ -117,15 +133,35 @@
   {
   public:
     write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition, WriteHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         stream_(stream),
         buffers_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_op(const write_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_op(write_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
     {
     }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
@@ -136,7 +172,8 @@
         buffers_.prepare(this->check_for_completion(ec, total_transferred_));
         for (;;)
         {
- stream_.async_write_some(buffers_, *this);
+ stream_.async_write_some(buffers_,
+ BOOST_ASIO_MOVE_CAST(write_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -168,16 +205,36 @@
     write_op(AsyncWriteStream& stream,
         const boost::asio::mutable_buffers_1& buffers,
         CompletionCondition completion_condition,
- WriteHandler handler)
+ WriteHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         stream_(stream),
         buffer_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_op(const write_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_op(write_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -188,8 +245,9 @@
         n = this->check_for_completion(ec, total_transferred_);
         for (;;)
         {
- stream_.async_write_some(boost::asio::buffer(
- buffer_ + total_transferred_, n), *this);
+ stream_.async_write_some(
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -219,15 +277,35 @@
     write_op(AsyncWriteStream& stream,
         const boost::asio::const_buffers_1& buffers,
         CompletionCondition completion_condition,
- WriteHandler handler)
+ WriteHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         stream_(stream),
         buffer_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_op(const write_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_op(write_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
     {
     }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
@@ -239,8 +317,9 @@
         n = this->check_for_completion(ec, total_transferred_);
         for (;;)
         {
- stream_.async_write_some(boost::asio::buffer(
- buffer_ + total_transferred_, n), *this);
+ stream_.async_write_some(
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -283,6 +362,17 @@
   template <typename Function, typename AsyncWriteStream,
       typename ConstBufferSequence, typename CompletionCondition,
       typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_op<AsyncWriteStream, ConstBufferSequence,
+ CompletionCondition, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncWriteStream,
+ typename ConstBufferSequence, typename CompletionCondition,
+ typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
       write_op<AsyncWriteStream, ConstBufferSequence,
         CompletionCondition, WriteHandler>* this_handler)
@@ -290,43 +380,78 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncWriteStream, typename ConstBufferSequence,
+ typename CompletionCondition, typename WriteHandler>
+ inline write_op<AsyncWriteStream, ConstBufferSequence,
+ CompletionCondition, WriteHandler>
+ make_write_op(AsyncWriteStream& s, const ConstBufferSequence& buffers,
+ CompletionCondition completion_condition, WriteHandler handler)
+ {
+ return write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition,
+ WriteHandler>(s, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncWriteStream, typename ConstBufferSequence,
   typename CompletionCondition, typename WriteHandler>
 inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
- detail::write_op<AsyncWriteStream, ConstBufferSequence,
- CompletionCondition, WriteHandler>(
- s, buffers, completion_condition, handler)(
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ detail::make_write_op(
+ s, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
 template <typename AsyncWriteStream, typename ConstBufferSequence,
     typename WriteHandler>
 inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
- async_write(s, buffers, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ detail::make_write_op(
+ s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #if !defined(BOOST_NO_IOSTREAM)
 
 namespace detail
 {
- template <typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   class write_streambuf_handler
   {
   public:
     write_streambuf_handler(boost::asio::basic_streambuf<Allocator>& streambuf,
- WriteHandler handler)
+ WriteHandler& handler)
       : streambuf_(streambuf),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_streambuf_handler(const write_streambuf_handler& other)
+ : streambuf_(other.streambuf_),
+ handler_(other.handler_)
     {
     }
 
+ write_streambuf_handler(write_streambuf_handler&& other)
+ : streambuf_(other.streambuf_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         const std::size_t bytes_transferred)
     {
@@ -339,53 +464,75 @@
     WriteHandler handler_;
   };
 
- template <typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void* asio_handler_allocate(std::size_t size,
- write_streambuf_handler<AsyncWriteStream,
- Allocator, WriteHandler>* this_handler)
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
   {
     return boost_asio_handler_alloc_helpers::allocate(
         size, this_handler->handler_);
   }
 
- template <typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void asio_handler_deallocate(void* pointer, std::size_t size,
- write_streambuf_handler<AsyncWriteStream,
- Allocator, WriteHandler>* this_handler)
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_alloc_helpers::deallocate(
         pointer, size, this_handler->handler_);
   }
 
- template <typename Function, typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Function, typename Allocator, typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename Allocator, typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
- write_streambuf_handler<AsyncWriteStream,
- Allocator, WriteHandler>* this_handler)
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename Allocator, typename WriteHandler>
+ inline write_streambuf_handler<Allocator, WriteHandler>
+ make_write_streambuf_handler(
+ boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler)
+ {
+ return write_streambuf_handler<Allocator, WriteHandler>(b, handler);
+ }
 } // namespace detail
 
 template <typename AsyncWriteStream, typename Allocator,
     typename CompletionCondition, typename WriteHandler>
 inline void async_write(AsyncWriteStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
   async_write(s, b.data(), completion_condition,
- detail::write_streambuf_handler<
- AsyncWriteStream, Allocator, WriteHandler>(b, handler));
+ detail::make_write_streambuf_handler(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
 inline void async_write(AsyncWriteStream& s,
- boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler)
+ boost::asio::basic_streambuf<Allocator>& b,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
- async_write(s, b, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ async_write(s, b.data(), transfer_all(),
+ detail::make_write_streambuf_handler(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 #endif // !defined(BOOST_NO_IOSTREAM)

Modified: branches/release/boost/asio/impl/write_at.hpp
==============================================================================
--- branches/release/boost/asio/impl/write_at.hpp (original)
+++ branches/release/boost/asio/impl/write_at.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -22,6 +22,7 @@
 #include <boost/asio/detail/consuming_buffers.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
@@ -60,10 +61,18 @@
   boost::system::error_code ec;
   std::size_t bytes_transferred = write_at(
       d, offset, buffers, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write_at");
   return bytes_transferred;
 }
 
+template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence>
+inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
+ boost::uint64_t offset, const ConstBufferSequence& buffers,
+ boost::system::error_code& ec)
+{
+ return write_at(d, offset, buffers, transfer_all(), ec);
+}
+
 template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence,
     typename CompletionCondition>
 inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
@@ -73,7 +82,7 @@
   boost::system::error_code ec;
   std::size_t bytes_transferred = write_at(
       d, offset, buffers, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write_at");
   return bytes_transferred;
 }
 
@@ -97,10 +106,18 @@
 {
   boost::system::error_code ec;
   std::size_t bytes_transferred = write_at(d, offset, b, transfer_all(), ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write_at");
   return bytes_transferred;
 }
 
+template <typename SyncRandomAccessWriteDevice, typename Allocator>
+inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
+ boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec)
+{
+ return write_at(d, offset, b, transfer_all(), ec);
+}
+
 template <typename SyncRandomAccessWriteDevice, typename Allocator,
     typename CompletionCondition>
 inline std::size_t write_at(SyncRandomAccessWriteDevice& d,
@@ -110,7 +127,7 @@
   boost::system::error_code ec;
   std::size_t bytes_transferred = write_at(
       d, offset, b, completion_condition, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "write_at");
   return bytes_transferred;
 }
 
@@ -126,16 +143,38 @@
   public:
     write_at_op(AsyncRandomAccessWriteDevice& device,
         boost::uint64_t offset, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition, WriteHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         device_(device),
         offset_(offset),
         buffers_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_op(const write_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_op(write_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
     {
     }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
@@ -147,7 +186,8 @@
         for (;;)
         {
           device_.async_write_some_at(
- offset_ + total_transferred_, buffers_, *this);
+ offset_ + total_transferred_, buffers_,
+ BOOST_ASIO_MOVE_CAST(write_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -180,16 +220,38 @@
     write_at_op(AsyncRandomAccessWriteDevice& device,
         boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers,
         CompletionCondition completion_condition,
- WriteHandler handler)
+ WriteHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         device_(device),
         offset_(offset),
         buffer_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_op(const write_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_op(write_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
     {
     }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
@@ -202,7 +264,8 @@
         for (;;)
         {
           device_.async_write_some_at(offset_ + total_transferred_,
- boost::asio::buffer(buffer_ + total_transferred_, n), *this);
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -233,17 +296,39 @@
     write_at_op(AsyncRandomAccessWriteDevice& device,
         boost::uint64_t offset, const boost::asio::const_buffers_1& buffers,
         CompletionCondition completion_condition,
- WriteHandler handler)
+ WriteHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         device_(device),
         offset_(offset),
         buffer_(buffers),
         total_transferred_(0),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_op(const write_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_op(write_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -255,7 +340,8 @@
         for (;;)
         {
           device_.async_write_some_at(offset_ + total_transferred_,
- boost::asio::buffer(buffer_ + total_transferred_, n), *this);
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -299,6 +385,17 @@
   template <typename Function, typename AsyncRandomAccessWriteDevice,
       typename ConstBufferSequence, typename CompletionCondition,
       typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
+ CompletionCondition, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncRandomAccessWriteDevice,
+ typename ConstBufferSequence, typename CompletionCondition,
+ typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
       write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
         CompletionCondition, WriteHandler>* this_handler)
@@ -306,17 +403,35 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
+ typename CompletionCondition, typename WriteHandler>
+ inline write_at_op<AsyncRandomAccessWriteDevice,
+ ConstBufferSequence, CompletionCondition, WriteHandler>
+ make_write_at_op(AsyncRandomAccessWriteDevice& d,
+ boost::uint64_t offset, const ConstBufferSequence& buffers,
+ CompletionCondition completion_condition, WriteHandler handler)
+ {
+ return write_at_op<AsyncRandomAccessWriteDevice,
+ ConstBufferSequence, CompletionCondition, WriteHandler>(
+ d, offset, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
     typename CompletionCondition, typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
- detail::write_at_op<AsyncRandomAccessWriteDevice,
- ConstBufferSequence, CompletionCondition, WriteHandler>(
- d, offset, buffers, completion_condition, handler)(
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ detail::make_write_at_op(
+ d, offset, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -324,27 +439,47 @@
     typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
- async_write_at(d, offset, buffers, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ detail::make_write_at_op(
+ d, offset, buffers, transfer_all(),
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #if !defined(BOOST_NO_IOSTREAM)
 
 namespace detail
 {
- template <typename AsyncRandomAccessWriteDevice,
- typename Allocator, typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   class write_at_streambuf_op
   {
   public:
     write_at_streambuf_op(
         boost::asio::basic_streambuf<Allocator>& streambuf,
- WriteHandler handler)
+ WriteHandler& handler)
       : streambuf_(streambuf),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_streambuf_op(const write_at_streambuf_op& other)
+ : streambuf_(other.streambuf_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_streambuf_op(write_at_streambuf_op&& other)
+ : streambuf_(other.streambuf_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
     {
     }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
     void operator()(const boost::system::error_code& ec,
         const std::size_t bytes_transferred)
@@ -358,55 +493,76 @@
     WriteHandler handler_;
   };
 
- template <typename AsyncRandomAccessWriteDevice, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void* asio_handler_allocate(std::size_t size,
- write_at_streambuf_op<AsyncRandomAccessWriteDevice,
- Allocator, WriteHandler>* this_handler)
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
   {
     return boost_asio_handler_alloc_helpers::allocate(
         size, this_handler->handler_);
   }
 
- template <typename AsyncRandomAccessWriteDevice, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void asio_handler_deallocate(void* pointer, std::size_t size,
- write_at_streambuf_op<AsyncRandomAccessWriteDevice,
- Allocator, WriteHandler>* this_handler)
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_alloc_helpers::deallocate(
         pointer, size, this_handler->handler_);
   }
 
- template <typename Function, typename AsyncRandomAccessWriteDevice,
- typename Allocator, typename WriteHandler>
+ template <typename Function, typename Allocator, typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename Allocator, typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
- write_at_streambuf_op<AsyncRandomAccessWriteDevice,
- Allocator, WriteHandler>* this_handler)
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename Allocator, typename WriteHandler>
+ inline write_at_streambuf_op<Allocator, WriteHandler>
+ make_write_at_streambuf_op(
+ boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler)
+ {
+ return write_at_streambuf_op<Allocator, WriteHandler>(b, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessWriteDevice, typename Allocator,
     typename CompletionCondition, typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
   async_write_at(d, offset, b.data(), completion_condition,
- detail::write_at_streambuf_op<
- AsyncRandomAccessWriteDevice, Allocator, WriteHandler>(b, handler));
+ detail::make_write_at_streambuf_op(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 template <typename AsyncRandomAccessWriteDevice, typename Allocator,
     typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
- async_write_at(d, offset, b, transfer_all(), handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ async_write_at(d, offset, b.data(), transfer_all(),
+ detail::make_write_at_streambuf_op(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 #endif // !defined(BOOST_NO_IOSTREAM)

Modified: branches/release/boost/asio/io_service.hpp
==============================================================================
--- branches/release/boost/asio/io_service.hpp (original)
+++ branches/release/boost/asio/io_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -68,9 +68,12 @@
  *
  * @par Thread Safety
  * @e Distinct @e objects: Safe._at_n
- * @e Shared @e objects: Safe, with the exception that calling reset() while
- * there are unfinished run(), run_one(), poll() or poll_one() calls results in
- * undefined behaviour.
+ * @e Shared @e objects: Safe, with the specific exceptions of the reset() and
+ * notify_fork() functions. Calling reset() while there are unfinished run(),
+ * run_one(), poll() or poll_one() calls results in undefined behaviour. The
+ * notify_fork() function should not be called while any io_service function,
+ * or any function on an I/O object that is associated with the io_service, is
+ * being called in another thread.
  *
  * @par Concepts:
  * Dispatcher.
@@ -256,8 +259,10 @@
    * waiting in the pool are equivalent and the io_service may choose any one
    * of them to invoke a handler.
    *
- * The run() function may be safely called again once it has completed only
- * after a call to reset().
+ * A normal exit from the run() function implies that the io_service object
+ * is stopped (the stopped() function returns @c true). Subsequent calls to
+ * run(), run_one(), poll() or poll_one() will return immediately unless there
+ * is a prior call to reset().
    *
    * @return The number of handlers that were executed.
    *
@@ -282,8 +287,10 @@
    * waiting in the pool are equivalent and the io_service may choose any one
    * of them to invoke a handler.
    *
- * The run() function may be safely called again once it has completed only
- * after a call to reset().
+ * A normal exit from the run() function implies that the io_service object
+ * is stopped (the stopped() function returns @c true). Subsequent calls to
+ * run(), run_one(), poll() or poll_one() will return immediately unless there
+ * is a prior call to reset().
    *
    * @param ec Set to indicate what error occurred, if any.
    *
@@ -304,7 +311,11 @@
    * The run_one() function blocks until one handler has been dispatched, or
    * until the io_service has been stopped.
    *
- * @return The number of handlers that were executed.
+ * @return The number of handlers that were executed. A zero return value
+ * implies that the io_service object is stopped (the stopped() function
+ * returns @c true). Subsequent calls to run(), run_one(), poll() or
+ * poll_one() will return immediately unless there is a prior call to
+ * reset().
    *
    * @throws boost::system::system_error Thrown on failure.
    */
@@ -316,7 +327,11 @@
    * The run_one() function blocks until one handler has been dispatched, or
    * until the io_service has been stopped.
    *
- * @param ec Set to indicate what error occurred, if any.
+ * @return The number of handlers that were executed. A zero return value
+ * implies that the io_service object is stopped (the stopped() function
+ * returns @c true). Subsequent calls to run(), run_one(), poll() or
+ * poll_one() will return immediately unless there is a prior call to
+ * reset().
    *
    * @return The number of handlers that were executed.
    */
@@ -379,13 +394,25 @@
    */
   BOOST_ASIO_DECL void stop();
 
+ /// Determine whether the io_service object has been stopped.
+ /**
+ * This function is used to determine whether an io_service object has been
+ * stopped, either through an explicit call to stop(), or due to running out
+ * of work. When an io_service object is stopped, calls to run(), run_one(),
+ * poll() or poll_one() will return immediately without invoking any
+ * handlers.
+ *
+ * @return @c true if the io_service object is stopped, otherwise @c false.
+ */
+ BOOST_ASIO_DECL bool stopped() const;
+
   /// Reset the io_service in preparation for a subsequent run() invocation.
   /**
    * This function must be called prior to any second or later set of
    * invocations of the run(), run_one(), poll() or poll_one() functions when a
    * previous invocation of these functions returned due to the io_service
- * being stopped or running out of work. This function allows the io_service
- * to reset any internal state, such as a "stopped" flag.
+ * being stopped or running out of work. After a call to reset(), the
+ * io_service object's stopped() function will return @c false.
    *
    * This function must not be called while there are any unfinished calls to
    * the run(), run_one(), poll() or poll_one() functions.
@@ -414,7 +441,7 @@
    * throws an exception.
    */
   template <typename CompletionHandler>
- void dispatch(CompletionHandler handler);
+ void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler);
 
   /// Request the io_service to invoke the given handler and return immediately.
   /**
@@ -439,7 +466,7 @@
    * throws an exception.
    */
   template <typename CompletionHandler>
- void post(CompletionHandler handler);
+ void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler);
 
   /// Create a new handler that automatically dispatches the wrapped handler
   /// on the io_service.
@@ -471,6 +498,61 @@
 #endif
   wrap(Handler handler);
 
+ /// Fork-related event notifications.
+ enum fork_event
+ {
+ /// Notify the io_service that the process is about to fork.
+ fork_prepare,
+
+ /// Notify the io_service that the process has forked and is the parent.
+ fork_parent,
+
+ /// Notify the io_service that the process has forked and is the child.
+ fork_child
+ };
+
+ /// Notify the io_service of a fork-related event.
+ /**
+ * This function is used to inform the io_service that the process is about
+ * to fork, or has just forked. This allows the io_service, and the services
+ * it contains, to perform any necessary housekeeping to ensure correct
+ * operation following a fork.
+ *
+ * This function must not be called while any other io_service function, or
+ * any function on an I/O object associated with the io_service, is being
+ * called in another thread. It is, however, safe to call this function from
+ * within a completion handler, provided no other thread is accessing the
+ * io_service.
+ *
+ * @param event A fork-related event.
+ *
+ * @throws boost::system::system_error Thrown on failure. If the notification
+ * fails the io_service object should no longer be used and should be
+ * destroyed.
+ *
+ * @par Example
+ * The following code illustrates how to incorporate the notify_fork()
+ * function:
+ * @code my_io_service.notify_fork(boost::asio::io_service::fork_prepare);
+ * if (fork() == 0)
+ * {
+ * // This is the child process.
+ * my_io_service.notify_fork(boost::asio::io_service::fork_child);
+ * }
+ * else
+ * {
+ * // This is the parent process.
+ * my_io_service.notify_fork(boost::asio::io_service::fork_parent);
+ * } @endcode
+ *
+ * @note For each service object @c svc in the io_service set, performs
+ * <tt>svc->fork_service();</tt>. When processing the fork_prepare event,
+ * services are visited in reverse order of the beginning of service object
+ * lifetime. Otherwise, services are visited in order of the beginning of
+ * service object lifetime.
+ */
+ BOOST_ASIO_DECL void notify_fork(boost::asio::io_service::fork_event event);
+
   /// Obtain the service object corresponding to the given type.
   /**
    * This function is used to locate a service object that corresponds to
@@ -569,10 +651,6 @@
    */
   ~work();
 
- /// (Deprecated: use get_io_service().) Get the io_service associated with the
- /// work.
- boost::asio::io_service& io_service();
-
   /// Get the io_service associated with the work.
   boost::asio::io_service& get_io_service();
 
@@ -598,10 +676,6 @@
   : private noncopyable
 {
 public:
- /// (Deprecated: use get_io_service().) Get the io_service object that owns
- /// the service.
- boost::asio::io_service& io_service();
-
   /// Get the io_service object that owns the service.
   boost::asio::io_service& get_io_service();
 
@@ -619,6 +693,15 @@
   /// Destroy all user-defined handler objects owned by the service.
   virtual void shutdown_service() = 0;
 
+ /// Handle notification of a fork-related event to perform any necessary
+ /// housekeeping.
+ /**
+ * This function is not a pure virtual so that services only have to
+ * implement it if necessary. The default implementation does nothing.
+ */
+ BOOST_ASIO_DECL virtual void fork_service(
+ boost::asio::io_service::fork_event event);
+
   friend class boost::asio::detail::service_registry;
   struct key
   {

Modified: branches/release/boost/asio/ip/address.hpp
==============================================================================
--- branches/release/boost/asio/ip/address.hpp (original)
+++ branches/release/boost/asio/ip/address.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -55,9 +55,19 @@
   /// Copy constructor.
   BOOST_ASIO_DECL address(const address& other);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move constructor.
+ BOOST_ASIO_DECL address(address&& other);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// Assign from another address.
   BOOST_ASIO_DECL address& operator=(const address& other);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move-assign from another address.
+ BOOST_ASIO_DECL address& operator=(address&& other);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// Assign from an IPv4 address.
   BOOST_ASIO_DECL address& operator=(
       const boost::asio::ip::address_v4& ipv4_address);
@@ -108,6 +118,15 @@
   BOOST_ASIO_DECL static address from_string(
       const std::string& str, boost::system::error_code& ec);
 
+ /// Determine whether the address is a loopback address.
+ BOOST_ASIO_DECL bool is_loopback() const;
+
+ /// Determine whether the address is unspecified.
+ BOOST_ASIO_DECL bool is_unspecified() const;
+
+ /// Determine whether the address is a multicast address.
+ BOOST_ASIO_DECL bool is_multicast() const;
+
   /// Compare two addresses for equality.
   BOOST_ASIO_DECL friend bool operator==(const address& a1, const address& a2);
 

Modified: branches/release/boost/asio/ip/address_v4.hpp
==============================================================================
--- branches/release/boost/asio/ip/address_v4.hpp (original)
+++ branches/release/boost/asio/ip/address_v4.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,7 +17,7 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <string>
-#include <boost/array.hpp>
+#include <boost/asio/detail/array.hpp>
 #include <boost/asio/detail/socket_types.hpp>
 #include <boost/asio/detail/winsock_init.hpp>
 #include <boost/system/error_code.hpp>
@@ -45,7 +45,15 @@
 {
 public:
   /// The type used to represent an address as an array of bytes.
- typedef boost::array<unsigned char, 4> bytes_type;
+ /**
+ * @note This type is defined in terms of the C++0x template @c std::array
+ * when it is available. Otherwise, it uses @c boost:array.
+ */
+#if defined(GENERATING_DOCUMENTATION)
+ typedef array<unsigned char, 4> bytes_type;
+#else
+ typedef boost::asio::detail::array<unsigned char, 4> bytes_type;
+#endif
 
   /// Default constructor.
   address_v4()
@@ -65,6 +73,14 @@
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move constructor.
+ address_v4(address_v4&& other)
+ : addr_(other.addr_)
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// Assign from another address.
   address_v4& operator=(const address_v4& other)
   {
@@ -72,6 +88,15 @@
     return *this;
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move-assign from another address.
+ address_v4& operator=(address_v4&& other)
+ {
+ addr_ = other.addr_;
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// Get the address in bytes, in network byte order.
   BOOST_ASIO_DECL bytes_type to_bytes() const;
 
@@ -98,6 +123,12 @@
   BOOST_ASIO_DECL static address_v4 from_string(
       const std::string& str, boost::system::error_code& ec);
 
+ /// Determine whether the address is a loopback address.
+ BOOST_ASIO_DECL bool is_loopback() const;
+
+ /// Determine whether the address is unspecified.
+ BOOST_ASIO_DECL bool is_unspecified() const;
+
   /// Determine whether the address is a class A address.
   BOOST_ASIO_DECL bool is_class_a() const;
 
@@ -149,19 +180,19 @@
   /// Obtain an address object that represents any address.
   static address_v4 any()
   {
- return address_v4(static_cast<unsigned long>(INADDR_ANY));
+ return address_v4();
   }
 
   /// Obtain an address object that represents the loopback address.
   static address_v4 loopback()
   {
- return address_v4(static_cast<unsigned long>(INADDR_LOOPBACK));
+ return address_v4(0x7F000001);
   }
 
   /// Obtain an address object that represents the broadcast address.
   static address_v4 broadcast()
   {
- return address_v4(static_cast<unsigned long>(INADDR_BROADCAST));
+ return address_v4(0xFFFFFFFF);
   }
 
   /// Obtain an address object that represents the broadcast address that

Modified: branches/release/boost/asio/ip/address_v6.hpp
==============================================================================
--- branches/release/boost/asio/ip/address_v6.hpp (original)
+++ branches/release/boost/asio/ip/address_v6.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,7 +17,7 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <string>
-#include <boost/array.hpp>
+#include <boost/asio/detail/array.hpp>
 #include <boost/asio/detail/socket_types.hpp>
 #include <boost/asio/detail/winsock_init.hpp>
 #include <boost/system/error_code.hpp>
@@ -46,7 +46,15 @@
 {
 public:
   /// The type used to represent an address as an array of bytes.
- typedef boost::array<unsigned char, 16> bytes_type;
+ /**
+ * @note This type is defined in terms of the C++0x template @c std::array
+ * when it is available. Otherwise, it uses @c boost:array.
+ */
+#if defined(GENERATING_DOCUMENTATION)
+ typedef array<unsigned char, 16> bytes_type;
+#else
+ typedef boost::asio::detail::array<unsigned char, 16> bytes_type;
+#endif
 
   /// Default constructor.
   BOOST_ASIO_DECL address_v6();
@@ -58,9 +66,19 @@
   /// Copy constructor.
   BOOST_ASIO_DECL address_v6(const address_v6& other);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move constructor.
+ BOOST_ASIO_DECL address_v6(address_v6&& other);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// Assign from another address.
   BOOST_ASIO_DECL address_v6& operator=(const address_v6& other);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move-assign from another address.
+ BOOST_ASIO_DECL address_v6& operator=(address_v6&& other);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// The scope ID of the address.
   /**
    * Returns the scope ID associated with the IPv6 address.

Modified: branches/release/boost/asio/ip/basic_endpoint.hpp
==============================================================================
--- branches/release/boost/asio/ip/basic_endpoint.hpp (original)
+++ branches/release/boost/asio/ip/basic_endpoint.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -78,8 +78,9 @@
    * boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876);
    * @endcode
    */
- basic_endpoint(const InternetProtocol& protocol, unsigned short port_num)
- : impl_(protocol.family(), port_num)
+ basic_endpoint(const InternetProtocol& internet_protocol,
+ unsigned short port_num)
+ : impl_(internet_protocol.family(), port_num)
   {
   }
 
@@ -97,6 +98,14 @@
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move constructor.
+ basic_endpoint(basic_endpoint&& other)
+ : impl_(other.impl_)
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// Assign from another endpoint.
   basic_endpoint& operator=(const basic_endpoint& other)
   {
@@ -104,6 +113,15 @@
     return *this;
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move-assign from another endpoint.
+ basic_endpoint& operator=(basic_endpoint&& other)
+ {
+ impl_ = other.impl_;
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// The protocol associated with the endpoint.
   protocol_type protocol() const
   {
@@ -131,9 +149,9 @@
   }
 
   /// Set the underlying size of the endpoint in the native type.
- void resize(std::size_t size)
+ void resize(std::size_t new_size)
   {
- impl_.resize(size);
+ impl_.resize(new_size);
   }
 
   /// Get the capacity of the endpoint in the native type.

Modified: branches/release/boost/asio/ip/basic_resolver.hpp
==============================================================================
--- branches/release/boost/asio/ip/basic_resolver.hpp (original)
+++ branches/release/boost/asio/ip/basic_resolver.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,6 +17,7 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <boost/asio/basic_io_object.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/ip/basic_resolver_iterator.hpp>
@@ -99,7 +100,7 @@
   {
     boost::system::error_code ec;
     iterator i = this->service.resolve(this->implementation, q, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "resolve");
     return i;
   }
 
@@ -152,9 +153,16 @@
    * the handler.
    */
   template <typename ResolveHandler>
- void async_resolve(const query& q, ResolveHandler handler)
+ void async_resolve(const query& q,
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
- return this->service.async_resolve(this->implementation, q, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ResolveHandler.
+ BOOST_ASIO_RESOLVE_HANDLER_CHECK(
+ ResolveHandler, handler, iterator) type_check;
+
+ return this->service.async_resolve(this->implementation, q,
+ BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
   }
 
   /// Perform reverse resolution of an endpoint to a list of entries.
@@ -179,7 +187,7 @@
   {
     boost::system::error_code ec;
     iterator i = this->service.resolve(this->implementation, e, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "resolve");
     return i;
   }
 
@@ -236,9 +244,16 @@
    * the handler.
    */
   template <typename ResolveHandler>
- void async_resolve(const endpoint_type& e, ResolveHandler handler)
+ void async_resolve(const endpoint_type& e,
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
- return this->service.async_resolve(this->implementation, e, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ResolveHandler.
+ BOOST_ASIO_RESOLVE_HANDLER_CHECK(
+ ResolveHandler, handler, iterator) type_check;
+
+ return this->service.async_resolve(this->implementation, e,
+ BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/ip/basic_resolver_entry.hpp
==============================================================================
--- branches/release/boost/asio/ip/basic_resolver_entry.hpp (original)
+++ branches/release/boost/asio/ip/basic_resolver_entry.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -49,11 +49,11 @@
   }
 
   /// Construct with specified endpoint, host name and service name.
- basic_resolver_entry(const endpoint_type& endpoint,
- const std::string& host_name, const std::string& service_name)
- : endpoint_(endpoint),
- host_name_(host_name),
- service_name_(service_name)
+ basic_resolver_entry(const endpoint_type& ep,
+ const std::string& host, const std::string& service)
+ : endpoint_(ep),
+ host_name_(host),
+ service_name_(service)
   {
   }
 

Modified: branches/release/boost/asio/ip/basic_resolver_iterator.hpp
==============================================================================
--- branches/release/boost/asio/ip/basic_resolver_iterator.hpp (original)
+++ branches/release/boost/asio/ip/basic_resolver_iterator.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,8 +16,9 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <boost/iterator.hpp>
+#include <cstddef>
 #include <cstring>
+#include <iterator>
 #include <string>
 #include <vector>
 #include <boost/asio/detail/shared_ptr.hpp>
@@ -45,15 +46,23 @@
  */
 template <typename InternetProtocol>
 class basic_resolver_iterator
-#if defined(GENERATING_DOCUMENTATION)
- : public std::iterator<
-#else // defined(GENERATING_DOCUMENTATION)
- : public boost::iterator<
-#endif // defined(GENERATING_DOCUMENTATION)
- std::forward_iterator_tag,
- const basic_resolver_entry<InternetProtocol> >
 {
 public:
+ /// The type used for the distance between two iterators.
+ typedef std::ptrdiff_t difference_type;
+
+ /// The type of the value pointed to by the iterator.
+ typedef basic_resolver_entry<InternetProtocol> value_type;
+
+ /// The type of the result of applying operator->() to the iterator.
+ typedef const basic_resolver_entry<InternetProtocol>* pointer;
+
+ /// The type of the result of applying operator*() to the iterator.
+ typedef const basic_resolver_entry<InternetProtocol>& reference;
+
+ /// The iterator category.
+ typedef std::forward_iterator_tag iterator_category;
+
   /// Default constructor creates an end iterator.
   basic_resolver_iterator()
     : index_(0)

Modified: branches/release/boost/asio/ip/basic_resolver_query.hpp
==============================================================================
--- branches/release/boost/asio/ip/basic_resolver_query.hpp (original)
+++ branches/release/boost/asio/ip/basic_resolver_query.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -48,8 +48,8 @@
    * This constructor is typically used to perform name resolution for local
    * service binding.
    *
- * @param service_name A string identifying the requested service. This may
- * be a descriptive name or a numeric string corresponding to a port number.
+ * @param service A string identifying the requested service. This may be a
+ * descriptive name or a numeric string corresponding to a port number.
    *
    * @param resolve_flags A set of flags that determine how name resolution
    * should be performed. The default flags are suitable for local service
@@ -60,11 +60,11 @@
    * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
    * may use additional locations when resolving service names.
    */
- basic_resolver_query(const std::string& service_name,
+ basic_resolver_query(const std::string& service,
       resolver_query_base::flags resolve_flags = passive | address_configured)
     : hints_(),
       host_name_(),
- service_name_(service_name)
+ service_name_(service)
   {
     typename InternetProtocol::endpoint endpoint;
     hints_.ai_flags = static_cast<int>(resolve_flags);
@@ -85,8 +85,8 @@
    * @param protocol A protocol object, normally representing either the IPv4 or
    * IPv6 version of an internet protocol.
    *
- * @param service_name A string identifying the requested service. This may
- * be a descriptive name or a numeric string corresponding to a port number.
+ * @param service A string identifying the requested service. This may be a
+ * descriptive name or a numeric string corresponding to a port number.
    *
    * @param resolve_flags A set of flags that determine how name resolution
    * should be performed. The default flags are suitable for local service
@@ -98,11 +98,11 @@
    * may use additional locations when resolving service names.
    */
   basic_resolver_query(const protocol_type& protocol,
- const std::string& service_name,
+ const std::string& service,
       resolver_query_base::flags resolve_flags = passive | address_configured)
     : hints_(),
       host_name_(),
- service_name_(service_name)
+ service_name_(service)
   {
     hints_.ai_flags = static_cast<int>(resolve_flags);
     hints_.ai_family = protocol.family();
@@ -119,16 +119,16 @@
    * This constructor is typically used to perform name resolution for
    * communication with remote hosts.
    *
- * @param host_name A string identifying a location. May be a descriptive name
- * or a numeric address string. If an empty string and the passive flag has
- * been specified, the resolved endpoints are suitable for local service
- * binding. If an empty string and passive is not specified, the resolved
- * endpoints will use the loopback address.
- *
- * @param service_name A string identifying the requested service. This may
- * be a descriptive name or a numeric string corresponding to a port number.
- * May be an empty string, in which case all resolved endpoints will have a
- * port number of 0.
+ * @param host A string identifying a location. May be a descriptive name or
+ * a numeric address string. If an empty string and the passive flag has been
+ * specified, the resolved endpoints are suitable for local service binding.
+ * If an empty string and passive is not specified, the resolved endpoints
+ * will use the loopback address.
+ *
+ * @param service A string identifying the requested service. This may be a
+ * descriptive name or a numeric string corresponding to a port number. May
+ * be an empty string, in which case all resolved endpoints will have a port
+ * number of 0.
    *
    * @param resolve_flags A set of flags that determine how name resolution
    * should be performed. The default flags are suitable for communication with
@@ -145,12 +145,11 @@
    * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems
    * may use additional locations when resolving service names.
    */
- basic_resolver_query(const std::string& host_name,
- const std::string& service_name,
+ basic_resolver_query(const std::string& host, const std::string& service,
       resolver_query_base::flags resolve_flags = address_configured)
     : hints_(),
- host_name_(host_name),
- service_name_(service_name)
+ host_name_(host),
+ service_name_(service)
   {
     typename InternetProtocol::endpoint endpoint;
     hints_.ai_flags = static_cast<int>(resolve_flags);
@@ -171,16 +170,16 @@
    * @param protocol A protocol object, normally representing either the IPv4 or
    * IPv6 version of an internet protocol.
    *
- * @param host_name A string identifying a location. May be a descriptive name
- * or a numeric address string. If an empty string and the passive flag has
- * been specified, the resolved endpoints are suitable for local service
- * binding. If an empty string and passive is not specified, the resolved
- * endpoints will use the loopback address.
- *
- * @param service_name A string identifying the requested service. This may
- * be a descriptive name or a numeric string corresponding to a port number.
- * May be an empty string, in which case all resolved endpoints will have a
- * port number of 0.
+ * @param host A string identifying a location. May be a descriptive name or
+ * a numeric address string. If an empty string and the passive flag has been
+ * specified, the resolved endpoints are suitable for local service binding.
+ * If an empty string and passive is not specified, the resolved endpoints
+ * will use the loopback address.
+ *
+ * @param service A string identifying the requested service. This may be a
+ * descriptive name or a numeric string corresponding to a port number. May
+ * be an empty string, in which case all resolved endpoints will have a port
+ * number of 0.
    *
    * @param resolve_flags A set of flags that determine how name resolution
    * should be performed. The default flags are suitable for communication with
@@ -198,11 +197,11 @@
    * may use additional locations when resolving service names.
    */
   basic_resolver_query(const protocol_type& protocol,
- const std::string& host_name, const std::string& service_name,
+ const std::string& host, const std::string& service,
       resolver_query_base::flags resolve_flags = address_configured)
     : hints_(),
- host_name_(host_name),
- service_name_(service_name)
+ host_name_(host),
+ service_name_(service)
   {
     hints_.ai_flags = static_cast<int>(resolve_flags);
     hints_.ai_family = protocol.family();

Modified: branches/release/boost/asio/ip/detail/endpoint.hpp
==============================================================================
--- branches/release/boost/asio/ip/detail/endpoint.hpp (original)
+++ branches/release/boost/asio/ip/detail/endpoint.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -78,12 +78,12 @@
   }
 
   // Set the underlying size of the endpoint in the native type.
- BOOST_ASIO_DECL void resize(std::size_t size);
+ BOOST_ASIO_DECL void resize(std::size_t new_size);
 
   // Get the capacity of the endpoint in the native type.
   std::size_t capacity() const
   {
- return sizeof(boost::asio::detail::sockaddr_storage_type);
+ return sizeof(data_);
   }
 
   // Get the port associated with the endpoint.
@@ -122,7 +122,6 @@
   union data_union
   {
     boost::asio::detail::socket_addr_type base;
- boost::asio::detail::sockaddr_storage_type storage;
     boost::asio::detail::sockaddr_in4_type v4;
     boost::asio::detail::sockaddr_in6_type v6;
   } data_;

Modified: branches/release/boost/asio/ip/detail/impl/endpoint.ipp
==============================================================================
--- branches/release/boost/asio/ip/detail/impl/endpoint.ipp (original)
+++ branches/release/boost/asio/ip/detail/impl/endpoint.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -57,8 +57,14 @@
     data_.v6.sin6_port =
       boost::asio::detail::socket_ops::host_to_network_short(port_num);
     data_.v6.sin6_flowinfo = 0;
- boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT;
- data_.v6.sin6_addr = tmp_addr;
+ data_.v6.sin6_addr.s6_addr[0] = 0; data_.v6.sin6_addr.s6_addr[1] = 0;
+ data_.v6.sin6_addr.s6_addr[2] = 0, data_.v6.sin6_addr.s6_addr[3] = 0;
+ data_.v6.sin6_addr.s6_addr[4] = 0, data_.v6.sin6_addr.s6_addr[5] = 0;
+ data_.v6.sin6_addr.s6_addr[6] = 0, data_.v6.sin6_addr.s6_addr[7] = 0;
+ data_.v6.sin6_addr.s6_addr[8] = 0, data_.v6.sin6_addr.s6_addr[9] = 0;
+ data_.v6.sin6_addr.s6_addr[10] = 0, data_.v6.sin6_addr.s6_addr[11] = 0;
+ data_.v6.sin6_addr.s6_addr[12] = 0, data_.v6.sin6_addr.s6_addr[13] = 0;
+ data_.v6.sin6_addr.s6_addr[14] = 0, data_.v6.sin6_addr.s6_addr[15] = 0;
     data_.v6.sin6_scope_id = 0;
   }
 }
@@ -85,14 +91,14 @@
     data_.v6.sin6_flowinfo = 0;
     boost::asio::ip::address_v6 v6_addr = addr.to_v6();
     boost::asio::ip::address_v6::bytes_type bytes = v6_addr.to_bytes();
- memcpy(data_.v6.sin6_addr.s6_addr, bytes.elems, 16);
+ memcpy(data_.v6.sin6_addr.s6_addr, bytes.data(), 16);
     data_.v6.sin6_scope_id = v6_addr.scope_id();
   }
 }
 
-void endpoint::resize(std::size_t size)
+void endpoint::resize(std::size_t new_size)
 {
- if (size > sizeof(boost::asio::detail::sockaddr_storage_type))
+ if (new_size > sizeof(boost::asio::detail::sockaddr_storage_type))
   {
     boost::system::error_code ec(boost::asio::error::invalid_argument);
     boost::asio::detail::throw_error(ec);
@@ -139,7 +145,11 @@
   else
   {
     boost::asio::ip::address_v6::bytes_type bytes;
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+ memcpy(bytes.data(), data_.v6.sin6_addr.s6_addr, 16);
+#else // defined(BOOST_ASIO_HAS_STD_ARRAY)
     memcpy(bytes.elems, data_.v6.sin6_addr.s6_addr, 16);
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
     return boost::asio::ip::address_v6(bytes, data_.v6.sin6_scope_id);
   }
 }

Modified: branches/release/boost/asio/ip/detail/socket_option.hpp
==============================================================================
--- branches/release/boost/asio/ip/detail/socket_option.hpp (original)
+++ branches/release/boost/asio/ip/detail/socket_option.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,6 +18,7 @@
 #include <boost/asio/detail/config.hpp>
 #include <cstddef>
 #include <cstring>
+#include <stdexcept>
 #include <boost/throw_exception.hpp>
 #include <boost/asio/detail/socket_ops.hpp>
 #include <boost/asio/detail/socket_types.hpp>
@@ -385,35 +386,22 @@
 public:
   // Default constructor.
   multicast_request()
+ : ipv4_value_(), // Zero-initialisation gives the "any" address.
+ ipv6_value_() // Zero-initialisation gives the "any" address.
   {
- ipv4_value_.imr_multiaddr.s_addr =
- boost::asio::detail::socket_ops::host_to_network_long(
- boost::asio::ip::address_v4::any().to_ulong());
- ipv4_value_.imr_interface.s_addr =
- boost::asio::detail::socket_ops::host_to_network_long(
- boost::asio::ip::address_v4::any().to_ulong());
-
- boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT;
- ipv6_value_.ipv6mr_multiaddr = tmp_addr;
- ipv6_value_.ipv6mr_interface = 0;
   }
 
   // Construct with multicast address only.
   explicit multicast_request(const boost::asio::ip::address& multicast_address)
+ : ipv4_value_(), // Zero-initialisation gives the "any" address.
+ ipv6_value_() // Zero-initialisation gives the "any" address.
   {
     if (multicast_address.is_v6())
     {
- ipv4_value_.imr_multiaddr.s_addr =
- boost::asio::detail::socket_ops::host_to_network_long(
- boost::asio::ip::address_v4::any().to_ulong());
- ipv4_value_.imr_interface.s_addr =
- boost::asio::detail::socket_ops::host_to_network_long(
- boost::asio::ip::address_v4::any().to_ulong());
-
       using namespace std; // For memcpy.
       boost::asio::ip::address_v6 ipv6_address = multicast_address.to_v6();
       boost::asio::ip::address_v6::bytes_type bytes = ipv6_address.to_bytes();
- memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.elems, 16);
+ memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16);
       ipv6_value_.ipv6mr_interface = 0;
     }
     else
@@ -424,10 +412,6 @@
       ipv4_value_.imr_interface.s_addr =
         boost::asio::detail::socket_ops::host_to_network_long(
             boost::asio::ip::address_v4::any().to_ulong());
-
- boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT;
- ipv6_value_.ipv6mr_multiaddr = tmp_addr;
- ipv6_value_.ipv6mr_interface = 0;
     }
   }
 
@@ -436,6 +420,7 @@
       const boost::asio::ip::address_v4& multicast_address,
       const boost::asio::ip::address_v4& network_interface
         = boost::asio::ip::address_v4::any())
+ : ipv6_value_() // Zero-initialisation gives the "any" address.
   {
     ipv4_value_.imr_multiaddr.s_addr =
       boost::asio::detail::socket_ops::host_to_network_long(
@@ -443,28 +428,18 @@
     ipv4_value_.imr_interface.s_addr =
       boost::asio::detail::socket_ops::host_to_network_long(
           network_interface.to_ulong());
-
- boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT;
- ipv6_value_.ipv6mr_multiaddr = tmp_addr;
- ipv6_value_.ipv6mr_interface = 0;
   }
 
   // Construct with multicast address and IPv6 network interface index.
   explicit multicast_request(
       const boost::asio::ip::address_v6& multicast_address,
       unsigned long network_interface = 0)
+ : ipv4_value_() // Zero-initialisation gives the "any" address.
   {
- ipv4_value_.imr_multiaddr.s_addr =
- boost::asio::detail::socket_ops::host_to_network_long(
- boost::asio::ip::address_v4::any().to_ulong());
- ipv4_value_.imr_interface.s_addr =
- boost::asio::detail::socket_ops::host_to_network_long(
- boost::asio::ip::address_v4::any().to_ulong());
-
     using namespace std; // For memcpy.
     boost::asio::ip::address_v6::bytes_type bytes =
       multicast_address.to_bytes();
- memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.elems, 16);
+ memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16);
     ipv6_value_.ipv6mr_interface = network_interface;
   }
 

Modified: branches/release/boost/asio/ip/icmp.hpp
==============================================================================
--- branches/release/boost/asio/ip/icmp.hpp (original)
+++ branches/release/boost/asio/ip/icmp.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -46,12 +46,6 @@
   /// The type of a ICMP endpoint.
   typedef basic_endpoint<icmp> endpoint;
 
- /// (Deprecated: use resolver::query.) The type of a resolver query.
- typedef basic_resolver_query<icmp> resolver_query;
-
- /// (Deprecated: use resolver::iterator.) The type of a resolver iterator.
- typedef basic_resolver_iterator<icmp> resolver_iterator;
-
   /// Construct to represent the IPv4 ICMP protocol.
   static icmp v4()
   {
@@ -102,9 +96,9 @@
 
 private:
   // Construct with a specific family.
- explicit icmp(int protocol, int family)
- : protocol_(protocol),
- family_(family)
+ explicit icmp(int protocol_id, int protocol_family)
+ : protocol_(protocol_id),
+ family_(protocol_family)
   {
   }
 

Modified: branches/release/boost/asio/ip/impl/address.ipp
==============================================================================
--- branches/release/boost/asio/ip/impl/address.ipp (original)
+++ branches/release/boost/asio/ip/impl/address.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -57,6 +57,15 @@
 {
 }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+address::address(address&& other)
+ : type_(other.type_),
+ ipv4_address_(other.ipv4_address_),
+ ipv6_address_(other.ipv6_address_)
+{
+}
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
 address& address::operator=(const address& other)
 {
   type_ = other.type_;
@@ -65,6 +74,16 @@
   return *this;
 }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+address& address::operator=(address&& other)
+{
+ type_ = other.type_;
+ ipv4_address_ = other.ipv4_address_;
+ ipv6_address_ = other.ipv6_address_;
+ return *this;
+}
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
 address& address::operator=(const boost::asio::ip::address_v4& ipv4_address)
 {
   type_ = ipv4;
@@ -159,6 +178,27 @@
   return from_string(str.c_str(), ec);
 }
 
+bool address::is_loopback() const
+{
+ return (type_ == ipv4)
+ ? ipv4_address_.is_loopback()
+ : ipv6_address_.is_loopback();
+}
+
+bool address::is_unspecified() const
+{
+ return (type_ == ipv4)
+ ? ipv4_address_.is_unspecified()
+ : ipv6_address_.is_unspecified();
+}
+
+bool address::is_multicast() const
+{
+ return (type_ == ipv4)
+ ? ipv4_address_.is_multicast()
+ : ipv6_address_.is_multicast();
+}
+
 bool operator==(const address& a1, const address& a2)
 {
   if (a1.type_ != a2.type_)

Modified: branches/release/boost/asio/ip/impl/address_v4.ipp
==============================================================================
--- branches/release/boost/asio/ip/impl/address_v4.ipp (original)
+++ branches/release/boost/asio/ip/impl/address_v4.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -42,7 +42,7 @@
 #endif // UCHAR_MAX > 0xFF
 
   using namespace std; // For memcpy.
- memcpy(&addr_.s_addr, bytes.elems, 4);
+ memcpy(&addr_.s_addr, bytes.data(), 4);
 }
 
 address_v4::address_v4(unsigned long addr)
@@ -62,7 +62,11 @@
 {
   using namespace std; // For memcpy.
   bytes_type bytes;
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+ memcpy(bytes.data(), &addr_.s_addr, 4);
+#else // defined(BOOST_ASIO_HAS_STD_ARRAY)
   memcpy(bytes.elems, &addr_.s_addr, 4);
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
   return bytes;
 }
 
@@ -119,24 +123,34 @@
   return from_string(str.c_str(), ec);
 }
 
+bool address_v4::is_loopback() const
+{
+ return (to_ulong() & 0xFF000000) == 0x7F000000;
+}
+
+bool address_v4::is_unspecified() const
+{
+ return to_ulong() == 0;
+}
+
 bool address_v4::is_class_a() const
 {
- return IN_CLASSA(to_ulong());
+ return (to_ulong() & 0x80000000) == 0;
 }
 
 bool address_v4::is_class_b() const
 {
- return IN_CLASSB(to_ulong());
+ return (to_ulong() & 0xC0000000) == 0x80000000;
 }
 
 bool address_v4::is_class_c() const
 {
- return IN_CLASSC(to_ulong());
+ return (to_ulong() & 0xE0000000) == 0xC0000000;
 }
 
 bool address_v4::is_multicast() const
 {
- return IN_MULTICAST(to_ulong());
+ return (to_ulong() & 0xF0000000) == 0xE0000000;
 }
 
 address_v4 address_v4::broadcast(const address_v4& addr, const address_v4& mask)

Modified: branches/release/boost/asio/ip/impl/address_v6.ipp
==============================================================================
--- branches/release/boost/asio/ip/impl/address_v6.ipp (original)
+++ branches/release/boost/asio/ip/impl/address_v6.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -32,15 +32,14 @@
 namespace ip {
 
 address_v6::address_v6()
- : scope_id_(0)
+ : addr_(),
+ scope_id_(0)
 {
- boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT;
- addr_ = tmp_addr;
 }
 
 address_v6::address_v6(const address_v6::bytes_type& bytes,
- unsigned long scope_id)
- : scope_id_(scope_id)
+ unsigned long scope)
+ : scope_id_(scope)
 {
 #if UCHAR_MAX > 0xFF
   for (std::size_t i = 0; i < bytes.size(); ++i)
@@ -54,7 +53,7 @@
 #endif // UCHAR_MAX > 0xFF
 
   using namespace std; // For memcpy.
- memcpy(addr_.s6_addr, bytes.elems, 16);
+ memcpy(addr_.s6_addr, bytes.data(), 16);
 }
 
 address_v6::address_v6(const address_v6& other)
@@ -63,6 +62,14 @@
 {
 }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+address_v6::address_v6(address_v6&& other)
+ : addr_(other.addr_),
+ scope_id_(other.scope_id_)
+{
+}
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
 address_v6& address_v6::operator=(const address_v6& other)
 {
   addr_ = other.addr_;
@@ -70,11 +77,24 @@
   return *this;
 }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+address_v6& address_v6::operator=(address_v6&& other)
+{
+ addr_ = other.addr_;
+ scope_id_ = other.scope_id_;
+ return *this;
+}
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
 address_v6::bytes_type address_v6::to_bytes() const
 {
   using namespace std; // For memcpy.
   bytes_type bytes;
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+ memcpy(bytes.data(), addr_.s6_addr, 16);
+#else // defined(BOOST_ASIO_HAS_STD_ARRAY)
   memcpy(bytes.elems, addr_.s6_addr, 16);
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
   return bytes;
 }
 
@@ -141,7 +161,6 @@
 
 bool address_v6::is_loopback() const
 {
-#if defined(__BORLANDC__)
   return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0)
       && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0)
       && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0)
@@ -150,15 +169,10 @@
       && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0)
       && (addr_.s6_addr[12] == 0) && (addr_.s6_addr[13] == 0)
       && (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 1));
-#else
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_LOOPBACK(&addr_) != 0;
-#endif
 }
 
 bool address_v6::is_unspecified() const
 {
-#if defined(__BORLANDC__)
   return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0)
       && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0)
       && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0)
@@ -167,70 +181,70 @@
       && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0)
       && (addr_.s6_addr[12] == 0) && (addr_.s6_addr[13] == 0)
       && (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 0));
-#else
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_UNSPECIFIED(&addr_) != 0;
-#endif
 }
 
 bool address_v6::is_link_local() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_LINKLOCAL(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0x80));
 }
 
 bool address_v6::is_site_local() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_SITELOCAL(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0xc0));
 }
 
 bool address_v6::is_v4_mapped() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_V4MAPPED(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0)
+ && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0)
+ && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0)
+ && (addr_.s6_addr[6] == 0) && (addr_.s6_addr[7] == 0)
+ && (addr_.s6_addr[8] == 0) && (addr_.s6_addr[9] == 0)
+ && (addr_.s6_addr[10] == 0xff) && (addr_.s6_addr[11] == 0xff));
 }
 
 bool address_v6::is_v4_compatible() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_V4COMPAT(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0)
+ && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0)
+ && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0)
+ && (addr_.s6_addr[6] == 0) && (addr_.s6_addr[7] == 0)
+ && (addr_.s6_addr[8] == 0) && (addr_.s6_addr[9] == 0)
+ && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0)
+ && !((addr_.s6_addr[12] == 0)
+ && (addr_.s6_addr[13] == 0)
+ && (addr_.s6_addr[14] == 0)
+ && ((addr_.s6_addr[15] == 0) || (addr_.s6_addr[15] == 1))));
 }
 
 bool address_v6::is_multicast() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_MULTICAST(&addr_) != 0;
+ return (addr_.s6_addr[0] == 0xff);
 }
 
 bool address_v6::is_multicast_global() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_MC_GLOBAL(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x0e));
 }
 
 bool address_v6::is_multicast_link_local() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_MC_LINKLOCAL(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x02));
 }
 
 bool address_v6::is_multicast_node_local() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_MC_NODELOCAL(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x01));
 }
 
 bool address_v6::is_multicast_org_local() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_MC_ORGLOCAL(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x08));
 }
 
 bool address_v6::is_multicast_site_local() const
 {
- using namespace boost::asio::detail;
- return IN6_IS_ADDR_MC_SITELOCAL(&addr_) != 0;
+ return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x05));
 }
 
 bool operator==(const address_v6& a1, const address_v6& a2)
@@ -256,8 +270,7 @@
 address_v6 address_v6::loopback()
 {
   address_v6 tmp;
- boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_LOOPBACK_INIT;
- tmp.addr_ = tmp_addr;
+ tmp.addr_.s6_addr[15] = 1;
   return tmp;
 }
 

Modified: branches/release/boost/asio/ip/resolver_service.hpp
==============================================================================
--- branches/release/boost/asio/ip/resolver_service.hpp (original)
+++ branches/release/boost/asio/ip/resolver_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -77,12 +77,6 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new resolver implementation.
   void construct(implementation_type& impl)
   {
@@ -109,11 +103,12 @@
   }
 
   /// Asynchronously resolve a query to a list of entries.
- template <typename Handler>
+ template <typename ResolveHandler>
   void async_resolve(implementation_type& impl, const query_type& query,
- Handler handler)
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
- service_impl_.async_resolve(impl, query, handler);
+ service_impl_.async_resolve(impl, query,
+ BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
   }
 
   /// Resolve an endpoint to a list of entries.
@@ -126,12 +121,25 @@
   /// Asynchronously resolve an endpoint to a list of entries.
   template <typename ResolveHandler>
   void async_resolve(implementation_type& impl, const endpoint_type& endpoint,
- ResolveHandler handler)
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
- return service_impl_.async_resolve(impl, endpoint, handler);
+ return service_impl_.async_resolve(impl, endpoint,
+ BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
+ // Perform any fork-related housekeeping.
+ void fork_service(boost::asio::io_service::fork_event event)
+ {
+ service_impl_.fork_service(event);
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/ip/tcp.hpp
==============================================================================
--- branches/release/boost/asio/ip/tcp.hpp (original)
+++ branches/release/boost/asio/ip/tcp.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -49,12 +49,6 @@
   /// The type of a TCP endpoint.
   typedef basic_endpoint<tcp> endpoint;
 
- /// (Deprecated: use resolver::query.) The type of a resolver query.
- typedef basic_resolver_query<tcp> resolver_query;
-
- /// (Deprecated: use resolver::iterator.) The type of a resolver iterator.
- typedef basic_resolver_iterator<tcp> resolver_iterator;
-
   /// Construct to represent the IPv4 TCP protocol.
   static tcp v4()
   {
@@ -146,8 +140,8 @@
 
 private:
   // Construct with a specific family.
- explicit tcp(int family)
- : family_(family)
+ explicit tcp(int protocol_family)
+ : family_(protocol_family)
   {
   }
 

Modified: branches/release/boost/asio/ip/udp.hpp
==============================================================================
--- branches/release/boost/asio/ip/udp.hpp (original)
+++ branches/release/boost/asio/ip/udp.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -46,12 +46,6 @@
   /// The type of a UDP endpoint.
   typedef basic_endpoint<udp> endpoint;
 
- /// (Deprecated: use resolver::query.) The type of a resolver query.
- typedef basic_resolver_query<udp> resolver_query;
-
- /// (Deprecated: use resolver::iterator.) The type of a resolver iterator.
- typedef basic_resolver_iterator<udp> resolver_iterator;
-
   /// Construct to represent the IPv4 UDP protocol.
   static udp v4()
   {
@@ -102,8 +96,8 @@
 
 private:
   // Construct with a specific family.
- explicit udp(int family)
- : family_(family)
+ explicit udp(int protocol_family)
+ : family_(protocol_family)
   {
   }
 

Modified: branches/release/boost/asio/local/basic_endpoint.hpp
==============================================================================
--- branches/release/boost/asio/local/basic_endpoint.hpp (original)
+++ branches/release/boost/asio/local/basic_endpoint.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -66,14 +66,14 @@
   }
 
   /// Construct an endpoint using the specified path name.
- basic_endpoint(const char* path)
- : impl_(path)
+ basic_endpoint(const char* path_name)
+ : impl_(path_name)
   {
   }
 
   /// Construct an endpoint using the specified path name.
- basic_endpoint(const std::string& path)
- : impl_(path)
+ basic_endpoint(const std::string& path_name)
+ : impl_(path_name)
   {
   }
 
@@ -83,6 +83,14 @@
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move constructor.
+ basic_endpoint(basic_endpoint&& other)
+ : impl_(other.impl_)
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// Assign from another endpoint.
   basic_endpoint& operator=(const basic_endpoint& other)
   {
@@ -90,6 +98,15 @@
     return *this;
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ /// Move-assign from another endpoint.
+ basic_endpoint& operator=(basic_endpoint&& other)
+ {
+ impl_ = other.impl_;
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   /// The protocol associated with the endpoint.
   protocol_type protocol() const
   {
@@ -115,9 +132,9 @@
   }
 
   /// Set the underlying size of the endpoint in the native type.
- void resize(std::size_t size)
+ void resize(std::size_t new_size)
   {
- impl_.resize(size);
+ impl_.resize(new_size);
   }
 
   /// Get the capacity of the endpoint in the native type.

Modified: branches/release/boost/asio/local/connect_pair.hpp
==============================================================================
--- branches/release/boost/asio/local/connect_pair.hpp (original)
+++ branches/release/boost/asio/local/connect_pair.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -52,7 +52,7 @@
 {
   boost::system::error_code ec;
   connect_pair(socket1, socket2, ec);
- boost::asio::detail::throw_error(ec);
+ boost::asio::detail::throw_error(ec, "connect_pair");
 }
 
 template <typename Protocol, typename SocketService1, typename SocketService2>

Modified: branches/release/boost/asio/local/detail/endpoint.hpp
==============================================================================
--- branches/release/boost/asio/local/detail/endpoint.hpp (original)
+++ branches/release/boost/asio/local/detail/endpoint.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -39,10 +39,10 @@
   BOOST_ASIO_DECL endpoint();
 
   // Construct an endpoint using the specified path name.
- BOOST_ASIO_DECL endpoint(const char* path);
+ BOOST_ASIO_DECL endpoint(const char* path_name);
 
   // Construct an endpoint using the specified path name.
- BOOST_ASIO_DECL endpoint(const std::string& path);
+ BOOST_ASIO_DECL endpoint(const std::string& path_name);
 
   // Copy constructor.
   endpoint(const endpoint& other)

Modified: branches/release/boost/asio/local/detail/impl/endpoint.ipp
==============================================================================
--- branches/release/boost/asio/local/detail/impl/endpoint.ipp (original)
+++ branches/release/boost/asio/local/detail/impl/endpoint.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -38,31 +38,31 @@
   init("", 0);
 }
 
-endpoint::endpoint(const char* path)
+endpoint::endpoint(const char* path_name)
 {
   using namespace std; // For strlen.
- init(path, strlen(path));
+ init(path_name, strlen(path_name));
 }
 
-endpoint::endpoint(const std::string& path)
+endpoint::endpoint(const std::string& path_name)
 {
- init(path.data(), path.length());
+ init(path_name.data(), path_name.length());
 }
 
-void endpoint::resize(std::size_t size)
+void endpoint::resize(std::size_t new_size)
 {
- if (size > sizeof(boost::asio::detail::sockaddr_un_type))
+ if (new_size > sizeof(boost::asio::detail::sockaddr_un_type))
   {
     boost::system::error_code ec(boost::asio::error::invalid_argument);
     boost::asio::detail::throw_error(ec);
   }
- else if (size == 0)
+ else if (new_size == 0)
   {
     path_length_ = 0;
   }
   else
   {
- path_length_ = size
+ path_length_ = new_size
       - offsetof(boost::asio::detail::sockaddr_un_type, sun_path);
 
     // The path returned by the operating system may be NUL-terminated.
@@ -97,7 +97,7 @@
   return e1.path() < e2.path();
 }
 
-void endpoint::init(const char* path, std::size_t path_length)
+void endpoint::init(const char* path_name, std::size_t path_length)
 {
   if (path_length > sizeof(data_.local.sun_path) - 1)
   {
@@ -109,7 +109,7 @@
   using namespace std; // For memcpy.
   data_.local = boost::asio::detail::sockaddr_un_type();
   data_.local.sun_family = AF_UNIX;
- memcpy(data_.local.sun_path, path, path_length);
+ memcpy(data_.local.sun_path, path_name, path_length);
   path_length_ = path_length;
 
   // NUL-terminate normal path names. Names that start with a NUL are in the

Modified: branches/release/boost/asio/placeholders.hpp
==============================================================================
--- branches/release/boost/asio/placeholders.hpp (original)
+++ branches/release/boost/asio/placeholders.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -42,6 +42,11 @@
 /// boost::asio::basic_resolver::async_resolve.
 unspecified iterator;
 
+/// An argument placeholder, for use with boost::bind(), that corresponds to
+/// the signal_number argument of a handler for asynchronous functions such as
+/// boost::asio::signal_set::async_wait.
+unspecified signal_number;
+
 #elif defined(__BORLANDC__) || defined(__GNUC__)
 
 inline boost::arg<1> error()
@@ -59,6 +64,11 @@
   return boost::arg<2>();
 }
 
+inline boost::arg<2> signal_number()
+{
+ return boost::arg<2>();
+}
+
 #else
 
 namespace detail
@@ -82,6 +92,8 @@
   = boost::asio::placeholders::detail::placeholder<2>::get();
 static boost::arg<2>& iterator
   = boost::asio::placeholders::detail::placeholder<2>::get();
+static boost::arg<2>& signal_number
+ = boost::asio::placeholders::detail::placeholder<2>::get();
 
 #else
 
@@ -93,6 +105,8 @@
     = boost::asio::placeholders::detail::placeholder<2>::get();
   boost::arg<2>& iterator
     = boost::asio::placeholders::detail::placeholder<2>::get();
+ boost::arg<2>& signal_number
+ = boost::asio::placeholders::detail::placeholder<2>::get();
 } // namespace
 
 #endif

Modified: branches/release/boost/asio/posix/basic_descriptor.hpp
==============================================================================
--- branches/release/boost/asio/posix/basic_descriptor.hpp (original)
+++ branches/release/boost/asio/posix/basic_descriptor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -46,8 +46,12 @@
     public descriptor_base
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// descriptor.
+ typedef typename DescriptorService::native_handle_type native_type;
+
   /// The native representation of a descriptor.
- typedef typename DescriptorService::native_type native_type;
+ typedef typename DescriptorService::native_handle_type native_handle_type;
 
   /// A basic_descriptor is always the lowest layer.
   typedef basic_descriptor<DescriptorService> lowest_layer_type;
@@ -79,14 +83,50 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_descriptor(boost::asio::io_service& io_service,
- const native_type& native_descriptor)
+ const native_handle_type& native_descriptor)
     : basic_io_object<DescriptorService>(io_service)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, native_descriptor, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ native_descriptor, ec);
+ boost::asio::detail::throw_error(ec, "assign");
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_descriptor from another.
+ /**
+ * This constructor moves a descriptor from one object to another.
+ *
+ * @param other The other basic_descriptor object from which the move will
+ * occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_descriptor(io_service&) constructor.
+ */
+ basic_descriptor(basic_descriptor&& other)
+ : basic_io_object<DescriptorService>(
+ BOOST_ASIO_MOVE_CAST(basic_descriptor)(other))
+ {
+ }
+
+ /// Move-assign a basic_descriptor from another.
+ /**
+ * This assignment operator moves a descriptor from one object to another.
+ *
+ * @param other The other basic_descriptor object from which the move will
+ * occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_descriptor(io_service&) constructor.
+ */
+ basic_descriptor& operator=(basic_descriptor&& other)
+ {
+ basic_io_object<DescriptorService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_descriptor)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Get a reference to the lowest layer.
   /**
    * This function returns a reference to the lowest layer in a stack of
@@ -123,11 +163,12 @@
    *
    * @throws boost::system::system_error Thrown on failure.
    */
- void assign(const native_type& native_descriptor)
+ void assign(const native_handle_type& native_descriptor)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, native_descriptor, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(),
+ native_descriptor, ec);
+ boost::asio::detail::throw_error(ec, "assign");
   }
 
   /// Assign an existing native descriptor to the descriptor.
@@ -138,16 +179,17 @@
    *
    * @param ec Set to indicate what error occurred, if any.
    */
- boost::system::error_code assign(const native_type& native_descriptor,
+ boost::system::error_code assign(const native_handle_type& native_descriptor,
       boost::system::error_code& ec)
   {
- return this->service.assign(this->implementation, native_descriptor, ec);
+ return this->get_service().assign(
+ this->get_implementation(), native_descriptor, ec);
   }
 
   /// Determine whether the descriptor is open.
   bool is_open() const
   {
- return this->service.is_open(this->implementation);
+ return this->get_service().is_open(this->implementation);
   }
 
   /// Close the descriptor.
@@ -156,13 +198,14 @@
    * write operations will be cancelled immediately, and will complete with the
    * boost::asio::error::operation_aborted error.
    *
- * @throws boost::system::system_error Thrown on failure.
+ * @throws boost::system::system_error Thrown on failure. Note that, even if
+ * the function indicates an error, the underlying descriptor is closed.
    */
   void close()
   {
     boost::system::error_code ec;
- this->service.close(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().close(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "close");
   }
 
   /// Close the descriptor.
@@ -171,14 +214,16 @@
    * write operations will be cancelled immediately, and will complete with the
    * boost::asio::error::operation_aborted error.
    *
- * @param ec Set to indicate what error occurred, if any.
+ * @param ec Set to indicate what error occurred, if any. Note that, even if
+ * the function indicates an error, the underlying descriptor is closed.
    */
   boost::system::error_code close(boost::system::error_code& ec)
   {
- return this->service.close(this->implementation, ec);
+ return this->get_service().close(this->get_implementation(), ec);
   }
 
- /// Get the native descriptor representation.
+ /// (Deprecated: Use native_handle().) Get the native descriptor
+ /// representation.
   /**
    * This function may be used to obtain the underlying representation of the
    * descriptor. This is intended to allow access to native descriptor
@@ -186,7 +231,33 @@
    */
   native_type native()
   {
- return this->service.native(this->implementation);
+ return this->get_service().native_handle(this->implementation);
+ }
+
+ /// Get the native descriptor representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * descriptor. This is intended to allow access to native descriptor
+ * functionality that is not otherwise provided.
+ */
+ native_handle_type native_handle()
+ {
+ return this->get_service().native_handle(this->implementation);
+ }
+
+ /// Release ownership of the native descriptor implementation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * descriptor. After calling this function, @c is_open() returns false. The
+ * caller is responsible for closing the descriptor.
+ *
+ * All outstanding asynchronous read or write operations will finish
+ * immediately, and the handlers for cancelled operations will be passed the
+ * boost::asio::error::operation_aborted error.
+ */
+ native_handle_type release()
+ {
+ return this->get_service().release(this->implementation);
   }
 
   /// Cancel all asynchronous operations associated with the descriptor.
@@ -200,8 +271,8 @@
   void cancel()
   {
     boost::system::error_code ec;
- this->service.cancel(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().cancel(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "cancel");
   }
 
   /// Cancel all asynchronous operations associated with the descriptor.
@@ -214,7 +285,7 @@
    */
   boost::system::error_code cancel(boost::system::error_code& ec)
   {
- return this->service.cancel(this->implementation, ec);
+ return this->get_service().cancel(this->get_implementation(), ec);
   }
 
   /// Perform an IO control command on the descriptor.
@@ -243,8 +314,8 @@
   void io_control(IoControlCommand& command)
   {
     boost::system::error_code ec;
- this->service.io_control(this->implementation, command, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().io_control(this->get_implementation(), command, ec);
+ boost::asio::detail::throw_error(ec, "io_control");
   }
 
   /// Perform an IO control command on the descriptor.
@@ -278,7 +349,128 @@
   boost::system::error_code io_control(IoControlCommand& command,
       boost::system::error_code& ec)
   {
- return this->service.io_control(this->implementation, command, ec);
+ return this->get_service().io_control(
+ this->get_implementation(), command, ec);
+ }
+
+ /// Gets the non-blocking mode of the descriptor.
+ /**
+ * @returns @c true if the descriptor's synchronous operations will fail with
+ * boost::asio::error::would_block if they are unable to perform the requested
+ * operation immediately. If @c false, synchronous operations will block
+ * until complete.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ bool non_blocking() const
+ {
+ return this->get_service().non_blocking(this->implementation);
+ }
+
+ /// Sets the non-blocking mode of the descriptor.
+ /**
+ * @param mode If @c true, the descriptor's synchronous operations will fail
+ * with boost::asio::error::would_block if they are unable to perform the
+ * requested operation immediately. If @c false, synchronous operations will
+ * block until complete.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ void non_blocking(bool mode)
+ {
+ boost::system::error_code ec;
+ this->get_service().non_blocking(this->get_implementation(), mode, ec);
+ boost::asio::detail::throw_error(ec, "non_blocking");
+ }
+
+ /// Sets the non-blocking mode of the descriptor.
+ /**
+ * @param mode If @c true, the descriptor's synchronous operations will fail
+ * with boost::asio::error::would_block if they are unable to perform the
+ * requested operation immediately. If @c false, synchronous operations will
+ * block until complete.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note The non-blocking mode has no effect on the behaviour of asynchronous
+ * operations. Asynchronous operations will never fail with the error
+ * boost::asio::error::would_block.
+ */
+ boost::system::error_code non_blocking(
+ bool mode, boost::system::error_code& ec)
+ {
+ return this->get_service().non_blocking(
+ this->get_implementation(), mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native descriptor implementation.
+ /**
+ * This function is used to retrieve the non-blocking mode of the underlying
+ * native descriptor. This mode has no effect on the behaviour of the
+ * descriptor object's synchronous operations.
+ *
+ * @returns @c true if the underlying descriptor is in non-blocking mode and
+ * direct system calls may fail with boost::asio::error::would_block (or the
+ * equivalent system error).
+ *
+ * @note The current non-blocking mode is cached by the descriptor object.
+ * Consequently, the return value may be incorrect if the non-blocking mode
+ * was set directly on the native descriptor.
+ */
+ bool native_non_blocking() const
+ {
+ return this->get_service().native_non_blocking(this->implementation);
+ }
+
+ /// Sets the non-blocking mode of the native descriptor implementation.
+ /**
+ * This function is used to modify the non-blocking mode of the underlying
+ * native descriptor. It has no effect on the behaviour of the descriptor
+ * object's synchronous operations.
+ *
+ * @param mode If @c true, the underlying descriptor is put into non-blocking
+ * mode and direct system calls may fail with boost::asio::error::would_block
+ * (or the equivalent system error).
+ *
+ * @throws boost::system::system_error Thrown on failure. If the @c mode is
+ * @c false, but the current value of @c non_blocking() is @c true, this
+ * function fails with boost::asio::error::invalid_argument, as the
+ * combination does not make sense.
+ */
+ void native_non_blocking(bool mode)
+ {
+ boost::system::error_code ec;
+ this->get_service().native_non_blocking(
+ this->get_implementation(), mode, ec);
+ boost::asio::detail::throw_error(ec, "native_non_blocking");
+ }
+
+ /// Sets the non-blocking mode of the native descriptor implementation.
+ /**
+ * This function is used to modify the non-blocking mode of the underlying
+ * native descriptor. It has no effect on the behaviour of the descriptor
+ * object's synchronous operations.
+ *
+ * @param mode If @c true, the underlying descriptor is put into non-blocking
+ * mode and direct system calls may fail with boost::asio::error::would_block
+ * (or the equivalent system error).
+ *
+ * @param ec Set to indicate what error occurred, if any. If the @c mode is
+ * @c false, but the current value of @c non_blocking() is @c true, this
+ * function fails with boost::asio::error::invalid_argument, as the
+ * combination does not make sense.
+ */
+ boost::system::error_code native_non_blocking(
+ bool mode, boost::system::error_code& ec)
+ {
+ return this->get_service().native_non_blocking(
+ this->get_implementation(), mode, ec);
   }
 
 protected:

Modified: branches/release/boost/asio/posix/basic_stream_descriptor.hpp
==============================================================================
--- branches/release/boost/asio/posix/basic_stream_descriptor.hpp (original)
+++ branches/release/boost/asio/posix/basic_stream_descriptor.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -21,6 +21,7 @@
   || defined(GENERATING_DOCUMENTATION)
 
 #include <cstddef>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/posix/basic_descriptor.hpp>
@@ -49,8 +50,13 @@
   : public basic_descriptor<StreamDescriptorService>
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// descriptor.
+ typedef typename StreamDescriptorService::native_handle_type native_type;
+
   /// The native representation of a descriptor.
- typedef typename StreamDescriptorService::native_type native_type;
+ typedef typename StreamDescriptorService::native_handle_type
+ native_handle_type;
 
   /// Construct a basic_stream_descriptor without opening it.
   /**
@@ -81,11 +87,47 @@
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_stream_descriptor(boost::asio::io_service& io_service,
- const native_type& native_descriptor)
+ const native_handle_type& native_descriptor)
     : basic_descriptor<StreamDescriptorService>(io_service, native_descriptor)
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_stream_descriptor from another.
+ /**
+ * This constructor moves a stream descriptor from one object to another.
+ *
+ * @param other The other basic_stream_descriptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_descriptor(io_service&) constructor.
+ */
+ basic_stream_descriptor(basic_stream_descriptor&& other)
+ : basic_descriptor<StreamDescriptorService>(
+ BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other))
+ {
+ }
+
+ /// Move-assign a basic_stream_descriptor from another.
+ /**
+ * This assignment operator moves a stream descriptor from one object to
+ * another.
+ *
+ * @param other The other basic_stream_descriptor object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_descriptor(io_service&) constructor.
+ */
+ basic_stream_descriptor& operator=(basic_stream_descriptor&& other)
+ {
+ basic_descriptor<StreamDescriptorService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Write some data to the descriptor.
   /**
    * This function is used to write data to the stream descriptor. The function
@@ -117,8 +159,9 @@
   std::size_t write_some(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.write_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "write_some");
     return s;
   }
 
@@ -142,7 +185,8 @@
   std::size_t write_some(const ConstBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.write_some(this->implementation, buffers, ec);
+ return this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
   }
 
   /// Start an asynchronous write.
@@ -182,9 +226,14 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_write_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_write_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the descriptor.
@@ -219,8 +268,9 @@
   std::size_t read_some(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.read_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "read_some");
     return s;
   }
 
@@ -245,7 +295,8 @@
   std::size_t read_some(const MutableBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.read_some(this->implementation, buffers, ec);
+ return this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
   }
 
   /// Start an asynchronous read.
@@ -286,9 +337,14 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_read_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_read_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/posix/descriptor_base.hpp
==============================================================================
--- branches/release/boost/asio/posix/descriptor_base.hpp (original)
+++ branches/release/boost/asio/posix/descriptor_base.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -35,7 +35,8 @@
 class descriptor_base
 {
 public:
- /// IO control command to set the blocking mode of the descriptor.
+ /// (Deprecated: Use non_blocking().) IO control command to set the blocking
+ /// mode of the descriptor.
   /**
    * Implements the FIONBIO IO control command.
    *

Modified: branches/release/boost/asio/posix/stream_descriptor_service.hpp
==============================================================================
--- branches/release/boost/asio/posix/stream_descriptor_service.hpp (original)
+++ branches/release/boost/asio/posix/stream_descriptor_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -57,11 +57,18 @@
   typedef service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native descriptor type.
+ /// (Deprecated: Use native_handle_type.) The native descriptor type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef service_impl_type::native_type native_type;
+ typedef service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native descriptor type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new stream descriptor service for the specified io_service.
@@ -71,18 +78,29 @@
   {
   }
 
- /// Destroy all user-defined descriptorr objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new stream descriptor implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new stream descriptor implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another stream descriptor implementation.
+ void move_assign(implementation_type& impl,
+ stream_descriptor_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a stream descriptor implementation.
   void destroy(implementation_type& impl)
   {
@@ -91,7 +109,8 @@
 
   /// Assign an existing native descriptor to a stream descriptor.
   boost::system::error_code assign(implementation_type& impl,
- const native_type& native_descriptor, boost::system::error_code& ec)
+ const native_handle_type& native_descriptor,
+ boost::system::error_code& ec)
   {
     return service_impl_.assign(impl, native_descriptor, ec);
   }
@@ -109,10 +128,23 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native descriptor implementation.
+ /// (Deprecated: Use native_handle().) Get the native descriptor
+ /// implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native descriptor implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Release ownership of the native descriptor implementation.
+ native_handle_type release(implementation_type& impl)
+ {
+ return service_impl_.release(impl);
   }
 
   /// Cancel all asynchronous operations associated with the descriptor.
@@ -130,6 +162,32 @@
     return service_impl_.io_control(impl, command, ec);
   }
 
+ /// Gets the non-blocking mode of the descriptor.
+ bool non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the descriptor.
+ boost::system::error_code non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.non_blocking(impl, mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native descriptor implementation.
+ bool native_non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.native_non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the native descriptor implementation.
+ boost::system::error_code native_non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.native_non_blocking(impl, mode, ec);
+ }
+
   /// Write the given data to the stream.
   template <typename ConstBufferSequence>
   std::size_t write_some(implementation_type& impl,
@@ -141,9 +199,11 @@
   /// Start an asynchronous write.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, WriteHandler descriptorr)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some(impl, buffers, descriptorr);
+ service_impl_.async_write_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -157,12 +217,20 @@
   /// Start an asynchronous read.
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, ReadHandler descriptorr)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some(impl, buffers, descriptorr);
+ service_impl_.async_read_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/raw_socket_service.hpp
==============================================================================
--- branches/release/boost/asio/raw_socket_service.hpp (original)
+++ branches/release/boost/asio/raw_socket_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -68,11 +68,18 @@
   typedef typename service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native socket type.
+ /// (Deprecated: Use native_handle_type.) The native socket type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef typename service_impl_type::native_type native_type;
+ typedef typename service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native socket type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef typename service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new raw socket service for the specified io_service.
@@ -83,18 +90,29 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new raw socket implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new raw socket implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another raw socket implementation.
+ void move_assign(implementation_type& impl,
+ raw_socket_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a raw socket implementation.
   void destroy(implementation_type& impl)
   {
@@ -114,7 +132,7 @@
 
   /// Assign an existing native socket to a raw socket.
   boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_type& native_socket,
+ const protocol_type& protocol, const native_handle_type& native_socket,
       boost::system::error_code& ec)
   {
     return service_impl_.assign(impl, protocol, native_socket, ec);
@@ -133,10 +151,16 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native socket implementation.
+ /// (Deprecated: Use native_handle().) Get the native socket implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native socket implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
   }
 
   /// Cancel all asynchronous operations associated with the socket.
@@ -177,9 +201,11 @@
   /// Start an asynchronous connect.
   template <typename ConnectHandler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, ConnectHandler handler)
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
- service_impl_.async_connect(impl, peer_endpoint, handler);
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set a socket option.
@@ -206,6 +232,32 @@
     return service_impl_.io_control(impl, command, ec);
   }
 
+ /// Gets the non-blocking mode of the socket.
+ bool non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.non_blocking(impl, mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.native_non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.native_non_blocking(impl, mode, ec);
+ }
+
   /// Get the local endpoint.
   endpoint_type local_endpoint(const implementation_type& impl,
       boost::system::error_code& ec) const
@@ -239,9 +291,11 @@
   /// Start an asynchronous send.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send(impl, buffers, flags, handler);
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Send raw data to the specified endpoint.
@@ -257,9 +311,11 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(implementation_type& impl,
       const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send_to(impl, buffers, destination, flags, handler);
+ service_impl_.async_send_to(impl, buffers, destination, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data from the peer.
@@ -275,9 +331,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_receive(impl, buffers, flags, handler);
+ service_impl_.async_receive(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Receive raw data with the endpoint of the sender.
@@ -294,13 +352,20 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(implementation_type& impl,
       const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags,
- handler);
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/read.hpp
==============================================================================
--- branches/release/boost/asio/read.hpp (original)
+++ branches/release/boost/asio/read.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -80,6 +80,46 @@
  * @li The supplied buffers are full. That is, the bytes transferred is equal to
  * the sum of the buffer sizes.
  *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the stream's
+ * read_some function.
+ *
+ * @param s The stream from which the data is to be read. The type must support
+ * the SyncReadStream concept.
+ *
+ * @param buffers One or more buffers into which the data will be read. The sum
+ * of the buffer sizes indicates the maximum number of bytes to read from the
+ * stream.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code boost::asio::read(s, boost::asio::buffer(data, size), ec); @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::read(
+ * s, buffers,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncReadStream, typename MutableBufferSequence>
+std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
+ boost::system::error_code& ec);
+
+/// Attempt to read a certain amount of data from a stream before returning.
+/**
+ * This function is used to read a certain number of bytes of data from a
+ * stream. The call will block until one of the following conditions is true:
+ *
+ * @li The supplied buffers are full. That is, the bytes transferred is equal to
+ * the sum of the buffer sizes.
+ *
  * @li The completion_condition function object returns 0.
  *
  * This operation is implemented in terms of zero or more calls to the stream's
@@ -201,6 +241,34 @@
  * This function is used to read a certain number of bytes of data from a
  * stream. The call will block until one of the following conditions is true:
  *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the stream's
+ * read_some function.
+ *
+ * @param s The stream from which the data is to be read. The type must support
+ * the SyncReadStream concept.
+ *
+ * @param b The basic_streambuf object into which the data will be read.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::read(
+ * s, b,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncReadStream, typename Allocator>
+std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec);
+
+/// Attempt to read a certain amount of data from a stream before returning.
+/**
+ * This function is used to read a certain number of bytes of data from a
+ * stream. The call will block until one of the following conditions is true:
+ *
  * @li The completion_condition function object returns 0.
  *
  * This operation is implemented in terms of zero or more calls to the stream's
@@ -347,7 +415,7 @@
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename ReadHandler>
 void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data from a
 /// stream.
@@ -415,7 +483,8 @@
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename CompletionCondition, typename ReadHandler>
 void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -467,7 +536,7 @@
  */
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data from a
 /// stream.
@@ -526,7 +595,8 @@
 template <typename AsyncReadStream, typename Allocator,
     typename CompletionCondition, typename ReadHandler>
 void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: branches/release/boost/asio/read_at.hpp
==============================================================================
--- branches/release/boost/asio/read_at.hpp (original)
+++ branches/release/boost/asio/read_at.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -88,6 +88,52 @@
  * @li The supplied buffers are full. That is, the bytes transferred is equal to
  * the sum of the buffer sizes.
  *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the device's
+ * read_some_at function.
+ *
+ * @param d The device from which the data is to be read. The type must support
+ * the SyncRandomAccessReadDevice concept.
+ *
+ * @param offset The offset at which the data will be read.
+ *
+ * @param buffers One or more buffers into which the data will be read. The sum
+ * of the buffer sizes indicates the maximum number of bytes to read from the
+ * device.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @par Example
+ * To read into a single data buffer use the @ref buffer function as follows:
+ * @code boost::asio::read_at(d, 42,
+ * boost::asio::buffer(data, size), ec); @endcode
+ * See the @ref buffer documentation for information on reading into multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::read_at(
+ * d, 42, buffers,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence>
+std::size_t read_at(SyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, const MutableBufferSequence& buffers,
+ boost::system::error_code& ec);
+
+/// Attempt to read a certain amount of data at the specified offset before
+/// returning.
+/**
+ * This function is used to read a certain number of bytes of data from a
+ * random access device at the specified offset. The call will block until one
+ * of the following conditions is true:
+ *
+ * @li The supplied buffers are full. That is, the bytes transferred is equal to
+ * the sum of the buffer sizes.
+ *
  * @li The completion_condition function object returns 0.
  *
  * This operation is implemented in terms of zero or more calls to the device's
@@ -224,6 +270,39 @@
  * random access device at the specified offset. The call will block until one
  * of the following conditions is true:
  *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the device's
+ * read_some_at function.
+ *
+ * @param d The device from which the data is to be read. The type must support
+ * the SyncRandomAccessReadDevice concept.
+ *
+ * @param offset The offset at which the data will be read.
+ *
+ * @param b The basic_streambuf object into which the data will be read.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::read_at(
+ * d, 42, b,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncRandomAccessReadDevice, typename Allocator>
+std::size_t read_at(SyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec);
+
+/// Attempt to read a certain amount of data at the specified offset before
+/// returning.
+/**
+ * This function is used to read a certain number of bytes of data from a
+ * random access device at the specified offset. The call will block until one
+ * of the following conditions is true:
+ *
  * @li The completion_condition function object returns 0.
  *
  * This operation is implemented in terms of zero or more calls to the device's
@@ -377,7 +456,8 @@
 template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
     typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset,
- const MutableBufferSequence& buffers, ReadHandler handler);
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data at the
 /// specified offset.
@@ -448,7 +528,8 @@
     typename CompletionCondition, typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -500,7 +581,7 @@
 template <typename AsyncRandomAccessReadDevice, typename Allocator,
     typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset,
- basic_streambuf<Allocator>& b, ReadHandler handler);
+ basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data at the
 /// specified offset.
@@ -559,7 +640,8 @@
     typename CompletionCondition, typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: branches/release/boost/asio/read_until.hpp
==============================================================================
--- branches/release/boost/asio/read_until.hpp (original)
+++ branches/release/boost/asio/read_until.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -36,30 +36,16 @@
 
 namespace detail
 {
-#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
+ char (&has_result_type_helper(...))[2];
+
   template <typename T>
- struct has_result_type
- {
- template <typename U> struct inner
- {
- struct big { char a[100]; };
- static big helper(U, ...);
- static char helper(U, typename U::result_type* = 0);
- };
- static const T& ref();
- enum { value = (sizeof((inner<const T&>::helper)((ref)())) == 1) };
- };
-#else // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
+ char has_result_type_helper(T*, typename T::result_type* = 0);
+
   template <typename T>
   struct has_result_type
   {
- struct big { char a[100]; };
- template <typename U> static big helper(U, ...);
- template <typename U> static char helper(U, typename U::result_type* = 0);
- static const T& ref();
- enum { value = (sizeof((helper)((ref)())) == 1) };
+ enum { value = (sizeof((has_result_type_helper)((T*)(0))) == 1) };
   };
-#endif // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
 } // namespace detail
 
 /// Type trait used to determine whether a type can be used as a match condition
@@ -604,7 +590,7 @@
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- char delim, ReadHandler handler);
+ char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read data into a streambuf until it
 /// contains a specified delimiter.
@@ -687,7 +673,7 @@
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const std::string& delim,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read data into a streambuf until some
 /// part of its data matches a regular expression.
@@ -774,7 +760,7 @@
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read data into a streambuf until a
 /// function object indicates a match.
@@ -903,7 +889,7 @@
     typename MatchCondition, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- MatchCondition match_condition, ReadHandler handler,
+ MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
     typename boost::enable_if<is_match_condition<MatchCondition> >::type* = 0);
 
 /*@}*/

Added: branches/release/boost/asio/seq_packet_socket_service.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/seq_packet_socket_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,341 @@
+//
+// seq_packet_socket_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP
+#define BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstddef>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_socket_service.hpp>
+#else
+# include <boost/asio/detail/reactive_socket_service.hpp>
+#endif
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Default service implementation for a sequenced packet socket.
+template <typename Protocol>
+class seq_packet_socket_service
+#if defined(GENERATING_DOCUMENTATION)
+ : public boost::asio::io_service::service
+#else
+ : public boost::asio::detail::service_base<
+ seq_packet_socket_service<Protocol> >
+#endif
+{
+public:
+#if defined(GENERATING_DOCUMENTATION)
+ /// The unique service identifier.
+ static boost::asio::io_service::id id;
+#endif
+
+ /// The protocol type.
+ typedef Protocol protocol_type;
+
+ /// The endpoint type.
+ typedef typename Protocol::endpoint endpoint_type;
+
+private:
+ // The type of the platform-specific implementation.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
+#else
+ typedef detail::reactive_socket_service<Protocol> service_impl_type;
+#endif
+
+public:
+ /// The type of a sequenced packet socket implementation.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined implementation_type;
+#else
+ typedef typename service_impl_type::implementation_type implementation_type;
+#endif
+
+ /// (Deprecated: Use native_handle_type.) The native socket type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_type;
+#else
+ typedef typename service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native socket type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef typename service_impl_type::native_handle_type native_handle_type;
+#endif
+
+ /// Construct a new sequenced packet socket service for the specified
+ /// io_service.
+ explicit seq_packet_socket_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<
+ seq_packet_socket_service<Protocol> >(io_service),
+ service_impl_(io_service)
+ {
+ }
+
+ /// Construct a new sequenced packet socket implementation.
+ void construct(implementation_type& impl)
+ {
+ service_impl_.construct(impl);
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new sequenced packet socket implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another sequenced packet socket implementation.
+ void move_assign(implementation_type& impl,
+ seq_packet_socket_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
+ /// Destroy a sequenced packet socket implementation.
+ void destroy(implementation_type& impl)
+ {
+ service_impl_.destroy(impl);
+ }
+
+ /// Open a sequenced packet socket.
+ boost::system::error_code open(implementation_type& impl,
+ const protocol_type& protocol, boost::system::error_code& ec)
+ {
+ if (protocol.type() == SOCK_SEQPACKET)
+ service_impl_.open(impl, protocol, ec);
+ else
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ /// Assign an existing native socket to a sequenced packet socket.
+ boost::system::error_code assign(implementation_type& impl,
+ const protocol_type& protocol, const native_handle_type& native_socket,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.assign(impl, protocol, native_socket, ec);
+ }
+
+ /// Determine whether the socket is open.
+ bool is_open(const implementation_type& impl) const
+ {
+ return service_impl_.is_open(impl);
+ }
+
+ /// Close a sequenced packet socket implementation.
+ boost::system::error_code close(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.close(impl, ec);
+ }
+
+ /// (Deprecated: Use native_handle().) Get the native socket implementation.
+ native_type native(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native socket implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Cancel all asynchronous operations associated with the socket.
+ boost::system::error_code cancel(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.cancel(impl, ec);
+ }
+
+ /// Determine whether the socket is at the out-of-band data mark.
+ bool at_mark(const implementation_type& impl,
+ boost::system::error_code& ec) const
+ {
+ return service_impl_.at_mark(impl, ec);
+ }
+
+ /// Determine the number of bytes available for reading.
+ std::size_t available(const implementation_type& impl,
+ boost::system::error_code& ec) const
+ {
+ return service_impl_.available(impl, ec);
+ }
+
+ /// Bind the sequenced packet socket to the specified local endpoint.
+ boost::system::error_code bind(implementation_type& impl,
+ const endpoint_type& endpoint, boost::system::error_code& ec)
+ {
+ return service_impl_.bind(impl, endpoint, ec);
+ }
+
+ /// Connect the sequenced packet socket to the specified endpoint.
+ boost::system::error_code connect(implementation_type& impl,
+ const endpoint_type& peer_endpoint, boost::system::error_code& ec)
+ {
+ return service_impl_.connect(impl, peer_endpoint, ec);
+ }
+
+ /// Start an asynchronous connect.
+ template <typename ConnectHandler>
+ void async_connect(implementation_type& impl,
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
+ {
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
+ }
+
+ /// Set a socket option.
+ template <typename SettableSocketOption>
+ boost::system::error_code set_option(implementation_type& impl,
+ const SettableSocketOption& option, boost::system::error_code& ec)
+ {
+ return service_impl_.set_option(impl, option, ec);
+ }
+
+ /// Get a socket option.
+ template <typename GettableSocketOption>
+ boost::system::error_code get_option(const implementation_type& impl,
+ GettableSocketOption& option, boost::system::error_code& ec) const
+ {
+ return service_impl_.get_option(impl, option, ec);
+ }
+
+ /// Perform an IO control command on the socket.
+ template <typename IoControlCommand>
+ boost::system::error_code io_control(implementation_type& impl,
+ IoControlCommand& command, boost::system::error_code& ec)
+ {
+ return service_impl_.io_control(impl, command, ec);
+ }
+
+ /// Gets the non-blocking mode of the socket.
+ bool non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.non_blocking(impl, mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.native_non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.native_non_blocking(impl, mode, ec);
+ }
+
+ /// Get the local endpoint.
+ endpoint_type local_endpoint(const implementation_type& impl,
+ boost::system::error_code& ec) const
+ {
+ return service_impl_.local_endpoint(impl, ec);
+ }
+
+ /// Get the remote endpoint.
+ endpoint_type remote_endpoint(const implementation_type& impl,
+ boost::system::error_code& ec) const
+ {
+ return service_impl_.remote_endpoint(impl, ec);
+ }
+
+ /// Disable sends or receives on the socket.
+ boost::system::error_code shutdown(implementation_type& impl,
+ socket_base::shutdown_type what, boost::system::error_code& ec)
+ {
+ return service_impl_.shutdown(impl, what, ec);
+ }
+
+ /// Send the given data to the peer.
+ template <typename ConstBufferSequence>
+ std::size_t send(implementation_type& impl,
+ const ConstBufferSequence& buffers,
+ socket_base::message_flags flags, boost::system::error_code& ec)
+ {
+ return service_impl_.send(impl, buffers, flags, ec);
+ }
+
+ /// Start an asynchronous send.
+ template <typename ConstBufferSequence, typename WriteHandler>
+ void async_send(implementation_type& impl,
+ const ConstBufferSequence& buffers,
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
+ {
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
+ }
+
+ /// Receive some data from the peer.
+ template <typename MutableBufferSequence>
+ std::size_t receive(implementation_type& impl,
+ const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags, boost::system::error_code& ec)
+ {
+ return service_impl_.receive_with_flags(impl,
+ buffers, in_flags, out_flags, ec);
+ }
+
+ /// Start an asynchronous receive.
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_receive(implementation_type& impl,
+ const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
+ socket_base::message_flags& out_flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
+ {
+ service_impl_.async_receive_with_flags(impl, buffers, in_flags,
+ out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
+ }
+
+private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
+ // The platform-specific implementation.
+ service_impl_type service_impl_;
+};
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP

Modified: branches/release/boost/asio/serial_port_service.hpp
==============================================================================
--- branches/release/boost/asio/serial_port_service.hpp (original)
+++ branches/release/boost/asio/serial_port_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -63,11 +63,18 @@
   typedef service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native handle type.
+ /// (Deprecated: Use native_handle_type.) The native handle type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef service_impl_type::native_type native_type;
+ typedef service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native handle type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new serial port service for the specified io_service.
@@ -77,18 +84,29 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new serial port implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new serial port implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another serial port implementation.
+ void move_assign(implementation_type& impl,
+ serial_port_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a serial port implementation.
   void destroy(implementation_type& impl)
   {
@@ -104,9 +122,9 @@
 
   /// Assign an existing native handle to a serial port.
   boost::system::error_code assign(implementation_type& impl,
- const native_type& native_handle, boost::system::error_code& ec)
+ const native_handle_type& handle, boost::system::error_code& ec)
   {
- return service_impl_.assign(impl, native_handle, ec);
+ return service_impl_.assign(impl, handle, ec);
   }
 
   /// Determine whether the handle is open.
@@ -122,10 +140,16 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native handle implementation.
+ /// (Deprecated: Use native_handle().) Get the native handle implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native handle implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
   }
 
   /// Cancel all asynchronous operations associated with the handle.
@@ -169,9 +193,11 @@
   /// Start an asynchronous write.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some(impl, buffers, handler);
+ service_impl_.async_write_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -185,12 +211,20 @@
   /// Start an asynchronous read.
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some(impl, buffers, handler);
+ service_impl_.async_read_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Added: branches/release/boost/asio/signal_set.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/signal_set.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,30 @@
+//
+// signal_set.hpp
+// ~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SIGNAL_SET_HPP
+#define BOOST_ASIO_SIGNAL_SET_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/basic_signal_set.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Typedef for the typical usage of a signal set.
+typedef basic_signal_set<> signal_set;
+
+} // namespace asio
+} // namespace boost
+
+#endif // BOOST_ASIO_SIGNAL_SET_HPP

Added: branches/release/boost/asio/signal_set_service.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/signal_set_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,128 @@
+//
+// signal_set_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SIGNAL_SET_SERVICE_HPP
+#define BOOST_ASIO_SIGNAL_SET_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/signal_set_service.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+/// Default service implementation for a signal set.
+class signal_set_service
+#if defined(GENERATING_DOCUMENTATION)
+ : public boost::asio::io_service::service
+#else
+ : public boost::asio::detail::service_base<signal_set_service>
+#endif
+{
+public:
+#if defined(GENERATING_DOCUMENTATION)
+ /// The unique service identifier.
+ static boost::asio::io_service::id id;
+#endif
+
+public:
+ /// The type of a signal set implementation.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined implementation_type;
+#else
+ typedef detail::signal_set_service::implementation_type implementation_type;
+#endif
+
+ /// Construct a new signal set service for the specified io_service.
+ explicit signal_set_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<signal_set_service>(io_service),
+ service_impl_(io_service)
+ {
+ }
+
+ /// Construct a new signal set implementation.
+ void construct(implementation_type& impl)
+ {
+ service_impl_.construct(impl);
+ }
+
+ /// Destroy a signal set implementation.
+ void destroy(implementation_type& impl)
+ {
+ service_impl_.destroy(impl);
+ }
+
+ /// Add a signal to a signal_set.
+ boost::system::error_code add(implementation_type& impl,
+ int signal_number, boost::system::error_code& ec)
+ {
+ return service_impl_.add(impl, signal_number, ec);
+ }
+
+ /// Remove a signal to a signal_set.
+ boost::system::error_code remove(implementation_type& impl,
+ int signal_number, boost::system::error_code& ec)
+ {
+ return service_impl_.remove(impl, signal_number, ec);
+ }
+
+ /// Remove all signals from a signal_set.
+ boost::system::error_code clear(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.clear(impl, ec);
+ }
+
+ /// Cancel all operations associated with the signal set.
+ boost::system::error_code cancel(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.cancel(impl, ec);
+ }
+
+ // Start an asynchronous operation to wait for a signal to be delivered.
+ template <typename SignalHandler>
+ void async_wait(implementation_type& impl,
+ BOOST_ASIO_MOVE_ARG(SignalHandler) handler)
+ {
+ service_impl_.async_wait(impl,
+ BOOST_ASIO_MOVE_CAST(SignalHandler)(handler));
+ }
+
+private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
+ // Perform any fork-related housekeeping.
+ void fork_service(boost::asio::io_service::fork_event event)
+ {
+ service_impl_.fork_service(event);
+ }
+
+ // The platform-specific implementation.
+ detail::signal_set_service service_impl_;
+};
+
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SIGNAL_SET_SERVICE_HPP

Modified: branches/release/boost/asio/socket_acceptor_service.hpp
==============================================================================
--- branches/release/boost/asio/socket_acceptor_service.hpp (original)
+++ branches/release/boost/asio/socket_acceptor_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -68,11 +68,18 @@
   typedef typename service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native acceptor type.
+ /// (Deprecated: Use native_handle_type.) The native acceptor type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef typename service_impl_type::native_type native_type;
+ typedef typename service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native acceptor type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef typename service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new socket acceptor service for the specified io_service.
@@ -83,18 +90,29 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new socket acceptor implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new socket acceptor implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another socket acceptor implementation.
+ void move_assign(implementation_type& impl,
+ socket_acceptor_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a socket acceptor implementation.
   void destroy(implementation_type& impl)
   {
@@ -110,7 +128,7 @@
 
   /// Assign an existing native acceptor to a socket acceptor.
   boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_type& native_acceptor,
+ const protocol_type& protocol, const native_handle_type& native_acceptor,
       boost::system::error_code& ec)
   {
     return service_impl_.assign(impl, protocol, native_acceptor, ec);
@@ -151,10 +169,16 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native acceptor implementation.
+ /// (Deprecated: Use native_handle().) Get the native acceptor implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native acceptor implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
   }
 
   /// Set a socket option.
@@ -181,6 +205,32 @@
     return service_impl_.io_control(impl, command, ec);
   }
 
+ /// Gets the non-blocking mode of the acceptor.
+ bool non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the acceptor.
+ boost::system::error_code non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.non_blocking(impl, mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native acceptor implementation.
+ bool native_non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.native_non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the native acceptor implementation.
+ boost::system::error_code native_non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.native_non_blocking(impl, mode, ec);
+ }
+
   /// Get the local endpoint.
   endpoint_type local_endpoint(const implementation_type& impl,
       boost::system::error_code& ec) const
@@ -201,12 +251,20 @@
   template <typename SocketService, typename AcceptHandler>
   void async_accept(implementation_type& impl,
       basic_socket<protocol_type, SocketService>& peer,
- endpoint_type* peer_endpoint, AcceptHandler handler)
+ endpoint_type* peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
   {
- service_impl_.async_accept(impl, peer, peer_endpoint, handler);
+ service_impl_.async_accept(impl, peer, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/socket_base.hpp
==============================================================================
--- branches/release/boost/asio/socket_base.hpp (original)
+++ branches/release/boost/asio/socket_base.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -63,6 +63,9 @@
 
   /// Specify that the data should not be subject to routing.
   static const int message_do_not_route = implementation_defined;
+
+ /// Specifies that the data marks the end of a record.
+ static const int message_end_of_record = implementation_defined;
 #else
   BOOST_STATIC_CONSTANT(int,
       message_peek = boost::asio::detail::message_peek);
@@ -70,6 +73,8 @@
       message_out_of_band = boost::asio::detail::message_out_of_band);
   BOOST_STATIC_CONSTANT(int,
       message_do_not_route = boost::asio::detail::message_do_not_route);
+ BOOST_STATIC_CONSTANT(int,
+ message_end_of_record = boost::asio::detail::message_end_of_record);
 #endif
 
   /// Socket option to permit sending of broadcast messages.
@@ -442,7 +447,8 @@
     enable_connection_aborted;
 #endif
 
- /// IO control command to set the blocking mode of the socket.
+ /// (Deprecated: Use non_blocking().) IO control command to
+ /// set the blocking mode of the socket.
   /**
    * Implements the FIONBIO IO control command.
    *

Modified: branches/release/boost/asio/ssl.hpp
==============================================================================
--- branches/release/boost/asio/ssl.hpp (original)
+++ branches/release/boost/asio/ssl.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,8 +19,12 @@
 #include <boost/asio/ssl/context.hpp>
 #include <boost/asio/ssl/context_base.hpp>
 #include <boost/asio/ssl/context_service.hpp>
+#include <boost/asio/ssl/error.hpp>
+#include <boost/asio/ssl/rfc2818_verification.hpp>
 #include <boost/asio/ssl/stream.hpp>
 #include <boost/asio/ssl/stream_base.hpp>
 #include <boost/asio/ssl/stream_service.hpp>
+#include <boost/asio/ssl/verify_context.hpp>
+#include <boost/asio/ssl/verify_mode.hpp>
 
 #endif // BOOST_ASIO_SSL_HPP

Modified: branches/release/boost/asio/ssl/basic_context.hpp
==============================================================================
--- branches/release/boost/asio/ssl/basic_context.hpp (original)
+++ branches/release/boost/asio/ssl/basic_context.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,8 +2,7 @@
 // ssl/basic_context.hpp
 // ~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -17,12 +16,10 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <string>
-#include <boost/noncopyable.hpp>
-#include <boost/asio/detail/throw_error.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ssl/context_base.hpp>
+
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/old/basic_context.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -30,400 +27,11 @@
 namespace asio {
 namespace ssl {
 
-/// SSL context.
-template <typename Service>
-class basic_context
- : public context_base,
- private boost::noncopyable
-{
-public:
- /// The type of the service that will be used to provide context operations.
- typedef Service service_type;
-
- /// The native implementation type of the locking dispatcher.
- typedef typename service_type::impl_type impl_type;
-
- /// Constructor.
- basic_context(boost::asio::io_service& io_service, method m)
- : service_(boost::asio::use_service<Service>(io_service)),
- impl_(service_.null())
- {
- service_.create(impl_, m);
- }
-
- /// Destructor.
- ~basic_context()
- {
- service_.destroy(impl_);
- }
-
- /// Get the underlying implementation in the native type.
- /**
- * This function may be used to obtain the underlying implementation of the
- * context. This is intended to allow access to context functionality that is
- * not otherwise provided.
- */
- impl_type impl()
- {
- return impl_;
- }
-
- /// Set options on the context.
- /**
- * This function may be used to configure the SSL options used by the context.
- *
- * @param o A bitmask of options. The available option values are defined in
- * the context_base class. The options are bitwise-ored with any existing
- * value for the options.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void set_options(options o)
- {
- boost::system::error_code ec;
- service_.set_options(impl_, o, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Set options on the context.
- /**
- * This function may be used to configure the SSL options used by the context.
- *
- * @param o A bitmask of options. The available option values are defined in
- * the context_base class. The options are bitwise-ored with any existing
- * value for the options.
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code set_options(options o,
- boost::system::error_code& ec)
- {
- return service_.set_options(impl_, o, ec);
- }
-
- /// Set the peer verification mode.
- /**
- * This function may be used to configure the peer verification mode used by
- * the context.
- *
- * @param v A bitmask of peer verification modes. The available verify_mode
- * values are defined in the context_base class.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void set_verify_mode(verify_mode v)
- {
- boost::system::error_code ec;
- service_.set_verify_mode(impl_, v, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Set the peer verification mode.
- /**
- * This function may be used to configure the peer verification mode used by
- * the context.
- *
- * @param v A bitmask of peer verification modes. The available verify_mode
- * values are defined in the context_base class.
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code set_verify_mode(verify_mode v,
- boost::system::error_code& ec)
- {
- return service_.set_verify_mode(impl_, v, ec);
- }
-
- /// Load a certification authority file for performing verification.
- /**
- * This function is used to load one or more trusted certification authorities
- * from a file.
- *
- * @param filename The name of a file containing certification authority
- * certificates in PEM format.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void load_verify_file(const std::string& filename)
- {
- boost::system::error_code ec;
- service_.load_verify_file(impl_, filename, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Load a certification authority file for performing verification.
- /**
- * This function is used to load the certificates for one or more trusted
- * certification authorities from a file.
- *
- * @param filename The name of a file containing certification authority
- * certificates in PEM format.
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code load_verify_file(const std::string& filename,
- boost::system::error_code& ec)
- {
- return service_.load_verify_file(impl_, filename, ec);
- }
-
- /// Add a directory containing certificate authority files to be used for
- /// performing verification.
- /**
- * This function is used to specify the name of a directory containing
- * certification authority certificates. Each file in the directory must
- * contain a single certificate. The files must be named using the subject
- * name's hash and an extension of ".0".
- *
- * @param path The name of a directory containing the certificates.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void add_verify_path(const std::string& path)
- {
- boost::system::error_code ec;
- service_.add_verify_path(impl_, path, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Add a directory containing certificate authority files to be used for
- /// performing verification.
- /**
- * This function is used to specify the name of a directory containing
- * certification authority certificates. Each file in the directory must
- * contain a single certificate. The files must be named using the subject
- * name's hash and an extension of ".0".
- *
- * @param path The name of a directory containing the certificates.
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code add_verify_path(const std::string& path,
- boost::system::error_code& ec)
- {
- return service_.add_verify_path(impl_, path, ec);
- }
-
- /// Use a certificate from a file.
- /**
- * This function is used to load a certificate into the context from a file.
- *
- * @param filename The name of the file containing the certificate.
- *
- * @param format The file format (ASN.1 or PEM).
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void use_certificate_file(const std::string& filename, file_format format)
- {
- boost::system::error_code ec;
- service_.use_certificate_file(impl_, filename, format, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Use a certificate from a file.
- /**
- * This function is used to load a certificate into the context from a file.
- *
- * @param filename The name of the file containing the certificate.
- *
- * @param format The file format (ASN.1 or PEM).
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code use_certificate_file(const std::string& filename,
- file_format format, boost::system::error_code& ec)
- {
- return service_.use_certificate_file(impl_, filename, format, ec);
- }
-
- /// Use a certificate chain from a file.
- /**
- * This function is used to load a certificate chain into the context from a
- * file.
- *
- * @param filename The name of the file containing the certificate. The file
- * must use the PEM format.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void use_certificate_chain_file(const std::string& filename)
- {
- boost::system::error_code ec;
- service_.use_certificate_chain_file(impl_, filename, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Use a certificate chain from a file.
- /**
- * This function is used to load a certificate chain into the context from a
- * file.
- *
- * @param filename The name of the file containing the certificate. The file
- * must use the PEM format.
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code use_certificate_chain_file(
- const std::string& filename, boost::system::error_code& ec)
- {
- return service_.use_certificate_chain_file(impl_, filename, ec);
- }
-
- /// Use a private key from a file.
- /**
- * This function is used to load a private key into the context from a file.
- *
- * @param filename The name of the file containing the private key.
- *
- * @param format The file format (ASN.1 or PEM).
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void use_private_key_file(const std::string& filename, file_format format)
- {
- boost::system::error_code ec;
- service_.use_private_key_file(impl_, filename, format, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Use a private key from a file.
- /**
- * This function is used to load a private key into the context from a file.
- *
- * @param filename The name of the file containing the private key.
- *
- * @param format The file format (ASN.1 or PEM).
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code use_private_key_file(const std::string& filename,
- file_format format, boost::system::error_code& ec)
- {
- return service_.use_private_key_file(impl_, filename, format, ec);
- }
-
- /// Use an RSA private key from a file.
- /**
- * This function is used to load an RSA private key into the context from a
- * file.
- *
- * @param filename The name of the file containing the RSA private key.
- *
- * @param format The file format (ASN.1 or PEM).
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void use_rsa_private_key_file(const std::string& filename, file_format format)
- {
- boost::system::error_code ec;
- service_.use_rsa_private_key_file(impl_, filename, format, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Use an RSA private key from a file.
- /**
- * This function is used to load an RSA private key into the context from a
- * file.
- *
- * @param filename The name of the file containing the RSA private key.
- *
- * @param format The file format (ASN.1 or PEM).
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code use_rsa_private_key_file(
- const std::string& filename, file_format format,
- boost::system::error_code& ec)
- {
- return service_.use_rsa_private_key_file(impl_, filename, format, ec);
- }
-
- /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
- /**
- * This function is used to load Diffie-Hellman parameters into the context
- * from a file.
- *
- * @param filename The name of the file containing the Diffie-Hellman
- * parameters. The file must use the PEM format.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- void use_tmp_dh_file(const std::string& filename)
- {
- boost::system::error_code ec;
- service_.use_tmp_dh_file(impl_, filename, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
- /**
- * This function is used to load Diffie-Hellman parameters into the context
- * from a file.
- *
- * @param filename The name of the file containing the Diffie-Hellman
- * parameters. The file must use the PEM format.
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- boost::system::error_code use_tmp_dh_file(const std::string& filename,
- boost::system::error_code& ec)
- {
- return service_.use_tmp_dh_file(impl_, filename, ec);
- }
-
- /// Set the password callback.
- /**
- * This function is used to specify a callback function to obtain password
- * information about an encrypted key in PEM format.
- *
- * @param callback The function object to be used for obtaining the password.
- * The function signature of the handler must be:
- * @code std::string password_callback(
- * std::size_t max_length, // The maximum size for a password.
- * password_purpose purpose // Whether password is for reading or writing.
- * ); @endcode
- * The return value of the callback is a string containing the password.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- template <typename PasswordCallback>
- void set_password_callback(PasswordCallback callback)
- {
- boost::system::error_code ec;
- service_.set_password_callback(impl_, callback, ec);
- boost::asio::detail::throw_error(ec);
- }
-
- /// Set the password callback.
- /**
- * This function is used to specify a callback function to obtain password
- * information about an encrypted key in PEM format.
- *
- * @param callback The function object to be used for obtaining the password.
- * The function signature of the handler must be:
- * @code std::string password_callback(
- * std::size_t max_length, // The maximum size for a password.
- * password_purpose purpose // Whether password is for reading or writing.
- * ); @endcode
- * The return value of the callback is a string containing the password.
- *
- * @param ec Set to indicate what error occurred, if any.
- */
- template <typename PasswordCallback>
- boost::system::error_code set_password_callback(PasswordCallback callback,
- boost::system::error_code& ec)
- {
- return service_.set_password_callback(impl_, callback, ec);
- }
-
-private:
- /// The backend service implementation.
- service_type& service_;
-
- /// The underlying native implementation.
- impl_type impl_;
-};
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+using boost::asio::ssl::old::basic_context;
+
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
 } // namespace ssl
 } // namespace asio

Modified: branches/release/boost/asio/ssl/context.hpp
==============================================================================
--- branches/release/boost/asio/ssl/context.hpp (original)
+++ branches/release/boost/asio/ssl/context.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,8 +2,7 @@
 // ssl/context.hpp
 // ~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -17,18 +16,518 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <boost/asio/ssl/basic_context.hpp>
-#include <boost/asio/ssl/context_service.hpp>
+
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/basic_context.hpp>
+# include <boost/asio/ssl/context_service.hpp>
+#else // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <string>
+# include <boost/asio/io_service.hpp>
+# include <boost/asio/ssl/context_base.hpp>
+# include <boost/asio/ssl/detail/openssl_types.hpp>
+# include <boost/asio/ssl/detail/openssl_init.hpp>
+# include <boost/asio/ssl/detail/password_callback.hpp>
+# include <boost/asio/ssl/detail/verify_callback.hpp>
+# include <boost/asio/ssl/verify_mode.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
 
 namespace boost {
 namespace asio {
 namespace ssl {
 
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
 /// Typedef for the typical usage of context.
 typedef basic_context<context_service> context;
 
+#else // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+class context
+ : public context_base,
+ private noncopyable
+{
+public:
+ /// The native handle type of the SSL context.
+ typedef SSL_CTX* native_handle_type;
+
+ /// (Deprecated: Use native_handle_type.) The native type of the SSL context.
+ typedef SSL_CTX* impl_type;
+
+ /// Constructor.
+ BOOST_ASIO_DECL explicit context(method m);
+
+ /// Deprecated constructor taking a reference to an io_service object.
+ BOOST_ASIO_DECL context(boost::asio::io_service&, method m);
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a context from another.
+ /**
+ * This constructor moves an SSL context from one object to another.
+ *
+ * @param other The other context object from which the move will occur.
+ *
+ * @note Following the move, the following operations only are valid for the
+ * moved-from object:
+ * @li Destruction.
+ * @li As a target for move-assignment.
+ */
+ BOOST_ASIO_DECL context(context&& other);
+
+ /// Move-assign a context from another.
+ /**
+ * This assignment operator moves an SSL context from one object to another.
+ *
+ * @param other The other context object from which the move will occur.
+ *
+ * @note Following the move, the following operations only are valid for the
+ * moved-from object:
+ * @li Destruction.
+ * @li As a target for move-assignment.
+ */
+ BOOST_ASIO_DECL context& operator=(context&& other);
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
+ /// Destructor.
+ BOOST_ASIO_DECL ~context();
+
+ /// Get the underlying implementation in the native type.
+ /**
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to context functionality that is
+ * not otherwise provided.
+ */
+ BOOST_ASIO_DECL native_handle_type native_handle();
+
+ /// (Deprecated: Use native_handle().) Get the underlying implementation in
+ /// the native type.
+ /**
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to context functionality that is
+ * not otherwise provided.
+ */
+ BOOST_ASIO_DECL impl_type impl();
+
+ /// Set options on the context.
+ /**
+ * This function may be used to configure the SSL options used by the context.
+ *
+ * @param o A bitmask of options. The available option values are defined in
+ * the context_base class. The options are bitwise-ored with any existing
+ * value for the options.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_set_options.
+ */
+ BOOST_ASIO_DECL void set_options(options o);
+
+ /// Set options on the context.
+ /**
+ * This function may be used to configure the SSL options used by the context.
+ *
+ * @param o A bitmask of options. The available option values are defined in
+ * the context_base class. The options are bitwise-ored with any existing
+ * value for the options.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_set_options.
+ */
+ BOOST_ASIO_DECL boost::system::error_code set_options(options o,
+ boost::system::error_code& ec);
+
+ /// Set the peer verification mode.
+ /**
+ * This function may be used to configure the peer verification mode used by
+ * the context.
+ *
+ * @param v A bitmask of peer verification modes. See @ref verify_mode for
+ * available values.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_set_verify.
+ */
+ BOOST_ASIO_DECL void set_verify_mode(verify_mode v);
+
+ /// Set the peer verification mode.
+ /**
+ * This function may be used to configure the peer verification mode used by
+ * the context.
+ *
+ * @param v A bitmask of peer verification modes. See @ref verify_mode for
+ * available values.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_set_verify.
+ */
+ BOOST_ASIO_DECL boost::system::error_code set_verify_mode(
+ verify_mode v, boost::system::error_code& ec);
+
+ /// Set the callback used to verify peer certificates.
+ /**
+ * This function is used to specify a callback function that will be called
+ * by the implementation when it needs to verify a peer certificate.
+ *
+ * @param callback The function object to be used for verifying a certificate.
+ * The function signature of the handler must be:
+ * @code bool verify_callback(
+ * bool preverified, // True if the certificate passed pre-verification.
+ * verify_context& ctx // The peer certificate and other context.
+ * ); @endcode
+ * The return value of the callback is true if the certificate has passed
+ * verification, false otherwise.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_set_verify.
+ */
+ template <typename VerifyCallback>
+ void set_verify_callback(VerifyCallback callback);
+
+ /// Set the callback used to verify peer certificates.
+ /**
+ * This function is used to specify a callback function that will be called
+ * by the implementation when it needs to verify a peer certificate.
+ *
+ * @param callback The function object to be used for verifying a certificate.
+ * The function signature of the handler must be:
+ * @code bool verify_callback(
+ * bool preverified, // True if the certificate passed pre-verification.
+ * verify_context& ctx // The peer certificate and other context.
+ * ); @endcode
+ * The return value of the callback is true if the certificate has passed
+ * verification, false otherwise.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_set_verify.
+ */
+ template <typename VerifyCallback>
+ boost::system::error_code set_verify_callback(VerifyCallback callback,
+ boost::system::error_code& ec);
+
+ /// Load a certification authority file for performing verification.
+ /**
+ * This function is used to load one or more trusted certification authorities
+ * from a file.
+ *
+ * @param filename The name of a file containing certification authority
+ * certificates in PEM format.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_load_verify_locations.
+ */
+ BOOST_ASIO_DECL void load_verify_file(const std::string& filename);
+
+ /// Load a certification authority file for performing verification.
+ /**
+ * This function is used to load the certificates for one or more trusted
+ * certification authorities from a file.
+ *
+ * @param filename The name of a file containing certification authority
+ * certificates in PEM format.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_load_verify_locations.
+ */
+ BOOST_ASIO_DECL boost::system::error_code load_verify_file(
+ const std::string& filename, boost::system::error_code& ec);
+
+ /// Configures the context to use the default directories for finding
+ /// certification authority certificates.
+ /**
+ * This function specifies that the context should use the default,
+ * system-dependent directories for locating certification authority
+ * certificates.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_set_default_verify_paths.
+ */
+ BOOST_ASIO_DECL void set_default_verify_paths();
+
+ /// Configures the context to use the default directories for finding
+ /// certification authority certificates.
+ /**
+ * This function specifies that the context should use the default,
+ * system-dependent directories for locating certification authority
+ * certificates.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_set_default_verify_paths.
+ */
+ BOOST_ASIO_DECL boost::system::error_code set_default_verify_paths(
+ boost::system::error_code& ec);
+
+ /// Add a directory containing certificate authority files to be used for
+ /// performing verification.
+ /**
+ * This function is used to specify the name of a directory containing
+ * certification authority certificates. Each file in the directory must
+ * contain a single certificate. The files must be named using the subject
+ * name's hash and an extension of ".0".
+ *
+ * @param path The name of a directory containing the certificates.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_load_verify_locations.
+ */
+ BOOST_ASIO_DECL void add_verify_path(const std::string& path);
+
+ /// Add a directory containing certificate authority files to be used for
+ /// performing verification.
+ /**
+ * This function is used to specify the name of a directory containing
+ * certification authority certificates. Each file in the directory must
+ * contain a single certificate. The files must be named using the subject
+ * name's hash and an extension of ".0".
+ *
+ * @param path The name of a directory containing the certificates.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_load_verify_locations.
+ */
+ BOOST_ASIO_DECL boost::system::error_code add_verify_path(
+ const std::string& path, boost::system::error_code& ec);
+
+ /// Use a certificate from a file.
+ /**
+ * This function is used to load a certificate into the context from a file.
+ *
+ * @param filename The name of the file containing the certificate.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_use_certificate_file.
+ */
+ BOOST_ASIO_DECL void use_certificate_file(
+ const std::string& filename, file_format format);
+
+ /// Use a certificate from a file.
+ /**
+ * This function is used to load a certificate into the context from a file.
+ *
+ * @param filename The name of the file containing the certificate.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_use_certificate_file.
+ */
+ BOOST_ASIO_DECL boost::system::error_code use_certificate_file(
+ const std::string& filename, file_format format,
+ boost::system::error_code& ec);
+
+ /// Use a certificate chain from a file.
+ /**
+ * This function is used to load a certificate chain into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the certificate. The file
+ * must use the PEM format.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_use_certificate_chain_file.
+ */
+ BOOST_ASIO_DECL void use_certificate_chain_file(const std::string& filename);
+
+ /// Use a certificate chain from a file.
+ /**
+ * This function is used to load a certificate chain into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the certificate. The file
+ * must use the PEM format.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_use_certificate_chain_file.
+ */
+ BOOST_ASIO_DECL boost::system::error_code use_certificate_chain_file(
+ const std::string& filename, boost::system::error_code& ec);
+
+ /// Use a private key from a file.
+ /**
+ * This function is used to load a private key into the context from a file.
+ *
+ * @param filename The name of the file containing the private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_use_PrivateKey_file.
+ */
+ BOOST_ASIO_DECL void use_private_key_file(
+ const std::string& filename, file_format format);
+
+ /// Use a private key from a file.
+ /**
+ * This function is used to load a private key into the context from a file.
+ *
+ * @param filename The name of the file containing the private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_use_PrivateKey_file.
+ */
+ BOOST_ASIO_DECL boost::system::error_code use_private_key_file(
+ const std::string& filename, file_format format,
+ boost::system::error_code& ec);
+
+ /// Use an RSA private key from a file.
+ /**
+ * This function is used to load an RSA private key into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the RSA private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_use_RSAPrivateKey_file.
+ */
+ BOOST_ASIO_DECL void use_rsa_private_key_file(
+ const std::string& filename, file_format format);
+
+ /// Use an RSA private key from a file.
+ /**
+ * This function is used to load an RSA private key into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the RSA private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_use_RSAPrivateKey_file.
+ */
+ BOOST_ASIO_DECL boost::system::error_code use_rsa_private_key_file(
+ const std::string& filename, file_format format,
+ boost::system::error_code& ec);
+
+ /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
+ /**
+ * This function is used to load Diffie-Hellman parameters into the context
+ * from a file.
+ *
+ * @param filename The name of the file containing the Diffie-Hellman
+ * parameters. The file must use the PEM format.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_set_tmp_dh.
+ */
+ BOOST_ASIO_DECL void use_tmp_dh_file(const std::string& filename);
+
+ /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
+ /**
+ * This function is used to load Diffie-Hellman parameters into the context
+ * from a file.
+ *
+ * @param filename The name of the file containing the Diffie-Hellman
+ * parameters. The file must use the PEM format.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_set_tmp_dh.
+ */
+ BOOST_ASIO_DECL boost::system::error_code use_tmp_dh_file(
+ const std::string& filename, boost::system::error_code& ec);
+
+ /// Set the password callback.
+ /**
+ * This function is used to specify a callback function to obtain password
+ * information about an encrypted key in PEM format.
+ *
+ * @param callback The function object to be used for obtaining the password.
+ * The function signature of the handler must be:
+ * @code std::string password_callback(
+ * std::size_t max_length, // The maximum size for a password.
+ * password_purpose purpose // Whether password is for reading or writing.
+ * ); @endcode
+ * The return value of the callback is a string containing the password.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_CTX_set_default_passwd_cb.
+ */
+ template <typename PasswordCallback>
+ void set_password_callback(PasswordCallback callback);
+
+ /// Set the password callback.
+ /**
+ * This function is used to specify a callback function to obtain password
+ * information about an encrypted key in PEM format.
+ *
+ * @param callback The function object to be used for obtaining the password.
+ * The function signature of the handler must be:
+ * @code std::string password_callback(
+ * std::size_t max_length, // The maximum size for a password.
+ * password_purpose purpose // Whether password is for reading or writing.
+ * ); @endcode
+ * The return value of the callback is a string containing the password.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_CTX_set_default_passwd_cb.
+ */
+ template <typename PasswordCallback>
+ boost::system::error_code set_password_callback(PasswordCallback callback,
+ boost::system::error_code& ec);
+
+private:
+ // Helper function used to set a peer certificate verification callback.
+ BOOST_ASIO_DECL boost::system::error_code do_set_verify_callback(
+ detail::verify_callback_base* callback, boost::system::error_code& ec);
+
+ // Callback used when the SSL implementation wants to verify a certificate.
+ BOOST_ASIO_DECL static int verify_callback_function(
+ int preverified, X509_STORE_CTX* ctx);
+
+ // Helper function used to set a password callback.
+ BOOST_ASIO_DECL boost::system::error_code do_set_password_callback(
+ detail::password_callback_base* callback, boost::system::error_code& ec);
+
+ // Callback used when the SSL implementation wants a password.
+ BOOST_ASIO_DECL static int password_callback_function(
+ char* buf, int size, int purpose, void* data);
+
+ // The underlying native implementation.
+ native_handle_type handle_;
+
+ // Ensure openssl is initialised.
+ boost::asio::ssl::detail::openssl_init<> init_;
+};
+
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
 } // namespace ssl
 } // namespace asio
 } // namespace boost
 
+#include <boost/asio/detail/pop_options.hpp>
+
+#include <boost/asio/ssl/impl/context.hpp>
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/ssl/impl/context.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
 #endif // BOOST_ASIO_SSL_CONTEXT_HPP

Modified: branches/release/boost/asio/ssl/context_base.hpp
==============================================================================
--- branches/release/boost/asio/ssl/context_base.hpp (original)
+++ branches/release/boost/asio/ssl/context_base.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,7 +2,7 @@
 // ssl/context_base.hpp
 // ~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -106,24 +106,11 @@
     pem
   };
 
- /// Bitmask type for peer verification.
+#if !defined(GENERATING_DOCUMENTATION)
+ // The following types and constants are preserved for backward compatibility.
+ // New programs should use the equivalents of the same names that are defined
+ // in the boost::asio::ssl namespace.
   typedef int verify_mode;
-
-#if defined(GENERATING_DOCUMENTATION)
- /// No verification.
- static const int verify_none = implementation_defined;
-
- /// Verify the peer.
- static const int verify_peer = implementation_defined;
-
- /// Fail verification if the peer has no certificate. Ignored unless
- /// verify_peer is set.
- static const int verify_fail_if_no_peer_cert = implementation_defined;
-
- /// Do not request client certificate on renegotiation. Ignored unless
- /// verify_peer is set.
- static const int verify_client_once = implementation_defined;
-#else
   BOOST_STATIC_CONSTANT(int, verify_none = SSL_VERIFY_NONE);
   BOOST_STATIC_CONSTANT(int, verify_peer = SSL_VERIFY_PEER);
   BOOST_STATIC_CONSTANT(int,

Modified: branches/release/boost/asio/ssl/context_service.hpp
==============================================================================
--- branches/release/boost/asio/ssl/context_service.hpp (original)
+++ branches/release/boost/asio/ssl/context_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,8 +2,7 @@
 // ssl/context_service.hpp
 // ~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -17,12 +16,10 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <string>
-#include <boost/noncopyable.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ssl/context_base.hpp>
-#include <boost/asio/ssl/detail/openssl_context_service.hpp>
+
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/old/context_service.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -30,140 +27,11 @@
 namespace asio {
 namespace ssl {
 
-/// Default service implementation for a context.
-class context_service
-#if defined(GENERATING_DOCUMENTATION)
- : public boost::asio::io_service::service
-#else
- : public boost::asio::detail::service_base<context_service>
-#endif
-{
-private:
- // The type of the platform-specific implementation.
- typedef detail::openssl_context_service service_impl_type;
-
-public:
-#if defined(GENERATING_DOCUMENTATION)
- /// The unique service identifier.
- static boost::asio::io_service::id id;
-#endif
-
- /// The type of the context.
-#if defined(GENERATING_DOCUMENTATION)
- typedef implementation_defined impl_type;
-#else
- typedef service_impl_type::impl_type impl_type;
-#endif
-
- /// Constructor.
- explicit context_service(boost::asio::io_service& io_service)
- : boost::asio::detail::service_base<context_service>(io_service),
- service_impl_(boost::asio::use_service<service_impl_type>(io_service))
- {
- }
-
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- }
-
- /// Return a null context implementation.
- impl_type null() const
- {
- return service_impl_.null();
- }
-
- /// Create a new context implementation.
- void create(impl_type& impl, context_base::method m)
- {
- service_impl_.create(impl, m);
- }
-
- /// Destroy a context implementation.
- void destroy(impl_type& impl)
- {
- service_impl_.destroy(impl);
- }
-
- /// Set options on the context.
- boost::system::error_code set_options(impl_type& impl,
- context_base::options o, boost::system::error_code& ec)
- {
- return service_impl_.set_options(impl, o, ec);
- }
-
- /// Set peer verification mode.
- boost::system::error_code set_verify_mode(impl_type& impl,
- context_base::verify_mode v, boost::system::error_code& ec)
- {
- return service_impl_.set_verify_mode(impl, v, ec);
- }
-
- /// Load a certification authority file for performing verification.
- boost::system::error_code load_verify_file(impl_type& impl,
- const std::string& filename, boost::system::error_code& ec)
- {
- return service_impl_.load_verify_file(impl, filename, ec);
- }
-
- /// Add a directory containing certification authority files to be used for
- /// performing verification.
- boost::system::error_code add_verify_path(impl_type& impl,
- const std::string& path, boost::system::error_code& ec)
- {
- return service_impl_.add_verify_path(impl, path, ec);
- }
-
- /// Use a certificate from a file.
- boost::system::error_code use_certificate_file(impl_type& impl,
- const std::string& filename, context_base::file_format format,
- boost::system::error_code& ec)
- {
- return service_impl_.use_certificate_file(impl, filename, format, ec);
- }
-
- /// Use a certificate chain from a file.
- boost::system::error_code use_certificate_chain_file(impl_type& impl,
- const std::string& filename, boost::system::error_code& ec)
- {
- return service_impl_.use_certificate_chain_file(impl, filename, ec);
- }
-
- /// Use a private key from a file.
- boost::system::error_code use_private_key_file(impl_type& impl,
- const std::string& filename, context_base::file_format format,
- boost::system::error_code& ec)
- {
- return service_impl_.use_private_key_file(impl, filename, format, ec);
- }
-
- /// Use an RSA private key from a file.
- boost::system::error_code use_rsa_private_key_file(impl_type& impl,
- const std::string& filename, context_base::file_format format,
- boost::system::error_code& ec)
- {
- return service_impl_.use_rsa_private_key_file(impl, filename, format, ec);
- }
-
- /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
- boost::system::error_code use_tmp_dh_file(impl_type& impl,
- const std::string& filename, boost::system::error_code& ec)
- {
- return service_impl_.use_tmp_dh_file(impl, filename, ec);
- }
-
- /// Set the password callback.
- template <typename PasswordCallback>
- boost::system::error_code set_password_callback(impl_type& impl,
- PasswordCallback callback, boost::system::error_code& ec)
- {
- return service_impl_.set_password_callback(impl, callback, ec);
- }
-
-private:
- // The service that provides the platform-specific implementation.
- service_impl_type& service_impl_;
-};
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+using boost::asio::ssl::old::context_service;
+
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
 } // namespace ssl
 } // namespace asio

Added: branches/release/boost/asio/ssl/detail/engine.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/engine.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,162 @@
+//
+// ssl/detail/engine.hpp
+// ~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_ENGINE_HPP
+#define BOOST_ASIO_SSL_DETAIL_ENGINE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/buffer.hpp>
+# include <boost/asio/detail/static_mutex.hpp>
+# include <boost/asio/ssl/detail/openssl_types.hpp>
+# include <boost/asio/ssl/detail/verify_callback.hpp>
+# include <boost/asio/ssl/stream_base.hpp>
+# include <boost/asio/ssl/verify_mode.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+class engine
+{
+public:
+ enum want
+ {
+ // Returned by functions to indicate that the engine wants input. The input
+ // buffer should be updated to point to the data. The engine then needs to
+ // be called again to retry the operation.
+ want_input_and_retry = -2,
+
+ // Returned by functions to indicate that the engine wants to write output.
+ // The output buffer points to the data to be written. The engine then
+ // needs to be called again to retry the operation.
+ want_output_and_retry = -1,
+
+ // Returned by functions to indicate that the engine doesn't need input or
+ // output.
+ want_nothing = 0,
+
+ // Returned by functions to indicate that the engine wants to write output.
+ // The output buffer points to the data to be written. After that the
+ // operation is complete, and the engine does not need to be called again.
+ want_output = 1
+ };
+
+ // Construct a new engine for the specified context.
+ BOOST_ASIO_DECL explicit engine(SSL_CTX* context);
+
+ // Destructor.
+ BOOST_ASIO_DECL ~engine();
+
+ // Get the underlying implementation in the native type.
+ BOOST_ASIO_DECL SSL* native_handle();
+
+ // Set the peer verification mode.
+ BOOST_ASIO_DECL boost::system::error_code set_verify_mode(
+ verify_mode v, boost::system::error_code& ec);
+
+ // Set a peer certificate verification callback.
+ BOOST_ASIO_DECL boost::system::error_code set_verify_callback(
+ verify_callback_base* callback, boost::system::error_code& ec);
+
+ // Perform an SSL handshake using either SSL_connect (client-side) or
+ // SSL_accept (server-side).
+ BOOST_ASIO_DECL want handshake(
+ stream_base::handshake_type type, boost::system::error_code& ec);
+
+ // Perform a graceful shutdown of the SSL session.
+ BOOST_ASIO_DECL want shutdown(boost::system::error_code& ec);
+
+ // Write bytes to the SSL session.
+ BOOST_ASIO_DECL want write(const boost::asio::const_buffer& data,
+ boost::system::error_code& ec, std::size_t& bytes_transferred);
+
+ // Read bytes from the SSL session.
+ BOOST_ASIO_DECL want read(const boost::asio::mutable_buffer& data,
+ boost::system::error_code& ec, std::size_t& bytes_transferred);
+
+ // Get output data to be written to the transport.
+ BOOST_ASIO_DECL boost::asio::mutable_buffers_1 get_output(
+ const boost::asio::mutable_buffer& data);
+
+ // Put input data that was read from the transport.
+ BOOST_ASIO_DECL boost::asio::const_buffer put_input(
+ const boost::asio::const_buffer& data);
+
+ // Map an error::eof code returned by the underlying transport according to
+ // the type and state of the SSL session. Returns a const reference to the
+ // error code object, suitable for passing to a completion handler.
+ BOOST_ASIO_DECL const boost::system::error_code& map_error_code(
+ boost::system::error_code& ec) const;
+
+private:
+ // Disallow copying and assignment.
+ engine(const engine&);
+ engine& operator=(const engine&);
+
+ // Callback used when the SSL implementation wants to verify a certificate.
+ BOOST_ASIO_DECL static int verify_callback_function(
+ int preverified, X509_STORE_CTX* ctx);
+
+ // The SSL_accept function may not be thread safe. This mutex is used to
+ // protect all calls to the SSL_accept function.
+ BOOST_ASIO_DECL static boost::asio::detail::static_mutex& accept_mutex();
+
+ // Perform one operation. Returns >= 0 on success or error, want_read if the
+ // operation needs more input, or want_write if it needs to write some output
+ // before the operation can complete.
+ BOOST_ASIO_DECL want perform(int (engine::* op)(void*, std::size_t),
+ void* data, std::size_t length, boost::system::error_code& ec,
+ std::size_t* bytes_transferred);
+
+ // Adapt the SSL_accept function to the signature needed for perform().
+ BOOST_ASIO_DECL int do_accept(void*, std::size_t);
+
+ // Adapt the SSL_connect function to the signature needed for perform().
+ BOOST_ASIO_DECL int do_connect(void*, std::size_t);
+
+ // Adapt the SSL_shutdown function to the signature needed for perform().
+ BOOST_ASIO_DECL int do_shutdown(void*, std::size_t);
+
+ // Adapt the SSL_read function to the signature needed for perform().
+ BOOST_ASIO_DECL int do_read(void* data, std::size_t length);
+
+ // Adapt the SSL_write function to the signature needed for perform().
+ BOOST_ASIO_DECL int do_write(void* data, std::size_t length);
+
+ SSL* ssl_;
+ BIO* ext_bio_;
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/ssl/detail/impl/engine.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // BOOST_ASIO_SSL_DETAIL_ENGINE_HPP

Added: branches/release/boost/asio/ssl/detail/handshake_op.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/handshake_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,70 @@
+//
+// ssl/detail/handshake_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP
+#define BOOST_ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/detail/engine.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+class handshake_op
+{
+public:
+ handshake_op(stream_base::handshake_type type)
+ : type_(type)
+ {
+ }
+
+ engine::want operator()(engine& eng,
+ boost::system::error_code& ec,
+ std::size_t& bytes_transferred) const
+ {
+ bytes_transferred = 0;
+ return eng.handshake(type_, ec);
+ }
+
+ template <typename Handler>
+ void call_handler(Handler& handler,
+ const boost::system::error_code& ec,
+ const std::size_t&) const
+ {
+ handler(ec);
+ }
+
+private:
+ stream_base::handshake_type type_;
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP

Added: branches/release/boost/asio/ssl/detail/impl/engine.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/impl/engine.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,290 @@
+//
+// ssl/detail/impl/engine.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_IMPL_ENGINE_IPP
+#define BOOST_ASIO_SSL_DETAIL_IMPL_ENGINE_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/detail/engine.hpp>
+# include <boost/asio/ssl/verify_context.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+engine::engine(SSL_CTX* context)
+ : ssl_(::SSL_new(context))
+{
+ accept_mutex().init();
+
+ ::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE);
+ ::SSL_set_mode(ssl_, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
+#if defined(SSL_MODE_RELEASE_BUFFERS)
+ ::SSL_set_mode(ssl_, SSL_MODE_RELEASE_BUFFERS);
+#endif // defined(SSL_MODE_RELEASE_BUFFERS)
+
+ ::BIO* int_bio = 0;
+ ::BIO_new_bio_pair(&int_bio, 0, &ext_bio_, 0);
+ ::SSL_set_bio(ssl_, int_bio, int_bio);
+}
+
+engine::~engine()
+{
+ if (SSL_get_app_data(ssl_))
+ {
+ delete static_cast<verify_callback_base*>(SSL_get_app_data(ssl_));
+ SSL_set_app_data(ssl_, 0);
+ }
+
+ ::BIO_free(ext_bio_);
+ ::SSL_free(ssl_);
+}
+
+SSL* engine::native_handle()
+{
+ return ssl_;
+}
+
+boost::system::error_code engine::set_verify_mode(
+ verify_mode v, boost::system::error_code& ec)
+{
+ ::SSL_set_verify(ssl_, v, ::SSL_get_verify_callback(ssl_));
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+boost::system::error_code engine::set_verify_callback(
+ verify_callback_base* callback, boost::system::error_code& ec)
+{
+ if (SSL_get_app_data(ssl_))
+ delete static_cast<verify_callback_base*>(SSL_get_app_data(ssl_));
+
+ SSL_set_app_data(ssl_, callback);
+
+ ::SSL_set_verify(ssl_, ::SSL_get_verify_mode(ssl_),
+ &engine::verify_callback_function);
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+int engine::verify_callback_function(int preverified, X509_STORE_CTX* ctx)
+{
+ if (ctx)
+ {
+ if (SSL* ssl = static_cast<SSL*>(
+ ::X509_STORE_CTX_get_ex_data(
+ ctx, ::SSL_get_ex_data_X509_STORE_CTX_idx())))
+ {
+ if (SSL_get_app_data(ssl))
+ {
+ verify_callback_base* callback =
+ static_cast<verify_callback_base*>(
+ SSL_get_app_data(ssl));
+
+ verify_context verify_ctx(ctx);
+ return callback->call(preverified != 0, verify_ctx) ? 1 : 0;
+ }
+ }
+ }
+
+ return 0;
+}
+
+engine::want engine::handshake(
+ stream_base::handshake_type type, boost::system::error_code& ec)
+{
+ return perform((type == boost::asio::ssl::stream_base::client)
+ ? &engine::do_connect : &engine::do_accept, 0, 0, ec, 0);
+}
+
+engine::want engine::shutdown(boost::system::error_code& ec)
+{
+ return perform(&engine::do_shutdown, 0, 0, ec, 0);
+}
+
+engine::want engine::write(const boost::asio::const_buffer& data,
+ boost::system::error_code& ec, std::size_t& bytes_transferred)
+{
+ return perform(&engine::do_write,
+ const_cast<void*>(boost::asio::buffer_cast<const void*>(data)),
+ boost::asio::buffer_size(data), ec, &bytes_transferred);
+}
+
+engine::want engine::read(const boost::asio::mutable_buffer& data,
+ boost::system::error_code& ec, std::size_t& bytes_transferred)
+{
+ return perform(&engine::do_read,
+ boost::asio::buffer_cast<void*>(data),
+ boost::asio::buffer_size(data), ec, &bytes_transferred);
+}
+
+boost::asio::mutable_buffers_1 engine::get_output(
+ const boost::asio::mutable_buffer& data)
+{
+ int length = ::BIO_read(ext_bio_,
+ boost::asio::buffer_cast<void*>(data),
+ boost::asio::buffer_size(data));
+
+ return boost::asio::buffer(data,
+ length > 0 ? static_cast<std::size_t>(length) : 0);
+}
+
+boost::asio::const_buffer engine::put_input(
+ const boost::asio::const_buffer& data)
+{
+ int length = ::BIO_write(ext_bio_,
+ boost::asio::buffer_cast<const void*>(data),
+ boost::asio::buffer_size(data));
+
+ return boost::asio::buffer(data +
+ (length > 0 ? static_cast<std::size_t>(length) : 0));
+}
+
+const boost::system::error_code& engine::map_error_code(
+ boost::system::error_code& ec) const
+{
+ // We only want to map the error::eof code.
+ if (ec != boost::asio::error::eof)
+ return ec;
+
+ // If there's data yet to be read, it's an error.
+ if (BIO_wpending(ext_bio_))
+ {
+ ec = boost::system::error_code(
+ ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ // SSL v2 doesn't provide a protocol-level shutdown, so an eof on the
+ // underlying transport is passed through.
+ if (ssl_ && ssl_->version == SSL2_VERSION)
+ return ec;
+
+ // Otherwise, the peer should have negotiated a proper shutdown.
+ ec = boost::system::error_code(
+ ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ),
+ boost::asio::error::get_ssl_category());
+ return ec;
+}
+
+boost::asio::detail::static_mutex& engine::accept_mutex()
+{
+ static boost::asio::detail::static_mutex mutex = BOOST_ASIO_STATIC_MUTEX_INIT;
+ return mutex;
+}
+
+engine::want engine::perform(int (engine::* op)(void*, std::size_t),
+ void* data, std::size_t length, boost::system::error_code& ec,
+ std::size_t* bytes_transferred)
+{
+ std::size_t pending_output_before = ::BIO_ctrl_pending(ext_bio_);
+ int result = (this->*op)(data, length);
+ int ssl_error = ::SSL_get_error(ssl_, result);
+ int sys_error = ::ERR_get_error();
+ std::size_t pending_output_after = ::BIO_ctrl_pending(ext_bio_);
+
+ if (ssl_error == SSL_ERROR_SSL)
+ {
+ ec = boost::system::error_code(sys_error,
+ boost::asio::error::get_ssl_category());
+ return want_nothing;
+ }
+
+ if (ssl_error == SSL_ERROR_SYSCALL)
+ {
+ ec = boost::system::error_code(sys_error,
+ boost::asio::error::get_system_category());
+ return want_nothing;
+ }
+
+ if (result > 0 && bytes_transferred)
+ *bytes_transferred = static_cast<std::size_t>(result);
+
+ if (ssl_error == SSL_ERROR_WANT_WRITE)
+ {
+ ec = boost::system::error_code();
+ return want_output_and_retry;
+ }
+ else if (pending_output_after > pending_output_before)
+ {
+ ec = boost::system::error_code();
+ return result > 0 ? want_output : want_output_and_retry;
+ }
+ else if (ssl_error == SSL_ERROR_WANT_READ)
+ {
+ ec = boost::system::error_code();
+ return want_input_and_retry;
+ }
+ else if (::SSL_get_shutdown(ssl_) & SSL_RECEIVED_SHUTDOWN)
+ {
+ ec = boost::asio::error::eof;
+ return want_nothing;
+ }
+ else
+ {
+ ec = boost::system::error_code();
+ return want_nothing;
+ }
+}
+
+int engine::do_accept(void*, std::size_t)
+{
+ boost::asio::detail::static_mutex::scoped_lock lock(accept_mutex());
+ return ::SSL_accept(ssl_);
+}
+
+int engine::do_connect(void*, std::size_t)
+{
+ return ::SSL_connect(ssl_);
+}
+
+int engine::do_shutdown(void*, std::size_t)
+{
+ int result = ::SSL_shutdown(ssl_);
+ if (result == 0)
+ result = ::SSL_shutdown(ssl_);
+ return result;
+}
+
+int engine::do_read(void* data, std::size_t length)
+{
+ return ::SSL_read(ssl_, data, length < INT_MAX ? length : INT_MAX);
+}
+
+int engine::do_write(void* data, std::size_t length)
+{
+ return ::SSL_write(ssl_, data, length < INT_MAX ? length : INT_MAX);
+}
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_IMPL_ENGINE_IPP

Added: branches/release/boost/asio/ssl/detail/impl/openssl_init.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/impl/openssl_init.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,109 @@
+//
+// ssl/detail/impl/openssl_init.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_IMPL_OPENSSL_INIT_IPP
+#define BOOST_ASIO_SSL_DETAIL_IMPL_OPENSSL_INIT_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <vector>
+#include <boost/assert.hpp>
+#include <boost/asio/detail/mutex.hpp>
+#include <boost/asio/detail/tss_ptr.hpp>
+#include <boost/asio/ssl/detail/openssl_init.hpp>
+#include <boost/asio/ssl/detail/openssl_types.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+class openssl_init_base::do_init
+{
+public:
+ do_init()
+ {
+ ::SSL_library_init();
+ ::SSL_load_error_strings();
+ ::OpenSSL_add_ssl_algorithms();
+
+ mutexes_.resize(::CRYPTO_num_locks());
+ for (size_t i = 0; i < mutexes_.size(); ++i)
+ mutexes_[i].reset(new boost::asio::detail::mutex);
+ ::CRYPTO_set_locking_callback(&do_init::openssl_locking_func);
+ ::CRYPTO_set_id_callback(&do_init::openssl_id_func);
+ }
+
+ ~do_init()
+ {
+ ::CRYPTO_set_id_callback(0);
+ ::CRYPTO_set_locking_callback(0);
+ ::ERR_free_strings();
+ ::ERR_remove_state(0);
+ ::EVP_cleanup();
+ ::CRYPTO_cleanup_all_ex_data();
+ ::CONF_modules_unload(1);
+ ::ENGINE_cleanup();
+ }
+
+private:
+ static unsigned long openssl_id_func()
+ {
+#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ return ::GetCurrentThreadId();
+#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ void* id = instance()->thread_id_;
+ if (id == 0)
+ instance()->thread_id_ = id = &id; // Ugh.
+ BOOST_ASSERT(sizeof(unsigned long) >= sizeof(void*));
+ return reinterpret_cast<unsigned long>(id);
+#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+ }
+
+ static void openssl_locking_func(int mode, int n,
+ const char* /*file*/, int /*line*/)
+ {
+ if (mode & CRYPTO_LOCK)
+ instance()->mutexes_[n]->lock();
+ else
+ instance()->mutexes_[n]->unlock();
+ }
+
+ // Mutexes to be used in locking callbacks.
+ std::vector<boost::asio::detail::shared_ptr<
+ boost::asio::detail::mutex> > mutexes_;
+
+#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+ // The thread identifiers to be used by openssl.
+ boost::asio::detail::tss_ptr<void> thread_id_;
+#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
+};
+
+boost::asio::detail::shared_ptr<openssl_init_base::do_init>
+openssl_init_base::instance()
+{
+ static boost::asio::detail::shared_ptr<do_init> init(new do_init);
+ return init;
+}
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_IMPL_OPENSSL_INIT_IPP

Added: branches/release/boost/asio/ssl/detail/io.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/io.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,336 @@
+//
+// ssl/detail/io.hpp
+// ~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_IO_HPP
+#define BOOST_ASIO_SSL_DETAIL_IO_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/detail/engine.hpp>
+# include <boost/asio/ssl/detail/stream_core.hpp>
+# include <boost/asio/write.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+template <typename Stream, typename Operation>
+std::size_t io(Stream& next_layer, stream_core& core,
+ const Operation& op, boost::system::error_code& ec)
+{
+ std::size_t bytes_transferred = 0;
+ do switch (op(core.engine_, ec, bytes_transferred))
+ {
+ case engine::want_input_and_retry:
+
+ // If the input buffer is empty then we need to read some more data from
+ // the underlying transport.
+ if (boost::asio::buffer_size(core.input_) == 0)
+ core.input_ = boost::asio::buffer(core.input_buffer_,
+ next_layer.read_some(core.input_buffer_, ec));
+
+ // Pass the new input data to the engine.
+ core.input_ = core.engine_.put_input(core.input_);
+
+ // Try the operation again.
+ continue;
+
+ case engine::want_output_and_retry:
+
+ // Get output data from the engine and write it to the underlying
+ // transport.
+ boost::asio::write(next_layer,
+ core.engine_.get_output(core.output_buffer_), ec);
+
+ // Try the operation again.
+ continue;
+
+ case engine::want_output:
+
+ // Get output data from the engine and write it to the underlying
+ // transport.
+ boost::asio::write(next_layer,
+ core.engine_.get_output(core.output_buffer_), ec);
+
+ // Operation is complete. Return result to caller.
+ core.engine_.map_error_code(ec);
+ return bytes_transferred;
+
+ default:
+
+ // Operation is complete. Return result to caller.
+ core.engine_.map_error_code(ec);
+ return bytes_transferred;
+
+ } while (!ec);
+
+ // Operation failed. Return result to caller.
+ core.engine_.map_error_code(ec);
+ return 0;
+}
+
+template <typename Stream, typename Operation, typename Handler>
+class io_op
+{
+public:
+ io_op(Stream& next_layer, stream_core& core,
+ const Operation& op, Handler& handler)
+ : next_layer_(next_layer),
+ core_(core),
+ op_(op),
+ bytes_transferred_(0),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ io_op(const io_op& other)
+ : next_layer_(other.next_layer_),
+ core_(other.core_),
+ op_(other.op_),
+ want_(other.want_),
+ ec_(other.ec_),
+ bytes_transferred_(other.bytes_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ io_op(io_op&& other)
+ : next_layer_(other.next_layer_),
+ core_(other.core_),
+ op_(other.op_),
+ want_(other.want_),
+ ec_(other.ec_),
+ bytes_transferred_(other.bytes_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ void operator()(boost::system::error_code ec,
+ std::size_t bytes_transferred = ~std::size_t(0), int start = 0)
+ {
+ switch (start)
+ {
+ case 1: // Called after at least one async operation.
+ do
+ {
+ switch (want_ = op_(core_.engine_, ec_, bytes_transferred_))
+ {
+ case engine::want_input_and_retry:
+
+ // If the input buffer already has data in it we can pass it to the
+ // engine and then retry the operation immediately.
+ if (boost::asio::buffer_size(core_.input_) != 0)
+ {
+ core_.input_ = core_.engine_.put_input(core_.input_);
+ continue;
+ }
+
+ // The engine wants more data to be read from input. However, we
+ // cannot allow more than one read operation at a time on the
+ // underlying transport. The pending_read_ timer's expiry is set to
+ // pos_infin if a read is in progress, and neg_infin otherwise.
+ if (core_.pending_read_.expires_at() == boost::posix_time::neg_infin)
+ {
+ // Prevent other read operations from being started.
+ core_.pending_read_.expires_at(boost::posix_time::pos_infin);
+
+ // Start reading some data from the underlying transport.
+ next_layer_.async_read_some(
+ boost::asio::buffer(core_.input_buffer_),
+ BOOST_ASIO_MOVE_CAST(io_op)(*this));
+ }
+ else
+ {
+ // Wait until the current read operation completes.
+ core_.pending_read_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this));
+ }
+
+ // Yield control until asynchronous operation completes. Control
+ // resumes at the "default:" label below.
+ return;
+
+ case engine::want_output_and_retry:
+ case engine::want_output:
+
+ // The engine wants some data to be written to the output. However, we
+ // cannot allow more than one write operation at a time on the
+ // underlying transport. The pending_write_ timer's expiry is set to
+ // pos_infin if a write is in progress, and neg_infin otherwise.
+ if (core_.pending_write_.expires_at() == boost::posix_time::neg_infin)
+ {
+ // Prevent other write operations from being started.
+ core_.pending_write_.expires_at(boost::posix_time::pos_infin);
+
+ // Start writing all the data to the underlying transport.
+ boost::asio::async_write(next_layer_,
+ core_.engine_.get_output(core_.output_buffer_),
+ BOOST_ASIO_MOVE_CAST(io_op)(*this));
+ }
+ else
+ {
+ // Wait until the current write operation completes.
+ core_.pending_write_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this));
+ }
+
+ // Yield control until asynchronous operation completes. Control
+ // resumes at the "default:" label below.
+ return;
+
+ default:
+
+ // The SSL operation is done and we can invoke the handler, but we
+ // have to keep in mind that this function might be being called from
+ // the async operation's initiating function. In this case we're not
+ // allowed to call the handler directly. Instead, issue a zero-sized
+ // read so the handler runs "as-if" posted using io_service::post().
+ if (start)
+ {
+ next_layer_.async_read_some(
+ boost::asio::buffer(core_.input_buffer_, 0),
+ BOOST_ASIO_MOVE_CAST(io_op)(*this));
+
+ // Yield control until asynchronous operation completes. Control
+ // resumes at the "default:" label below.
+ return;
+ }
+ else
+ {
+ // Continue on to run handler directly.
+ break;
+ }
+ }
+
+ default:
+ if (bytes_transferred != ~std::size_t(0) && !ec_)
+ ec_ = ec;
+
+ switch (want_)
+ {
+ case engine::want_input_and_retry:
+
+ // Add received data to the engine's input.
+ core_.input_ = boost::asio::buffer(
+ core_.input_buffer_, bytes_transferred);
+ core_.input_ = core_.engine_.put_input(core_.input_);
+
+ // Release any waiting read operations.
+ core_.pending_read_.expires_at(boost::posix_time::neg_infin);
+
+ // Try the operation again.
+ continue;
+
+ case engine::want_output_and_retry:
+
+ // Release any waiting write operations.
+ core_.pending_write_.expires_at(boost::posix_time::neg_infin);
+
+ // Try the operation again.
+ continue;
+
+ case engine::want_output:
+
+ // Release any waiting write operations.
+ core_.pending_write_.expires_at(boost::posix_time::neg_infin);
+
+ // Fall through to call handler.
+
+ default:
+
+ // Pass the result to the handler.
+ op_.call_handler(handler_,
+ core_.engine_.map_error_code(ec_),
+ ec_ ? 0 : bytes_transferred_);
+
+ // Our work here is done.
+ return;
+ }
+ } while (!ec_);
+
+ // Operation failed. Pass the result to the handler.
+ op_.call_handler(handler_, core_.engine_.map_error_code(ec_), 0);
+ }
+ }
+
+//private:
+ Stream& next_layer_;
+ stream_core& core_;
+ Operation op_;
+ engine::want want_;
+ boost::system::error_code ec_;
+ std::size_t bytes_transferred_;
+ Handler handler_;
+};
+
+template <typename Stream, typename Operation, typename Handler>
+inline void* asio_handler_allocate(std::size_t size,
+ io_op<Stream, Operation, Handler>* this_handler)
+{
+ return boost_asio_handler_alloc_helpers::allocate(
+ size, this_handler->handler_);
+}
+
+template <typename Stream, typename Operation, typename Handler>
+inline void asio_handler_deallocate(void* pointer, std::size_t size,
+ io_op<Stream, Operation, Handler>* this_handler)
+{
+ boost_asio_handler_alloc_helpers::deallocate(
+ pointer, size, this_handler->handler_);
+}
+
+template <typename Function, typename Stream,
+ typename Operation, typename Handler>
+inline void asio_handler_invoke(Function& function,
+ io_op<Stream, Operation, Handler>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Stream,
+ typename Operation, typename Handler>
+inline void asio_handler_invoke(const Function& function,
+ io_op<Stream, Operation, Handler>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Stream, typename Operation, typename Handler>
+inline void async_io(Stream& next_layer, stream_core& core,
+ const Operation& op, Handler handler)
+{
+ io_op<Stream, Operation, Handler>(
+ next_layer, core, op, handler)(
+ boost::system::error_code(), 0, 1);
+}
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_IO_HPP

Deleted: branches/release/boost/asio/ssl/detail/openssl_context_service.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_context_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,377 +0,0 @@
-//
-// ssl/detail/openssl_context_service.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 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)
-//
-
-#ifndef BOOST_ASIO_SSL_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP
-#define BOOST_ASIO_SSL_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-#include <cstring>
-#include <string>
-#include <boost/function.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ssl/context_base.hpp>
-#include <boost/asio/ssl/detail/openssl_init.hpp>
-#include <boost/asio/ssl/detail/openssl_types.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace ssl {
-namespace detail {
-
-class openssl_context_service
- : public boost::asio::detail::service_base<openssl_context_service>
-{
-public:
- // The native type of the context.
- typedef ::SSL_CTX* impl_type;
-
- // The type for the password callback function object.
- typedef boost::function<std::string(std::size_t,
- context_base::password_purpose)> password_callback_type;
-
- // Constructor.
- openssl_context_service(boost::asio::io_service& io_service)
- : boost::asio::detail::service_base<openssl_context_service>(io_service)
- {
- }
-
- // Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- }
-
- // Return a null context implementation.
- static impl_type null()
- {
- return 0;
- }
-
- // Create a new context implementation.
- void create(impl_type& impl, context_base::method m)
- {
- switch (m)
- {
- case context_base::sslv2:
- impl = ::SSL_CTX_new(::SSLv2_method());
- break;
- case context_base::sslv2_client:
- impl = ::SSL_CTX_new(::SSLv2_client_method());
- break;
- case context_base::sslv2_server:
- impl = ::SSL_CTX_new(::SSLv2_server_method());
- break;
- case context_base::sslv3:
- impl = ::SSL_CTX_new(::SSLv3_method());
- break;
- case context_base::sslv3_client:
- impl = ::SSL_CTX_new(::SSLv3_client_method());
- break;
- case context_base::sslv3_server:
- impl = ::SSL_CTX_new(::SSLv3_server_method());
- break;
- case context_base::tlsv1:
- impl = ::SSL_CTX_new(::TLSv1_method());
- break;
- case context_base::tlsv1_client:
- impl = ::SSL_CTX_new(::TLSv1_client_method());
- break;
- case context_base::tlsv1_server:
- impl = ::SSL_CTX_new(::TLSv1_server_method());
- break;
- case context_base::sslv23:
- impl = ::SSL_CTX_new(::SSLv23_method());
- break;
- case context_base::sslv23_client:
- impl = ::SSL_CTX_new(::SSLv23_client_method());
- break;
- case context_base::sslv23_server:
- impl = ::SSL_CTX_new(::SSLv23_server_method());
- break;
- default:
- impl = ::SSL_CTX_new(0);
- break;
- }
- }
-
- // Destroy a context implementation.
- void destroy(impl_type& impl)
- {
- if (impl != null())
- {
- if (impl->default_passwd_callback_userdata)
- {
- password_callback_type* callback =
- static_cast<password_callback_type*>(
- impl->default_passwd_callback_userdata);
- delete callback;
- impl->default_passwd_callback_userdata = 0;
- }
-
- ::SSL_CTX_free(impl);
- impl = null();
- }
- }
-
- // Set options on the context.
- boost::system::error_code set_options(impl_type& impl,
- context_base::options o, boost::system::error_code& ec)
- {
- ::SSL_CTX_set_options(impl, o);
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Set peer verification mode.
- boost::system::error_code set_verify_mode(impl_type& impl,
- context_base::verify_mode v, boost::system::error_code& ec)
- {
- ::SSL_CTX_set_verify(impl, v, 0);
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Load a certification authority file for performing verification.
- boost::system::error_code load_verify_file(impl_type& impl,
- const std::string& filename, boost::system::error_code& ec)
- {
- if (::SSL_CTX_load_verify_locations(impl, filename.c_str(), 0) != 1)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Add a directory containing certification authority files to be used for
- // performing verification.
- boost::system::error_code add_verify_path(impl_type& impl,
- const std::string& path, boost::system::error_code& ec)
- {
- if (::SSL_CTX_load_verify_locations(impl, 0, path.c_str()) != 1)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Use a certificate from a file.
- boost::system::error_code use_certificate_file(impl_type& impl,
- const std::string& filename, context_base::file_format format,
- boost::system::error_code& ec)
- {
- int file_type;
- switch (format)
- {
- case context_base::asn1:
- file_type = SSL_FILETYPE_ASN1;
- break;
- case context_base::pem:
- file_type = SSL_FILETYPE_PEM;
- break;
- default:
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
- }
-
- if (::SSL_CTX_use_certificate_file(impl, filename.c_str(), file_type) != 1)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Use a certificate chain from a file.
- boost::system::error_code use_certificate_chain_file(impl_type& impl,
- const std::string& filename, boost::system::error_code& ec)
- {
- if (::SSL_CTX_use_certificate_chain_file(impl, filename.c_str()) != 1)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Use a private key from a file.
- boost::system::error_code use_private_key_file(impl_type& impl,
- const std::string& filename, context_base::file_format format,
- boost::system::error_code& ec)
- {
- int file_type;
- switch (format)
- {
- case context_base::asn1:
- file_type = SSL_FILETYPE_ASN1;
- break;
- case context_base::pem:
- file_type = SSL_FILETYPE_PEM;
- break;
- default:
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
- }
-
- if (::SSL_CTX_use_PrivateKey_file(impl, filename.c_str(), file_type) != 1)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Use an RSA private key from a file.
- boost::system::error_code use_rsa_private_key_file(impl_type& impl,
- const std::string& filename, context_base::file_format format,
- boost::system::error_code& ec)
- {
- int file_type;
- switch (format)
- {
- case context_base::asn1:
- file_type = SSL_FILETYPE_ASN1;
- break;
- case context_base::pem:
- file_type = SSL_FILETYPE_PEM;
- break;
- default:
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
- }
-
- if (::SSL_CTX_use_RSAPrivateKey_file(
- impl, filename.c_str(), file_type) != 1)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Use the specified file to obtain the temporary Diffie-Hellman parameters.
- boost::system::error_code use_tmp_dh_file(impl_type& impl,
- const std::string& filename, boost::system::error_code& ec)
- {
- ::BIO* bio = ::BIO_new_file(filename.c_str(), "r");
- if (!bio)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ::DH* dh = ::PEM_read_bio_DHparams(bio, 0, 0, 0);
- if (!dh)
- {
- ::BIO_free(bio);
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ::BIO_free(bio);
- int result = ::SSL_CTX_set_tmp_dh(impl, dh);
- ::DH_free(dh);
- if (result != 1)
- {
- ec = boost::asio::error::invalid_argument;
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- static int password_callback(char* buf, int size, int purpose, void* data)
- {
- using namespace std; // For strncat and strlen.
-
- if (data)
- {
- password_callback_type* callback =
- static_cast<password_callback_type*>(data);
- std::string passwd = (*callback)(static_cast<std::size_t>(size),
- purpose ? context_base::for_writing : context_base::for_reading);
- *buf = '\0';
- strncat(buf, passwd.c_str(), size);
- return strlen(buf);
- }
-
- return 0;
- }
-
- // Set the password callback.
- template <typename Password_Callback>
- boost::system::error_code set_password_callback(impl_type& impl,
- Password_Callback callback, boost::system::error_code& ec)
- {
- // Allocate callback function object if not already present.
- if (impl->default_passwd_callback_userdata)
- {
- password_callback_type* callback_function =
- static_cast<password_callback_type*>(
- impl->default_passwd_callback_userdata);
- *callback_function = callback;
- }
- else
- {
- password_callback_type* callback_function =
- new password_callback_type(callback);
- impl->default_passwd_callback_userdata = callback_function;
- }
-
- // Set the password callback.
- SSL_CTX_set_default_passwd_cb(impl,
- &openssl_context_service::password_callback);
-
- ec = boost::system::error_code();
- return ec;
- }
-
-private:
- // Ensure openssl is initialised.
- openssl_init<> init_;
-};
-
-} // namespace detail
-} // namespace ssl
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP

Modified: branches/release/boost/asio/ssl/detail/openssl_init.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_init.hpp (original)
+++ branches/release/boost/asio/ssl/detail/openssl_init.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,8 +2,7 @@
 // ssl/detail/openssl_init.hpp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -18,12 +17,8 @@
 
 #include <boost/asio/detail/config.hpp>
 #include <cstring>
-#include <vector>
-#include <boost/assert.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/asio/detail/mutex.hpp>
-#include <boost/asio/detail/tss_ptr.hpp>
-#include <boost/asio/ssl/detail/openssl_types.hpp>
+#include <boost/asio/detail/noncopyable.hpp>
+#include <boost/asio/detail/shared_ptr.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -32,93 +27,28 @@
 namespace ssl {
 namespace detail {
 
-template <bool Do_Init = true>
-class openssl_init
- : private boost::noncopyable
+class openssl_init_base
+ : private noncopyable
 {
-private:
- // Structure to perform the actual initialisation.
- class do_init
- {
- public:
- do_init()
- {
- if (Do_Init)
- {
- ::SSL_library_init();
- ::SSL_load_error_strings();
- ::OpenSSL_add_ssl_algorithms();
-
- mutexes_.resize(::CRYPTO_num_locks());
- for (size_t i = 0; i < mutexes_.size(); ++i)
- mutexes_[i].reset(new boost::asio::detail::mutex);
- ::CRYPTO_set_locking_callback(&do_init::openssl_locking_func);
- ::CRYPTO_set_id_callback(&do_init::openssl_id_func);
- }
- }
-
- ~do_init()
- {
- if (Do_Init)
- {
- ::CRYPTO_set_id_callback(0);
- ::CRYPTO_set_locking_callback(0);
- ::ERR_free_strings();
- ::ERR_remove_state(0);
- ::EVP_cleanup();
- ::CRYPTO_cleanup_all_ex_data();
- ::CONF_modules_unload(1);
- ::ENGINE_cleanup();
- }
- }
-
- // Helper function to manage a do_init singleton. The static instance of the
- // openssl_init object ensures that this function is always called before
- // main, and therefore before any other threads can get started. The do_init
- // instance must be static in this function to ensure that it gets
- // initialised before any other global objects try to use it.
- static boost::shared_ptr<do_init> instance()
- {
- static boost::shared_ptr<do_init> init(new do_init);
- return init;
- }
-
- private:
- static unsigned long openssl_id_func()
- {
-#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- return ::GetCurrentThreadId();
-#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- void* id = instance()->thread_id_;
- if (id == 0)
- instance()->thread_id_ = id = &id; // Ugh.
- BOOST_ASSERT(sizeof(unsigned long) >= sizeof(void*));
- return reinterpret_cast<unsigned long>(id);
-#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
- }
-
- static void openssl_locking_func(int mode, int n,
- const char* /*file*/, int /*line*/)
- {
- if (mode & CRYPTO_LOCK)
- instance()->mutexes_[n]->lock();
- else
- instance()->mutexes_[n]->unlock();
- }
-
- // Mutexes to be used in locking callbacks.
- std::vector<boost::shared_ptr<boost::asio::detail::mutex> > mutexes_;
-
-#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
- // The thread identifiers to be used by openssl.
- boost::asio::detail::tss_ptr<void> thread_id_;
-#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
- };
+protected:
+ // Class that performs the actual initialisation.
+ class do_init;
+
+ // Helper function to manage a do_init singleton. The static instance of the
+ // openssl_init object ensures that this function is always called before
+ // main, and therefore before any other threads can get started. The do_init
+ // instance must be static in this function to ensure that it gets
+ // initialised before any other global objects try to use it.
+ BOOST_ASIO_DECL static boost::asio::detail::shared_ptr<do_init> instance();
+};
 
+template <bool Do_Init = true>
+class openssl_init : private openssl_init_base
+{
 public:
   // Constructor.
   openssl_init()
- : ref_(do_init::instance())
+ : ref_(instance())
   {
     using namespace std; // For memmove.
 
@@ -138,7 +68,7 @@
 
   // Reference to singleton do_init object to ensure that openssl does not get
   // cleaned up until the last user has finished with it.
- boost::shared_ptr<do_init> ref_;
+ boost::asio::detail::shared_ptr<do_init> ref_;
 };
 
 template <bool Do_Init>
@@ -151,4 +81,8 @@
 
 #include <boost/asio/detail/pop_options.hpp>
 
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/ssl/detail/impl/openssl_init.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
 #endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_INIT_HPP

Deleted: branches/release/boost/asio/ssl/detail/openssl_operation.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_operation.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,523 +0,0 @@
-//
-// ssl/detail/openssl_operation.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster 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)
-//
-
-#ifndef BOOST_ASIO_SSL_DETAIL_OPENSSL_OPERATION_HPP
-#define BOOST_ASIO_SSL_DETAIL_OPENSSL_OPERATION_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-#include <boost/function.hpp>
-#include <boost/assert.hpp>
-#include <boost/bind.hpp>
-#include <boost/asio/buffer.hpp>
-#include <boost/asio/detail/socket_ops.hpp>
-#include <boost/asio/placeholders.hpp>
-#include <boost/asio/ssl/detail/openssl_types.hpp>
-#include <boost/asio/strand.hpp>
-#include <boost/system/system_error.hpp>
-#include <boost/asio/write.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace ssl {
-namespace detail {
-
-typedef boost::function<int (::SSL*)> ssl_primitive_func;
-typedef boost::function<void (const boost::system::error_code&, int)>
- user_handler_func;
-
-// Network send_/recv buffer implementation
-//
-//
-class net_buffer
-{
- static const int NET_BUF_SIZE = 16*1024 + 256; // SSL record size + spare
-
- unsigned char buf_[NET_BUF_SIZE];
- unsigned char* data_start_;
- unsigned char* data_end_;
-
-public:
- net_buffer()
- {
- data_start_ = data_end_ = buf_;
- }
- unsigned char* get_unused_start() { return data_end_; }
- unsigned char* get_data_start() { return data_start_; }
- size_t get_unused_len() { return (NET_BUF_SIZE - (data_end_ - buf_)); }
- size_t get_data_len() { return (data_end_ - data_start_); }
- void data_added(size_t count)
- {
- data_end_ += count;
- data_end_ = data_end_ > (buf_ + NET_BUF_SIZE)?
- (buf_ + NET_BUF_SIZE):
- data_end_;
- }
- void data_removed(size_t count)
- {
- data_start_ += count;
- if (data_start_ >= data_end_) reset();
- }
- void reset() { data_start_ = buf_; data_end_ = buf_; }
- bool has_data() { return (data_start_ < data_end_); }
-}; // class net_buffer
-
-//
-// Operation class
-//
-//
-template <typename Stream>
-class openssl_operation
-{
-public:
-
- // Constructor for asynchronous operations
- openssl_operation(ssl_primitive_func primitive,
- Stream& socket,
- net_buffer& recv_buf,
- SSL* session,
- BIO* ssl_bio,
- user_handler_func handler,
- boost::asio::io_service::strand& strand
- )
- : primitive_(primitive)
- , user_handler_(handler)
- , strand_(&strand)
- , recv_buf_(recv_buf)
- , socket_(socket)
- , ssl_bio_(ssl_bio)
- , session_(session)
- {
- write_ = boost::bind(
- &openssl_operation::do_async_write,
- this, boost::arg<1>(), boost::arg<2>()
- );
- read_ = boost::bind(
- &openssl_operation::do_async_read,
- this
- );
- handler_= boost::bind(
- &openssl_operation::async_user_handler,
- this, boost::arg<1>(), boost::arg<2>()
- );
- }
-
- // Constructor for synchronous operations
- openssl_operation(ssl_primitive_func primitive,
- Stream& socket,
- net_buffer& recv_buf,
- SSL* session,
- BIO* ssl_bio)
- : primitive_(primitive)
- , strand_(0)
- , recv_buf_(recv_buf)
- , socket_(socket)
- , ssl_bio_(ssl_bio)
- , session_(session)
- {
- write_ = boost::bind(
- &openssl_operation::do_sync_write,
- this, boost::arg<1>(), boost::arg<2>()
- );
- read_ = boost::bind(
- &openssl_operation::do_sync_read,
- this
- );
- handler_ = boost::bind(
- &openssl_operation::sync_user_handler,
- this, boost::arg<1>(), boost::arg<2>()
- );
- }
-
- // Start operation
- // In case of asynchronous it returns 0, in sync mode returns success code
- // or throws an error...
- int start()
- {
- int rc = primitive_( session_ );
-
- bool is_operation_done = (rc > 0);
- // For connect/accept/shutdown, the operation
- // is done, when return code is 1
- // for write, it is done, when is retcode > 0
- // for read, is is done when retcode > 0
-
- int error_code = !is_operation_done ?
- ::SSL_get_error( session_, rc ) :
- 0;
- int sys_error_code = ERR_get_error();
-
- if (error_code == SSL_ERROR_SSL)
- return handler_(boost::system::error_code(
- sys_error_code, boost::asio::error::get_ssl_category()), rc);
-
- bool is_read_needed = (error_code == SSL_ERROR_WANT_READ);
- bool is_write_needed = (error_code == SSL_ERROR_WANT_WRITE ||
- ::BIO_ctrl_pending( ssl_bio_ ));
- bool is_shut_down_received =
- ((::SSL_get_shutdown( session_ ) & SSL_RECEIVED_SHUTDOWN) ==
- SSL_RECEIVED_SHUTDOWN);
- bool is_shut_down_sent =
- ((::SSL_get_shutdown( session_ ) & SSL_SENT_SHUTDOWN) ==
- SSL_SENT_SHUTDOWN);
-
- if (is_shut_down_sent && is_shut_down_received
- && is_operation_done && !is_write_needed)
- // SSL connection is shut down cleanly
- return handler_(boost::system::error_code(), 1);
-
- if (is_shut_down_received && !is_operation_done)
- // Shutdown has been requested, while we were reading or writing...
- // abort our action...
- return handler_(boost::asio::error::shut_down, 0);
-
- if (!is_operation_done && !is_read_needed && !is_write_needed
- && !is_shut_down_sent)
- {
- // The operation has failed... It is not completed and does
- // not want network communication nor does want to send shutdown out...
- if (error_code == SSL_ERROR_SYSCALL)
- {
- return handler_(boost::system::error_code(
- sys_error_code, boost::asio::error::system_category), rc);
- }
- else
- {
- return handler_(boost::system::error_code(
- sys_error_code, boost::asio::error::get_ssl_category()), rc);
- }
- }
-
- if (!is_operation_done && !is_write_needed)
- {
- // We may have left over data that we can pass to SSL immediately
- if (recv_buf_.get_data_len() > 0)
- {
- // Pass the buffered data to SSL
- int written = ::BIO_write
- (
- ssl_bio_,
- recv_buf_.get_data_start(),
- recv_buf_.get_data_len()
- );
-
- if (written > 0)
- {
- recv_buf_.data_removed(written);
- }
- else if (written < 0)
- {
- if (!BIO_should_retry(ssl_bio_))
- {
- // Some serios error with BIO....
- return handler_(boost::asio::error::no_recovery, 0);
- }
- }
-
- return start();
- }
- else if (is_read_needed || (is_shut_down_sent && !is_shut_down_received))
- {
- return read_();
- }
- }
-
- // Continue with operation, flush any SSL data out to network...
- return write_(is_operation_done, rc);
- }
-
-// Private implementation
-private:
- typedef boost::function<int (const boost::system::error_code&, int)>
- int_handler_func;
- typedef boost::function<int (bool, int)> write_func;
- typedef boost::function<int ()> read_func;
-
- ssl_primitive_func primitive_;
- user_handler_func user_handler_;
- boost::asio::io_service::strand* strand_;
- write_func write_;
- read_func read_;
- int_handler_func handler_;
-
- net_buffer send_buf_; // buffers for network IO
-
- // The recv buffer is owned by the stream, not the operation, since there can
- // be left over bytes after passing the data up to the application, and these
- // bytes need to be kept around for the next read operation issued by the
- // application.
- net_buffer& recv_buf_;
-
- Stream& socket_;
- BIO* ssl_bio_;
- SSL* session_;
-
- //
- int sync_user_handler(const boost::system::error_code& error, int rc)
- {
- if (!error)
- return rc;
-
- throw boost::system::system_error(error);
- }
-
- int async_user_handler(boost::system::error_code error, int rc)
- {
- if (rc < 0)
- {
- if (!error)
- error = boost::asio::error::no_recovery;
- rc = 0;
- }
-
- user_handler_(error, rc);
- return 0;
- }
-
- // Writes bytes asynchronously from SSL to NET
- int do_async_write(bool is_operation_done, int rc)
- {
- int len = ::BIO_ctrl_pending( ssl_bio_ );
- if ( len )
- {
- // There is something to write into net, do it...
- len = (int)send_buf_.get_unused_len() > len?
- len:
- send_buf_.get_unused_len();
-
- if (len == 0)
- {
- // In case our send buffer is full, we have just to wait until
- // previous send to complete...
- return 0;
- }
-
- // Read outgoing data from bio
- len = ::BIO_read( ssl_bio_, send_buf_.get_unused_start(), len);
-
- if (len > 0)
- {
- unsigned char *data_start = send_buf_.get_unused_start();
- send_buf_.data_added(len);
-
- BOOST_ASSERT(strand_);
- boost::asio::async_write
- (
- socket_,
- boost::asio::buffer(data_start, len),
- strand_->wrap
- (
- boost::bind
- (
- &openssl_operation::async_write_handler,
- this,
- is_operation_done,
- rc,
- boost::asio::placeholders::error,
- boost::asio::placeholders::bytes_transferred
- )
- )
- );
-
- return 0;
- }
- else if (!BIO_should_retry(ssl_bio_))
- {
- // Seems like fatal error
- // reading from SSL BIO has failed...
- handler_(boost::asio::error::no_recovery, 0);
- return 0;
- }
- }
-
- if (is_operation_done)
- {
- // Finish the operation, with success
- handler_(boost::system::error_code(), rc);
- return 0;
- }
-
- // OPeration is not done and writing to net has been made...
- // start operation again
- start();
-
- return 0;
- }
-
- void async_write_handler(bool is_operation_done, int rc,
- const boost::system::error_code& error, size_t bytes_sent)
- {
- if (!error)
- {
- // Remove data from send buffer
- send_buf_.data_removed(bytes_sent);
-
- if (is_operation_done)
- handler_(boost::system::error_code(), rc);
- else
- // Since the operation was not completed, try it again...
- start();
- }
- else
- handler_(error, rc);
- }
-
- int do_async_read()
- {
- // Wait for new data
- BOOST_ASSERT(strand_);
- socket_.async_read_some
- (
- boost::asio::buffer(recv_buf_.get_unused_start(),
- recv_buf_.get_unused_len()),
- strand_->wrap
- (
- boost::bind
- (
- &openssl_operation::async_read_handler,
- this,
- boost::asio::placeholders::error,
- boost::asio::placeholders::bytes_transferred
- )
- )
- );
- return 0;
- }
-
- void async_read_handler(const boost::system::error_code& error,
- size_t bytes_recvd)
- {
- if (!error)
- {
- recv_buf_.data_added(bytes_recvd);
-
- // Pass the received data to SSL
- int written = ::BIO_write
- (
- ssl_bio_,
- recv_buf_.get_data_start(),
- recv_buf_.get_data_len()
- );
-
- if (written > 0)
- {
- recv_buf_.data_removed(written);
- }
- else if (written < 0)
- {
- if (!BIO_should_retry(ssl_bio_))
- {
- // Some serios error with BIO....
- handler_(boost::asio::error::no_recovery, 0);
- return;
- }
- }
-
- // and try the SSL primitive again
- start();
- }
- else
- {
- // Error in network level...
- // SSL can't continue either...
- handler_(error, 0);
- }
- }
-
- // Syncronous functions...
- int do_sync_write(bool is_operation_done, int rc)
- {
- int len = ::BIO_ctrl_pending( ssl_bio_ );
- if ( len )
- {
- // There is something to write into net, do it...
- len = (int)send_buf_.get_unused_len() > len?
- len:
- send_buf_.get_unused_len();
-
- // Read outgoing data from bio
- len = ::BIO_read( ssl_bio_, send_buf_.get_unused_start(), len);
-
- if (len > 0)
- {
- size_t sent_len = boost::asio::write(
- socket_,
- boost::asio::buffer(send_buf_.get_unused_start(), len)
- );
-
- send_buf_.data_added(len);
- send_buf_.data_removed(sent_len);
- }
- else if (!BIO_should_retry(ssl_bio_))
- {
- // Seems like fatal error
- // reading from SSL BIO has failed...
- throw boost::system::system_error(boost::asio::error::no_recovery);
- }
- }
-
- if (is_operation_done)
- // Finish the operation, with success
- return rc;
-
- // Operation is not finished, start again.
- return start();
- }
-
- int do_sync_read()
- {
- size_t len = socket_.read_some
- (
- boost::asio::buffer(recv_buf_.get_unused_start(),
- recv_buf_.get_unused_len())
- );
-
- // Write data to ssl
- recv_buf_.data_added(len);
-
- // Pass the received data to SSL
- int written = ::BIO_write
- (
- ssl_bio_,
- recv_buf_.get_data_start(),
- recv_buf_.get_data_len()
- );
-
- if (written > 0)
- {
- recv_buf_.data_removed(written);
- }
- else if (written < 0)
- {
- if (!BIO_should_retry(ssl_bio_))
- {
- // Some serios error with BIO....
- throw boost::system::system_error(boost::asio::error::no_recovery);
- }
- }
-
- // Try the operation again
- return start();
- }
-}; // class openssl_operation
-
-} // namespace detail
-} // namespace ssl
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_OPERATION_HPP

Deleted: branches/release/boost/asio/ssl/detail/openssl_stream_service.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_stream_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,571 +0,0 @@
-//
-// ssl/detail/stream_service.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 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)
-//
-
-#ifndef BOOST_ASIO_SSL_DETAIL_OPENSSL_STREAM_SERVICE_HPP
-#define BOOST_ASIO_SSL_DETAIL_OPENSSL_STREAM_SERVICE_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include <boost/asio/detail/config.hpp>
-#include <cstddef>
-#include <climits>
-#include <memory>
-#include <boost/config.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
-#include <boost/asio/detail/buffer_sequence_adapter.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ssl/basic_context.hpp>
-#include <boost/asio/ssl/stream_base.hpp>
-#include <boost/asio/ssl/detail/openssl_operation.hpp>
-#include <boost/asio/ssl/detail/openssl_types.hpp>
-#include <boost/asio/strand.hpp>
-#include <boost/system/system_error.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-
-namespace boost {
-namespace asio {
-namespace ssl {
-namespace detail {
-
-class openssl_stream_service
- : public boost::asio::detail::service_base<openssl_stream_service>
-{
-private:
- enum { max_buffer_size = INT_MAX };
-
- //Base handler for asyncrhonous operations
- template <typename Stream>
- class base_handler
- {
- public:
- typedef boost::function<
- void (const boost::system::error_code&, size_t)> func_t;
-
- base_handler(boost::asio::io_service& io_service)
- : op_(NULL)
- , io_service_(io_service)
- , work_(io_service)
- {}
-
- void do_func(const boost::system::error_code& error, size_t size)
- {
- func_(error, size);
- }
-
- void set_operation(openssl_operation<Stream>* op) { op_ = op; }
- void set_func(func_t func) { func_ = func; }
-
- ~base_handler()
- {
- delete op_;
- }
-
- private:
- func_t func_;
- openssl_operation<Stream>* op_;
- boost::asio::io_service& io_service_;
- boost::asio::io_service::work work_;
- }; // class base_handler
-
- // Handler for asynchronous IO (write/read) operations
- template<typename Stream, typename Handler>
- class io_handler
- : public base_handler<Stream>
- {
- public:
- io_handler(Handler handler, boost::asio::io_service& io_service)
- : base_handler<Stream>(io_service)
- , handler_(handler)
- {
- this->set_func(boost::bind(
- &io_handler<Stream, Handler>::handler_impl,
- this, boost::arg<1>(), boost::arg<2>() ));
- }
-
- private:
- Handler handler_;
- void handler_impl(const boost::system::error_code& error, size_t size)
- {
- std::auto_ptr<io_handler<Stream, Handler> > this_ptr(this);
- handler_(error, size);
- }
- }; // class io_handler
-
- // Handler for asyncrhonous handshake (connect, accept) functions
- template <typename Stream, typename Handler>
- class handshake_handler
- : public base_handler<Stream>
- {
- public:
- handshake_handler(Handler handler, boost::asio::io_service& io_service)
- : base_handler<Stream>(io_service)
- , handler_(handler)
- {
- this->set_func(boost::bind(
- &handshake_handler<Stream, Handler>::handler_impl,
- this, boost::arg<1>(), boost::arg<2>() ));
- }
-
- private:
- Handler handler_;
- void handler_impl(const boost::system::error_code& error, size_t)
- {
- std::auto_ptr<handshake_handler<Stream, Handler> > this_ptr(this);
- handler_(error);
- }
-
- }; // class handshake_handler
-
- // Handler for asyncrhonous shutdown
- template <typename Stream, typename Handler>
- class shutdown_handler
- : public base_handler<Stream>
- {
- public:
- shutdown_handler(Handler handler, boost::asio::io_service& io_service)
- : base_handler<Stream>(io_service),
- handler_(handler)
- {
- this->set_func(boost::bind(
- &shutdown_handler<Stream, Handler>::handler_impl,
- this, boost::arg<1>(), boost::arg<2>() ));
- }
-
- private:
- Handler handler_;
- void handler_impl(const boost::system::error_code& error, size_t)
- {
- std::auto_ptr<shutdown_handler<Stream, Handler> > this_ptr(this);
- handler_(error);
- }
- }; // class shutdown_handler
-
-public:
- // The implementation type.
- typedef struct impl_struct
- {
- ::SSL* ssl;
- ::BIO* ext_bio;
- net_buffer recv_buf;
- } * impl_type;
-
- // Construct a new stream socket service for the specified io_service.
- explicit openssl_stream_service(boost::asio::io_service& io_service)
- : boost::asio::detail::service_base<openssl_stream_service>(io_service),
- strand_(io_service)
- {
- }
-
- // Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- }
-
- // Return a null stream implementation.
- impl_type null() const
- {
- return 0;
- }
-
- // Create a new stream implementation.
- template <typename Stream, typename Context_Service>
- void create(impl_type& impl, Stream& /*next_layer*/,
- basic_context<Context_Service>& context)
- {
- impl = new impl_struct;
- impl->ssl = ::SSL_new(context.impl());
- ::SSL_set_mode(impl->ssl, SSL_MODE_ENABLE_PARTIAL_WRITE);
- ::SSL_set_mode(impl->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
- ::BIO* int_bio = 0;
- impl->ext_bio = 0;
- ::BIO_new_bio_pair(&int_bio, 8192, &impl->ext_bio, 8192);
- ::SSL_set_bio(impl->ssl, int_bio, int_bio);
- }
-
- // Destroy a stream implementation.
- template <typename Stream>
- void destroy(impl_type& impl, Stream& /*next_layer*/)
- {
- if (impl != 0)
- {
- ::BIO_free(impl->ext_bio);
- ::SSL_free(impl->ssl);
- delete impl;
- impl = 0;
- }
- }
-
- // Perform SSL handshaking.
- template <typename Stream>
- boost::system::error_code handshake(impl_type& impl, Stream& next_layer,
- stream_base::handshake_type type, boost::system::error_code& ec)
- {
- try
- {
- openssl_operation<Stream> op(
- type == stream_base::client ?
- &ssl_wrap<mutex_type>::SSL_connect:
- &ssl_wrap<mutex_type>::SSL_accept,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio);
- op.start();
- }
- catch (boost::system::system_error& e)
- {
- ec = e.code();
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Start an asynchronous SSL handshake.
- template <typename Stream, typename Handler>
- void async_handshake(impl_type& impl, Stream& next_layer,
- stream_base::handshake_type type, Handler handler)
- {
- typedef handshake_handler<Stream, Handler> connect_handler;
-
- connect_handler* local_handler =
- new connect_handler(handler, get_io_service());
-
- openssl_operation<Stream>* op = new openssl_operation<Stream>
- (
- type == stream_base::client ?
- &ssl_wrap<mutex_type>::SSL_connect:
- &ssl_wrap<mutex_type>::SSL_accept,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio,
- boost::bind
- (
- &base_handler<Stream>::do_func,
- local_handler,
- boost::arg<1>(),
- boost::arg<2>()
- ),
- strand_
- );
- local_handler->set_operation(op);
-
- strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
- }
-
- // Shut down SSL on the stream.
- template <typename Stream>
- boost::system::error_code shutdown(impl_type& impl, Stream& next_layer,
- boost::system::error_code& ec)
- {
- try
- {
- openssl_operation<Stream> op(
- &ssl_wrap<mutex_type>::SSL_shutdown,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio);
- op.start();
- }
- catch (boost::system::system_error& e)
- {
- ec = e.code();
- return ec;
- }
-
- ec = boost::system::error_code();
- return ec;
- }
-
- // Asynchronously shut down SSL on the stream.
- template <typename Stream, typename Handler>
- void async_shutdown(impl_type& impl, Stream& next_layer, Handler handler)
- {
- typedef shutdown_handler<Stream, Handler> disconnect_handler;
-
- disconnect_handler* local_handler =
- new disconnect_handler(handler, get_io_service());
-
- openssl_operation<Stream>* op = new openssl_operation<Stream>
- (
- &ssl_wrap<mutex_type>::SSL_shutdown,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio,
- boost::bind
- (
- &base_handler<Stream>::do_func,
- local_handler,
- boost::arg<1>(),
- boost::arg<2>()
- ),
- strand_
- );
- local_handler->set_operation(op);
-
- strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
- }
-
- // Write some data to the stream.
- template <typename Stream, typename Const_Buffers>
- std::size_t write_some(impl_type& impl, Stream& next_layer,
- const Const_Buffers& buffers, boost::system::error_code& ec)
- {
- size_t bytes_transferred = 0;
- try
- {
- boost::asio::const_buffer buffer =
- boost::asio::detail::buffer_sequence_adapter<
- boost::asio::const_buffer, Const_Buffers>::first(buffers);
-
- std::size_t buffer_size = boost::asio::buffer_size(buffer);
- if (buffer_size > max_buffer_size)
- buffer_size = max_buffer_size;
- else if (buffer_size == 0)
- {
- ec = boost::system::error_code();
- return 0;
- }
-
- boost::function<int (SSL*)> send_func =
- boost::bind(boost::type<int>(), &::SSL_write, boost::arg<1>(),
- boost::asio::buffer_cast<const void*>(buffer),
- static_cast<int>(buffer_size));
- openssl_operation<Stream> op(
- send_func,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio
- );
- bytes_transferred = static_cast<size_t>(op.start());
- }
- catch (boost::system::system_error& e)
- {
- ec = e.code();
- return 0;
- }
-
- ec = boost::system::error_code();
- return bytes_transferred;
- }
-
- // Start an asynchronous write.
- template <typename Stream, typename Const_Buffers, typename Handler>
- void async_write_some(impl_type& impl, Stream& next_layer,
- const Const_Buffers& buffers, Handler handler)
- {
- typedef io_handler<Stream, Handler> send_handler;
-
- boost::asio::const_buffer buffer =
- boost::asio::detail::buffer_sequence_adapter<
- boost::asio::const_buffer, Const_Buffers>::first(buffers);
-
- std::size_t buffer_size = boost::asio::buffer_size(buffer);
- if (buffer_size > max_buffer_size)
- buffer_size = max_buffer_size;
- else if (buffer_size == 0)
- {
- get_io_service().post(boost::asio::detail::bind_handler(
- handler, boost::system::error_code(), 0));
- return;
- }
-
- send_handler* local_handler = new send_handler(handler, get_io_service());
-
- boost::function<int (SSL*)> send_func =
- boost::bind(boost::type<int>(), &::SSL_write, boost::arg<1>(),
- boost::asio::buffer_cast<const void*>(buffer),
- static_cast<int>(buffer_size));
-
- openssl_operation<Stream>* op = new openssl_operation<Stream>
- (
- send_func,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio,
- boost::bind
- (
- &base_handler<Stream>::do_func,
- local_handler,
- boost::arg<1>(),
- boost::arg<2>()
- ),
- strand_
- );
- local_handler->set_operation(op);
-
- strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
- }
-
- // Read some data from the stream.
- template <typename Stream, typename Mutable_Buffers>
- std::size_t read_some(impl_type& impl, Stream& next_layer,
- const Mutable_Buffers& buffers, boost::system::error_code& ec)
- {
- size_t bytes_transferred = 0;
- try
- {
- boost::asio::mutable_buffer buffer =
- boost::asio::detail::buffer_sequence_adapter<
- boost::asio::mutable_buffer, Mutable_Buffers>::first(buffers);
-
- std::size_t buffer_size = boost::asio::buffer_size(buffer);
- if (buffer_size > max_buffer_size)
- buffer_size = max_buffer_size;
- else if (buffer_size == 0)
- {
- ec = boost::system::error_code();
- return 0;
- }
-
- boost::function<int (SSL*)> recv_func =
- boost::bind(boost::type<int>(), &::SSL_read, boost::arg<1>(),
- boost::asio::buffer_cast<void*>(buffer),
- static_cast<int>(buffer_size));
- openssl_operation<Stream> op(recv_func,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio
- );
-
- bytes_transferred = static_cast<size_t>(op.start());
- }
- catch (boost::system::system_error& e)
- {
- ec = e.code();
- return 0;
- }
-
- ec = boost::system::error_code();
- return bytes_transferred;
- }
-
- // Start an asynchronous read.
- template <typename Stream, typename Mutable_Buffers, typename Handler>
- void async_read_some(impl_type& impl, Stream& next_layer,
- const Mutable_Buffers& buffers, Handler handler)
- {
- typedef io_handler<Stream, Handler> recv_handler;
-
- boost::asio::mutable_buffer buffer =
- boost::asio::detail::buffer_sequence_adapter<
- boost::asio::mutable_buffer, Mutable_Buffers>::first(buffers);
-
- std::size_t buffer_size = boost::asio::buffer_size(buffer);
- if (buffer_size > max_buffer_size)
- buffer_size = max_buffer_size;
- else if (buffer_size == 0)
- {
- get_io_service().post(boost::asio::detail::bind_handler(
- handler, boost::system::error_code(), 0));
- return;
- }
-
- recv_handler* local_handler = new recv_handler(handler, get_io_service());
-
- boost::function<int (SSL*)> recv_func =
- boost::bind(boost::type<int>(), &::SSL_read, boost::arg<1>(),
- boost::asio::buffer_cast<void*>(buffer),
- static_cast<int>(buffer_size));
-
- openssl_operation<Stream>* op = new openssl_operation<Stream>
- (
- recv_func,
- next_layer,
- impl->recv_buf,
- impl->ssl,
- impl->ext_bio,
- boost::bind
- (
- &base_handler<Stream>::do_func,
- local_handler,
- boost::arg<1>(),
- boost::arg<2>()
- ),
- strand_
- );
- local_handler->set_operation(op);
-
- strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
- }
-
- // Peek at the incoming data on the stream.
- template <typename Stream, typename Mutable_Buffers>
- std::size_t peek(impl_type& /*impl*/, Stream& /*next_layer*/,
- const Mutable_Buffers& /*buffers*/, boost::system::error_code& ec)
- {
- ec = boost::system::error_code();
- return 0;
- }
-
- // Determine the amount of data that may be read without blocking.
- template <typename Stream>
- std::size_t in_avail(impl_type& /*impl*/, Stream& /*next_layer*/,
- boost::system::error_code& ec)
- {
- ec = boost::system::error_code();
- return 0;
- }
-
-private:
- boost::asio::io_service::strand strand_;
-
- typedef boost::asio::detail::mutex mutex_type;
-
- template<typename Mutex>
- struct ssl_wrap
- {
- static Mutex ssl_mutex_;
-
- static int SSL_accept(SSL *ssl)
- {
- typename Mutex::scoped_lock lock(ssl_mutex_);
- return ::SSL_accept(ssl);
- }
-
- static int SSL_connect(SSL *ssl)
- {
- typename Mutex::scoped_lock lock(ssl_mutex_);
- return ::SSL_connect(ssl);
- }
-
- static int SSL_shutdown(SSL *ssl)
- {
- typename Mutex::scoped_lock lock(ssl_mutex_);
- return ::SSL_shutdown(ssl);
- }
- };
-};
-
-template<typename Mutex>
-Mutex openssl_stream_service::ssl_wrap<Mutex>::ssl_mutex_;
-
-} // namespace detail
-} // namespace ssl
-} // namespace asio
-} // namespace boost
-
-#include <boost/asio/detail/pop_options.hpp>
-
-#endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_STREAM_SERVICE_HPP

Modified: branches/release/boost/asio/ssl/detail/openssl_types.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_types.hpp (original)
+++ branches/release/boost/asio/ssl/detail/openssl_types.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,7 +2,7 @@
 // ssl/detail/openssl_types.hpp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -20,6 +20,7 @@
 #include <openssl/ssl.h>
 #include <openssl/engine.h>
 #include <openssl/err.h>
+#include <openssl/x509v3.h>
 #include <boost/asio/detail/socket_types.hpp>
 
 #endif // BOOST_ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP

Added: branches/release/boost/asio/ssl/detail/password_callback.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/password_callback.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,74 @@
+//
+// ssl/detail/password_callback.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP
+#define BOOST_ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <cstddef>
+# include <string>
+# include <boost/asio/ssl/context_base.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+class password_callback_base
+{
+public:
+ virtual ~password_callback_base()
+ {
+ }
+
+ virtual std::string call(std::size_t size,
+ context_base::password_purpose purpose) = 0;
+};
+
+template <typename PasswordCallback>
+class password_callback : public password_callback_base
+{
+public:
+ explicit password_callback(PasswordCallback callback)
+ : callback_(callback)
+ {
+ }
+
+ virtual std::string call(std::size_t size,
+ context_base::password_purpose purpose)
+ {
+ return callback_(size, purpose);
+ }
+
+private:
+ PasswordCallback callback_;
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP

Added: branches/release/boost/asio/ssl/detail/read_op.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/read_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,75 @@
+//
+// ssl/detail/read_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_READ_OP_HPP
+#define BOOST_ASIO_SSL_DETAIL_READ_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/detail/buffer_sequence_adapter.hpp>
+# include <boost/asio/ssl/detail/engine.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+template <typename MutableBufferSequence>
+class read_op
+{
+public:
+ read_op(const MutableBufferSequence& buffers)
+ : buffers_(buffers)
+ {
+ }
+
+ engine::want operator()(engine& eng,
+ boost::system::error_code& ec,
+ std::size_t& bytes_transferred) const
+ {
+ boost::asio::mutable_buffer buffer =
+ boost::asio::detail::buffer_sequence_adapter<boost::asio::mutable_buffer,
+ MutableBufferSequence>::first(buffers_);
+
+ return eng.read(buffer, ec, bytes_transferred);
+ }
+
+ template <typename Handler>
+ void call_handler(Handler& handler,
+ const boost::system::error_code& ec,
+ const std::size_t& bytes_transferred) const
+ {
+ handler(ec, bytes_transferred);
+ }
+
+private:
+ MutableBufferSequence buffers_;
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_READ_OP_HPP

Added: branches/release/boost/asio/ssl/detail/shutdown_op.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/shutdown_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,62 @@
+//
+// ssl/detail/shutdown_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP
+#define BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/detail/engine.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+class shutdown_op
+{
+public:
+ engine::want operator()(engine& eng,
+ boost::system::error_code& ec,
+ std::size_t& bytes_transferred) const
+ {
+ bytes_transferred = 0;
+ return eng.shutdown(ec);
+ }
+
+ template <typename Handler>
+ void call_handler(Handler& handler,
+ const boost::system::error_code& ec,
+ const std::size_t&) const
+ {
+ handler(ec);
+ }
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP

Added: branches/release/boost/asio/ssl/detail/stream_core.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/stream_core.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,88 @@
+//
+// ssl/detail/stream_core.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_STREAM_CORE_HPP
+#define BOOST_ASIO_SSL_DETAIL_STREAM_CORE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/deadline_timer.hpp>
+# include <boost/asio/ssl/detail/engine.hpp>
+# include <boost/asio/buffer.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+struct stream_core
+{
+ stream_core(SSL_CTX* context, boost::asio::io_service& io_service)
+ : engine_(context),
+ pending_read_(io_service),
+ pending_write_(io_service),
+ output_buffer_space_(16384),
+ output_buffer_(boost::asio::buffer(output_buffer_space_)),
+ input_buffer_space_(16384),
+ input_buffer_(boost::asio::buffer(input_buffer_space_))
+ {
+ pending_read_.expires_at(boost::posix_time::neg_infin);
+ pending_write_.expires_at(boost::posix_time::neg_infin);
+ }
+
+ ~stream_core()
+ {
+ }
+
+ // The SSL engine.
+ engine engine_;
+
+ // Timer used for storing queued read operations.
+ boost::asio::deadline_timer pending_read_;
+
+ // Timer used for storing queued write operations.
+ boost::asio::deadline_timer pending_write_;
+
+ // Buffer space used to prepare output intended for the transport.
+ std::vector<unsigned char> output_buffer_space_;
+
+ // A buffer that may be used to prepare output intended for the transport.
+ const boost::asio::mutable_buffers_1 output_buffer_;
+
+ // Buffer space used to read input intended for the engine.
+ std::vector<unsigned char> input_buffer_space_;
+
+ // A buffer that may be used to read input intended for the engine.
+ const boost::asio::mutable_buffers_1 input_buffer_;
+
+ // The buffer pointing to the engine's unconsumed input.
+ boost::asio::const_buffer input_;
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_STREAM_CORE_HPP

Added: branches/release/boost/asio/ssl/detail/verify_callback.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/verify_callback.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,70 @@
+//
+// ssl/detail/verify_callback.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP
+#define BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/verify_context.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+class verify_callback_base
+{
+public:
+ virtual ~verify_callback_base()
+ {
+ }
+
+ virtual bool call(bool preverified, verify_context& ctx) = 0;
+};
+
+template <typename VerifyCallback>
+class verify_callback : public verify_callback_base
+{
+public:
+ explicit verify_callback(VerifyCallback callback)
+ : callback_(callback)
+ {
+ }
+
+ virtual bool call(bool preverified, verify_context& ctx)
+ {
+ return callback_(preverified, ctx);
+ }
+
+private:
+ VerifyCallback callback_;
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP

Added: branches/release/boost/asio/ssl/detail/write_op.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/detail/write_op.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,75 @@
+//
+// ssl/detail/write_op.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP
+#define BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/detail/buffer_sequence_adapter.hpp>
+# include <boost/asio/ssl/detail/engine.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+template <typename ConstBufferSequence>
+class write_op
+{
+public:
+ write_op(const ConstBufferSequence& buffers)
+ : buffers_(buffers)
+ {
+ }
+
+ engine::want operator()(engine& eng,
+ boost::system::error_code& ec,
+ std::size_t& bytes_transferred) const
+ {
+ boost::asio::const_buffer buffer =
+ boost::asio::detail::buffer_sequence_adapter<boost::asio::const_buffer,
+ ConstBufferSequence>::first(buffers_);
+
+ return eng.write(buffer, ec, bytes_transferred);
+ }
+
+ template <typename Handler>
+ void call_handler(Handler& handler,
+ const boost::system::error_code& ec,
+ const std::size_t& bytes_transferred) const
+ {
+ handler(ec, bytes_transferred);
+ }
+
+private:
+ ConstBufferSequence buffers_;
+};
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP

Added: branches/release/boost/asio/ssl/error.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/error.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,72 @@
+//
+// ssl/error.hpp
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_ERROR_HPP
+#define BOOST_ASIO_SSL_ERROR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/system/error_code.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace error {
+
+enum ssl_errors
+{
+};
+
+extern BOOST_ASIO_DECL
+const boost::system::error_category& get_ssl_category();
+
+static const boost::system::error_category& ssl_category
+ = boost::asio::error::get_ssl_category();
+
+} // namespace error
+} // namespace asio
+} // namespace boost
+
+namespace boost {
+namespace system {
+
+template<> struct is_error_code_enum<boost::asio::error::ssl_errors>
+{
+ static const bool value = true;
+};
+
+} // namespace system
+} // namespace boost
+
+namespace boost {
+namespace asio {
+namespace error {
+
+inline boost::system::error_code make_error_code(ssl_errors e)
+{
+ return boost::system::error_code(
+ static_cast<int>(e), get_ssl_category());
+}
+
+} // namespace error
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/ssl/impl/error.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // BOOST_ASIO_SSL_ERROR_HPP

Added: branches/release/boost/asio/ssl/impl/context.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/impl/context.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,73 @@
+//
+// ssl/impl/context.hpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_IMPL_CONTEXT_HPP
+#define BOOST_ASIO_SSL_IMPL_CONTEXT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/detail/throw_error.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+template <typename VerifyCallback>
+void context::set_verify_callback(VerifyCallback callback)
+{
+ boost::system::error_code ec;
+ this->set_verify_callback(callback, ec);
+ boost::asio::detail::throw_error(ec, "set_verify_callback");
+}
+
+template <typename VerifyCallback>
+boost::system::error_code context::set_verify_callback(
+ VerifyCallback callback, boost::system::error_code& ec)
+{
+ return do_set_verify_callback(
+ new detail::verify_callback<VerifyCallback>(callback), ec);
+}
+
+template <typename PasswordCallback>
+void context::set_password_callback(PasswordCallback callback)
+{
+ boost::system::error_code ec;
+ this->set_password_callback(callback, ec);
+ boost::asio::detail::throw_error(ec, "set_password_callback");
+}
+
+template <typename PasswordCallback>
+boost::system::error_code context::set_password_callback(
+ PasswordCallback callback, boost::system::error_code& ec)
+{
+ return do_set_password_callback(
+ new detail::password_callback<PasswordCallback>(callback), ec);
+}
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_IMPL_CONTEXT_HPP

Added: branches/release/boost/asio/ssl/impl/context.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/impl/context.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,527 @@
+//
+// ssl/impl/context.ipp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_IMPL_CONTEXT_IPP
+#define BOOST_ASIO_SSL_IMPL_CONTEXT_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <cstring>
+# include <boost/asio/detail/throw_error.hpp>
+# include <boost/asio/error.hpp>
+# include <boost/asio/ssl/context.hpp>
+# include <boost/asio/ssl/error.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+context::context(context::method m)
+ : handle_(0)
+{
+ switch (m)
+ {
+#if defined(OPENSSL_NO_SSL2)
+ case context::sslv2:
+ case context::sslv2_client:
+ case context::sslv2_server:
+ boost::asio::detail::throw_error(
+ boost::asio::error::invalid_argument, "context");
+ break;
+#else // defined(OPENSSL_NO_SSL2)
+ case context::sslv2:
+ handle_ = ::SSL_CTX_new(::SSLv2_method());
+ break;
+ case context::sslv2_client:
+ handle_ = ::SSL_CTX_new(::SSLv2_client_method());
+ break;
+ case context::sslv2_server:
+ handle_ = ::SSL_CTX_new(::SSLv2_server_method());
+ break;
+#endif // defined(OPENSSL_NO_SSL2)
+ case context::sslv3:
+ handle_ = ::SSL_CTX_new(::SSLv3_method());
+ break;
+ case context::sslv3_client:
+ handle_ = ::SSL_CTX_new(::SSLv3_client_method());
+ break;
+ case context::sslv3_server:
+ handle_ = ::SSL_CTX_new(::SSLv3_server_method());
+ break;
+ case context::tlsv1:
+ handle_ = ::SSL_CTX_new(::TLSv1_method());
+ break;
+ case context::tlsv1_client:
+ handle_ = ::SSL_CTX_new(::TLSv1_client_method());
+ break;
+ case context::tlsv1_server:
+ handle_ = ::SSL_CTX_new(::TLSv1_server_method());
+ break;
+ case context::sslv23:
+ handle_ = ::SSL_CTX_new(::SSLv23_method());
+ break;
+ case context::sslv23_client:
+ handle_ = ::SSL_CTX_new(::SSLv23_client_method());
+ break;
+ case context::sslv23_server:
+ handle_ = ::SSL_CTX_new(::SSLv23_server_method());
+ break;
+ default:
+ handle_ = ::SSL_CTX_new(0);
+ break;
+ }
+
+ if (handle_ == 0)
+ {
+ boost::system::error_code ec(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ boost::asio::detail::throw_error(ec, "context");
+ }
+}
+
+context::context(boost::asio::io_service&, context::method m)
+ : handle_(0)
+{
+ context tmp(m);
+ handle_ = tmp.handle_;
+ tmp.handle_ = 0;
+}
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+context::context(context&& other)
+{
+ handle_ = other.handle_;
+ other.handle_ = 0;
+}
+
+context& context::operator=(context&& other)
+{
+ context tmp(BOOST_ASIO_MOVE_CAST(context)(*this));
+ handle_ = other.handle_;
+ other.handle_ = 0;
+ return *this;
+}
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
+context::~context()
+{
+ if (handle_)
+ {
+ if (handle_->default_passwd_callback_userdata)
+ {
+ detail::password_callback_base* callback =
+ static_cast<detail::password_callback_base*>(
+ handle_->default_passwd_callback_userdata);
+ delete callback;
+ handle_->default_passwd_callback_userdata = 0;
+ }
+
+ if (SSL_CTX_get_app_data(handle_))
+ {
+ detail::verify_callback_base* callback =
+ static_cast<detail::verify_callback_base*>(
+ SSL_CTX_get_app_data(handle_));
+ delete callback;
+ SSL_CTX_set_app_data(handle_, 0);
+ }
+
+ ::SSL_CTX_free(handle_);
+ }
+}
+
+context::native_handle_type context::native_handle()
+{
+ return handle_;
+}
+
+context::impl_type context::impl()
+{
+ return handle_;
+}
+
+void context::set_options(context::options o)
+{
+ boost::system::error_code ec;
+ set_options(o, ec);
+ boost::asio::detail::throw_error(ec, "set_options");
+}
+
+boost::system::error_code context::set_options(
+ context::options o, boost::system::error_code& ec)
+{
+ ::SSL_CTX_set_options(handle_, o);
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::set_verify_mode(verify_mode v)
+{
+ boost::system::error_code ec;
+ set_verify_mode(v, ec);
+ boost::asio::detail::throw_error(ec, "set_verify_mode");
+}
+
+boost::system::error_code context::set_verify_mode(
+ verify_mode v, boost::system::error_code& ec)
+{
+ ::SSL_CTX_set_verify(handle_, v, ::SSL_CTX_get_verify_callback(handle_));
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::load_verify_file(const std::string& filename)
+{
+ boost::system::error_code ec;
+ load_verify_file(filename, ec);
+ boost::asio::detail::throw_error(ec, "load_verify_file");
+}
+
+boost::system::error_code context::load_verify_file(
+ const std::string& filename, boost::system::error_code& ec)
+{
+ if (::SSL_CTX_load_verify_locations(handle_, filename.c_str(), 0) != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::set_default_verify_paths()
+{
+ boost::system::error_code ec;
+ set_default_verify_paths(ec);
+ boost::asio::detail::throw_error(ec, "set_default_verify_paths");
+}
+
+boost::system::error_code context::set_default_verify_paths(
+ boost::system::error_code& ec)
+{
+ if (::SSL_CTX_set_default_verify_paths(handle_) != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::add_verify_path(const std::string& path)
+{
+ boost::system::error_code ec;
+ add_verify_path(path, ec);
+ boost::asio::detail::throw_error(ec, "add_verify_path");
+}
+
+boost::system::error_code context::add_verify_path(
+ const std::string& path, boost::system::error_code& ec)
+{
+ if (::SSL_CTX_load_verify_locations(handle_, 0, path.c_str()) != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::use_certificate_file(
+ const std::string& filename, file_format format)
+{
+ boost::system::error_code ec;
+ use_certificate_file(filename, format, ec);
+ boost::asio::detail::throw_error(ec, "use_certificate_file");
+}
+
+boost::system::error_code context::use_certificate_file(
+ const std::string& filename, file_format format,
+ boost::system::error_code& ec)
+{
+ int file_type;
+ switch (format)
+ {
+ case context_base::asn1:
+ file_type = SSL_FILETYPE_ASN1;
+ break;
+ case context_base::pem:
+ file_type = SSL_FILETYPE_PEM;
+ break;
+ default:
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+ }
+
+ if (::SSL_CTX_use_certificate_file(handle_, filename.c_str(), file_type) != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::use_certificate_chain_file(const std::string& filename)
+{
+ boost::system::error_code ec;
+ use_certificate_chain_file(filename, ec);
+ boost::asio::detail::throw_error(ec, "use_certificate_chain_file");
+}
+
+boost::system::error_code context::use_certificate_chain_file(
+ const std::string& filename, boost::system::error_code& ec)
+{
+ if (::SSL_CTX_use_certificate_chain_file(handle_, filename.c_str()) != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::use_private_key_file(
+ const std::string& filename, context::file_format format)
+{
+ boost::system::error_code ec;
+ use_private_key_file(filename, format, ec);
+ boost::asio::detail::throw_error(ec, "use_private_key_file");
+}
+
+boost::system::error_code context::use_private_key_file(
+ const std::string& filename, context::file_format format,
+ boost::system::error_code& ec)
+{
+ int file_type;
+ switch (format)
+ {
+ case context_base::asn1:
+ file_type = SSL_FILETYPE_ASN1;
+ break;
+ case context_base::pem:
+ file_type = SSL_FILETYPE_PEM;
+ break;
+ default:
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+ }
+
+ if (::SSL_CTX_use_PrivateKey_file(handle_, filename.c_str(), file_type) != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::use_rsa_private_key_file(
+ const std::string& filename, context::file_format format)
+{
+ boost::system::error_code ec;
+ use_rsa_private_key_file(filename, format, ec);
+ boost::asio::detail::throw_error(ec, "use_rsa_private_key_file");
+}
+
+boost::system::error_code context::use_rsa_private_key_file(
+ const std::string& filename, context::file_format format,
+ boost::system::error_code& ec)
+{
+ int file_type;
+ switch (format)
+ {
+ case context_base::asn1:
+ file_type = SSL_FILETYPE_ASN1;
+ break;
+ case context_base::pem:
+ file_type = SSL_FILETYPE_PEM;
+ break;
+ default:
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+ }
+
+ if (::SSL_CTX_use_RSAPrivateKey_file(
+ handle_, filename.c_str(), file_type) != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+void context::use_tmp_dh_file(const std::string& filename)
+{
+ boost::system::error_code ec;
+ use_tmp_dh_file(filename, ec);
+ boost::asio::detail::throw_error(ec, "use_tmp_dh_file");
+}
+
+boost::system::error_code context::use_tmp_dh_file(
+ const std::string& filename, boost::system::error_code& ec)
+{
+ ::BIO* bio = ::BIO_new_file(filename.c_str(), "r");
+ if (!bio)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ::DH* dh = ::PEM_read_bio_DHparams(bio, 0, 0, 0);
+ if (!dh)
+ {
+ ::BIO_free(bio);
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ::BIO_free(bio);
+ int result = ::SSL_CTX_set_tmp_dh(handle_, dh);
+ ::DH_free(dh);
+ if (result != 1)
+ {
+ ec = boost::system::error_code(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+boost::system::error_code context::do_set_verify_callback(
+ detail::verify_callback_base* callback, boost::system::error_code& ec)
+{
+ if (SSL_CTX_get_app_data(handle_))
+ {
+ delete static_cast<detail::verify_callback_base*>(
+ SSL_CTX_get_app_data(handle_));
+ }
+
+ SSL_CTX_set_app_data(handle_, callback);
+
+ ::SSL_CTX_set_verify(handle_,
+ ::SSL_CTX_get_verify_mode(handle_),
+ &context::verify_callback_function);
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+int context::verify_callback_function(int preverified, X509_STORE_CTX* ctx)
+{
+ if (ctx)
+ {
+ if (SSL* ssl = static_cast<SSL*>(
+ ::X509_STORE_CTX_get_ex_data(
+ ctx, ::SSL_get_ex_data_X509_STORE_CTX_idx())))
+ {
+ if (SSL_CTX* handle = ::SSL_get_SSL_CTX(ssl))
+ {
+ if (SSL_CTX_get_app_data(handle))
+ {
+ detail::verify_callback_base* callback =
+ static_cast<detail::verify_callback_base*>(
+ SSL_CTX_get_app_data(handle));
+
+ verify_context verify_ctx(ctx);
+ return callback->call(preverified != 0, verify_ctx) ? 1 : 0;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+boost::system::error_code context::do_set_password_callback(
+ detail::password_callback_base* callback, boost::system::error_code& ec)
+{
+ if (handle_->default_passwd_callback_userdata)
+ delete static_cast<detail::password_callback_base*>(
+ handle_->default_passwd_callback_userdata);
+
+ handle_->default_passwd_callback_userdata = callback;
+
+ SSL_CTX_set_default_passwd_cb(handle_, &context::password_callback_function);
+
+ ec = boost::system::error_code();
+ return ec;
+}
+
+int context::password_callback_function(
+ char* buf, int size, int purpose, void* data)
+{
+ using namespace std; // For strncat and strlen.
+
+ if (data)
+ {
+ detail::password_callback_base* callback =
+ static_cast<detail::password_callback_base*>(data);
+
+ std::string passwd = callback->call(static_cast<std::size_t>(size),
+ purpose ? context_base::for_writing : context_base::for_reading);
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE)
+ strcpy_s(buf, size, passwd.c_str());
+#else
+ *buf = '\0';
+ strncat(buf, passwd.c_str(), size);
+#endif
+
+ return strlen(buf);
+ }
+
+ return 0;
+}
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_IMPL_CONTEXT_IPP

Added: branches/release/boost/asio/ssl/impl/error.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/impl/error.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,59 @@
+//
+// ssl/impl/error.ipp
+// ~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_IMPL_ERROR_IPP
+#define BOOST_ASIO_SSL_IMPL_ERROR_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/ssl/error.hpp>
+#include <boost/asio/ssl/detail/openssl_init.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace error {
+
+namespace detail {
+
+class ssl_category : public boost::system::error_category
+{
+public:
+ const char* name() const
+ {
+ return "asio.ssl";
+ }
+
+ std::string message(int value) const
+ {
+ const char* s = ::ERR_reason_error_string(value);
+ return s ? s : "asio.ssl error";
+ }
+};
+
+} // namespace detail
+
+const boost::system::error_category& get_ssl_category()
+{
+ static detail::ssl_category instance;
+ return instance;
+}
+
+} // namespace error
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_IMPL_ERROR_IPP

Added: branches/release/boost/asio/ssl/impl/rfc2818_verification.ipp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/impl/rfc2818_verification.ipp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,158 @@
+//
+// ssl/impl/rfc2818_verification.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_IMPL_RFC2818_VERIFICATION_IPP
+#define BOOST_ASIO_SSL_IMPL_RFC2818_VERIFICATION_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <cctype>
+# include <cstring>
+# include <boost/asio/ip/address.hpp>
+# include <boost/asio/ssl/rfc2818_verification.hpp>
+# include <boost/asio/ssl/detail/openssl_types.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+bool rfc2818_verification::operator()(
+ bool preverified, verify_context& ctx) const
+{
+ using namespace std; // For memcmp.
+
+ // Don't bother looking at certificates that have failed pre-verification.
+ if (!preverified)
+ return false;
+
+ // We're only interested in checking the certificate at the end of the chain.
+ int depth = X509_STORE_CTX_get_error_depth(ctx.native_handle());
+ if (depth > 0)
+ return true;
+
+ // Try converting the host name to an address. If it is an address then we
+ // need to look for an IP address in the certificate rather than a host name.
+ boost::system::error_code ec;
+ ip::address address = ip::address::from_string(host_, ec);
+ bool is_address = !ec;
+
+ X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
+
+ // Go through the alternate names in the certificate looking for matching DNS
+ // or IP address entries.
+ GENERAL_NAMES* gens = static_cast<GENERAL_NAMES*>(
+ X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0));
+ for (int i = 0; i < sk_GENERAL_NAME_num(gens); ++i)
+ {
+ GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
+ if (gen->type == GEN_DNS && !is_address)
+ {
+ ASN1_IA5STRING* domain = gen->d.dNSName;
+ if (domain->type == V_ASN1_IA5STRING && domain->data && domain->length)
+ {
+ const char* pattern = reinterpret_cast<const char*>(domain->data);
+ std::size_t pattern_length = domain->length;
+ if (match_pattern(pattern, pattern_length, host_.c_str()))
+ return true;
+ }
+ }
+ else if (gen->type == GEN_IPADD && is_address)
+ {
+ ASN1_OCTET_STRING* ip_address = gen->d.iPAddress;
+ if (ip_address->type == V_ASN1_OCTET_STRING && ip_address->data)
+ {
+ if (address.is_v4() && ip_address->length == 4)
+ {
+ ip::address_v4::bytes_type bytes = address.to_v4().to_bytes();
+ if (memcmp(bytes.data(), ip_address->data, 4) == 0)
+ return true;
+ }
+ else if (address.is_v6() && ip_address->length == 16)
+ {
+ ip::address_v6::bytes_type bytes = address.to_v6().to_bytes();
+ if (memcmp(bytes.data(), ip_address->data, 16) == 0)
+ return true;
+ }
+ }
+ }
+ }
+
+ // No match in the alternate names, so try the common names. We should only
+ // use the "most specific" common name, which is the last one in the list.
+ X509_NAME* name = X509_get_subject_name(cert);
+ int i = -1;
+ ASN1_STRING* common_name = 0;
+ while ((i = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0)
+ {
+ X509_NAME_ENTRY* name_entry = X509_NAME_get_entry(name, i);
+ common_name = X509_NAME_ENTRY_get_data(name_entry);
+ }
+ if (common_name && common_name->data && common_name->length)
+ {
+ const char* pattern = reinterpret_cast<const char*>(common_name->data);
+ std::size_t pattern_length = common_name->length;
+ if (match_pattern(pattern, pattern_length, host_.c_str()))
+ return true;
+ }
+
+ return false;
+}
+
+bool rfc2818_verification::match_pattern(const char* pattern,
+ std::size_t pattern_length, const char* host)
+{
+ using namespace std; // For tolower.
+
+ const char* p = pattern;
+ const char* p_end = p + pattern_length;
+ const char* h = host;
+
+ while (p != p_end && *h)
+ {
+ if (*p == '*')
+ {
+ ++p;
+ while (*h && *h != '.')
+ if (match_pattern(p, p_end - p, h++))
+ return true;
+ }
+ else if (tolower(*p) == tolower(*h))
+ {
+ ++p;
+ ++h;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ return p == p_end && !*h;
+}
+
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_IMPL_RFC2818_VERIFICATION_IPP

Added: branches/release/boost/asio/ssl/impl/src.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/impl/src.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,28 @@
+//
+// impl/ssl/src.hpp
+// ~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_IMPL_SRC_HPP
+#define BOOST_ASIO_IMPL_SRC_HPP
+
+#define BOOST_ASIO_SOURCE
+
+#include <boost/asio/detail/config.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# error Do not compile Asio library source with BOOST_ASIO_HEADER_ONLY defined
+#endif
+
+#include <boost/asio/ssl/impl/context.ipp>
+#include <boost/asio/ssl/impl/error.ipp>
+#include <boost/asio/ssl/detail/impl/engine.ipp>
+#include <boost/asio/ssl/detail/impl/openssl_init.ipp>
+#include <boost/asio/ssl/impl/rfc2818_verification.ipp>
+
+#endif // BOOST_ASIO_IMPL_SRC_HPP

Added: branches/release/boost/asio/ssl/old/basic_context.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/old/basic_context.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,436 @@
+//
+// ssl/old/basic_context.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_OLD_BASIC_CONTEXT_HPP
+#define BOOST_ASIO_SSL_OLD_BASIC_CONTEXT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <string>
+#include <boost/noncopyable.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/ssl/context_base.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace old {
+
+/// SSL context.
+template <typename Service>
+class basic_context
+ : public context_base,
+ private boost::noncopyable
+{
+public:
+ /// The type of the service that will be used to provide context operations.
+ typedef Service service_type;
+
+ /// The native implementation type of the SSL context.
+ typedef typename service_type::impl_type impl_type;
+
+ /// Constructor.
+ basic_context(boost::asio::io_service& io_service, method m)
+ : service_(boost::asio::use_service<Service>(io_service)),
+ impl_(service_.null())
+ {
+ service_.create(impl_, m);
+ }
+
+ /// Destructor.
+ ~basic_context()
+ {
+ service_.destroy(impl_);
+ }
+
+ /// Get the underlying implementation in the native type.
+ /**
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to context functionality that is
+ * not otherwise provided.
+ */
+ impl_type impl()
+ {
+ return impl_;
+ }
+
+ /// Set options on the context.
+ /**
+ * This function may be used to configure the SSL options used by the context.
+ *
+ * @param o A bitmask of options. The available option values are defined in
+ * the context_base class. The options are bitwise-ored with any existing
+ * value for the options.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void set_options(options o)
+ {
+ boost::system::error_code ec;
+ service_.set_options(impl_, o, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Set options on the context.
+ /**
+ * This function may be used to configure the SSL options used by the context.
+ *
+ * @param o A bitmask of options. The available option values are defined in
+ * the context_base class. The options are bitwise-ored with any existing
+ * value for the options.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code set_options(options o,
+ boost::system::error_code& ec)
+ {
+ return service_.set_options(impl_, o, ec);
+ }
+
+ /// Set the peer verification mode.
+ /**
+ * This function may be used to configure the peer verification mode used by
+ * the context.
+ *
+ * @param v A bitmask of peer verification modes. The available verify_mode
+ * values are defined in the context_base class.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void set_verify_mode(verify_mode v)
+ {
+ boost::system::error_code ec;
+ service_.set_verify_mode(impl_, v, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Set the peer verification mode.
+ /**
+ * This function may be used to configure the peer verification mode used by
+ * the context.
+ *
+ * @param v A bitmask of peer verification modes. The available verify_mode
+ * values are defined in the context_base class.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code set_verify_mode(verify_mode v,
+ boost::system::error_code& ec)
+ {
+ return service_.set_verify_mode(impl_, v, ec);
+ }
+
+ /// Load a certification authority file for performing verification.
+ /**
+ * This function is used to load one or more trusted certification authorities
+ * from a file.
+ *
+ * @param filename The name of a file containing certification authority
+ * certificates in PEM format.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void load_verify_file(const std::string& filename)
+ {
+ boost::system::error_code ec;
+ service_.load_verify_file(impl_, filename, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Load a certification authority file for performing verification.
+ /**
+ * This function is used to load the certificates for one or more trusted
+ * certification authorities from a file.
+ *
+ * @param filename The name of a file containing certification authority
+ * certificates in PEM format.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code load_verify_file(const std::string& filename,
+ boost::system::error_code& ec)
+ {
+ return service_.load_verify_file(impl_, filename, ec);
+ }
+
+ /// Add a directory containing certificate authority files to be used for
+ /// performing verification.
+ /**
+ * This function is used to specify the name of a directory containing
+ * certification authority certificates. Each file in the directory must
+ * contain a single certificate. The files must be named using the subject
+ * name's hash and an extension of ".0".
+ *
+ * @param path The name of a directory containing the certificates.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void add_verify_path(const std::string& path)
+ {
+ boost::system::error_code ec;
+ service_.add_verify_path(impl_, path, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Add a directory containing certificate authority files to be used for
+ /// performing verification.
+ /**
+ * This function is used to specify the name of a directory containing
+ * certification authority certificates. Each file in the directory must
+ * contain a single certificate. The files must be named using the subject
+ * name's hash and an extension of ".0".
+ *
+ * @param path The name of a directory containing the certificates.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code add_verify_path(const std::string& path,
+ boost::system::error_code& ec)
+ {
+ return service_.add_verify_path(impl_, path, ec);
+ }
+
+ /// Use a certificate from a file.
+ /**
+ * This function is used to load a certificate into the context from a file.
+ *
+ * @param filename The name of the file containing the certificate.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void use_certificate_file(const std::string& filename, file_format format)
+ {
+ boost::system::error_code ec;
+ service_.use_certificate_file(impl_, filename, format, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Use a certificate from a file.
+ /**
+ * This function is used to load a certificate into the context from a file.
+ *
+ * @param filename The name of the file containing the certificate.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code use_certificate_file(const std::string& filename,
+ file_format format, boost::system::error_code& ec)
+ {
+ return service_.use_certificate_file(impl_, filename, format, ec);
+ }
+
+ /// Use a certificate chain from a file.
+ /**
+ * This function is used to load a certificate chain into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the certificate. The file
+ * must use the PEM format.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void use_certificate_chain_file(const std::string& filename)
+ {
+ boost::system::error_code ec;
+ service_.use_certificate_chain_file(impl_, filename, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Use a certificate chain from a file.
+ /**
+ * This function is used to load a certificate chain into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the certificate. The file
+ * must use the PEM format.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code use_certificate_chain_file(
+ const std::string& filename, boost::system::error_code& ec)
+ {
+ return service_.use_certificate_chain_file(impl_, filename, ec);
+ }
+
+ /// Use a private key from a file.
+ /**
+ * This function is used to load a private key into the context from a file.
+ *
+ * @param filename The name of the file containing the private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void use_private_key_file(const std::string& filename, file_format format)
+ {
+ boost::system::error_code ec;
+ service_.use_private_key_file(impl_, filename, format, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Use a private key from a file.
+ /**
+ * This function is used to load a private key into the context from a file.
+ *
+ * @param filename The name of the file containing the private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code use_private_key_file(const std::string& filename,
+ file_format format, boost::system::error_code& ec)
+ {
+ return service_.use_private_key_file(impl_, filename, format, ec);
+ }
+
+ /// Use an RSA private key from a file.
+ /**
+ * This function is used to load an RSA private key into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the RSA private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void use_rsa_private_key_file(const std::string& filename, file_format format)
+ {
+ boost::system::error_code ec;
+ service_.use_rsa_private_key_file(impl_, filename, format, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Use an RSA private key from a file.
+ /**
+ * This function is used to load an RSA private key into the context from a
+ * file.
+ *
+ * @param filename The name of the file containing the RSA private key.
+ *
+ * @param format The file format (ASN.1 or PEM).
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code use_rsa_private_key_file(
+ const std::string& filename, file_format format,
+ boost::system::error_code& ec)
+ {
+ return service_.use_rsa_private_key_file(impl_, filename, format, ec);
+ }
+
+ /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
+ /**
+ * This function is used to load Diffie-Hellman parameters into the context
+ * from a file.
+ *
+ * @param filename The name of the file containing the Diffie-Hellman
+ * parameters. The file must use the PEM format.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void use_tmp_dh_file(const std::string& filename)
+ {
+ boost::system::error_code ec;
+ service_.use_tmp_dh_file(impl_, filename, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
+ /**
+ * This function is used to load Diffie-Hellman parameters into the context
+ * from a file.
+ *
+ * @param filename The name of the file containing the Diffie-Hellman
+ * parameters. The file must use the PEM format.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code use_tmp_dh_file(const std::string& filename,
+ boost::system::error_code& ec)
+ {
+ return service_.use_tmp_dh_file(impl_, filename, ec);
+ }
+
+ /// Set the password callback.
+ /**
+ * This function is used to specify a callback function to obtain password
+ * information about an encrypted key in PEM format.
+ *
+ * @param callback The function object to be used for obtaining the password.
+ * The function signature of the handler must be:
+ * @code std::string password_callback(
+ * std::size_t max_length, // The maximum size for a password.
+ * password_purpose purpose // Whether password is for reading or writing.
+ * ); @endcode
+ * The return value of the callback is a string containing the password.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ template <typename PasswordCallback>
+ void set_password_callback(PasswordCallback callback)
+ {
+ boost::system::error_code ec;
+ service_.set_password_callback(impl_, callback, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Set the password callback.
+ /**
+ * This function is used to specify a callback function to obtain password
+ * information about an encrypted key in PEM format.
+ *
+ * @param callback The function object to be used for obtaining the password.
+ * The function signature of the handler must be:
+ * @code std::string password_callback(
+ * std::size_t max_length, // The maximum size for a password.
+ * password_purpose purpose // Whether password is for reading or writing.
+ * ); @endcode
+ * The return value of the callback is a string containing the password.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ template <typename PasswordCallback>
+ boost::system::error_code set_password_callback(PasswordCallback callback,
+ boost::system::error_code& ec)
+ {
+ return service_.set_password_callback(impl_, callback, ec);
+ }
+
+private:
+ /// The backend service implementation.
+ service_type& service_;
+
+ /// The underlying native implementation.
+ impl_type impl_;
+};
+
+} // namespace old
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_OLD_BASIC_CONTEXT_HPP

Added: branches/release/boost/asio/ssl/old/context_service.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/old/context_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,176 @@
+//
+// ssl/old/context_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_OLD_CONTEXT_SERVICE_HPP
+#define BOOST_ASIO_SSL_OLD_CONTEXT_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <string>
+#include <boost/noncopyable.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/ssl/context_base.hpp>
+#include <boost/asio/ssl/old/detail/openssl_context_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace old {
+
+/// Default service implementation for a context.
+class context_service
+#if defined(GENERATING_DOCUMENTATION)
+ : public boost::asio::io_service::service
+#else
+ : public boost::asio::detail::service_base<context_service>
+#endif
+{
+private:
+ // The type of the platform-specific implementation.
+ typedef old::detail::openssl_context_service service_impl_type;
+
+public:
+#if defined(GENERATING_DOCUMENTATION)
+ /// The unique service identifier.
+ static boost::asio::io_service::id id;
+#endif
+
+ /// The type of the context.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined impl_type;
+#else
+ typedef service_impl_type::impl_type impl_type;
+#endif
+
+ /// Constructor.
+ explicit context_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<context_service>(io_service),
+ service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+ {
+ }
+
+ /// Return a null context implementation.
+ impl_type null() const
+ {
+ return service_impl_.null();
+ }
+
+ /// Create a new context implementation.
+ void create(impl_type& impl, context_base::method m)
+ {
+ service_impl_.create(impl, m);
+ }
+
+ /// Destroy a context implementation.
+ void destroy(impl_type& impl)
+ {
+ service_impl_.destroy(impl);
+ }
+
+ /// Set options on the context.
+ boost::system::error_code set_options(impl_type& impl,
+ context_base::options o, boost::system::error_code& ec)
+ {
+ return service_impl_.set_options(impl, o, ec);
+ }
+
+ /// Set peer verification mode.
+ boost::system::error_code set_verify_mode(impl_type& impl,
+ context_base::verify_mode v, boost::system::error_code& ec)
+ {
+ return service_impl_.set_verify_mode(impl, v, ec);
+ }
+
+ /// Load a certification authority file for performing verification.
+ boost::system::error_code load_verify_file(impl_type& impl,
+ const std::string& filename, boost::system::error_code& ec)
+ {
+ return service_impl_.load_verify_file(impl, filename, ec);
+ }
+
+ /// Add a directory containing certification authority files to be used for
+ /// performing verification.
+ boost::system::error_code add_verify_path(impl_type& impl,
+ const std::string& path, boost::system::error_code& ec)
+ {
+ return service_impl_.add_verify_path(impl, path, ec);
+ }
+
+ /// Use a certificate from a file.
+ boost::system::error_code use_certificate_file(impl_type& impl,
+ const std::string& filename, context_base::file_format format,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.use_certificate_file(impl, filename, format, ec);
+ }
+
+ /// Use a certificate chain from a file.
+ boost::system::error_code use_certificate_chain_file(impl_type& impl,
+ const std::string& filename, boost::system::error_code& ec)
+ {
+ return service_impl_.use_certificate_chain_file(impl, filename, ec);
+ }
+
+ /// Use a private key from a file.
+ boost::system::error_code use_private_key_file(impl_type& impl,
+ const std::string& filename, context_base::file_format format,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.use_private_key_file(impl, filename, format, ec);
+ }
+
+ /// Use an RSA private key from a file.
+ boost::system::error_code use_rsa_private_key_file(impl_type& impl,
+ const std::string& filename, context_base::file_format format,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.use_rsa_private_key_file(impl, filename, format, ec);
+ }
+
+ /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
+ boost::system::error_code use_tmp_dh_file(impl_type& impl,
+ const std::string& filename, boost::system::error_code& ec)
+ {
+ return service_impl_.use_tmp_dh_file(impl, filename, ec);
+ }
+
+ /// Set the password callback.
+ template <typename PasswordCallback>
+ boost::system::error_code set_password_callback(impl_type& impl,
+ PasswordCallback callback, boost::system::error_code& ec)
+ {
+ return service_impl_.set_password_callback(impl, callback, ec);
+ }
+
+private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ // The service that provides the platform-specific implementation.
+ service_impl_type& service_impl_;
+};
+
+} // namespace old
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_OLD_CONTEXT_SERVICE_HPP

Added: branches/release/boost/asio/ssl/old/detail/openssl_context_service.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/old/detail/openssl_context_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,388 @@
+//
+// ssl/old/detail/openssl_context_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP
+#define BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstring>
+#include <string>
+#include <boost/function.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/ssl/context_base.hpp>
+#include <boost/asio/ssl/detail/openssl_init.hpp>
+#include <boost/asio/ssl/detail/openssl_types.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace old {
+namespace detail {
+
+class openssl_context_service
+ : public boost::asio::detail::service_base<openssl_context_service>
+{
+public:
+ // The native type of the context.
+ typedef ::SSL_CTX* impl_type;
+
+ // The type for the password callback function object.
+ typedef boost::function<std::string(std::size_t,
+ context_base::password_purpose)> password_callback_type;
+
+ // Constructor.
+ openssl_context_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<openssl_context_service>(io_service)
+ {
+ }
+
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ // Return a null context implementation.
+ static impl_type null()
+ {
+ return 0;
+ }
+
+ // Create a new context implementation.
+ void create(impl_type& impl, context_base::method m)
+ {
+ switch (m)
+ {
+#if defined(OPENSSL_NO_SSL2)
+ case context_base::sslv2:
+ case context_base::sslv2_client:
+ case context_base::sslv2_server:
+ boost::asio::detail::throw_error(boost::asio::error::invalid_argument);
+ break;
+#else // defined(OPENSSL_NO_SSL2)
+ case context_base::sslv2:
+ impl = ::SSL_CTX_new(::SSLv2_method());
+ break;
+ case context_base::sslv2_client:
+ impl = ::SSL_CTX_new(::SSLv2_client_method());
+ break;
+ case context_base::sslv2_server:
+ impl = ::SSL_CTX_new(::SSLv2_server_method());
+ break;
+#endif // defined(OPENSSL_NO_SSL2)
+ case context_base::sslv3:
+ impl = ::SSL_CTX_new(::SSLv3_method());
+ break;
+ case context_base::sslv3_client:
+ impl = ::SSL_CTX_new(::SSLv3_client_method());
+ break;
+ case context_base::sslv3_server:
+ impl = ::SSL_CTX_new(::SSLv3_server_method());
+ break;
+ case context_base::tlsv1:
+ impl = ::SSL_CTX_new(::TLSv1_method());
+ break;
+ case context_base::tlsv1_client:
+ impl = ::SSL_CTX_new(::TLSv1_client_method());
+ break;
+ case context_base::tlsv1_server:
+ impl = ::SSL_CTX_new(::TLSv1_server_method());
+ break;
+ case context_base::sslv23:
+ impl = ::SSL_CTX_new(::SSLv23_method());
+ break;
+ case context_base::sslv23_client:
+ impl = ::SSL_CTX_new(::SSLv23_client_method());
+ break;
+ case context_base::sslv23_server:
+ impl = ::SSL_CTX_new(::SSLv23_server_method());
+ break;
+ default:
+ impl = ::SSL_CTX_new(0);
+ break;
+ }
+ }
+
+ // Destroy a context implementation.
+ void destroy(impl_type& impl)
+ {
+ if (impl != null())
+ {
+ if (impl->default_passwd_callback_userdata)
+ {
+ password_callback_type* callback =
+ static_cast<password_callback_type*>(
+ impl->default_passwd_callback_userdata);
+ delete callback;
+ impl->default_passwd_callback_userdata = 0;
+ }
+
+ ::SSL_CTX_free(impl);
+ impl = null();
+ }
+ }
+
+ // Set options on the context.
+ boost::system::error_code set_options(impl_type& impl,
+ context_base::options o, boost::system::error_code& ec)
+ {
+ ::SSL_CTX_set_options(impl, o);
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Set peer verification mode.
+ boost::system::error_code set_verify_mode(impl_type& impl,
+ context_base::verify_mode v, boost::system::error_code& ec)
+ {
+ ::SSL_CTX_set_verify(impl, v, 0);
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Load a certification authority file for performing verification.
+ boost::system::error_code load_verify_file(impl_type& impl,
+ const std::string& filename, boost::system::error_code& ec)
+ {
+ if (::SSL_CTX_load_verify_locations(impl, filename.c_str(), 0) != 1)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Add a directory containing certification authority files to be used for
+ // performing verification.
+ boost::system::error_code add_verify_path(impl_type& impl,
+ const std::string& path, boost::system::error_code& ec)
+ {
+ if (::SSL_CTX_load_verify_locations(impl, 0, path.c_str()) != 1)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Use a certificate from a file.
+ boost::system::error_code use_certificate_file(impl_type& impl,
+ const std::string& filename, context_base::file_format format,
+ boost::system::error_code& ec)
+ {
+ int file_type;
+ switch (format)
+ {
+ case context_base::asn1:
+ file_type = SSL_FILETYPE_ASN1;
+ break;
+ case context_base::pem:
+ file_type = SSL_FILETYPE_PEM;
+ break;
+ default:
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+ }
+
+ if (::SSL_CTX_use_certificate_file(impl, filename.c_str(), file_type) != 1)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Use a certificate chain from a file.
+ boost::system::error_code use_certificate_chain_file(impl_type& impl,
+ const std::string& filename, boost::system::error_code& ec)
+ {
+ if (::SSL_CTX_use_certificate_chain_file(impl, filename.c_str()) != 1)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Use a private key from a file.
+ boost::system::error_code use_private_key_file(impl_type& impl,
+ const std::string& filename, context_base::file_format format,
+ boost::system::error_code& ec)
+ {
+ int file_type;
+ switch (format)
+ {
+ case context_base::asn1:
+ file_type = SSL_FILETYPE_ASN1;
+ break;
+ case context_base::pem:
+ file_type = SSL_FILETYPE_PEM;
+ break;
+ default:
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+ }
+
+ if (::SSL_CTX_use_PrivateKey_file(impl, filename.c_str(), file_type) != 1)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Use an RSA private key from a file.
+ boost::system::error_code use_rsa_private_key_file(impl_type& impl,
+ const std::string& filename, context_base::file_format format,
+ boost::system::error_code& ec)
+ {
+ int file_type;
+ switch (format)
+ {
+ case context_base::asn1:
+ file_type = SSL_FILETYPE_ASN1;
+ break;
+ case context_base::pem:
+ file_type = SSL_FILETYPE_PEM;
+ break;
+ default:
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+ }
+
+ if (::SSL_CTX_use_RSAPrivateKey_file(
+ impl, filename.c_str(), file_type) != 1)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Use the specified file to obtain the temporary Diffie-Hellman parameters.
+ boost::system::error_code use_tmp_dh_file(impl_type& impl,
+ const std::string& filename, boost::system::error_code& ec)
+ {
+ ::BIO* bio = ::BIO_new_file(filename.c_str(), "r");
+ if (!bio)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ::DH* dh = ::PEM_read_bio_DHparams(bio, 0, 0, 0);
+ if (!dh)
+ {
+ ::BIO_free(bio);
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ::BIO_free(bio);
+ int result = ::SSL_CTX_set_tmp_dh(impl, dh);
+ ::DH_free(dh);
+ if (result != 1)
+ {
+ ec = boost::asio::error::invalid_argument;
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ static int password_callback(char* buf, int size, int purpose, void* data)
+ {
+ using namespace std; // For strncat and strlen.
+
+ if (data)
+ {
+ password_callback_type* callback =
+ static_cast<password_callback_type*>(data);
+ std::string passwd = (*callback)(static_cast<std::size_t>(size),
+ purpose ? context_base::for_writing : context_base::for_reading);
+ *buf = '\0';
+ strncat(buf, passwd.c_str(), size);
+ return strlen(buf);
+ }
+
+ return 0;
+ }
+
+ // Set the password callback.
+ template <typename Password_Callback>
+ boost::system::error_code set_password_callback(impl_type& impl,
+ Password_Callback callback, boost::system::error_code& ec)
+ {
+ // Allocate callback function object if not already present.
+ if (impl->default_passwd_callback_userdata)
+ {
+ password_callback_type* callback_function =
+ static_cast<password_callback_type*>(
+ impl->default_passwd_callback_userdata);
+ *callback_function = callback;
+ }
+ else
+ {
+ password_callback_type* callback_function =
+ new password_callback_type(callback);
+ impl->default_passwd_callback_userdata = callback_function;
+ }
+
+ // Set the password callback.
+ SSL_CTX_set_default_passwd_cb(impl,
+ &openssl_context_service::password_callback);
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+private:
+ // Ensure openssl is initialised.
+ boost::asio::ssl::detail::openssl_init<> init_;
+};
+
+} // namespace detail
+} // namespace old
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_CONTEXT_SERVICE_HPP

Added: branches/release/boost/asio/ssl/old/detail/openssl_operation.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/old/detail/openssl_operation.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,526 @@
+//
+// ssl/old/detail/openssl_operation.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster 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)
+//
+
+#ifndef BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_OPERATION_HPP
+#define BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_OPERATION_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/function.hpp>
+#include <boost/assert.hpp>
+#include <boost/bind.hpp>
+#include <boost/asio/buffer.hpp>
+#include <boost/asio/detail/socket_ops.hpp>
+#include <boost/asio/placeholders.hpp>
+#include <boost/asio/ssl/detail/openssl_types.hpp>
+#include <boost/asio/ssl/error.hpp>
+#include <boost/asio/strand.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/asio/write.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace old {
+namespace detail {
+
+typedef boost::function<int (::SSL*)> ssl_primitive_func;
+typedef boost::function<void (const boost::system::error_code&, int)>
+ user_handler_func;
+
+// Network send_/recv buffer implementation
+//
+//
+class net_buffer
+{
+ static const int NET_BUF_SIZE = 16*1024 + 256; // SSL record size + spare
+
+ unsigned char buf_[NET_BUF_SIZE];
+ unsigned char* data_start_;
+ unsigned char* data_end_;
+
+public:
+ net_buffer()
+ {
+ data_start_ = data_end_ = buf_;
+ }
+ unsigned char* get_unused_start() { return data_end_; }
+ unsigned char* get_data_start() { return data_start_; }
+ size_t get_unused_len() { return (NET_BUF_SIZE - (data_end_ - buf_)); }
+ size_t get_data_len() { return (data_end_ - data_start_); }
+ void data_added(size_t count)
+ {
+ data_end_ += count;
+ data_end_ = data_end_ > (buf_ + NET_BUF_SIZE)?
+ (buf_ + NET_BUF_SIZE):
+ data_end_;
+ }
+ void data_removed(size_t count)
+ {
+ data_start_ += count;
+ if (data_start_ >= data_end_) reset();
+ }
+ void reset() { data_start_ = buf_; data_end_ = buf_; }
+ bool has_data() { return (data_start_ < data_end_); }
+}; // class net_buffer
+
+//
+// Operation class
+//
+//
+template <typename Stream>
+class openssl_operation
+{
+public:
+
+ // Constructor for asynchronous operations
+ openssl_operation(ssl_primitive_func primitive,
+ Stream& socket,
+ net_buffer& recv_buf,
+ SSL* session,
+ BIO* ssl_bio,
+ user_handler_func handler,
+ boost::asio::io_service::strand& strand
+ )
+ : primitive_(primitive)
+ , user_handler_(handler)
+ , strand_(&strand)
+ , recv_buf_(recv_buf)
+ , socket_(socket)
+ , ssl_bio_(ssl_bio)
+ , session_(session)
+ {
+ write_ = boost::bind(
+ &openssl_operation::do_async_write,
+ this, boost::arg<1>(), boost::arg<2>()
+ );
+ read_ = boost::bind(
+ &openssl_operation::do_async_read,
+ this
+ );
+ handler_= boost::bind(
+ &openssl_operation::async_user_handler,
+ this, boost::arg<1>(), boost::arg<2>()
+ );
+ }
+
+ // Constructor for synchronous operations
+ openssl_operation(ssl_primitive_func primitive,
+ Stream& socket,
+ net_buffer& recv_buf,
+ SSL* session,
+ BIO* ssl_bio)
+ : primitive_(primitive)
+ , strand_(0)
+ , recv_buf_(recv_buf)
+ , socket_(socket)
+ , ssl_bio_(ssl_bio)
+ , session_(session)
+ {
+ write_ = boost::bind(
+ &openssl_operation::do_sync_write,
+ this, boost::arg<1>(), boost::arg<2>()
+ );
+ read_ = boost::bind(
+ &openssl_operation::do_sync_read,
+ this
+ );
+ handler_ = boost::bind(
+ &openssl_operation::sync_user_handler,
+ this, boost::arg<1>(), boost::arg<2>()
+ );
+ }
+
+ // Start operation
+ // In case of asynchronous it returns 0, in sync mode returns success code
+ // or throws an error...
+ int start()
+ {
+ int rc = primitive_( session_ );
+
+ bool is_operation_done = (rc > 0);
+ // For connect/accept/shutdown, the operation
+ // is done, when return code is 1
+ // for write, it is done, when is retcode > 0
+ // for read, is is done when retcode > 0
+
+ int error_code = !is_operation_done ?
+ ::SSL_get_error( session_, rc ) :
+ 0;
+ int sys_error_code = ERR_get_error();
+
+ if (error_code == SSL_ERROR_SSL)
+ return handler_(boost::system::error_code(
+ sys_error_code, boost::asio::error::get_ssl_category()), rc);
+
+ bool is_read_needed = (error_code == SSL_ERROR_WANT_READ);
+ bool is_write_needed = (error_code == SSL_ERROR_WANT_WRITE ||
+ ::BIO_ctrl_pending( ssl_bio_ ));
+ bool is_shut_down_received =
+ ((::SSL_get_shutdown( session_ ) & SSL_RECEIVED_SHUTDOWN) ==
+ SSL_RECEIVED_SHUTDOWN);
+ bool is_shut_down_sent =
+ ((::SSL_get_shutdown( session_ ) & SSL_SENT_SHUTDOWN) ==
+ SSL_SENT_SHUTDOWN);
+
+ if (is_shut_down_sent && is_shut_down_received
+ && is_operation_done && !is_write_needed)
+ // SSL connection is shut down cleanly
+ return handler_(boost::system::error_code(), 1);
+
+ if (is_shut_down_received && !is_operation_done)
+ // Shutdown has been requested, while we were reading or writing...
+ // abort our action...
+ return handler_(boost::asio::error::shut_down, 0);
+
+ if (!is_operation_done && !is_read_needed && !is_write_needed
+ && !is_shut_down_sent)
+ {
+ // The operation has failed... It is not completed and does
+ // not want network communication nor does want to send shutdown out...
+ if (error_code == SSL_ERROR_SYSCALL)
+ {
+ return handler_(boost::system::error_code(
+ sys_error_code, boost::asio::error::system_category), rc);
+ }
+ else
+ {
+ return handler_(boost::system::error_code(
+ sys_error_code, boost::asio::error::get_ssl_category()), rc);
+ }
+ }
+
+ if (!is_operation_done && !is_write_needed)
+ {
+ // We may have left over data that we can pass to SSL immediately
+ if (recv_buf_.get_data_len() > 0)
+ {
+ // Pass the buffered data to SSL
+ int written = ::BIO_write
+ (
+ ssl_bio_,
+ recv_buf_.get_data_start(),
+ recv_buf_.get_data_len()
+ );
+
+ if (written > 0)
+ {
+ recv_buf_.data_removed(written);
+ }
+ else if (written < 0)
+ {
+ if (!BIO_should_retry(ssl_bio_))
+ {
+ // Some serios error with BIO....
+ return handler_(boost::asio::error::no_recovery, 0);
+ }
+ }
+
+ return start();
+ }
+ else if (is_read_needed || (is_shut_down_sent && !is_shut_down_received))
+ {
+ return read_();
+ }
+ }
+
+ // Continue with operation, flush any SSL data out to network...
+ return write_(is_operation_done, rc);
+ }
+
+// Private implementation
+private:
+ typedef boost::function<int (const boost::system::error_code&, int)>
+ int_handler_func;
+ typedef boost::function<int (bool, int)> write_func;
+ typedef boost::function<int ()> read_func;
+
+ ssl_primitive_func primitive_;
+ user_handler_func user_handler_;
+ boost::asio::io_service::strand* strand_;
+ write_func write_;
+ read_func read_;
+ int_handler_func handler_;
+
+ net_buffer send_buf_; // buffers for network IO
+
+ // The recv buffer is owned by the stream, not the operation, since there can
+ // be left over bytes after passing the data up to the application, and these
+ // bytes need to be kept around for the next read operation issued by the
+ // application.
+ net_buffer& recv_buf_;
+
+ Stream& socket_;
+ BIO* ssl_bio_;
+ SSL* session_;
+
+ //
+ int sync_user_handler(const boost::system::error_code& error, int rc)
+ {
+ if (!error)
+ return rc;
+
+ throw boost::system::system_error(error);
+ }
+
+ int async_user_handler(boost::system::error_code error, int rc)
+ {
+ if (rc < 0)
+ {
+ if (!error)
+ error = boost::asio::error::no_recovery;
+ rc = 0;
+ }
+
+ user_handler_(error, rc);
+ return 0;
+ }
+
+ // Writes bytes asynchronously from SSL to NET
+ int do_async_write(bool is_operation_done, int rc)
+ {
+ int len = ::BIO_ctrl_pending( ssl_bio_ );
+ if ( len )
+ {
+ // There is something to write into net, do it...
+ len = (int)send_buf_.get_unused_len() > len?
+ len:
+ send_buf_.get_unused_len();
+
+ if (len == 0)
+ {
+ // In case our send buffer is full, we have just to wait until
+ // previous send to complete...
+ return 0;
+ }
+
+ // Read outgoing data from bio
+ len = ::BIO_read( ssl_bio_, send_buf_.get_unused_start(), len);
+
+ if (len > 0)
+ {
+ unsigned char *data_start = send_buf_.get_unused_start();
+ send_buf_.data_added(len);
+
+ BOOST_ASSERT(strand_);
+ boost::asio::async_write
+ (
+ socket_,
+ boost::asio::buffer(data_start, len),
+ strand_->wrap
+ (
+ boost::bind
+ (
+ &openssl_operation::async_write_handler,
+ this,
+ is_operation_done,
+ rc,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred
+ )
+ )
+ );
+
+ return 0;
+ }
+ else if (!BIO_should_retry(ssl_bio_))
+ {
+ // Seems like fatal error
+ // reading from SSL BIO has failed...
+ handler_(boost::asio::error::no_recovery, 0);
+ return 0;
+ }
+ }
+
+ if (is_operation_done)
+ {
+ // Finish the operation, with success
+ handler_(boost::system::error_code(), rc);
+ return 0;
+ }
+
+ // OPeration is not done and writing to net has been made...
+ // start operation again
+ start();
+
+ return 0;
+ }
+
+ void async_write_handler(bool is_operation_done, int rc,
+ const boost::system::error_code& error, size_t bytes_sent)
+ {
+ if (!error)
+ {
+ // Remove data from send buffer
+ send_buf_.data_removed(bytes_sent);
+
+ if (is_operation_done)
+ handler_(boost::system::error_code(), rc);
+ else
+ // Since the operation was not completed, try it again...
+ start();
+ }
+ else
+ handler_(error, rc);
+ }
+
+ int do_async_read()
+ {
+ // Wait for new data
+ BOOST_ASSERT(strand_);
+ socket_.async_read_some
+ (
+ boost::asio::buffer(recv_buf_.get_unused_start(),
+ recv_buf_.get_unused_len()),
+ strand_->wrap
+ (
+ boost::bind
+ (
+ &openssl_operation::async_read_handler,
+ this,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred
+ )
+ )
+ );
+ return 0;
+ }
+
+ void async_read_handler(const boost::system::error_code& error,
+ size_t bytes_recvd)
+ {
+ if (!error)
+ {
+ recv_buf_.data_added(bytes_recvd);
+
+ // Pass the received data to SSL
+ int written = ::BIO_write
+ (
+ ssl_bio_,
+ recv_buf_.get_data_start(),
+ recv_buf_.get_data_len()
+ );
+
+ if (written > 0)
+ {
+ recv_buf_.data_removed(written);
+ }
+ else if (written < 0)
+ {
+ if (!BIO_should_retry(ssl_bio_))
+ {
+ // Some serios error with BIO....
+ handler_(boost::asio::error::no_recovery, 0);
+ return;
+ }
+ }
+
+ // and try the SSL primitive again
+ start();
+ }
+ else
+ {
+ // Error in network level...
+ // SSL can't continue either...
+ handler_(error, 0);
+ }
+ }
+
+ // Syncronous functions...
+ int do_sync_write(bool is_operation_done, int rc)
+ {
+ int len = ::BIO_ctrl_pending( ssl_bio_ );
+ if ( len )
+ {
+ // There is something to write into net, do it...
+ len = (int)send_buf_.get_unused_len() > len?
+ len:
+ send_buf_.get_unused_len();
+
+ // Read outgoing data from bio
+ len = ::BIO_read( ssl_bio_, send_buf_.get_unused_start(), len);
+
+ if (len > 0)
+ {
+ size_t sent_len = boost::asio::write(
+ socket_,
+ boost::asio::buffer(send_buf_.get_unused_start(), len)
+ );
+
+ send_buf_.data_added(len);
+ send_buf_.data_removed(sent_len);
+ }
+ else if (!BIO_should_retry(ssl_bio_))
+ {
+ // Seems like fatal error
+ // reading from SSL BIO has failed...
+ throw boost::system::system_error(boost::asio::error::no_recovery);
+ }
+ }
+
+ if (is_operation_done)
+ // Finish the operation, with success
+ return rc;
+
+ // Operation is not finished, start again.
+ return start();
+ }
+
+ int do_sync_read()
+ {
+ size_t len = socket_.read_some
+ (
+ boost::asio::buffer(recv_buf_.get_unused_start(),
+ recv_buf_.get_unused_len())
+ );
+
+ // Write data to ssl
+ recv_buf_.data_added(len);
+
+ // Pass the received data to SSL
+ int written = ::BIO_write
+ (
+ ssl_bio_,
+ recv_buf_.get_data_start(),
+ recv_buf_.get_data_len()
+ );
+
+ if (written > 0)
+ {
+ recv_buf_.data_removed(written);
+ }
+ else if (written < 0)
+ {
+ if (!BIO_should_retry(ssl_bio_))
+ {
+ // Some serios error with BIO....
+ throw boost::system::system_error(boost::asio::error::no_recovery);
+ }
+ }
+
+ // Try the operation again
+ return start();
+ }
+}; // class openssl_operation
+
+} // namespace detail
+} // namespace old
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_OPERATION_HPP

Added: branches/release/boost/asio/ssl/old/detail/openssl_stream_service.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/old/detail/openssl_stream_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,573 @@
+//
+// ssl/old/detail/stream_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_STREAM_SERVICE_HPP
+#define BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_STREAM_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstddef>
+#include <climits>
+#include <memory>
+#include <boost/config.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/asio/detail/buffer_sequence_adapter.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/ssl/basic_context.hpp>
+#include <boost/asio/ssl/stream_base.hpp>
+#include <boost/asio/ssl/old/detail/openssl_operation.hpp>
+#include <boost/asio/ssl/detail/openssl_types.hpp>
+#include <boost/asio/strand.hpp>
+#include <boost/system/system_error.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace old {
+namespace detail {
+
+class openssl_stream_service
+ : public boost::asio::detail::service_base<openssl_stream_service>
+{
+private:
+ enum { max_buffer_size = INT_MAX };
+
+ //Base handler for asyncrhonous operations
+ template <typename Stream>
+ class base_handler
+ {
+ public:
+ typedef boost::function<
+ void (const boost::system::error_code&, size_t)> func_t;
+
+ base_handler(boost::asio::io_service& io_service)
+ : op_(NULL)
+ , io_service_(io_service)
+ , work_(io_service)
+ {}
+
+ void do_func(const boost::system::error_code& error, size_t size)
+ {
+ func_(error, size);
+ }
+
+ void set_operation(openssl_operation<Stream>* op) { op_ = op; }
+ void set_func(func_t func) { func_ = func; }
+
+ ~base_handler()
+ {
+ delete op_;
+ }
+
+ private:
+ func_t func_;
+ openssl_operation<Stream>* op_;
+ boost::asio::io_service& io_service_;
+ boost::asio::io_service::work work_;
+ }; // class base_handler
+
+ // Handler for asynchronous IO (write/read) operations
+ template<typename Stream, typename Handler>
+ class io_handler
+ : public base_handler<Stream>
+ {
+ public:
+ io_handler(Handler handler, boost::asio::io_service& io_service)
+ : base_handler<Stream>(io_service)
+ , handler_(handler)
+ {
+ this->set_func(boost::bind(
+ &io_handler<Stream, Handler>::handler_impl,
+ this, boost::arg<1>(), boost::arg<2>() ));
+ }
+
+ private:
+ Handler handler_;
+ void handler_impl(const boost::system::error_code& error, size_t size)
+ {
+ std::auto_ptr<io_handler<Stream, Handler> > this_ptr(this);
+ handler_(error, size);
+ }
+ }; // class io_handler
+
+ // Handler for asyncrhonous handshake (connect, accept) functions
+ template <typename Stream, typename Handler>
+ class handshake_handler
+ : public base_handler<Stream>
+ {
+ public:
+ handshake_handler(Handler handler, boost::asio::io_service& io_service)
+ : base_handler<Stream>(io_service)
+ , handler_(handler)
+ {
+ this->set_func(boost::bind(
+ &handshake_handler<Stream, Handler>::handler_impl,
+ this, boost::arg<1>(), boost::arg<2>() ));
+ }
+
+ private:
+ Handler handler_;
+ void handler_impl(const boost::system::error_code& error, size_t)
+ {
+ std::auto_ptr<handshake_handler<Stream, Handler> > this_ptr(this);
+ handler_(error);
+ }
+
+ }; // class handshake_handler
+
+ // Handler for asyncrhonous shutdown
+ template <typename Stream, typename Handler>
+ class shutdown_handler
+ : public base_handler<Stream>
+ {
+ public:
+ shutdown_handler(Handler handler, boost::asio::io_service& io_service)
+ : base_handler<Stream>(io_service),
+ handler_(handler)
+ {
+ this->set_func(boost::bind(
+ &shutdown_handler<Stream, Handler>::handler_impl,
+ this, boost::arg<1>(), boost::arg<2>() ));
+ }
+
+ private:
+ Handler handler_;
+ void handler_impl(const boost::system::error_code& error, size_t)
+ {
+ std::auto_ptr<shutdown_handler<Stream, Handler> > this_ptr(this);
+ handler_(error);
+ }
+ }; // class shutdown_handler
+
+public:
+ // The implementation type.
+ typedef struct impl_struct
+ {
+ ::SSL* ssl;
+ ::BIO* ext_bio;
+ net_buffer recv_buf;
+ } * impl_type;
+
+ // Construct a new stream socket service for the specified io_service.
+ explicit openssl_stream_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<openssl_stream_service>(io_service),
+ strand_(io_service)
+ {
+ }
+
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ // Return a null stream implementation.
+ impl_type null() const
+ {
+ return 0;
+ }
+
+ // Create a new stream implementation.
+ template <typename Stream, typename Context_Service>
+ void create(impl_type& impl, Stream& /*next_layer*/,
+ basic_context<Context_Service>& context)
+ {
+ impl = new impl_struct;
+ impl->ssl = ::SSL_new(context.impl());
+ ::SSL_set_mode(impl->ssl, SSL_MODE_ENABLE_PARTIAL_WRITE);
+ ::SSL_set_mode(impl->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
+ ::BIO* int_bio = 0;
+ impl->ext_bio = 0;
+ ::BIO_new_bio_pair(&int_bio, 8192, &impl->ext_bio, 8192);
+ ::SSL_set_bio(impl->ssl, int_bio, int_bio);
+ }
+
+ // Destroy a stream implementation.
+ template <typename Stream>
+ void destroy(impl_type& impl, Stream& /*next_layer*/)
+ {
+ if (impl != 0)
+ {
+ ::BIO_free(impl->ext_bio);
+ ::SSL_free(impl->ssl);
+ delete impl;
+ impl = 0;
+ }
+ }
+
+ // Perform SSL handshaking.
+ template <typename Stream>
+ boost::system::error_code handshake(impl_type& impl, Stream& next_layer,
+ stream_base::handshake_type type, boost::system::error_code& ec)
+ {
+ try
+ {
+ openssl_operation<Stream> op(
+ type == stream_base::client ?
+ &ssl_wrap<mutex_type>::SSL_connect:
+ &ssl_wrap<mutex_type>::SSL_accept,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio);
+ op.start();
+ }
+ catch (boost::system::system_error& e)
+ {
+ ec = e.code();
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Start an asynchronous SSL handshake.
+ template <typename Stream, typename Handler>
+ void async_handshake(impl_type& impl, Stream& next_layer,
+ stream_base::handshake_type type, Handler handler)
+ {
+ typedef handshake_handler<Stream, Handler> connect_handler;
+
+ connect_handler* local_handler =
+ new connect_handler(handler, get_io_service());
+
+ openssl_operation<Stream>* op = new openssl_operation<Stream>
+ (
+ type == stream_base::client ?
+ &ssl_wrap<mutex_type>::SSL_connect:
+ &ssl_wrap<mutex_type>::SSL_accept,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio,
+ boost::bind
+ (
+ &base_handler<Stream>::do_func,
+ local_handler,
+ boost::arg<1>(),
+ boost::arg<2>()
+ ),
+ strand_
+ );
+ local_handler->set_operation(op);
+
+ strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
+ }
+
+ // Shut down SSL on the stream.
+ template <typename Stream>
+ boost::system::error_code shutdown(impl_type& impl, Stream& next_layer,
+ boost::system::error_code& ec)
+ {
+ try
+ {
+ openssl_operation<Stream> op(
+ &ssl_wrap<mutex_type>::SSL_shutdown,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio);
+ op.start();
+ }
+ catch (boost::system::system_error& e)
+ {
+ ec = e.code();
+ return ec;
+ }
+
+ ec = boost::system::error_code();
+ return ec;
+ }
+
+ // Asynchronously shut down SSL on the stream.
+ template <typename Stream, typename Handler>
+ void async_shutdown(impl_type& impl, Stream& next_layer, Handler handler)
+ {
+ typedef shutdown_handler<Stream, Handler> disconnect_handler;
+
+ disconnect_handler* local_handler =
+ new disconnect_handler(handler, get_io_service());
+
+ openssl_operation<Stream>* op = new openssl_operation<Stream>
+ (
+ &ssl_wrap<mutex_type>::SSL_shutdown,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio,
+ boost::bind
+ (
+ &base_handler<Stream>::do_func,
+ local_handler,
+ boost::arg<1>(),
+ boost::arg<2>()
+ ),
+ strand_
+ );
+ local_handler->set_operation(op);
+
+ strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
+ }
+
+ // Write some data to the stream.
+ template <typename Stream, typename Const_Buffers>
+ std::size_t write_some(impl_type& impl, Stream& next_layer,
+ const Const_Buffers& buffers, boost::system::error_code& ec)
+ {
+ size_t bytes_transferred = 0;
+ try
+ {
+ boost::asio::const_buffer buffer =
+ boost::asio::detail::buffer_sequence_adapter<
+ boost::asio::const_buffer, Const_Buffers>::first(buffers);
+
+ std::size_t buffer_size = boost::asio::buffer_size(buffer);
+ if (buffer_size > max_buffer_size)
+ buffer_size = max_buffer_size;
+ else if (buffer_size == 0)
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+ boost::function<int (SSL*)> send_func =
+ boost::bind(boost::type<int>(), &::SSL_write, boost::arg<1>(),
+ boost::asio::buffer_cast<const void*>(buffer),
+ static_cast<int>(buffer_size));
+ openssl_operation<Stream> op(
+ send_func,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio
+ );
+ bytes_transferred = static_cast<size_t>(op.start());
+ }
+ catch (boost::system::system_error& e)
+ {
+ ec = e.code();
+ return 0;
+ }
+
+ ec = boost::system::error_code();
+ return bytes_transferred;
+ }
+
+ // Start an asynchronous write.
+ template <typename Stream, typename Const_Buffers, typename Handler>
+ void async_write_some(impl_type& impl, Stream& next_layer,
+ const Const_Buffers& buffers, Handler handler)
+ {
+ typedef io_handler<Stream, Handler> send_handler;
+
+ boost::asio::const_buffer buffer =
+ boost::asio::detail::buffer_sequence_adapter<
+ boost::asio::const_buffer, Const_Buffers>::first(buffers);
+
+ std::size_t buffer_size = boost::asio::buffer_size(buffer);
+ if (buffer_size > max_buffer_size)
+ buffer_size = max_buffer_size;
+ else if (buffer_size == 0)
+ {
+ get_io_service().post(boost::asio::detail::bind_handler(
+ handler, boost::system::error_code(), 0));
+ return;
+ }
+
+ send_handler* local_handler = new send_handler(handler, get_io_service());
+
+ boost::function<int (SSL*)> send_func =
+ boost::bind(boost::type<int>(), &::SSL_write, boost::arg<1>(),
+ boost::asio::buffer_cast<const void*>(buffer),
+ static_cast<int>(buffer_size));
+
+ openssl_operation<Stream>* op = new openssl_operation<Stream>
+ (
+ send_func,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio,
+ boost::bind
+ (
+ &base_handler<Stream>::do_func,
+ local_handler,
+ boost::arg<1>(),
+ boost::arg<2>()
+ ),
+ strand_
+ );
+ local_handler->set_operation(op);
+
+ strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
+ }
+
+ // Read some data from the stream.
+ template <typename Stream, typename Mutable_Buffers>
+ std::size_t read_some(impl_type& impl, Stream& next_layer,
+ const Mutable_Buffers& buffers, boost::system::error_code& ec)
+ {
+ size_t bytes_transferred = 0;
+ try
+ {
+ boost::asio::mutable_buffer buffer =
+ boost::asio::detail::buffer_sequence_adapter<
+ boost::asio::mutable_buffer, Mutable_Buffers>::first(buffers);
+
+ std::size_t buffer_size = boost::asio::buffer_size(buffer);
+ if (buffer_size > max_buffer_size)
+ buffer_size = max_buffer_size;
+ else if (buffer_size == 0)
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+ boost::function<int (SSL*)> recv_func =
+ boost::bind(boost::type<int>(), &::SSL_read, boost::arg<1>(),
+ boost::asio::buffer_cast<void*>(buffer),
+ static_cast<int>(buffer_size));
+ openssl_operation<Stream> op(recv_func,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio
+ );
+
+ bytes_transferred = static_cast<size_t>(op.start());
+ }
+ catch (boost::system::system_error& e)
+ {
+ ec = e.code();
+ return 0;
+ }
+
+ ec = boost::system::error_code();
+ return bytes_transferred;
+ }
+
+ // Start an asynchronous read.
+ template <typename Stream, typename Mutable_Buffers, typename Handler>
+ void async_read_some(impl_type& impl, Stream& next_layer,
+ const Mutable_Buffers& buffers, Handler handler)
+ {
+ typedef io_handler<Stream, Handler> recv_handler;
+
+ boost::asio::mutable_buffer buffer =
+ boost::asio::detail::buffer_sequence_adapter<
+ boost::asio::mutable_buffer, Mutable_Buffers>::first(buffers);
+
+ std::size_t buffer_size = boost::asio::buffer_size(buffer);
+ if (buffer_size > max_buffer_size)
+ buffer_size = max_buffer_size;
+ else if (buffer_size == 0)
+ {
+ get_io_service().post(boost::asio::detail::bind_handler(
+ handler, boost::system::error_code(), 0));
+ return;
+ }
+
+ recv_handler* local_handler = new recv_handler(handler, get_io_service());
+
+ boost::function<int (SSL*)> recv_func =
+ boost::bind(boost::type<int>(), &::SSL_read, boost::arg<1>(),
+ boost::asio::buffer_cast<void*>(buffer),
+ static_cast<int>(buffer_size));
+
+ openssl_operation<Stream>* op = new openssl_operation<Stream>
+ (
+ recv_func,
+ next_layer,
+ impl->recv_buf,
+ impl->ssl,
+ impl->ext_bio,
+ boost::bind
+ (
+ &base_handler<Stream>::do_func,
+ local_handler,
+ boost::arg<1>(),
+ boost::arg<2>()
+ ),
+ strand_
+ );
+ local_handler->set_operation(op);
+
+ strand_.post(boost::bind(&openssl_operation<Stream>::start, op));
+ }
+
+ // Peek at the incoming data on the stream.
+ template <typename Stream, typename Mutable_Buffers>
+ std::size_t peek(impl_type& /*impl*/, Stream& /*next_layer*/,
+ const Mutable_Buffers& /*buffers*/, boost::system::error_code& ec)
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+ // Determine the amount of data that may be read without blocking.
+ template <typename Stream>
+ std::size_t in_avail(impl_type& /*impl*/, Stream& /*next_layer*/,
+ boost::system::error_code& ec)
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+private:
+ boost::asio::io_service::strand strand_;
+
+ typedef boost::asio::detail::mutex mutex_type;
+
+ template<typename Mutex>
+ struct ssl_wrap
+ {
+ static Mutex ssl_mutex_;
+
+ static int SSL_accept(SSL *ssl)
+ {
+ typename Mutex::scoped_lock lock(ssl_mutex_);
+ return ::SSL_accept(ssl);
+ }
+
+ static int SSL_connect(SSL *ssl)
+ {
+ typename Mutex::scoped_lock lock(ssl_mutex_);
+ return ::SSL_connect(ssl);
+ }
+
+ static int SSL_shutdown(SSL *ssl)
+ {
+ typename Mutex::scoped_lock lock(ssl_mutex_);
+ return ::SSL_shutdown(ssl);
+ }
+ };
+};
+
+template<typename Mutex>
+Mutex openssl_stream_service::ssl_wrap<Mutex>::ssl_mutex_;
+
+} // namespace detail
+} // namespace old
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_OLD_DETAIL_OPENSSL_STREAM_SERVICE_HPP

Added: branches/release/boost/asio/ssl/old/stream.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/old/stream.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,503 @@
+//
+// ssl/old/stream.hpp
+// ~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_OLD_STREAM_HPP
+#define BOOST_ASIO_SSL_OLD_STREAM_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstddef>
+#include <boost/noncopyable.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/asio/detail/throw_error.hpp>
+#include <boost/asio/error.hpp>
+#include <boost/asio/ssl/basic_context.hpp>
+#include <boost/asio/ssl/stream_base.hpp>
+#include <boost/asio/ssl/stream_service.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace old {
+
+/// Provides stream-oriented functionality using SSL.
+/**
+ * The stream class template provides asynchronous and blocking stream-oriented
+ * functionality using SSL.
+ *
+ * @par Thread Safety
+ * @e Distinct @e objects: Safe._at_n
+ * @e Shared @e objects: Unsafe.
+ *
+ * @par Example
+ * To use the SSL stream template with an ip::tcp::socket, you would write:
+ * @code
+ * boost::asio::io_service io_service;
+ * boost::asio::ssl::context context(io_service, boost::asio::ssl::context::sslv23);
+ * boost::asio::ssl::stream<boost::asio::ip::tcp::socket> sock(io_service, context);
+ * @endcode
+ *
+ * @par Concepts:
+ * AsyncReadStream, AsyncWriteStream, Stream, SyncRead_Stream, SyncWriteStream.
+ */
+template <typename Stream, typename Service = old::stream_service>
+class stream
+ : public stream_base,
+ private boost::noncopyable
+{
+public:
+ /// The type of the next layer.
+ typedef typename boost::remove_reference<Stream>::type next_layer_type;
+
+ /// The type of the lowest layer.
+ typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
+
+ /// The type of the service that will be used to provide stream operations.
+ typedef Service service_type;
+
+ /// The native implementation type of the stream.
+ typedef typename service_type::impl_type impl_type;
+
+ /// Construct a stream.
+ /**
+ * This constructor creates a stream and initialises the underlying stream
+ * object.
+ *
+ * @param arg The argument to be passed to initialise the underlying stream.
+ *
+ * @param context The SSL context to be used for the stream.
+ */
+ template <typename Arg, typename Context_Service>
+ explicit stream(Arg& arg, basic_context<Context_Service>& context)
+ : next_layer_(arg),
+ service_(boost::asio::use_service<Service>(next_layer_.get_io_service())),
+ impl_(service_.null())
+ {
+ service_.create(impl_, next_layer_, context);
+ }
+
+ /// Destructor.
+ ~stream()
+ {
+ service_.destroy(impl_, next_layer_);
+ }
+
+ /// Get the io_service associated with the object.
+ /**
+ * This function may be used to obtain the io_service object that the stream
+ * uses to dispatch handlers for asynchronous operations.
+ *
+ * @return A reference to the io_service object that stream will use to
+ * dispatch handlers. Ownership is not transferred to the caller.
+ */
+ boost::asio::io_service& get_io_service()
+ {
+ return next_layer_.get_io_service();
+ }
+
+ /// Get a reference to the next layer.
+ /**
+ * This function returns a reference to the next layer in a stack of stream
+ * layers.
+ *
+ * @return A reference to the next layer in the stack of stream layers.
+ * Ownership is not transferred to the caller.
+ */
+ next_layer_type& next_layer()
+ {
+ return next_layer_;
+ }
+
+ /// Get a reference to the lowest layer.
+ /**
+ * This function returns a reference to the lowest layer in a stack of
+ * stream layers.
+ *
+ * @return A reference to the lowest layer in the stack of stream layers.
+ * Ownership is not transferred to the caller.
+ */
+ lowest_layer_type& lowest_layer()
+ {
+ return next_layer_.lowest_layer();
+ }
+
+ /// Get a const reference to the lowest layer.
+ /**
+ * This function returns a const reference to the lowest layer in a stack of
+ * stream layers.
+ *
+ * @return A const reference to the lowest layer in the stack of stream
+ * layers. Ownership is not transferred to the caller.
+ */
+ const lowest_layer_type& lowest_layer() const
+ {
+ return next_layer_.lowest_layer();
+ }
+
+ /// Get the underlying implementation in the native type.
+ /**
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to stream functionality that is
+ * not otherwise provided.
+ */
+ impl_type impl()
+ {
+ return impl_;
+ }
+
+ /// Perform SSL handshaking.
+ /**
+ * This function is used to perform SSL handshaking on the stream. The
+ * function call will block until handshaking is complete or an error occurs.
+ *
+ * @param type The type of handshaking to be performed, i.e. as a client or as
+ * a server.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void handshake(handshake_type type)
+ {
+ boost::system::error_code ec;
+ service_.handshake(impl_, next_layer_, type, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Perform SSL handshaking.
+ /**
+ * This function is used to perform SSL handshaking on the stream. The
+ * function call will block until handshaking is complete or an error occurs.
+ *
+ * @param type The type of handshaking to be performed, i.e. as a client or as
+ * a server.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code handshake(handshake_type type,
+ boost::system::error_code& ec)
+ {
+ return service_.handshake(impl_, next_layer_, type, ec);
+ }
+
+ /// Start an asynchronous SSL handshake.
+ /**
+ * This function is used to asynchronously perform an SSL handshake on the
+ * stream. This function call always returns immediately.
+ *
+ * @param type The type of handshaking to be performed, i.e. as a client or as
+ * a server.
+ *
+ * @param handler The handler to be called when the handshake operation
+ * completes. Copies will be made of the handler as required. The equivalent
+ * function signature of the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error // Result of operation.
+ * ); @endcode
+ */
+ template <typename HandshakeHandler>
+ void async_handshake(handshake_type type, HandshakeHandler handler)
+ {
+ service_.async_handshake(impl_, next_layer_, type, handler);
+ }
+
+ /// Shut down SSL on the stream.
+ /**
+ * This function is used to shut down SSL on the stream. The function call
+ * will block until SSL has been shut down or an error occurs.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ void shutdown()
+ {
+ boost::system::error_code ec;
+ service_.shutdown(impl_, next_layer_, ec);
+ boost::asio::detail::throw_error(ec);
+ }
+
+ /// Shut down SSL on the stream.
+ /**
+ * This function is used to shut down SSL on the stream. The function call
+ * will block until SSL has been shut down or an error occurs.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ */
+ boost::system::error_code shutdown(boost::system::error_code& ec)
+ {
+ return service_.shutdown(impl_, next_layer_, ec);
+ }
+
+ /// Asynchronously shut down SSL on the stream.
+ /**
+ * This function is used to asynchronously shut down SSL on the stream. This
+ * function call always returns immediately.
+ *
+ * @param handler The handler to be called when the handshake operation
+ * completes. Copies will be made of the handler as required. The equivalent
+ * function signature of the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error // Result of operation.
+ * ); @endcode
+ */
+ template <typename ShutdownHandler>
+ void async_shutdown(ShutdownHandler handler)
+ {
+ service_.async_shutdown(impl_, next_layer_, handler);
+ }
+
+ /// Write some data to the stream.
+ /**
+ * This function is used to write data on the stream. The function call will
+ * block until one or more bytes of data has been written successfully, or
+ * until an error occurs.
+ *
+ * @param buffers The data to be written.
+ *
+ * @returns The number of bytes written.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note The write_some operation may not transmit all of the data to the
+ * peer. Consider using the @ref write function if you need to ensure that all
+ * data is written before the blocking operation completes.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some(const ConstBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t s = service_.write_some(impl_, next_layer_, buffers, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Write some data to the stream.
+ /**
+ * This function is used to write data on the stream. The function call will
+ * block until one or more bytes of data has been written successfully, or
+ * until an error occurs.
+ *
+ * @param buffers The data to be written to the stream.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes written. Returns 0 if an error occurred.
+ *
+ * @note The write_some operation may not transmit all of the data to the
+ * peer. Consider using the @ref write function if you need to ensure that all
+ * data is written before the blocking operation completes.
+ */
+ template <typename ConstBufferSequence>
+ std::size_t write_some(const ConstBufferSequence& buffers,
+ boost::system::error_code& ec)
+ {
+ return service_.write_some(impl_, next_layer_, buffers, ec);
+ }
+
+ /// Start an asynchronous write.
+ /**
+ * This function is used to asynchronously write one or more bytes of data to
+ * the stream. The function call always returns immediately.
+ *
+ * @param buffers The data to be written to the stream. Although the buffers
+ * object may be copied as necessary, ownership of the underlying buffers is
+ * retained by the caller, which must guarantee that they remain valid until
+ * the handler is called.
+ *
+ * @param handler The handler to be called when the write operation completes.
+ * Copies will be made of the handler as required. The equivalent function
+ * signature of the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes written.
+ * ); @endcode
+ *
+ * @note The async_write_some operation may not transmit all of the data to
+ * the peer. Consider using the @ref async_write function if you need to
+ * ensure that all data is written before the blocking operation completes.
+ */
+ template <typename ConstBufferSequence, typename WriteHandler>
+ void async_write_some(const ConstBufferSequence& buffers,
+ WriteHandler handler)
+ {
+ service_.async_write_some(impl_, next_layer_, buffers, handler);
+ }
+
+ /// Read some data from the stream.
+ /**
+ * This function is used to read data from the stream. The function call will
+ * block until one or more bytes of data has been read successfully, or until
+ * an error occurs.
+ *
+ * @param buffers The buffers into which the data will be read.
+ *
+ * @returns The number of bytes read.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that the
+ * requested amount of data is read before the blocking operation completes.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t s = service_.read_some(impl_, next_layer_, buffers, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Read some data from the stream.
+ /**
+ * This function is used to read data from the stream. The function call will
+ * block until one or more bytes of data has been read successfully, or until
+ * an error occurs.
+ *
+ * @param buffers The buffers into which the data will be read.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes read. Returns 0 if an error occurred.
+ *
+ * @note The read_some operation may not read all of the requested number of
+ * bytes. Consider using the @ref read function if you need to ensure that the
+ * requested amount of data is read before the blocking operation completes.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers,
+ boost::system::error_code& ec)
+ {
+ return service_.read_some(impl_, next_layer_, buffers, ec);
+ }
+
+ /// Start an asynchronous read.
+ /**
+ * This function is used to asynchronously read one or more bytes of data from
+ * the stream. The function call always returns immediately.
+ *
+ * @param buffers The buffers into which the data will be read. Although the
+ * buffers object may be copied as necessary, ownership of the underlying
+ * buffers is retained by the caller, which must guarantee that they remain
+ * valid until the handler is called.
+ *
+ * @param handler The handler to be called when the read operation completes.
+ * Copies will be made of the handler as required. The equivalent function
+ * signature of the handler must be:
+ * @code void handler(
+ * const boost::system::error_code& error, // Result of operation.
+ * std::size_t bytes_transferred // Number of bytes read.
+ * ); @endcode
+ *
+ * @note The async_read_some operation may not read all of the requested
+ * number of bytes. Consider using the @ref async_read function if you need to
+ * ensure that the requested amount of data is read before the asynchronous
+ * operation completes.
+ */
+ template <typename MutableBufferSequence, typename ReadHandler>
+ void async_read_some(const MutableBufferSequence& buffers,
+ ReadHandler handler)
+ {
+ service_.async_read_some(impl_, next_layer_, buffers, handler);
+ }
+
+ /// Peek at the incoming data on the stream.
+ /**
+ * This function is used to peek at the incoming data on the stream, without
+ * removing it from the input queue. The function call will block until data
+ * has been read successfully or an error occurs.
+ *
+ * @param buffers The buffers into which the data will be read.
+ *
+ * @returns The number of bytes read.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t peek(const MutableBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t s = service_.peek(impl_, next_layer_, buffers, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Peek at the incoming data on the stream.
+ /**
+ * This function is used to peek at the incoming data on the stream, withoutxi
+ * removing it from the input queue. The function call will block until data
+ * has been read successfully or an error occurs.
+ *
+ * @param buffers The buffers into which the data will be read.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes read. Returns 0 if an error occurred.
+ */
+ template <typename MutableBufferSequence>
+ std::size_t peek(const MutableBufferSequence& buffers,
+ boost::system::error_code& ec)
+ {
+ return service_.peek(impl_, next_layer_, buffers, ec);
+ }
+
+ /// Determine the amount of data that may be read without blocking.
+ /**
+ * This function is used to determine the amount of data, in bytes, that may
+ * be read from the stream without blocking.
+ *
+ * @returns The number of bytes of data that can be read without blocking.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ */
+ std::size_t in_avail()
+ {
+ boost::system::error_code ec;
+ std::size_t s = service_.in_avail(impl_, next_layer_, ec);
+ boost::asio::detail::throw_error(ec);
+ return s;
+ }
+
+ /// Determine the amount of data that may be read without blocking.
+ /**
+ * This function is used to determine the amount of data, in bytes, that may
+ * be read from the stream without blocking.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes of data that can be read without blocking.
+ */
+ std::size_t in_avail(boost::system::error_code& ec)
+ {
+ return service_.in_avail(impl_, next_layer_, ec);
+ }
+
+private:
+ /// The next layer.
+ Stream next_layer_;
+
+ /// The backend service implementation.
+ service_type& service_;
+
+ /// The underlying native implementation.
+ impl_type impl_;
+};
+
+} // namespace old
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_OLD_STREAM_HPP

Added: branches/release/boost/asio/ssl/old/stream_service.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/old/stream_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,186 @@
+//
+// ssl/old/stream_service.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_OLD_STREAM_SERVICE_HPP
+#define BOOST_ASIO_SSL_OLD_STREAM_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <cstddef>
+#include <boost/noncopyable.hpp>
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/ssl/basic_context.hpp>
+#include <boost/asio/ssl/old/detail/openssl_stream_service.hpp>
+#include <boost/asio/ssl/stream_base.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+namespace old {
+
+/// Default service implementation for an SSL stream.
+class stream_service
+#if defined(GENERATING_DOCUMENTATION)
+ : public boost::asio::io_service::service
+#else
+ : public boost::asio::detail::service_base<stream_service>
+#endif
+{
+private:
+ // The type of the platform-specific implementation.
+ typedef old::detail::openssl_stream_service service_impl_type;
+
+public:
+#if defined(GENERATING_DOCUMENTATION)
+ /// The unique service identifier.
+ static boost::asio::io_service::id id;
+#endif
+
+ /// The type of a stream implementation.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined impl_type;
+#else
+ typedef service_impl_type::impl_type impl_type;
+#endif
+
+ /// Construct a new stream service for the specified io_service.
+ explicit stream_service(boost::asio::io_service& io_service)
+ : boost::asio::detail::service_base<stream_service>(io_service),
+ service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+ {
+ }
+
+ /// Return a null stream implementation.
+ impl_type null() const
+ {
+ return service_impl_.null();
+ }
+
+ /// Create a new stream implementation.
+ template <typename Stream, typename Context_Service>
+ void create(impl_type& impl, Stream& next_layer,
+ basic_context<Context_Service>& context)
+ {
+ service_impl_.create(impl, next_layer, context);
+ }
+
+ /// Destroy a stream implementation.
+ template <typename Stream>
+ void destroy(impl_type& impl, Stream& next_layer)
+ {
+ service_impl_.destroy(impl, next_layer);
+ }
+
+ /// Perform SSL handshaking.
+ template <typename Stream>
+ boost::system::error_code handshake(impl_type& impl, Stream& next_layer,
+ stream_base::handshake_type type, boost::system::error_code& ec)
+ {
+ return service_impl_.handshake(impl, next_layer, type, ec);
+ }
+
+ /// Start an asynchronous SSL handshake.
+ template <typename Stream, typename HandshakeHandler>
+ void async_handshake(impl_type& impl, Stream& next_layer,
+ stream_base::handshake_type type, HandshakeHandler handler)
+ {
+ service_impl_.async_handshake(impl, next_layer, type, handler);
+ }
+
+ /// Shut down SSL on the stream.
+ template <typename Stream>
+ boost::system::error_code shutdown(impl_type& impl, Stream& next_layer,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.shutdown(impl, next_layer, ec);
+ }
+
+ /// Asynchronously shut down SSL on the stream.
+ template <typename Stream, typename ShutdownHandler>
+ void async_shutdown(impl_type& impl, Stream& next_layer,
+ ShutdownHandler handler)
+ {
+ service_impl_.async_shutdown(impl, next_layer, handler);
+ }
+
+ /// Write some data to the stream.
+ template <typename Stream, typename ConstBufferSequence>
+ std::size_t write_some(impl_type& impl, Stream& next_layer,
+ const ConstBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return service_impl_.write_some(impl, next_layer, buffers, ec);
+ }
+
+ /// Start an asynchronous write.
+ template <typename Stream, typename ConstBufferSequence,
+ typename WriteHandler>
+ void async_write_some(impl_type& impl, Stream& next_layer,
+ const ConstBufferSequence& buffers, WriteHandler handler)
+ {
+ service_impl_.async_write_some(impl, next_layer, buffers, handler);
+ }
+
+ /// Read some data from the stream.
+ template <typename Stream, typename MutableBufferSequence>
+ std::size_t read_some(impl_type& impl, Stream& next_layer,
+ const MutableBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return service_impl_.read_some(impl, next_layer, buffers, ec);
+ }
+
+ /// Start an asynchronous read.
+ template <typename Stream, typename MutableBufferSequence,
+ typename ReadHandler>
+ void async_read_some(impl_type& impl, Stream& next_layer,
+ const MutableBufferSequence& buffers, ReadHandler handler)
+ {
+ service_impl_.async_read_some(impl, next_layer, buffers, handler);
+ }
+
+ /// Peek at the incoming data on the stream.
+ template <typename Stream, typename MutableBufferSequence>
+ std::size_t peek(impl_type& impl, Stream& next_layer,
+ const MutableBufferSequence& buffers, boost::system::error_code& ec)
+ {
+ return service_impl_.peek(impl, next_layer, buffers, ec);
+ }
+
+ /// Determine the amount of data that may be read without blocking.
+ template <typename Stream>
+ std::size_t in_avail(impl_type& impl, Stream& next_layer,
+ boost::system::error_code& ec)
+ {
+ return service_impl_.in_avail(impl, next_layer, ec);
+ }
+
+private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ }
+
+ // The service that provides the platform-specific implementation.
+ service_impl_type& service_impl_;
+};
+
+} // namespace old
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_OLD_STREAM_SERVICE_HPP

Added: branches/release/boost/asio/ssl/rfc2818_verification.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/rfc2818_verification.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,102 @@
+//
+// ssl/rfc2818_verification.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_RFC2818_VERIFICATION_HPP
+#define BOOST_ASIO_SSL_RFC2818_VERIFICATION_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <string>
+# include <boost/asio/ssl/detail/openssl_types.hpp>
+# include <boost/asio/ssl/verify_context.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+/// Verifies a certificate against a hostname according to the rules described
+/// in RFC 2818.
+/**
+ * @par Example
+ * The following example shows how to synchronously open a secure connection to
+ * a given host name:
+ * @code
+ * using boost::asio::ip::tcp;
+ * namespace ssl = boost::asio::ssl;
+ * typedef ssl::stream<tcp::socket> ssl_socket;
+ *
+ * // Create a context that uses the default paths for finding CA certificates.
+ * ssl::context ctx(ssl::context::sslv23);
+ * ctx.set_default_verify_paths();
+ *
+ * // Open a socket and connect it to the remote host.
+ * boost::asio::io_service io_service;
+ * ssl_socket sock(io_service, ctx);
+ * tcp::resolver resolver(io_service);
+ * tcp::resolver::query query("host.name", "https");
+ * boost::asio::connect(sock.lowest_layer(), resolver.resolve(query));
+ * sock.lowest_layer().set_option(tcp::no_delay(true));
+ *
+ * // Perform SSL handshake and verify the remote host's certificate.
+ * sock.set_verify_mode(ssl::verify_peer);
+ * sock.set_verify_callback(ssl::rfc2818_verification("host.name"));
+ * sock.handshake(ssl_socket::client);
+ *
+ * // ... read and write as normal ...
+ * @endcode
+ */
+class rfc2818_verification
+{
+public:
+ /// The type of the function object's result.
+ typedef bool result_type;
+
+ /// Constructor.
+ explicit rfc2818_verification(const std::string& host)
+ : host_(host)
+ {
+ }
+
+ /// Perform certificate verification.
+ BOOST_ASIO_DECL bool operator()(bool preverified, verify_context& ctx) const;
+
+private:
+ // Helper function to check a host name against a pattern.
+ BOOST_ASIO_DECL static bool match_pattern(const char* pattern,
+ std::size_t pattern_length, const char* host);
+
+ // Helper function to check a host name against an IPv4 address
+ // The host name to be checked.
+ std::string host_;
+};
+
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#if defined(BOOST_ASIO_HEADER_ONLY)
+# include <boost/asio/ssl/impl/rfc2818_verification.ipp>
+#endif // defined(BOOST_ASIO_HEADER_ONLY)
+
+#endif // BOOST_ASIO_SSL_RFC2818_VERIFICATION_HPP

Modified: branches/release/boost/asio/ssl/stream.hpp
==============================================================================
--- branches/release/boost/asio/ssl/stream.hpp (original)
+++ branches/release/boost/asio/ssl/stream.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,8 +2,7 @@
 // ssl/stream.hpp
 // ~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -17,14 +16,23 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <cstddef>
-#include <boost/noncopyable.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/asio/detail/throw_error.hpp>
-#include <boost/asio/error.hpp>
-#include <boost/asio/ssl/basic_context.hpp>
-#include <boost/asio/ssl/stream_base.hpp>
-#include <boost/asio/ssl/stream_service.hpp>
+
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/old/stream.hpp>
+#else // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/detail/buffer_sequence_adapter.hpp>
+# include <boost/asio/detail/handler_type_requirements.hpp>
+# include <boost/asio/detail/noncopyable.hpp>
+# include <boost/asio/ssl/context.hpp>
+# include <boost/asio/ssl/detail/handshake_op.hpp>
+# include <boost/asio/ssl/detail/io.hpp>
+# include <boost/asio/ssl/detail/read_op.hpp>
+# include <boost/asio/ssl/detail/shutdown_op.hpp>
+# include <boost/asio/ssl/detail/stream_core.hpp>
+# include <boost/asio/ssl/detail/write_op.hpp>
+# include <boost/asio/ssl/stream_base.hpp>
+# include <boost/type_traits/remove_reference.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -32,6 +40,12 @@
 namespace asio {
 namespace ssl {
 
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+using boost::asio::ssl::old::stream;
+
+#else // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
 /// Provides stream-oriented functionality using SSL.
 /**
  * The stream class template provides asynchronous and blocking stream-oriented
@@ -39,37 +53,45 @@
  *
  * @par Thread Safety
  * @e Distinct @e objects: Safe._at_n
- * @e Shared @e objects: Unsafe.
+ * @e Shared @e objects: Unsafe. The application must also ensure that all
+ * asynchronous operations are performed within the same implicit or explicit
+ * strand.
  *
  * @par Example
  * To use the SSL stream template with an ip::tcp::socket, you would write:
  * @code
  * boost::asio::io_service io_service;
- * boost::asio::ssl::context context(io_service, boost::asio::ssl::context::sslv23);
- * boost::asio::ssl::stream<boost::asio::ip::tcp::socket> sock(io_service, context);
+ * boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23);
+ * boost::asio::ssl::stream<asio:ip::tcp::socket> sock(io_service, ctx);
  * @endcode
  *
  * @par Concepts:
- * AsyncReadStream, AsyncWriteStream, Stream, SyncRead_Stream, SyncWriteStream.
+ * AsyncReadStream, AsyncWriteStream, Stream, SyncReadStream, SyncWriteStream.
  */
-template <typename Stream, typename Service = stream_service>
-class stream
- : public stream_base,
- private boost::noncopyable
+template <typename Stream>
+class stream :
+ public stream_base,
+ private noncopyable
 {
 public:
+ /// The native handle type of the SSL stream.
+ typedef SSL* native_handle_type;
+
+ /// Structure for use with deprecated impl_type.
+ struct impl_struct
+ {
+ SSL* ssl;
+ };
+
+ /// (Deprecated: Use native_handle_type.) The underlying implementation type.
+ typedef impl_struct* impl_type;
+
   /// The type of the next layer.
   typedef typename boost::remove_reference<Stream>::type next_layer_type;
 
   /// The type of the lowest layer.
   typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
 
- /// The type of the service that will be used to provide stream operations.
- typedef Service service_type;
-
- /// The native implementation type of the stream.
- typedef typename service_type::impl_type impl_type;
-
   /// Construct a stream.
   /**
    * This constructor creates a stream and initialises the underlying stream
@@ -77,25 +99,22 @@
    *
    * @param arg The argument to be passed to initialise the underlying stream.
    *
- * @param context The SSL context to be used for the stream.
+ * @param ctx The SSL context to be used for the stream.
    */
- template <typename Arg, typename Context_Service>
- explicit stream(Arg& arg, basic_context<Context_Service>& context)
+ template <typename Arg>
+ stream(Arg& arg, context& ctx)
     : next_layer_(arg),
- service_(boost::asio::use_service<Service>(next_layer_.get_io_service())),
- impl_(service_.null())
+ core_(ctx.native_handle(), next_layer_.lowest_layer().get_io_service())
   {
- service_.create(impl_, next_layer_, context);
+ backwards_compatible_impl_.ssl = core_.engine_.native_handle();
   }
 
   /// Destructor.
   ~stream()
   {
- service_.destroy(impl_, next_layer_);
   }
 
- /// (Deprecated: use get_io_service().) Get the io_service associated with
- /// the object.
+ /// Get the io_service associated with the object.
   /**
    * This function may be used to obtain the io_service object that the stream
    * uses to dispatch handlers for asynchronous operations.
@@ -103,22 +122,63 @@
    * @return A reference to the io_service object that stream will use to
    * dispatch handlers. Ownership is not transferred to the caller.
    */
- boost::asio::io_service& io_service()
+ boost::asio::io_service& get_io_service()
   {
- return next_layer_.get_io_service();
+ return next_layer_.lowest_layer().get_io_service();
   }
 
- /// Get the io_service associated with the object.
+ /// Get the underlying implementation in the native type.
   /**
- * This function may be used to obtain the io_service object that the stream
- * uses to dispatch handlers for asynchronous operations.
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to context functionality that is
+ * not otherwise provided.
    *
- * @return A reference to the io_service object that stream will use to
- * dispatch handlers. Ownership is not transferred to the caller.
+ * @par Example
+ * The native_handle() function returns a pointer of type @c SSL* that is
+ * suitable for passing to functions such as @c SSL_get_verify_result and
+ * @c SSL_get_peer_certificate:
+ * @code
+ * boost::asio::ssl::stream<asio:ip::tcp::socket> sock(io_service, ctx);
+ *
+ * // ... establish connection and perform handshake ...
+ *
+ * if (X509* cert = SSL_get_peer_certificate(sock.native_handle()))
+ * {
+ * if (SSL_get_verify_result(sock.native_handle()) == X509_V_OK)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
    */
- boost::asio::io_service& get_io_service()
+ native_handle_type native_handle()
+ {
+ return core_.engine_.native_handle();
+ }
+
+ /// (Deprecated: Use native_handle().) Get the underlying implementation in
+ /// the native type.
+ /**
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to stream functionality that is
+ * not otherwise provided.
+ */
+ impl_type impl()
+ {
+ return &backwards_compatible_impl_;
+ }
+
+ /// Get a reference to the next layer.
+ /**
+ * This function returns a reference to the next layer in a stack of stream
+ * layers.
+ *
+ * @return A reference to the next layer in the stack of stream layers.
+ * Ownership is not transferred to the caller.
+ */
+ const next_layer_type& next_layer() const
   {
- return next_layer_.get_io_service();
+ return next_layer_;
   }
 
   /// Get a reference to the next layer.
@@ -147,28 +207,106 @@
     return next_layer_.lowest_layer();
   }
 
- /// Get a const reference to the lowest layer.
+ /// Get a reference to the lowest layer.
   /**
- * This function returns a const reference to the lowest layer in a stack of
+ * This function returns a reference to the lowest layer in a stack of
    * stream layers.
    *
- * @return A const reference to the lowest layer in the stack of stream
- * layers. Ownership is not transferred to the caller.
+ * @return A reference to the lowest layer in the stack of stream layers.
+ * Ownership is not transferred to the caller.
    */
   const lowest_layer_type& lowest_layer() const
   {
     return next_layer_.lowest_layer();
   }
 
- /// Get the underlying implementation in the native type.
+ /// Set the peer verification mode.
   /**
- * This function may be used to obtain the underlying implementation of the
- * context. This is intended to allow access to stream functionality that is
- * not otherwise provided.
+ * This function may be used to configure the peer verification mode used by
+ * the stream. The new mode will override the mode inherited from the context.
+ *
+ * @param v A bitmask of peer verification modes. See @ref verify_mode for
+ * available values.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_set_verify.
    */
- impl_type impl()
+ void set_verify_mode(verify_mode v)
   {
- return impl_;
+ boost::system::error_code ec;
+ set_verify_mode(v, ec);
+ boost::asio::detail::throw_error(ec, "set_verify_mode");
+ }
+
+ /// Set the peer verification mode.
+ /**
+ * This function may be used to configure the peer verification mode used by
+ * the stream. The new mode will override the mode inherited from the context.
+ *
+ * @param v A bitmask of peer verification modes. See @ref verify_mode for
+ * available values.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_set_verify.
+ */
+ boost::system::error_code set_verify_mode(
+ verify_mode v, boost::system::error_code& ec)
+ {
+ return core_.engine_.set_verify_mode(v, ec);
+ }
+
+ /// Set the callback used to verify peer certificates.
+ /**
+ * This function is used to specify a callback function that will be called
+ * by the implementation when it needs to verify a peer certificate.
+ *
+ * @param callback The function object to be used for verifying a certificate.
+ * The function signature of the handler must be:
+ * @code bool verify_callback(
+ * bool preverified, // True if the certificate passed pre-verification.
+ * verify_context& ctx // The peer certificate and other context.
+ * ); @endcode
+ * The return value of the callback is true if the certificate has passed
+ * verification, false otherwise.
+ *
+ * @throws boost::system::system_error Thrown on failure.
+ *
+ * @note Calls @c SSL_set_verify.
+ */
+ template <typename VerifyCallback>
+ void set_verify_callback(VerifyCallback callback)
+ {
+ boost::system::error_code ec;
+ this->set_verify_callback(callback, ec);
+ boost::asio::detail::throw_error(ec, "set_verify_callback");
+ }
+
+ /// Set the callback used to verify peer certificates.
+ /**
+ * This function is used to specify a callback function that will be called
+ * by the implementation when it needs to verify a peer certificate.
+ *
+ * @param callback The function object to be used for verifying a certificate.
+ * The function signature of the handler must be:
+ * @code bool verify_callback(
+ * bool preverified, // True if the certificate passed pre-verification.
+ * verify_context& ctx // The peer certificate and other context.
+ * ); @endcode
+ * The return value of the callback is true if the certificate has passed
+ * verification, false otherwise.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @note Calls @c SSL_set_verify.
+ */
+ template <typename VerifyCallback>
+ boost::system::error_code set_verify_callback(VerifyCallback callback,
+ boost::system::error_code& ec)
+ {
+ return core_.engine_.set_verify_callback(
+ new detail::verify_callback<VerifyCallback>(callback), ec);
   }
 
   /// Perform SSL handshaking.
@@ -184,8 +322,8 @@
   void handshake(handshake_type type)
   {
     boost::system::error_code ec;
- service_.handshake(impl_, next_layer_, type, ec);
- boost::asio::detail::throw_error(ec);
+ handshake(type, ec);
+ boost::asio::detail::throw_error(ec, "handshake");
   }
 
   /// Perform SSL handshaking.
@@ -201,7 +339,8 @@
   boost::system::error_code handshake(handshake_type type,
       boost::system::error_code& ec)
   {
- return service_.handshake(impl_, next_layer_, type, ec);
+ detail::io(next_layer_, core_, detail::handshake_op(type), ec);
+ return ec;
   }
 
   /// Start an asynchronous SSL handshake.
@@ -220,9 +359,15 @@
    * ); @endcode
    */
   template <typename HandshakeHandler>
- void async_handshake(handshake_type type, HandshakeHandler handler)
+ void async_handshake(handshake_type type,
+ BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
   {
- service_.async_handshake(impl_, next_layer_, type, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a HandshakeHandler.
+ BOOST_ASIO_HANDSHAKE_HANDLER_CHECK(HandshakeHandler, handler) type_check;
+
+ detail::async_io(next_layer_, core_, detail::handshake_op(type),
+ BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
   }
 
   /// Shut down SSL on the stream.
@@ -235,8 +380,8 @@
   void shutdown()
   {
     boost::system::error_code ec;
- service_.shutdown(impl_, next_layer_, ec);
- boost::asio::detail::throw_error(ec);
+ shutdown(ec);
+ boost::asio::detail::throw_error(ec, "shutdown");
   }
 
   /// Shut down SSL on the stream.
@@ -248,7 +393,8 @@
    */
   boost::system::error_code shutdown(boost::system::error_code& ec)
   {
- return service_.shutdown(impl_, next_layer_, ec);
+ detail::io(next_layer_, core_, detail::shutdown_op(), ec);
+ return ec;
   }
 
   /// Asynchronously shut down SSL on the stream.
@@ -264,9 +410,14 @@
    * ); @endcode
    */
   template <typename ShutdownHandler>
- void async_shutdown(ShutdownHandler handler)
+ void async_shutdown(BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
   {
- service_.async_shutdown(impl_, next_layer_, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ShutdownHandler.
+ BOOST_ASIO_SHUTDOWN_HANDLER_CHECK(ShutdownHandler, handler) type_check;
+
+ detail::async_io(next_layer_, core_, detail::shutdown_op(),
+ BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler));
   }
 
   /// Write some data to the stream.
@@ -289,9 +440,9 @@
   std::size_t write_some(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = service_.write_some(impl_, next_layer_, buffers, ec);
- boost::asio::detail::throw_error(ec);
- return s;
+ std::size_t n = write_some(buffers, ec);
+ boost::asio::detail::throw_error(ec, "write_some");
+ return n;
   }
 
   /// Write some data to the stream.
@@ -314,7 +465,8 @@
   std::size_t write_some(const ConstBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return service_.write_some(impl_, next_layer_, buffers, ec);
+ return detail::io(next_layer_, core_,
+ detail::write_op<ConstBufferSequence>(buffers), ec);
   }
 
   /// Start an asynchronous write.
@@ -341,9 +493,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_.async_write_some(impl_, next_layer_, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ detail::async_io(next_layer_, core_,
+ detail::write_op<ConstBufferSequence>(buffers),
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -366,9 +524,9 @@
   std::size_t read_some(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = service_.read_some(impl_, next_layer_, buffers, ec);
- boost::asio::detail::throw_error(ec);
- return s;
+ std::size_t n = read_some(buffers, ec);
+ boost::asio::detail::throw_error(ec, "read_some");
+ return n;
   }
 
   /// Read some data from the stream.
@@ -391,7 +549,8 @@
   std::size_t read_some(const MutableBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return service_.read_some(impl_, next_layer_, buffers, ec);
+ return detail::io(next_layer_, core_,
+ detail::read_op<MutableBufferSequence>(buffers), ec);
   }
 
   /// Start an asynchronous read.
@@ -419,93 +578,25 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_.async_read_some(impl_, next_layer_, buffers, handler);
- }
-
- /// Peek at the incoming data on the stream.
- /**
- * This function is used to peek at the incoming data on the stream, without
- * removing it from the input queue. The function call will block until data
- * has been read successfully or an error occurs.
- *
- * @param buffers The buffers into which the data will be read.
- *
- * @returns The number of bytes read.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- template <typename MutableBufferSequence>
- std::size_t peek(const MutableBufferSequence& buffers)
- {
- boost::system::error_code ec;
- std::size_t s = service_.peek(impl_, next_layer_, buffers, ec);
- boost::asio::detail::throw_error(ec);
- return s;
- }
-
- /// Peek at the incoming data on the stream.
- /**
- * This function is used to peek at the incoming data on the stream, withoutxi
- * removing it from the input queue. The function call will block until data
- * has been read successfully or an error occurs.
- *
- * @param buffers The buffers into which the data will be read.
- *
- * @param ec Set to indicate what error occurred, if any.
- *
- * @returns The number of bytes read. Returns 0 if an error occurred.
- */
- template <typename MutableBufferSequence>
- std::size_t peek(const MutableBufferSequence& buffers,
- boost::system::error_code& ec)
- {
- return service_.peek(impl_, next_layer_, buffers, ec);
- }
-
- /// Determine the amount of data that may be read without blocking.
- /**
- * This function is used to determine the amount of data, in bytes, that may
- * be read from the stream without blocking.
- *
- * @returns The number of bytes of data that can be read without blocking.
- *
- * @throws boost::system::system_error Thrown on failure.
- */
- std::size_t in_avail()
- {
- boost::system::error_code ec;
- std::size_t s = service_.in_avail(impl_, next_layer_, ec);
- boost::asio::detail::throw_error(ec);
- return s;
- }
-
- /// Determine the amount of data that may be read without blocking.
- /**
- * This function is used to determine the amount of data, in bytes, that may
- * be read from the stream without blocking.
- *
- * @param ec Set to indicate what error occurred, if any.
- *
- * @returns The number of bytes of data that can be read without blocking.
- */
- std::size_t in_avail(boost::system::error_code& ec)
- {
- return service_.in_avail(impl_, next_layer_, ec);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ detail::async_io(next_layer_, core_,
+ detail::read_op<MutableBufferSequence>(buffers),
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
- /// The next layer.
   Stream next_layer_;
-
- /// The backend service implementation.
- service_type& service_;
-
- /// The underlying native implementation.
- impl_type impl_;
+ detail::stream_core core_;
+ impl_struct backwards_compatible_impl_;
 };
 
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
 } // namespace ssl
 } // namespace asio
 } // namespace boost

Modified: branches/release/boost/asio/ssl/stream_base.hpp
==============================================================================
--- branches/release/boost/asio/ssl/stream_base.hpp (original)
+++ branches/release/boost/asio/ssl/stream_base.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,7 +2,7 @@
 // ssl/stream_base.hpp
 // ~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)

Modified: branches/release/boost/asio/ssl/stream_service.hpp
==============================================================================
--- branches/release/boost/asio/ssl/stream_service.hpp (original)
+++ branches/release/boost/asio/ssl/stream_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -2,8 +2,7 @@
 // ssl/stream_service.hpp
 // ~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2011 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)
@@ -17,12 +16,10 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
-#include <cstddef>
-#include <boost/noncopyable.hpp>
-#include <boost/asio/io_service.hpp>
-#include <boost/asio/ssl/basic_context.hpp>
-#include <boost/asio/ssl/detail/openssl_stream_service.hpp>
-#include <boost/asio/ssl/stream_base.hpp>
+
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/ssl/old/stream_service.hpp>
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -30,150 +27,11 @@
 namespace asio {
 namespace ssl {
 
-/// Default service implementation for an SSL stream.
-class stream_service
-#if defined(GENERATING_DOCUMENTATION)
- : public boost::asio::io_service::service
-#else
- : public boost::asio::detail::service_base<stream_service>
-#endif
-{
-private:
- // The type of the platform-specific implementation.
- typedef detail::openssl_stream_service service_impl_type;
-
-public:
-#if defined(GENERATING_DOCUMENTATION)
- /// The unique service identifier.
- static boost::asio::io_service::id id;
-#endif
-
- /// The type of a stream implementation.
-#if defined(GENERATING_DOCUMENTATION)
- typedef implementation_defined impl_type;
-#else
- typedef service_impl_type::impl_type impl_type;
-#endif
-
- /// Construct a new stream service for the specified io_service.
- explicit stream_service(boost::asio::io_service& io_service)
- : boost::asio::detail::service_base<stream_service>(io_service),
- service_impl_(boost::asio::use_service<service_impl_type>(io_service))
- {
- }
-
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- }
-
- /// Return a null stream implementation.
- impl_type null() const
- {
- return service_impl_.null();
- }
-
- /// Create a new stream implementation.
- template <typename Stream, typename Context_Service>
- void create(impl_type& impl, Stream& next_layer,
- basic_context<Context_Service>& context)
- {
- service_impl_.create(impl, next_layer, context);
- }
-
- /// Destroy a stream implementation.
- template <typename Stream>
- void destroy(impl_type& impl, Stream& next_layer)
- {
- service_impl_.destroy(impl, next_layer);
- }
-
- /// Perform SSL handshaking.
- template <typename Stream>
- boost::system::error_code handshake(impl_type& impl, Stream& next_layer,
- stream_base::handshake_type type, boost::system::error_code& ec)
- {
- return service_impl_.handshake(impl, next_layer, type, ec);
- }
-
- /// Start an asynchronous SSL handshake.
- template <typename Stream, typename HandshakeHandler>
- void async_handshake(impl_type& impl, Stream& next_layer,
- stream_base::handshake_type type, HandshakeHandler handler)
- {
- service_impl_.async_handshake(impl, next_layer, type, handler);
- }
-
- /// Shut down SSL on the stream.
- template <typename Stream>
- boost::system::error_code shutdown(impl_type& impl, Stream& next_layer,
- boost::system::error_code& ec)
- {
- return service_impl_.shutdown(impl, next_layer, ec);
- }
-
- /// Asynchronously shut down SSL on the stream.
- template <typename Stream, typename ShutdownHandler>
- void async_shutdown(impl_type& impl, Stream& next_layer,
- ShutdownHandler handler)
- {
- service_impl_.async_shutdown(impl, next_layer, handler);
- }
-
- /// Write some data to the stream.
- template <typename Stream, typename ConstBufferSequence>
- std::size_t write_some(impl_type& impl, Stream& next_layer,
- const ConstBufferSequence& buffers, boost::system::error_code& ec)
- {
- return service_impl_.write_some(impl, next_layer, buffers, ec);
- }
-
- /// Start an asynchronous write.
- template <typename Stream, typename ConstBufferSequence,
- typename WriteHandler>
- void async_write_some(impl_type& impl, Stream& next_layer,
- const ConstBufferSequence& buffers, WriteHandler handler)
- {
- service_impl_.async_write_some(impl, next_layer, buffers, handler);
- }
-
- /// Read some data from the stream.
- template <typename Stream, typename MutableBufferSequence>
- std::size_t read_some(impl_type& impl, Stream& next_layer,
- const MutableBufferSequence& buffers, boost::system::error_code& ec)
- {
- return service_impl_.read_some(impl, next_layer, buffers, ec);
- }
-
- /// Start an asynchronous read.
- template <typename Stream, typename MutableBufferSequence,
- typename ReadHandler>
- void async_read_some(impl_type& impl, Stream& next_layer,
- const MutableBufferSequence& buffers, ReadHandler handler)
- {
- service_impl_.async_read_some(impl, next_layer, buffers, handler);
- }
-
- /// Peek at the incoming data on the stream.
- template <typename Stream, typename MutableBufferSequence>
- std::size_t peek(impl_type& impl, Stream& next_layer,
- const MutableBufferSequence& buffers, boost::system::error_code& ec)
- {
- return service_impl_.peek(impl, next_layer, buffers, ec);
- }
-
- /// Determine the amount of data that may be read without blocking.
- template <typename Stream>
- std::size_t in_avail(impl_type& impl, Stream& next_layer,
- boost::system::error_code& ec)
- {
- return service_impl_.in_avail(impl, next_layer, ec);
- }
-
-private:
- // The service that provides the platform-specific implementation.
- service_impl_type& service_impl_;
-};
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+using boost::asio::ssl::old::stream_service;
+
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
 } // namespace ssl
 } // namespace asio

Added: branches/release/boost/asio/ssl/verify_context.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/verify_context.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,75 @@
+//
+// ssl/verify_context.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP
+#define BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/detail/noncopyable.hpp>
+# include <boost/asio/ssl/detail/openssl_types.hpp>
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+/// A simple wrapper around the X509_STORE_CTX type, used during verification of
+/// a peer certificate.
+/**
+ * @note The verify_context does not own the underlying X509_STORE_CTX object.
+ */
+class verify_context
+ : private noncopyable
+{
+public:
+ /// The native handle type of the verification context.
+ typedef X509_STORE_CTX* native_handle_type;
+
+ /// Constructor.
+ explicit verify_context(native_handle_type handle)
+ : handle_(handle)
+ {
+ }
+
+ /// Get the underlying implementation in the native type.
+ /**
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to context functionality that is
+ * not otherwise provided.
+ */
+ native_handle_type native_handle()
+ {
+ return handle_;
+ }
+
+private:
+ // The underlying native implementation.
+ native_handle_type handle_;
+};
+
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_VERIFY_CONTEXT_HPP

Added: branches/release/boost/asio/ssl/verify_mode.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/asio/ssl/verify_mode.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,65 @@
+//
+// ssl/verify_mode.hpp
+// ~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef BOOST_ASIO_SSL_VERIFY_MODE_HPP
+#define BOOST_ASIO_SSL_VERIFY_MODE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/ssl/detail/openssl_types.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace ssl {
+
+/// Bitmask type for peer verification.
+/**
+ * Possible values are:
+ *
+ * @li @ref verify_none
+ * @li @ref verify_peer
+ * @li @ref verify_fail_if_no_peer_cert
+ * @li @ref verify_client_once
+ */
+typedef int verify_mode;
+
+#if defined(GENERATING_DOCUMENTATION)
+/// No verification.
+const int verify_none = implementation_defined;
+
+/// Verify the peer.
+const int verify_peer = implementation_defined;
+
+/// Fail verification if the peer has no certificate. Ignored unless
+/// @ref verify_peer is set.
+const int verify_fail_if_no_peer_cert = implementation_defined;
+
+/// Do not request client certificate on renegotiation. Ignored unless
+/// @ref verify_peer is set.
+const int verify_client_once = implementation_defined;
+#else
+const int verify_none = SSL_VERIFY_NONE;
+const int verify_peer = SSL_VERIFY_PEER;
+const int verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+const int verify_client_once = SSL_VERIFY_CLIENT_ONCE;
+#endif
+
+} // namespace ssl
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_SSL_VERIFY_MODE_HPP

Modified: branches/release/boost/asio/strand.hpp
==============================================================================
--- branches/release/boost/asio/strand.hpp (original)
+++ branches/release/boost/asio/strand.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,6 +16,7 @@
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
 #include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/strand_service.hpp>
 #include <boost/asio/detail/wrapped_handler.hpp>
 #include <boost/asio/io_service.hpp>
@@ -107,20 +108,6 @@
     service_.destroy(impl_);
   }
 
- /// (Deprecated: use get_io_service().) Get the io_service associated with
- /// the strand.
- /**
- * This function may be used to obtain the io_service object that the strand
- * uses to dispatch handlers for asynchronous operations.
- *
- * @return A reference to the io_service object that the strand will use to
- * dispatch handlers. Ownership is not transferred to the caller.
- */
- boost::asio::io_service& io_service()
- {
- return service_.get_io_service();
- }
-
   /// Get the io_service associated with the strand.
   /**
    * This function may be used to obtain the io_service object that the strand
@@ -153,10 +140,14 @@
    * handler object as required. The function signature of the handler must be:
    * @code void handler(); @endcode
    */
- template <typename Handler>
- void dispatch(Handler handler)
+ template <typename CompletionHandler>
+ void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
   {
- service_.dispatch(impl_, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a CompletionHandler.
+ BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
+
+ service_.dispatch(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
   }
 
   /// Request the strand to invoke the given handler and return
@@ -175,10 +166,14 @@
    * handler object as required. The function signature of the handler must be:
    * @code void handler(); @endcode
    */
- template <typename Handler>
- void post(Handler handler)
+ template <typename CompletionHandler>
+ void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
   {
- service_.post(impl_, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a CompletionHandler.
+ BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
+
+ service_.post(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
   }
 
   /// Create a new handler that automatically dispatches the wrapped handler

Modified: branches/release/boost/asio/stream_socket_service.hpp
==============================================================================
--- branches/release/boost/asio/stream_socket_service.hpp (original)
+++ branches/release/boost/asio/stream_socket_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -68,11 +68,18 @@
   typedef typename service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native socket type.
+ /// (Deprecated: Use native_handle_type.) The native socket type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef typename service_impl_type::native_type native_type;
+ typedef typename service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native socket type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef typename service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new stream socket service for the specified io_service.
@@ -83,18 +90,29 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new stream socket implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new stream socket implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another stream socket implementation.
+ void move_assign(implementation_type& impl,
+ stream_socket_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a stream socket implementation.
   void destroy(implementation_type& impl)
   {
@@ -114,7 +132,7 @@
 
   /// Assign an existing native socket to a stream socket.
   boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_type& native_socket,
+ const protocol_type& protocol, const native_handle_type& native_socket,
       boost::system::error_code& ec)
   {
     return service_impl_.assign(impl, protocol, native_socket, ec);
@@ -133,10 +151,16 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native socket implementation.
+ /// (Deprecated: Use native_handle().) Get the native socket implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native socket implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
   }
 
   /// Cancel all asynchronous operations associated with the socket.
@@ -177,9 +201,11 @@
   /// Start an asynchronous connect.
   template <typename ConnectHandler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, ConnectHandler handler)
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
- service_impl_.async_connect(impl, peer_endpoint, handler);
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set a socket option.
@@ -206,6 +232,32 @@
     return service_impl_.io_control(impl, command, ec);
   }
 
+ /// Gets the non-blocking mode of the socket.
+ bool non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the socket.
+ boost::system::error_code non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.non_blocking(impl, mode, ec);
+ }
+
+ /// Gets the non-blocking mode of the native socket implementation.
+ bool native_non_blocking(const implementation_type& impl) const
+ {
+ return service_impl_.native_non_blocking(impl);
+ }
+
+ /// Sets the non-blocking mode of the native socket implementation.
+ boost::system::error_code native_non_blocking(implementation_type& impl,
+ bool mode, boost::system::error_code& ec)
+ {
+ return service_impl_.native_non_blocking(impl, mode, ec);
+ }
+
   /// Get the local endpoint.
   endpoint_type local_endpoint(const implementation_type& impl,
       boost::system::error_code& ec) const
@@ -240,9 +292,11 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(implementation_type& impl,
       const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send(impl, buffers, flags, handler);
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data from the peer.
@@ -258,12 +312,20 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_receive(impl, buffers, flags, handler);
+ service_impl_.async_receive(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/version.hpp
==============================================================================
--- branches/release/boost/asio/version.hpp (original)
+++ branches/release/boost/asio/version.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,6 +18,6 @@
 // BOOST_ASIO_VERSION % 100 is the sub-minor version
 // BOOST_ASIO_VERSION / 100 % 1000 is the minor version
 // BOOST_ASIO_VERSION / 100000 is the major version
-#define BOOST_ASIO_VERSION 100409 // 1.4.9
+#define BOOST_ASIO_VERSION 100600 // 1.6.0
 
 #endif // BOOST_ASIO_VERSION_HPP

Modified: branches/release/boost/asio/windows/basic_handle.hpp
==============================================================================
--- branches/release/boost/asio/windows/basic_handle.hpp (original)
+++ branches/release/boost/asio/windows/basic_handle.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -45,8 +45,12 @@
   : public basic_io_object<HandleService>
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// handle.
+ typedef typename HandleService::native_handle_type native_type;
+
   /// The native representation of a handle.
- typedef typename HandleService::native_type native_type;
+ typedef typename HandleService::native_handle_type native_handle_type;
 
   /// A basic_handle is always the lowest layer.
   typedef basic_handle<HandleService> lowest_layer_type;
@@ -70,18 +74,51 @@
    * @param io_service The io_service object that the handle will use to
    * dispatch handlers for any asynchronous operations performed on the handle.
    *
- * @param native_handle A native handle.
+ * @param handle A native handle.
    *
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_handle(boost::asio::io_service& io_service,
- const native_type& native_handle)
+ const native_handle_type& handle)
     : basic_io_object<HandleService>(io_service)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, native_handle, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(), handle, ec);
+ boost::asio::detail::throw_error(ec, "assign");
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_handle from another.
+ /**
+ * This constructor moves a handle from one object to another.
+ *
+ * @param other The other basic_handle object from which the move will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_handle(io_service&) constructor.
+ */
+ basic_handle(basic_handle&& other)
+ : basic_io_object<HandleService>(
+ BOOST_ASIO_MOVE_CAST(basic_handle)(other))
+ {
+ }
+
+ /// Move-assign a basic_handle from another.
+ /**
+ * This assignment operator moves a handle from one object to another.
+ *
+ * @param other The other basic_handle object from which the move will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_handle(io_service&) constructor.
+ */
+ basic_handle& operator=(basic_handle&& other)
+ {
+ basic_io_object<HandleService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_handle)(other));
+ return *this;
   }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
 
   /// Get a reference to the lowest layer.
   /**
@@ -115,35 +152,35 @@
   /*
    * This function opens the handle to hold an existing native handle.
    *
- * @param native_handle A native handle.
+ * @param handle A native handle.
    *
    * @throws boost::system::system_error Thrown on failure.
    */
- void assign(const native_type& native_handle)
+ void assign(const native_handle_type& handle)
   {
     boost::system::error_code ec;
- this->service.assign(this->implementation, native_handle, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().assign(this->get_implementation(), handle, ec);
+ boost::asio::detail::throw_error(ec, "assign");
   }
 
   /// Assign an existing native handle to the handle.
   /*
    * This function opens the handle to hold an existing native handle.
    *
- * @param native_handle A native handle.
+ * @param handle A native handle.
    *
    * @param ec Set to indicate what error occurred, if any.
    */
- boost::system::error_code assign(const native_type& native_handle,
+ boost::system::error_code assign(const native_handle_type& handle,
       boost::system::error_code& ec)
   {
- return this->service.assign(this->implementation, native_handle, ec);
+ return this->get_service().assign(this->get_implementation(), handle, ec);
   }
 
   /// Determine whether the handle is open.
   bool is_open() const
   {
- return this->service.is_open(this->implementation);
+ return this->get_service().is_open(this->get_implementation());
   }
 
   /// Close the handle.
@@ -157,8 +194,8 @@
   void close()
   {
     boost::system::error_code ec;
- this->service.close(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().close(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "close");
   }
 
   /// Close the handle.
@@ -171,10 +208,10 @@
    */
   boost::system::error_code close(boost::system::error_code& ec)
   {
- return this->service.close(this->implementation, ec);
+ return this->get_service().close(this->get_implementation(), ec);
   }
 
- /// Get the native handle representation.
+ /// (Deprecated: Use native_handle().) Get the native handle representation.
   /**
    * This function may be used to obtain the underlying representation of the
    * handle. This is intended to allow access to native handle functionality
@@ -182,7 +219,18 @@
    */
   native_type native()
   {
- return this->service.native(this->implementation);
+ return this->get_service().native_handle(this->get_implementation());
+ }
+
+ /// Get the native handle representation.
+ /**
+ * This function may be used to obtain the underlying representation of the
+ * handle. This is intended to allow access to native handle functionality
+ * that is not otherwise provided.
+ */
+ native_handle_type native_handle()
+ {
+ return this->get_service().native_handle(this->get_implementation());
   }
 
   /// Cancel all asynchronous operations associated with the handle.
@@ -196,8 +244,8 @@
   void cancel()
   {
     boost::system::error_code ec;
- this->service.cancel(this->implementation, ec);
- boost::asio::detail::throw_error(ec);
+ this->get_service().cancel(this->get_implementation(), ec);
+ boost::asio::detail::throw_error(ec, "cancel");
   }
 
   /// Cancel all asynchronous operations associated with the handle.
@@ -210,7 +258,7 @@
    */
   boost::system::error_code cancel(boost::system::error_code& ec)
   {
- return this->service.cancel(this->implementation, ec);
+ return this->get_service().cancel(this->get_implementation(), ec);
   }
 
 protected:

Modified: branches/release/boost/asio/windows/basic_random_access_handle.hpp
==============================================================================
--- branches/release/boost/asio/windows/basic_random_access_handle.hpp (original)
+++ branches/release/boost/asio/windows/basic_random_access_handle.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -21,6 +21,7 @@
   || defined(GENERATING_DOCUMENTATION)
 
 #include <cstddef>
+#include <boost/asio/detail/handler_type_requirements.hpp>
 #include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/windows/basic_handle.hpp>
@@ -46,8 +47,13 @@
   : public basic_handle<RandomAccessHandleService>
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// handle.
+ typedef typename RandomAccessHandleService::native_handle_type native_type;
+
   /// The native representation of a handle.
- typedef typename RandomAccessHandleService::native_type native_type;
+ typedef typename RandomAccessHandleService::native_handle_type
+ native_handle_type;
 
   /// Construct a basic_random_access_handle without opening it.
   /**
@@ -72,16 +78,54 @@
    * use to dispatch handlers for any asynchronous operations performed on the
    * handle.
    *
- * @param native_handle The new underlying handle implementation.
+ * @param handle The new underlying handle implementation.
    *
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_random_access_handle(boost::asio::io_service& io_service,
- const native_type& native_handle)
- : basic_handle<RandomAccessHandleService>(io_service, native_handle)
+ const native_handle_type& handle)
+ : basic_handle<RandomAccessHandleService>(io_service, handle)
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_random_access_handle from another.
+ /**
+ * This constructor moves a random-access handle from one object to another.
+ *
+ * @param other The other basic_random_access_handle object from which the
+ * move will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_random_access_handle(io_service&)
+ * constructor.
+ */
+ basic_random_access_handle(basic_random_access_handle&& other)
+ : basic_handle<RandomAccessHandleService>(
+ BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other))
+ {
+ }
+
+ /// Move-assign a basic_random_access_handle from another.
+ /**
+ * This assignment operator moves a random-access handle from one object to
+ * another.
+ *
+ * @param other The other basic_random_access_handle object from which the
+ * move will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_random_access_handle(io_service&)
+ * constructor.
+ */
+ basic_random_access_handle& operator=(basic_random_access_handle&& other)
+ {
+ basic_handle<RandomAccessHandleService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Write some data to the handle at the specified offset.
   /**
    * This function is used to write data to the random-access handle. The
@@ -116,9 +160,9 @@
       const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.write_some_at(
- this->implementation, offset, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().write_some_at(
+ this->get_implementation(), offset, buffers, ec);
+ boost::asio::detail::throw_error(ec, "write_some_at");
     return s;
   }
 
@@ -144,8 +188,8 @@
   std::size_t write_some_at(boost::uint64_t offset,
       const ConstBufferSequence& buffers, boost::system::error_code& ec)
   {
- return this->service.write_some_at(
- this->implementation, offset, buffers, ec);
+ return this->get_service().write_some_at(
+ this->get_implementation(), offset, buffers, ec);
   }
 
   /// Start an asynchronous write at the specified offset.
@@ -187,10 +231,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some_at(boost::uint64_t offset,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_write_some_at(
- this->implementation, offset, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_write_some_at(this->get_implementation(),
+ offset, buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the handle at the specified offset.
@@ -228,9 +277,9 @@
       const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.read_some_at(
- this->implementation, offset, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().read_some_at(
+ this->get_implementation(), offset, buffers, ec);
+ boost::asio::detail::throw_error(ec, "read_some_at");
     return s;
   }
 
@@ -257,8 +306,8 @@
   std::size_t read_some_at(boost::uint64_t offset,
       const MutableBufferSequence& buffers, boost::system::error_code& ec)
   {
- return this->service.read_some_at(
- this->implementation, offset, buffers, ec);
+ return this->get_service().read_some_at(
+ this->get_implementation(), offset, buffers, ec);
   }
 
   /// Start an asynchronous read at the specified offset.
@@ -301,10 +350,15 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some_at(boost::uint64_t offset,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_read_some_at(
- this->implementation, offset, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_read_some_at(this->get_implementation(),
+ offset, buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/windows/basic_stream_handle.hpp
==============================================================================
--- branches/release/boost/asio/windows/basic_stream_handle.hpp (original)
+++ branches/release/boost/asio/windows/basic_stream_handle.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -21,10 +21,11 @@
   || defined(GENERATING_DOCUMENTATION)
 
 #include <cstddef>
+#include <boost/asio/detail/handler_type_requirements.hpp>
+#include <boost/asio/detail/throw_error.hpp>
 #include <boost/asio/error.hpp>
 #include <boost/asio/windows/basic_handle.hpp>
 #include <boost/asio/windows/stream_handle_service.hpp>
-#include <boost/asio/detail/throw_error.hpp>
 
 #include <boost/asio/detail/push_options.hpp>
 
@@ -49,8 +50,12 @@
   : public basic_handle<StreamHandleService>
 {
 public:
+ /// (Deprecated: Use native_handle_type.) The native representation of a
+ /// handle.
+ typedef typename StreamHandleService::native_handle_type native_type;
+
   /// The native representation of a handle.
- typedef typename StreamHandleService::native_type native_type;
+ typedef typename StreamHandleService::native_handle_type native_handle_type;
 
   /// Construct a basic_stream_handle without opening it.
   /**
@@ -74,16 +79,52 @@
    * @param io_service The io_service object that the stream handle will use to
    * dispatch handlers for any asynchronous operations performed on the handle.
    *
- * @param native_handle The new underlying handle implementation.
+ * @param handle The new underlying handle implementation.
    *
    * @throws boost::system::system_error Thrown on failure.
    */
   basic_stream_handle(boost::asio::io_service& io_service,
- const native_type& native_handle)
- : basic_handle<StreamHandleService>(io_service, native_handle)
+ const native_handle_type& handle)
+ : basic_handle<StreamHandleService>(io_service, handle)
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a basic_stream_handle from another.
+ /**
+ * This constructor moves a stream handle from one object to another.
+ *
+ * @param other The other basic_stream_handle object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_handle(io_service&) constructor.
+ */
+ basic_stream_handle(basic_stream_handle&& other)
+ : basic_handle<StreamHandleService>(
+ BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other))
   {
   }
 
+ /// Move-assign a basic_stream_handle from another.
+ /**
+ * This assignment operator moves a stream handle from one object to
+ * another.
+ *
+ * @param other The other basic_stream_handle object from which the move
+ * will occur.
+ *
+ * @note Following the move, the moved-from object is in the same state as if
+ * constructed using the @c basic_stream_handle(io_service&) constructor.
+ */
+ basic_stream_handle& operator=(basic_stream_handle&& other)
+ {
+ basic_handle<StreamHandleService>::operator=(
+ BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other));
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Write some data to the handle.
   /**
    * This function is used to write data to the stream handle. The function call
@@ -115,8 +156,9 @@
   std::size_t write_some(const ConstBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.write_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "write_some");
     return s;
   }
 
@@ -140,7 +182,8 @@
   std::size_t write_some(const ConstBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.write_some(this->implementation, buffers, ec);
+ return this->get_service().write_some(
+ this->get_implementation(), buffers, ec);
   }
 
   /// Start an asynchronous write.
@@ -180,9 +223,14 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- this->service.async_write_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a WriteHandler.
+ BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+ this->get_service().async_write_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the handle.
@@ -217,8 +265,9 @@
   std::size_t read_some(const MutableBufferSequence& buffers)
   {
     boost::system::error_code ec;
- std::size_t s = this->service.read_some(this->implementation, buffers, ec);
- boost::asio::detail::throw_error(ec);
+ std::size_t s = this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
+ boost::asio::detail::throw_error(ec, "read_some");
     return s;
   }
 
@@ -243,7 +292,8 @@
   std::size_t read_some(const MutableBufferSequence& buffers,
       boost::system::error_code& ec)
   {
- return this->service.read_some(this->implementation, buffers, ec);
+ return this->get_service().read_some(
+ this->get_implementation(), buffers, ec);
   }
 
   /// Start an asynchronous read.
@@ -284,9 +334,14 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- this->service.async_read_some(this->implementation, buffers, handler);
+ // If you get an error on the following line it means that your handler does
+ // not meet the documented type requirements for a ReadHandler.
+ BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+ this->get_service().async_read_some(this->get_implementation(),
+ buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 };
 

Modified: branches/release/boost/asio/windows/overlapped_ptr.hpp
==============================================================================
--- branches/release/boost/asio/windows/overlapped_ptr.hpp (original)
+++ branches/release/boost/asio/windows/overlapped_ptr.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -51,8 +51,9 @@
 
   /// Construct an overlapped_ptr to contain the specified handler.
   template <typename Handler>
- explicit overlapped_ptr(boost::asio::io_service& io_service, Handler handler)
- : impl_(io_service, handler)
+ explicit overlapped_ptr(boost::asio::io_service& io_service,
+ BOOST_ASIO_MOVE_ARG(Handler) handler)
+ : impl_(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -70,9 +71,10 @@
   /// Reset to contain the specified handler, freeing any current OVERLAPPED
   /// object.
   template <typename Handler>
- void reset(boost::asio::io_service& io_service, Handler handler)
+ void reset(boost::asio::io_service& io_service,
+ BOOST_ASIO_MOVE_ARG(Handler) handler)
   {
- impl_.reset(io_service, handler);
+ impl_.reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler));
   }
 
   /// Get the contained OVERLAPPED object.

Modified: branches/release/boost/asio/windows/random_access_handle_service.hpp
==============================================================================
--- branches/release/boost/asio/windows/random_access_handle_service.hpp (original)
+++ branches/release/boost/asio/windows/random_access_handle_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -59,11 +59,18 @@
   typedef service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native handle type.
+ /// (Deprecated: Use native_handle_type.) The native handle type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef service_impl_type::native_type native_type;
+ typedef service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native handle type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new random-access handle service for the specified io_service.
@@ -74,18 +81,29 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new random-access handle implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new random-access handle implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another random-access handle implementation.
+ void move_assign(implementation_type& impl,
+ random_access_handle_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a random-access handle implementation.
   void destroy(implementation_type& impl)
   {
@@ -94,9 +112,9 @@
 
   /// Assign an existing native handle to a random-access handle.
   boost::system::error_code assign(implementation_type& impl,
- const native_type& native_handle, boost::system::error_code& ec)
+ const native_handle_type& handle, boost::system::error_code& ec)
   {
- return service_impl_.assign(impl, native_handle, ec);
+ return service_impl_.assign(impl, handle, ec);
   }
 
   /// Determine whether the handle is open.
@@ -112,10 +130,16 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native handle implementation.
+ /// (Deprecated: Use native_handle().) Get the native handle implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native handle implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
   }
 
   /// Cancel all asynchronous operations associated with the handle.
@@ -135,10 +159,12 @@
 
   /// Start an asynchronous write at the specified offset.
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_write_some_at(implementation_type& impl, boost::uint64_t offset,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_write_some_at(implementation_type& impl,
+ boost::uint64_t offset, const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some_at(impl, offset, buffers, handler);
+ service_impl_.async_write_some_at(impl, offset, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the specified offset.
@@ -151,13 +177,21 @@
 
   /// Start an asynchronous read at the specified offset.
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_read_some_at(implementation_type& impl, boost::uint64_t offset,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_read_some_at(implementation_type& impl,
+ boost::uint64_t offset, const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some_at(impl, offset, buffers, handler);
+ service_impl_.async_read_some_at(impl, offset, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/windows/stream_handle_service.hpp
==============================================================================
--- branches/release/boost/asio/windows/stream_handle_service.hpp (original)
+++ branches/release/boost/asio/windows/stream_handle_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -57,11 +57,18 @@
   typedef service_impl_type::implementation_type implementation_type;
 #endif
 
- /// The native handle type.
+ /// (Deprecated: Use native_handle_type.) The native handle type.
 #if defined(GENERATING_DOCUMENTATION)
   typedef implementation_defined native_type;
 #else
- typedef service_impl_type::native_type native_type;
+ typedef service_impl_type::native_handle_type native_type;
+#endif
+
+ /// The native handle type.
+#if defined(GENERATING_DOCUMENTATION)
+ typedef implementation_defined native_handle_type;
+#else
+ typedef service_impl_type::native_handle_type native_handle_type;
 #endif
 
   /// Construct a new stream handle service for the specified io_service.
@@ -71,18 +78,29 @@
   {
   }
 
- /// Destroy all user-defined handler objects owned by the service.
- void shutdown_service()
- {
- service_impl_.shutdown_service();
- }
-
   /// Construct a new stream handle implementation.
   void construct(implementation_type& impl)
   {
     service_impl_.construct(impl);
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ /// Move-construct a new stream handle implementation.
+ void move_construct(implementation_type& impl,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_construct(impl, other_impl);
+ }
+
+ /// Move-assign from another stream handle implementation.
+ void move_assign(implementation_type& impl,
+ stream_handle_service& other_service,
+ implementation_type& other_impl)
+ {
+ service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
   /// Destroy a stream handle implementation.
   void destroy(implementation_type& impl)
   {
@@ -91,9 +109,9 @@
 
   /// Assign an existing native handle to a stream handle.
   boost::system::error_code assign(implementation_type& impl,
- const native_type& native_handle, boost::system::error_code& ec)
+ const native_handle_type& handle, boost::system::error_code& ec)
   {
- return service_impl_.assign(impl, native_handle, ec);
+ return service_impl_.assign(impl, handle, ec);
   }
 
   /// Determine whether the handle is open.
@@ -109,10 +127,16 @@
     return service_impl_.close(impl, ec);
   }
 
- /// Get the native handle implementation.
+ /// (Deprecated: Use native_handle().) Get the native handle implementation.
   native_type native(implementation_type& impl)
   {
- return service_impl_.native(impl);
+ return service_impl_.native_handle(impl);
+ }
+
+ /// Get the native handle implementation.
+ native_handle_type native_handle(implementation_type& impl)
+ {
+ return service_impl_.native_handle(impl);
   }
 
   /// Cancel all asynchronous operations associated with the handle.
@@ -133,9 +157,11 @@
   /// Start an asynchronous write.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some(impl, buffers, handler);
+ service_impl_.async_write_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -149,12 +175,20 @@
   /// Start an asynchronous read.
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some(impl, buffers, handler);
+ service_impl_.async_read_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:
+ // Destroy all user-defined handler objects owned by the service.
+ void shutdown_service()
+ {
+ service_impl_.shutdown_service();
+ }
+
   // The platform-specific implementation.
   service_impl_type service_impl_;
 };

Modified: branches/release/boost/asio/write.hpp
==============================================================================
--- branches/release/boost/asio/write.hpp (original)
+++ branches/release/boost/asio/write.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -71,6 +71,46 @@
 template <typename SyncWriteStream, typename ConstBufferSequence>
 std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers);
 
+/// Write all of the supplied data to a stream before returning.
+/**
+ * This function is used to write a certain number of bytes of data to a stream.
+ * The call will block until one of the following conditions is true:
+ *
+ * @li All of the data in the supplied buffers has been written. That is, the
+ * bytes transferred is equal to the sum of the buffer sizes.
+ *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the stream's
+ * write_some function.
+ *
+ * @param s The stream to which the data is to be written. The type must support
+ * the SyncWriteStream concept.
+ *
+ * @param buffers One or more buffers containing the data to be written. The sum
+ * of the buffer sizes indicates the maximum number of bytes to write to the
+ * stream.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code boost::asio::write(s, boost::asio::buffer(data, size), ec); @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::write(
+ * s, buffers,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncWriteStream, typename ConstBufferSequence>
+std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers,
+ boost::system::error_code& ec);
+
 /// Write a certain amount of data to a stream before returning.
 /**
  * This function is used to write a certain number of bytes of data to a stream.
@@ -197,6 +237,36 @@
 template <typename SyncWriteStream, typename Allocator>
 std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b);
 
+/// Write all of the supplied data to a stream before returning.
+/**
+ * This function is used to write a certain number of bytes of data to a stream.
+ * The call will block until one of the following conditions is true:
+ *
+ * @li All of the data in the supplied basic_streambuf has been written.
+ *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the stream's
+ * write_some function.
+ *
+ * @param s The stream to which the data is to be written. The type must support
+ * the SyncWriteStream concept.
+ *
+ * @param b The basic_streambuf object from which data will be written.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::write(
+ * s, b,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncWriteStream, typename Allocator>
+std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec);
+
 /// Write a certain amount of data to a stream before returning.
 /**
  * This function is used to write a certain number of bytes of data to a stream.
@@ -344,7 +414,7 @@
 template <typename AsyncWriteStream, typename ConstBufferSequence,
     typename WriteHandler>
 void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- WriteHandler handler);
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data to a
 /// stream.
@@ -416,7 +486,8 @@
 template <typename AsyncWriteStream, typename ConstBufferSequence,
     typename CompletionCondition, typename WriteHandler>
 void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -463,7 +534,7 @@
  */
 template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
 void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
- WriteHandler handler);
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data to a
 /// stream.
@@ -523,7 +594,8 @@
 template <typename AsyncWriteStream, typename Allocator,
     typename CompletionCondition, typename WriteHandler>
 void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, WriteHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: branches/release/boost/asio/write_at.hpp
==============================================================================
--- branches/release/boost/asio/write_at.hpp (original)
+++ branches/release/boost/asio/write_at.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -76,6 +76,51 @@
 std::size_t write_at(SyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, const ConstBufferSequence& buffers);
 
+/// Write all of the supplied data at the specified offset before returning.
+/**
+ * This function is used to write a certain number of bytes of data to a random
+ * access device at a specified offset. The call will block until one of the
+ * following conditions is true:
+ *
+ * @li All of the data in the supplied buffers has been written. That is, the
+ * bytes transferred is equal to the sum of the buffer sizes.
+ *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the device's
+ * write_some_at function.
+ *
+ * @param d The device to which the data is to be written. The type must support
+ * the SyncRandomAccessWriteDevice concept.
+ *
+ * @param offset The offset at which the data will be written.
+ *
+ * @param buffers One or more buffers containing the data to be written. The sum
+ * of the buffer sizes indicates the maximum number of bytes to write to the
+ * device.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @par Example
+ * To write a single data buffer use the @ref buffer function as follows:
+ * @code boost::asio::write_at(d, 42,
+ * boost::asio::buffer(data, size), ec); @endcode
+ * See the @ref buffer documentation for information on writing multiple
+ * buffers in one go, and how to use it with arrays, boost::array or
+ * std::vector.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::write_at(
+ * d, offset, buffers,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence>
+std::size_t write_at(SyncRandomAccessWriteDevice& d,
+ boost::uint64_t offset, const ConstBufferSequence& buffers,
+ boost::system::error_code& ec);
+
 /// Write a certain amount of data at a specified offset before returning.
 /**
  * This function is used to write a certain number of bytes of data to a random
@@ -214,6 +259,40 @@
 std::size_t write_at(SyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, basic_streambuf<Allocator>& b);
 
+/// Write all of the supplied data at the specified offset before returning.
+/**
+ * This function is used to write a certain number of bytes of data to a random
+ * access device at a specified offset. The call will block until one of the
+ * following conditions is true:
+ *
+ * @li All of the data in the supplied basic_streambuf has been written.
+ *
+ * @li An error occurred.
+ *
+ * This operation is implemented in terms of zero or more calls to the device's
+ * write_some_at function.
+ *
+ * @param d The device to which the data is to be written. The type must support
+ * the SyncRandomAccessWriteDevice concept.
+ *
+ * @param offset The offset at which the data will be written.
+ *
+ * @param b The basic_streambuf object from which data will be written.
+ *
+ * @param ec Set to indicate what error occurred, if any.
+ *
+ * @returns The number of bytes transferred.
+ *
+ * @note This overload is equivalent to calling:
+ * @code boost::asio::write_at(
+ * d, 42, b,
+ * boost::asio::transfer_all(), ec); @endcode
+ */
+template <typename SyncRandomAccessWriteDevice, typename Allocator>
+std::size_t write_at(SyncRandomAccessWriteDevice& d,
+ boost::uint64_t offset, basic_streambuf<Allocator>& b,
+ boost::system::error_code& ec);
+
 /// Write a certain amount of data at a specified offset before returning.
 /**
  * This function is used to write a certain number of bytes of data to a random
@@ -367,7 +446,8 @@
 template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
     typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset,
- const ConstBufferSequence& buffers, WriteHandler handler);
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data at the
 /// specified offset.
@@ -439,7 +519,8 @@
     typename CompletionCondition, typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -486,7 +567,7 @@
 template <typename AsyncRandomAccessWriteDevice, typename Allocator,
     typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset,
- basic_streambuf<Allocator>& b, WriteHandler handler);
+ basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data at the
 /// specified offset.
@@ -546,7 +627,7 @@
     typename CompletionCondition, typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset,
     basic_streambuf<Allocator>& b, CompletionCondition completion_condition,
- WriteHandler handler);
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: branches/release/libs/asio/doc/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/doc/Jamfile.v2 (original)
+++ branches/release/libs/asio/doc/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -25,7 +25,7 @@
     <location>html/boost_asio
   ;
 
-local example-names = allocation buffers chat echo http/client http/server
+local example-names = allocation buffers chat echo fork http/client http/server
   http/server2 http/server3 http/server4 icmp invocation iostreams local
   multicast nonblocking porthopper serialization services socks4 ssl timeouts
   timers windows ;

Modified: branches/release/libs/asio/doc/asio.qbk
==============================================================================
--- branches/release/libs/asio/doc/asio.qbk (original)
+++ branches/release/libs/asio/doc/asio.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -7,7 +7,7 @@
 
 [library Boost.Asio
     [quickbook 1.4]
- [copyright 2003 - 2010 Christopher M. Kohlhoff]
+ [copyright 2003 - 2011 Christopher M. Kohlhoff]
     [purpose Networking library]
     [license
         Distributed under the Boost Software License, Version 1.0.
@@ -37,9 +37,9 @@
 
 [/=============================================================================]
 
-Boost.Asio is a cross-platform C++ library for network and low-level I/O
-programming that provides developers with a consistent asynchronous model using
-a modern C++ approach.
+Boost.Asio is a cross-platform C++ library for network and low-level I/O programming
+that provides developers with a consistent asynchronous model using a modern
+C++ approach.
 
 [variablelist
   [
@@ -74,8 +74,7 @@
       [link boost_asio.examples Examples]
     ]
     [
- Examples that illustrate the use of Boost.Asio in more complex
- applications.
+ Examples that illustrate the use of Boost.Asio in more complex applications.
     ]
   ]
   [

Modified: branches/release/libs/asio/doc/examples.qbk
==============================================================================
--- branches/release/libs/asio/doc/examples.qbk (original)
+++ branches/release/libs/asio/doc/examples.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -34,8 +34,8 @@
 * [@boost_asio/example/chat/chat_server.cpp]
 
 The following POSIX-specific chat client demonstrates how to use the
-[link boost_asio.reference.posix__stream_descriptor posix::stream_descriptor]
-class to perform console input and output.
+[link boost_asio.reference.posix__stream_descriptor posix::stream_descriptor] class to
+perform console input and output.
 
 * [@boost_asio/example/chat/posix_chat_client.cpp]
 
@@ -53,6 +53,20 @@
 * [@boost_asio/example/echo/blocking_udp_echo_server.cpp]
 
 
+[heading Fork]
+
+These POSIX-specific examples show how to use Boost.Asio in conjunction with the
+`fork()` system call. The first example illustrates the steps required to start
+a daemon process:
+
+* [@boost_asio/example/fork/daemon.cpp]
+
+The second example demonstrates how it is possible to fork a process from
+within a completion handler.
+
+* [@boost_asio/example/fork/process_per_connection.cpp]
+
+
 [heading HTTP Client]
 
 Example programs implementing simple HTTP 1.0 clients. These examples show how
@@ -74,9 +88,9 @@
 * [@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/main.cpp]
 * [@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]
@@ -86,7 +100,6 @@
 * [@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]
@@ -98,9 +111,9 @@
 * [@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/main.cpp]
 * [@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]
@@ -110,7 +123,6 @@
 * [@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]
@@ -120,9 +132,9 @@
 * [@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/main.cpp]
 * [@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]
@@ -132,7 +144,6 @@
 * [@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 HTTP Server 4]
@@ -143,9 +154,9 @@
 * [@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/main.cpp]
 * [@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]
@@ -154,7 +165,6 @@
 * [@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]
 
 
@@ -182,6 +192,7 @@
 
 * [@boost_asio/example/iostreams/daytime_client.cpp]
 * [@boost_asio/example/iostreams/daytime_server.cpp]
+* [@boost_asio/example/iostreams/http_client.cpp]
 
 
 [heading Multicast]
@@ -231,8 +242,7 @@
 [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.reference.ssl__stream ssl::stream<>] template with asynchronous operations.
 
 * [@boost_asio/example/ssl/client.cpp]
 * [@boost_asio/example/ssl/server.cpp]

Modified: branches/release/libs/asio/doc/history.qbk
==============================================================================
--- branches/release/libs/asio/doc/history.qbk (original)
+++ branches/release/libs/asio/doc/history.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -7,27 +7,10 @@
 
 [section:history Revision History]
 
-[heading Asio 1.4.9 / Boost 1.46.1]
-
-* `EV_ONESHOT` seems to cause problems on some versions of Mac OS X, with the
- `io_service` destructor getting stuck inside the `close()` system call.
- Changed the kqueue backend to use `EV_CLEAR` instead
- ([@https://svn.boost.org/trac/boost/ticket/5021 #5021]).
-* Fixed compile failures with some versions of [^g++] due to the use of
- anonymous enums ([@https://svn.boost.org/trac/boost/ticket/4883 #4883]).
-* Fixed a bug on kqueue-based platforms, where some system calls that
- repeatedly fail with `EWOULDBLOCK` are not correctly re-registered with
- kqueue.
-* Changed `asio::streambuf` to ensure that its internal pointers are updated
- correctly after the data has been modified using `std::streambuf` member
- functions.
-* Fixed a bug that prevented the linger socket option from working on platforms
- other than Windows.
-
 [heading Asio 1.4.8 / Boost 1.46]
 
-* Fixed an integer overflow problem that occurs when
- `ip::address_v4::broadcast()` is used on 64-bit platforms.
+* Fixed an integer overflow problem that occurs when `ip::address_v4::netmask()`
+ is used on 64-bit platforms.
 * Fixed a problem on older Linux kernels (where epoll is used without timerfd
   support) that prevents timely delivery of deadline_timer handlers, after the
   program has been running for some time

Modified: branches/release/libs/asio/doc/overview.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview.qbk (original)
+++ branches/release/libs/asio/doc/overview.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,19 +18,29 @@
   * [link boost_asio.overview.core.reactor Reactor-Style Operations]
   * [link boost_asio.overview.core.line_based Line-Based Operations]
   * [link boost_asio.overview.core.allocation Custom Memory Allocation]
+ * [link boost_asio.overview.core.handler_tracking Handler Tracking]
 * [link boost_asio.overview.networking Networking]
   * [link boost_asio.overview.networking.protocols TCP, UDP and ICMP]
   * [link boost_asio.overview.networking.iostreams Socket Iostreams]
   * [link boost_asio.overview.networking.bsd_sockets The BSD Socket API and Boost.Asio]
 * [link boost_asio.overview.timers Timers]
 * [link boost_asio.overview.serial_ports Serial Ports]
+* [link boost_asio.overview.signals Signal Handling]
 * [link boost_asio.overview.posix POSIX-Specific Functionality]
   * [link boost_asio.overview.posix.local UNIX Domain Sockets]
   * [link boost_asio.overview.posix.stream_descriptor Stream-Oriented File Descriptors]
+ * [link boost_asio.overview.posix.fork Fork]
 * [link boost_asio.overview.windows Windows-Specific Functionality]
   * [link boost_asio.overview.windows.stream_handle Stream-Oriented HANDLEs]
   * [link boost_asio.overview.windows.random_access_handle Random-Access HANDLEs]
 * [link boost_asio.overview.ssl SSL]
+* [link boost_asio.overview.cpp2011 C++ 2011 Support]
+ * [link boost_asio.overview.cpp2011.move_objects Movable I/O Objects]
+ * [link boost_asio.overview.cpp2011.move_handlers Movable Handlers]
+ * [link boost_asio.overview.cpp2011.variadic Variadic Templates]
+ * [link boost_asio.overview.cpp2011.array Array Container]
+ * [link boost_asio.overview.cpp2011.atomic Atomics]
+ * [link boost_asio.overview.cpp2011.shared_ptr Shared Pointers]
 * [link boost_asio.overview.implementation Platform-Specific Implementation Notes]
 
 [include overview/rationale.qbk]
@@ -46,6 +56,7 @@
 * [link boost_asio.overview.core.reactor Reactor-Style Operations]
 * [link boost_asio.overview.core.line_based Line-Based Operations]
 * [link boost_asio.overview.core.allocation Custom Memory Allocation]
+* [link boost_asio.overview.core.handler_tracking Handler Tracking]
 
 [include overview/basics.qbk]
 [include overview/async.qbk]
@@ -56,6 +67,7 @@
 [include overview/reactor.qbk]
 [include overview/line_based.qbk]
 [include overview/allocation.qbk]
+[include overview/handler_tracking.qbk]
 
 [endsect]
 
@@ -73,9 +85,11 @@
 
 [include overview/timers.qbk]
 [include overview/serial_ports.qbk]
+[include overview/signals.qbk]
 [include overview/posix.qbk]
 [include overview/windows.qbk]
 [include overview/ssl.qbk]
+[include overview/cpp2011.qbk]
 [include overview/implementation.qbk]
 
 [endsect]

Modified: branches/release/libs/asio/doc/overview/allocation.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/allocation.qbk (original)
+++ branches/release/libs/asio/doc/overview/allocation.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -48,11 +48,6 @@
 memory visibility should allocation functions need to be called from different
 threads.
 
-Custom memory allocation support is currently implemented for all asynchronous
-operations with the following exceptions:
-
-* Asynchronous SSL operations.
-
 [heading See Also]
 
 [link boost_asio.reference.asio_handler_allocate asio_handler_allocate],

Modified: branches/release/libs/asio/doc/overview/basics.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/basics.qbk (original)
+++ branches/release/libs/asio/doc/overview/basics.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -43,13 +43,13 @@
 4. The [*operating system] returns the result of the operation to the
 [*io_service].
 
-5. The [*io_service] translates any error resulting from the operation into a
-`boost::system::error_code`. An `error_code` may be compared with specific
-values, or tested as a boolean (where a `false` result means that no error
-occurred). The result is then forwarded back up to the [*I/O object].
+5. The [*io_service] translates any error resulting from the operation into an
+object of type `boost::system::error_code`. An `error_code` may be compared with
+specific values, or tested as a boolean (where a `false` result means that no
+error occurred). The result is then forwarded back up to the [*I/O object].
 
-6. The [*I/O object] throws an exception of type `boost::system::system_error`
-if the operation failed. If the code to initiate the operation had instead been
+6. The [*I/O object] throws an exception of type `boost::system::system_error` if the
+operation failed. If the code to initiate the operation had instead been
 written as:
 
   boost::system::error_code ec;

Added: branches/release/libs/asio/doc/overview/cpp2011.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/overview/cpp2011.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,194 @@
+[/
+ / Copyright (c) 2003-2011 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:cpp2011 C++ 2011 Support]
+
+
+[link boost_asio.overview.cpp2011.move_objects Movable I/O Objects]
+
+[link boost_asio.overview.cpp2011.move_handlers Movable Handlers]
+
+[link boost_asio.overview.cpp2011.variadic Variadic Templates]
+
+[link boost_asio.overview.cpp2011.array Array Container]
+
+[link boost_asio.overview.cpp2011.atomic Atomics]
+
+[link boost_asio.overview.cpp2011.shared_ptr Shared Pointers]
+
+
+[section:move_objects Movable I/O Objects]
+
+When move support is available (via rvalue references), Boost.Asio allows move
+construction and assignment of sockets, serial ports, POSIX descriptors and
+Windows handles.
+
+Move support allows you to write code like:
+
+ tcp::socket make_socket(io_service& i)
+ {
+ tcp::socket s(i);
+ ...
+ std::move(s);
+ }
+
+or:
+
+ class connection : public enable_shared_from_this<connection>
+ {
+ private:
+ tcp::socket socket_;
+ ...
+ public:
+ connection(tcp::socket&& s) : socket_(std::move(s)) {}
+ ...
+ };
+
+ ...
+
+ class server
+ {
+ private:
+ tcp::acceptor acceptor_;
+ tcp::socket socket_;
+ ...
+ void handle_accept(error_code ec)
+ {
+ if (!ec)
+ std::make_shared<connection>(std::move(socket_))->go();
+ acceptor_.async_accept(socket_, ...);
+ }
+ ...
+ };
+
+as well as:
+
+ std::vector<tcp::socket> sockets;
+ sockets.push_back(tcp::socket(...));
+
+A word of warning: There is nothing stopping you from moving these objects
+while there are pending asynchronous operations, but it is unlikely to be a
+good idea to do so. In particular, composed operations like [link
+boost_asio.reference.async_read async_read()] store a reference to the stream object.
+Moving during the composed operation means that the composed operation may
+attempt to access a moved-from object.
+
+Move support is automatically enabled for [^g++] 4.5 and later, when the
+[^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It may be disabled
+by defining `BOOST_ASIO_DISABLE_MOVE`, or explicitly enabled for other compilers by
+defining `BOOST_ASIO_HAS_MOVE`. Note that these macros also affect the availability
+of [link boost_asio.overview.cpp2011.move_handlers movable handlers].
+
+[endsect]
+
+[section:move_handlers Movable Handlers]
+
+As an optimisation, user-defined completion handlers may provide move
+constructors, and Boost.Asio's implementation will use a handler's move constructor
+in preference to its copy constructor. In certain circumstances, Boost.Asio may be
+able to eliminate all calls to a handler's copy constructor. However, handler
+types are still required to be copy constructible.
+
+When move support is enabled, asynchronous that are documented as follows:
+
+ template <typename Handler>
+ void async_XYZ(..., Handler handler);
+
+are actually declared as:
+
+ template <typename Handler>
+ void async_XYZ(..., Handler&& handler);
+
+The handler argument is perfectly forwarded and the move construction occurs
+within the body of `async_XYZ()`. This ensures that all other function
+arguments are evaluated prior to the move. This is critical when the other
+arguments to `async_XYZ()` are members of the handler. For example:
+
+ struct my_operation
+ {
+ shared_ptr<tcp::socket> socket;
+ shared_ptr<vector<char>> buffer;
+ ...
+ void operator(error_code ec, size_t length)
+ {
+ ...
+ socket->async_read_some(boost::asio::buffer(*buffer), std::move(*this));
+ ...
+ }
+ };
+
+Move support is automatically enabled for [^g++] 4.5 and later, when the
+[^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It may be disabled
+by defining `BOOST_ASIO_DISABLE_MOVE`, or explicitly enabled for other compilers by
+defining `BOOST_ASIO_HAS_MOVE`. Note that these macros also affect the availability
+of [link boost_asio.overview.cpp2011.move_objects movable I/O objects].
+
+[endsect]
+
+[section:variadic Variadic Templates]
+
+When supported by a compiler, Boost.Asio can use variadic templates to implement the
+[link boost_asio.reference.basic_socket_streambuf.connect
+basic_socket_streambuf::connect()] and [link
+boost_asio.reference.basic_socket_iostream.connect basic_socket_iostream::connect()]
+functions.
+
+Support for variadic templates is automatically enabled for [^g++] 4.3 and
+later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It
+may be disabled by defining `BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES`, or explicitly
+enabled for other compilers by defining `BOOST_ASIO_HAS_VARIADIC_TEMPLATES`.
+
+[endsect]
+
+[section:array Array Container]
+
+Where the standard library provides `std::array<>`, Boost.Asio:
+
+* Provides overloads for the [link boost_asio.reference.buffer buffer()] function.
+
+* Uses it in preference to `boost::array<>` for the
+ [link boost_asio.reference.ip__address_v4.bytes_type ip::address_v4::bytes_type] and
+ [link boost_asio.reference.ip__address_v6.bytes_type ip::address_v6::bytes_type]
+ types.
+
+* Uses it in preference to `boost::array<>` where a fixed size array type is
+ needed in the implementation.
+
+Support for `std::array<>` is automatically enabled for [^g++] 4.3 and later,
+when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used, as well as
+for Microsoft Visual C++ 10. It may be disabled by defining
+`BOOST_ASIO_DISABLE_STD_ARRAY`, or explicitly enabled for other compilers by
+defining `BOOST_ASIO_HAS_STD_ARRAY`.
+
+[endsect]
+
+[section:atomic Atomics]
+
+Boost.Asio's implementation can use `std::atomic<>` in preference to
+`boost::detail::atomic_count`.
+
+Support for the standard atomic integer template is automatically enabled for
+[^g++] 4.5 and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler
+options are used. It may be disabled by defining `BOOST_ASIO_DISABLE_STD_ATOMIC`, or
+explicitly enabled for other compilers by defining `BOOST_ASIO_HAS_STD_ATOMIC`.
+
+[endsect]
+
+[section:shared_ptr Shared Pointers]
+
+Boost.Asio's implementation can use `std::shared_ptr<>` and `std::weak_ptr<>` in
+preference to the Boost equivalents.
+
+Support for the standard smart pointers is automatically enabled for [^g++] 4.3
+and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used,
+as well as for Microsoft Visual C++ 10. It may be disabled by defining
+`BOOST_ASIO_DISABLE_STD_SHARED_PTR`, or explicitly enabled for other compilers by
+defining `BOOST_ASIO_HAS_STD_SHARED_PTR`.
+
+[endsect]
+
+[endsect]

Added: branches/release/libs/asio/doc/overview/handler_tracking.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/overview/handler_tracking.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,102 @@
+[/
+ / Copyright (c) 2003-2011 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:handler_tracking Handler Tracking]
+
+To aid in debugging asynchronous programs, Boost.Asio provides support for handler
+tracking. When enabled by defining `BOOST_ASIO_ENABLE_HANDLER_TRACKING`, Boost.Asio
+writes debugging output to the standard error stream. The output records
+asynchronous operations and the relationships between their handlers.
+
+[teletype]
+This feature is useful when debugging and you need to know how your
+asynchronous operations are chained together, or what the pending asynchronous
+operations are. As an illustration, here is the output when you run the HTTP
+Server example, handle a single request, then shut down via Ctrl+C:
+
+ @asio|1298160085.070638|0*1|signal_set_at_0x7fff50528f40.async_wait
+ @asio|1298160085.070888|0*2|socket_at_0x7fff50528f60.async_accept
+ @asio|1298160085.070913|0|resolver_at_0x7fff50528e28.cancel
+ @asio|1298160118.075438|>2|ec=asio.system:0
+ @asio|1298160118.075472|2*3|socket_at_0xb39048.async_receive
+ @asio|1298160118.075507|2*4|socket_at_0x7fff50528f60.async_accept
+ @asio|1298160118.075527|<2|
+ @asio|1298160118.075540|>3|ec=asio.system:0,bytes_transferred=122
+ @asio|1298160118.075731|3*5|socket_at_0xb39048.async_send
+ @asio|1298160118.075778|<3|
+ @asio|1298160118.075793|>5|ec=asio.system:0,bytes_transferred=156
+ @asio|1298160118.075831|5|socket_at_0xb39048.close
+ @asio|1298160118.075855|<5|
+ @asio|1298160122.827317|>1|ec=asio.system:0,signal_number=2
+ @asio|1298160122.827333|1|socket_at_0x7fff50528f60.close
+ @asio|1298160122.827359|<1|
+ @asio|1298160122.827370|>4|ec=asio.system:125
+ @asio|1298160122.827378|<4|
+ @asio|1298160122.827394|0|signal_set_at_0x7fff50528f40.cancel
+
+Each line is of the form:
+
+ <tag>|<timestamp>|<action>|<description>
+
+The `<tag>` is always `@asio`, and is used to identify and extract the handler
+tracking messages from the program output.
+
+The `<timestamp>` is seconds and microseconds from 1 Jan 1970 UTC.
+
+The `<action>` takes one of the following forms:
+
+[variablelist
+ [
+ [>n]
+ [The program entered the handler number `n`. The `<description>` shows the
+ arguments to the handler.]
+ ]
+ [
+ [<n]
+ [The program left handler number `n`.]
+ ]
+ [
+ [!n]
+ [The program left handler number n due to an exception.]
+ ]
+ [
+ [~n]
+ [The handler number `n` was destroyed without having been invoked. This is
+ usually the case for any unfinished asynchronous operations when the
+ `io_service` is destroyed.]
+ ]
+ [
+ [n*m]
+ [The handler number `n` created a new asynchronous operation with completion
+ handler number `m`. The `<description>` shows what asynchronous operation
+ was started.]
+ ]
+ [
+ [n]
+ [The handler number n performed some other operation. The `<description>`
+ shows what function was called. Currently only `close()` and `cancel()`
+ operations are logged, as these may affect the state of pending
+ asynchronous operations.]
+ ]
+]
+
+Where the `<description>` shows a synchronous or asynchronous operation, the
+format is `<object-type>@<pointer>.<operation>`. For handler entry, it shows a
+comma-separated list of arguments and their values.
+
+As shown above, Each handler is assigned a numeric identifier. Where the
+handler tracking output shows a handler number of 0, it means that the action
+was performed outside of any handler.
+
+[heading Visual Representations]
+
+The handler tracking output may be post-processed using the included
+[^handlerviz.pl] tool to create a visual representation of the handlers
+(requires the GraphViz tool [^dot]).
+[c++]
+
+[endsect]

Modified: branches/release/libs/asio/doc/overview/implementation.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/implementation.qbk (original)
+++ branches/release/libs/asio/doc/overview/implementation.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -241,6 +241,10 @@
 `io_service::run()`, `io_service::run_one()`, `io_service::poll()` or
 `io_service::poll_one()`.
 
+* An additional thread per `io_service` is used to trigger timers. This thread
+is created on construction of the first `deadline_timer` or
+`deadline_timer_service` objects.
+
 * An additional thread per `io_service` is used for the `select`
 demultiplexing. This thread is created on the first call to `async_connect()`.
 

Modified: branches/release/libs/asio/doc/overview/iostreams.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/iostreams.qbk (original)
+++ branches/release/libs/asio/doc/overview/iostreams.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -32,6 +32,32 @@
     ...
   }
 
+Timeouts may be set by calling `expires_at()` or `expires_from_now()` to
+establish a deadline. Any socket operations that occur past the deadline will
+put the iostream into a "bad" state.
+
+For example, a simple client program like this:
+
+ ip::tcp::iostream stream;
+ stream.expires_from_now(boost::posix_time::seconds(60));
+ stream.connect("www.boost.org", "http");
+ stream << "GET /LICENSE_1_0.txt HTTP/1.0\r\n";
+ stream << "Host: www.boost.org\r\n";
+ stream << "Accept: */*\r\n";
+ stream << "Connection: close\r\n\r\n";
+ stream.flush();
+ std::cout << stream.rdbuf();
+
+will fail if all the socket operations combined take longer than 60 seconds.
+
+If an error does occur, the iostream's `error()` member function may be used to
+retrieve the error code from the most recent system call:
+
+ if (!stream)
+ {
+ std::cout << "Error: " << stream.error().message() << "\n";
+ }
+
 [heading See Also]
 
 [link boost_asio.reference.ip__tcp.iostream ip::tcp::iostream],

Modified: branches/release/libs/asio/doc/overview/posix.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/posix.qbk (original)
+++ branches/release/libs/asio/doc/overview/posix.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -11,6 +11,8 @@
 
 [link boost_asio.overview.posix.stream_descriptor Stream-Oriented File Descriptors]
 
+[link boost_asio.overview.posix.fork Fork]
+
 [section:local UNIX Domain Sockets]
 
 Boost.Asio provides basic support UNIX domain sockets (also known as local sockets).
@@ -103,4 +105,41 @@
 
 [endsect]
 
+[section:fork Fork]
+
+Boost.Asio supports programs that utilise the `fork()` system call. Provided the
+program calls `io_service.notify_fork()` at the appropriate times, Boost.Asio will
+recreate any internal file descriptors (such as the "self-pipe trick"
+descriptor used for waking up a reactor). The notification is usually performed
+as follows:
+
+ io_service_.notify_fork(boost::asio::io_service::fork_prepare);
+ if (fork() == 0)
+ {
+ io_service_.notify_fork(boost::asio::io_service::fork_child);
+ ...
+ }
+ else
+ {
+ io_service_.notify_fork(boost::asio::io_service::fork_parent);
+ ...
+ }
+
+User-defined services can also be made fork-aware by overriding the
+`io_service::service::fork_service()` virtual function.
+
+Note that any file descriptors accessible via Boost.Asio's public API (e.g. the
+descriptors underlying `basic_socket<>`, `posix::stream_descriptor`, etc.) are
+not altered during a fork. It is the program's responsibility to manage these
+as required.
+
+[heading See Also]
+
+[link boost_asio.reference.io_service.notify_fork io_service::notify_fork()],
+[link boost_asio.reference.io_service.fork_event io_service::fork_event],
+[link boost_asio.reference.io_service__service.fork_service io_service::service::fork_service()],
+[link boost_asio.examples.fork Fork examples].
+
+[endsect]
+
 [endsect]

Modified: branches/release/libs/asio/doc/overview/protocols.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/protocols.qbk (original)
+++ branches/release/libs/asio/doc/overview/protocols.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -26,10 +26,40 @@
   }
 
 The list of endpoints obtained above could contain both IPv4 and IPv6 endpoints,
-so a program may try each of them until it finds one that works. This keeps the
+so a program should try each of them until it finds one that works. This keeps the
 client program independent of a specific IP version.
 
-When an endpoint is available, a socket can be created and connected:
+To simplify the development of protocol-independent programs, TCP clients may
+establish connections using the free functions [link boost_asio.reference.connect
+connect()] and [link boost_asio.reference.async_connect async_connect()]. These
+operations try each endpoint in a list until the socket is successfully
+connected. For example, a single call:
+
+ ip::tcp::socket socket(my_io_service);
+ boost::asio::connect(socket, resolver.resolve(query));
+
+will synchronously try all endpoints until one is successfully connected.
+Similarly, an asynchronous connect may be performed by writing:
+
+ boost::asio::async_connect(socket_, iter,
+ boost::bind(&client::handle_connect, this,
+ boost::asio::placeholders::error));
+
+ // ...
+
+ void handle_connect(const error_code& error)
+ {
+ if (!error)
+ {
+ // Start read or write operations.
+ }
+ else
+ {
+ // Handle error.
+ }
+ }
+
+When a specific endpoint is available, a socket can be created and connected:
 
   ip::tcp::socket socket(my_io_service);
   socket.connect(endpoint);

Modified: branches/release/libs/asio/doc/overview/reactor.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/reactor.qbk (original)
+++ branches/release/libs/asio/doc/overview/reactor.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,8 +18,7 @@
 
   ip::tcp::socket socket(my_io_service);
   ...
- ip::tcp::socket::non_blocking nb(true);
- socket.io_control(nb);
+ socket.non_blocking(true);
   ...
   socket.async_read_some(null_buffers(), read_handler);
   ...
@@ -38,6 +37,8 @@
 [heading See Also]
 
 [link boost_asio.reference.null_buffers null_buffers],
+[link boost_asio.reference.basic_socket.non_blocking basic_socket::non_blocking()],
+[link boost_asio.reference.basic_socket.native_non_blocking basic_socket::native_non_blocking()],
 [link boost_asio.examples.nonblocking nonblocking example].
 
 [endsect]

Modified: branches/release/libs/asio/doc/overview/serial_ports.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/serial_ports.qbk (original)
+++ branches/release/libs/asio/doc/overview/serial_ports.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -15,12 +15,11 @@
 where name is something like `"COM1"` on Windows, and `"/dev/ttyS0"` on POSIX
 platforms.
 
-Once opened, the serial port may be used as a [link
-boost_asio.overview.core.streams stream]. This means the objects can be used
-with any of the [link boost_asio.reference.read read()], [link
-boost_asio.reference.async_read async_read()], [link boost_asio.reference.write
-write()], [link boost_asio.reference.async_write async_write()], [link
-boost_asio.reference.read_until read_until()] or [link
+Once opened, the serial port may be used as a [link boost_asio.overview.core.streams
+stream]. This means the objects can be used with any of the [link
+boost_asio.reference.read read()], [link boost_asio.reference.async_read async_read()],
+[link boost_asio.reference.write write()], [link boost_asio.reference.async_write
+async_write()], [link boost_asio.reference.read_until read_until()] or [link
 boost_asio.reference.async_read_until async_read_until()] free functions.
 
 The serial port implementation also includes option classes for configuring the

Added: branches/release/libs/asio/doc/overview/signals.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/overview/signals.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,43 @@
+[/
+ / Copyright (c) 2003-2011 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:signals Signal Handling]
+
+Boost.Asio supports signal handling using a class called [link
+boost_asio.reference.signal_set signal_set]. Programs may add one or more signals to
+the set, and then perform an `async_wait()` operation. The specified handler
+will be called when one of the signals occurs. The same signal number may be
+registered with multiple [link boost_asio.reference.signal_set signal_set] objects,
+however the signal number must be used only with Boost.Asio.
+
+ void handler(
+ const boost::system::error_code& error,
+ int signal_number)
+ {
+ if (!error)
+ {
+ // A signal occurred.
+ }
+ }
+
+ ...
+
+ // Construct a signal set registered for process termination.
+ boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
+
+ // Start an asynchronous wait for one of the signals to occur.
+ signals.async_wait(handler);
+
+Signal handling also works on Windows, as the Microsoft Visual C++ runtime
+library maps console events like Ctrl+C to the equivalent signal.
+
+[heading See Also]
+
+[link boost_asio.reference.signal_set signal_set],
+[link boost_asio.examples.http_server HTTP server example].
+
+[endsect]

Modified: branches/release/libs/asio/doc/overview/ssl.qbk
==============================================================================
--- branches/release/libs/asio/doc/overview/ssl.qbk (original)
+++ branches/release/libs/asio/doc/overview/ssl.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,8 +16,8 @@
 mode, certificate files, and so on. As an illustration, client-side
 initialisation may look something like:
 
- ssl::context ctx(my_io_service, ssl::context::sslv23);
- ctx.set_verify_mode(ssl::context::verify_peer);
+ ssl::context ctx(ssl::context::sslv23);
+ ctx.set_verify_mode(ssl::verify_peer);
   ctx.load_verify_file("ca.pem");
 
 To use SSL with a TCP socket, one may write:
@@ -41,9 +41,8 @@
 
 SSL handshaking must be performed prior to transmitting or receiving data over
 an encrypted connection. This is accomplished using the `ssl::stream`
-template's [link boost_asio.reference.ssl__stream.handshake handshake()] or
-[link boost_asio.reference.ssl__stream.async_handshake async_handshake()] member
-functions.
+template's [link boost_asio.reference.ssl__stream.handshake handshake()] or [link
+boost_asio.reference.ssl__stream.async_handshake async_handshake()] member functions.
 
 Once connected, SSL stream objects are used as synchronous or asynchronous read
 and write streams. This means the objects can be used with any of the [link
@@ -52,15 +51,65 @@
 async_write()], [link boost_asio.reference.read_until read_until()] or [link
 boost_asio.reference.async_read_until async_read_until()] free functions.
 
+[heading Certificate Verification]
+
+Boost.Asio provides various methods for configuring the way SSL certificates are
+verified:
+
+ * [link boost_asio.reference.ssl__context.set_default_verify_paths ssl::context::set_default_verify_paths()]
+ * [link boost_asio.reference.ssl__context.set_verify_mode ssl::context::set_verify_mode()]
+ * [link boost_asio.reference.ssl__context.set_verify_callback ssl::context::set_verify_callback()]
+ * [link boost_asio.reference.ssl__context.load_verify_file ssl::context::load_verify_file()]
+ * [link boost_asio.reference.ssl__stream.set_verify_mode ssl::stream::set_verify_mode()]
+ * [link boost_asio.reference.ssl__stream.set_verify_callback ssl::stream::set_verify_callback()]
+
+To simplify use cases where certificates are verified according to the rules in
+RFC 2818 (certificate verification for HTTPS), Boost.Asio provides a reusable
+verification callback as a function object:
+
+ * [link boost_asio.reference.ssl__rfc2818_verification ssl::rfc2818_verification]
+
+The following example shows verification of a remote host's certificate
+according to the rules used by HTTPS:
+
+ using boost::asio::ip::tcp;
+ namespace ssl = boost::asio::ssl;
+ typedef ssl::stream<tcp::socket> ssl_socket;
+
+ // Create a context that uses the default paths for
+ // finding CA certificates.
+ ssl::context ctx(ssl::context::sslv23);
+ ctx.set_default_verify_paths();
+
+ // Open a socket and connect it to the remote host.
+ boost::asio::io_service io_service;
+ ssl_socket sock(io_service, ctx);
+ tcp::resolver resolver(io_service);
+ tcp::resolver::query query("host.name", "https");
+ boost::asio::connect(sock.lowest_layer(), resolver.resolve(query));
+ sock.lowest_layer().set_option(tcp::no_delay(true));
+
+ // Perform SSL handshake and verify the remote host's
+ // certificate.
+ sock.set_verify_mode(ssl::verify_peer);
+ sock.set_verify_callback(ssl::rfc2818_verification("host.name"));
+ sock.handshake(ssl_socket::client);
+
+ // ... read and write as normal ...
+
+[heading SSL and Threads]
+
+SSL stream objects perform no locking of their own. Therefore, it is essential
+that all asynchronous SSL operations are performed in an implicit or explicit
+[link boost_asio.overview.core.strands strand]. Note that this means that no
+synchronisation is required (and so no locking overhead is incurred) in single
+threaded programs.
+
 [heading See Also]
 
-[link boost_asio.reference.ssl__basic_context ssl::basic_context],
 [link boost_asio.reference.ssl__context ssl::context],
-[link boost_asio.reference.ssl__context_base ssl::context_base],
-[link boost_asio.reference.ssl__context_service ssl::context_service],
+[link boost_asio.reference.ssl__rfc2818_verification ssl::rfc2818_verification],
 [link boost_asio.reference.ssl__stream ssl::stream],
-[link boost_asio.reference.ssl__stream_base ssl::stream_base],
-[link boost_asio.reference.ssl__stream_service ssl::stream_service],
 [link boost_asio.examples.ssl SSL example].
 
 [heading Notes]
@@ -68,7 +117,7 @@
 [@http://www.openssl.org OpenSSL] is required to make use of Boost.Asio's SSL
 support. When an application needs to use OpenSSL functionality that is not
 wrapped by Boost.Asio, the underlying OpenSSL types may be obtained by calling [link
-boost_asio.reference.ssl__basic_context.impl `ssl::context::impl()`] or [link
-boost_asio.reference.ssl__stream.impl `ssl::stream::impl()`].
+boost_asio.reference.ssl__context.native_handle `ssl::context::native_handle()`] or
+[link boost_asio.reference.ssl__stream.native_handle `ssl::stream::native_handle()`].
 
 [endsect]

Modified: branches/release/libs/asio/doc/reference.qbk
==============================================================================
--- branches/release/libs/asio/doc/reference.qbk (original)
+++ branches/release/libs/asio/doc/reference.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,6 +16,7 @@
 [include requirements/AsyncReadStream.qbk]
 [include requirements/AsyncWriteStream.qbk]
 [include requirements/CompletionHandler.qbk]
+[include requirements/ComposedConnectHandler.qbk]
 [include requirements/ConnectHandler.qbk]
 [include requirements/ConstBufferSequence.qbk]
 [include requirements/ConvertibleToConstBuffer.qbk]
@@ -27,6 +28,7 @@
 [include requirements/GettableSocketOption.qbk]
 [include requirements/Handler.qbk]
 [include requirements/HandleService.qbk]
+[include requirements/HandshakeHandler.qbk]
 [include requirements/InternetProtocol.qbk]
 [include requirements/IoControlCommand.qbk]
 [include requirements/IoObjectService.qbk]
@@ -37,10 +39,14 @@
 [include requirements/ReadHandler.qbk]
 [include requirements/ResolveHandler.qbk]
 [include requirements/ResolverService.qbk]
+[include requirements/SeqPacketSocketService.qbk]
 [include requirements/SerialPortService.qbk]
 [include requirements/Service.qbk]
 [include requirements/SettableSerialPortOption.qbk]
 [include requirements/SettableSocketOption.qbk]
+[include requirements/ShutdownHandler.qbk]
+[include requirements/SignalHandler.qbk]
+[include requirements/SignalSetService.qbk]
 [include requirements/SocketAcceptorService.qbk]
 [include requirements/SocketService.qbk]
 [include requirements/StreamDescriptorService.qbk]
@@ -261,6 +267,518 @@
 [endsect]
 
 
+[section:async_connect async_connect]
+
+[indexterm1 async_connect]
+Asynchronously establishes a socket connection by trying each endpoint in a sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void ``[link boost_asio.reference.async_connect.overload1 async_connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ComposedConnectHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void ``[link boost_asio.reference.async_connect.overload2 async_connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ComposedConnectHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload2 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void ``[link boost_asio.reference.async_connect.overload3 async_connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ConnectCondition connect_condition,
+ ComposedConnectHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload3 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void ``[link boost_asio.reference.async_connect.overload4 async_connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ConnectCondition connect_condition,
+ ComposedConnectHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.async_connect.overload4 more...]]``
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/connect.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:overload1 async_connect (1 of 4 overloads)]
+
+
+Asynchronously establishes a socket connection by trying each endpoint in a sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void async_connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ComposedConnectHandler handler);
+
+
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
+
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
+
+[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ // Result of operation. if the sequence is empty, set to
+ // boost::asio::error::not_found. Otherwise, contains the
+ // error from the last connection attempt.
+ const boost::system::error_code& error,
+
+ // On success, an iterator denoting the successfully
+ // connected endpoint. Otherwise, the end iterator.
+ Iterator iterator
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
+
+
+[heading Example]
+
+
+
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+
+ // ...
+
+ r.async_resolve(q, resolve_handler);
+
+ // ...
+
+ void resolve_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ if (!ec)
+ {
+ boost::asio::async_connect(s, i, connect_handler);
+ }
+ }
+
+ // ...
+
+ void connect_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ // ...
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 async_connect (2 of 4 overloads)]
+
+
+Asynchronously establishes a socket connection by trying each endpoint in a sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void async_connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ComposedConnectHandler handler);
+
+
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
+
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
+
+[[end][An iterator pointing to the end of a sequence of endpoints.]]
+
+[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ // Result of operation. if the sequence is empty, set to
+ // boost::asio::error::not_found. Otherwise, contains the
+ // error from the last connection attempt.
+ const boost::system::error_code& error,
+
+ // On success, an iterator denoting the successfully
+ // connected endpoint. Otherwise, the end iterator.
+ Iterator iterator
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Example]
+
+
+
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+
+ // ...
+
+ r.async_resolve(q, resolve_handler);
+
+ // ...
+
+ void resolve_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ if (!ec)
+ {
+ tcp::resolver::iterator end;
+ boost::asio::async_connect(s, i, end, connect_handler);
+ }
+ }
+
+ // ...
+
+ void connect_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ // ...
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 async_connect (3 of 4 overloads)]
+
+
+Asynchronously establishes a socket connection by trying each endpoint in a sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void async_connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ConnectCondition connect_condition,
+ ComposedConnectHandler handler);
+
+
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
+
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
+
+[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
+``
+ Iterator connect_condition(
+ const boost::system::error_code& ec,
+ Iterator next);
+``
+The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is an iterator pointing to the next endpoint to be tried. The function object should return the next iterator, but is permitted to return a different iterator so that endpoints may be skipped. The implementation guarantees that the function object will never be called with the end iterator.]]
+
+[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ // Result of operation. if the sequence is empty, set to
+ // boost::asio::error::not_found. Otherwise, contains the
+ // error from the last connection attempt.
+ const boost::system::error_code& error,
+
+ // On success, an iterator denoting the successfully
+ // connected endpoint. Otherwise, the end iterator.
+ Iterator iterator
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
+
+
+[heading Example]
+
+The following connect condition function object can be used to output information about the individual connection attempts:
+
+ struct my_connect_condition
+ {
+ template <typename Iterator>
+ Iterator operator()(
+ const boost::system::error_code& ec,
+ Iterator next)
+ {
+ if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ std::cout << "Trying: " << next->endpoint() << std::endl;
+ return next;
+ }
+ };
+
+
+It would be used with the `boost::asio::connect` function as follows:
+
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+
+ // ...
+
+ r.async_resolve(q, resolve_handler);
+
+ // ...
+
+ void resolve_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ if (!ec)
+ {
+ boost::asio::async_connect(s, i,
+ my_connect_condition(),
+ connect_handler);
+ }
+ }
+
+ // ...
+
+ void connect_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ if (ec)
+ {
+ // An error occurred.
+ }
+ else
+ {
+ std::cout << "Connected to: " << i->endpoint() << std::endl;
+ }
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload4 async_connect (4 of 4 overloads)]
+
+
+Asynchronously establishes a socket connection by trying each endpoint in a sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition,
+ typename ``[link boost_asio.reference.ComposedConnectHandler ComposedConnectHandler]``>
+ void async_connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ConnectCondition connect_condition,
+ ComposedConnectHandler handler);
+
+
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `async_connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
+
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
+
+[[end][An iterator pointing to the end of a sequence of endpoints.]]
+
+[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
+``
+ Iterator connect_condition(
+ const boost::system::error_code& ec,
+ Iterator next);
+``
+The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is an iterator pointing to the next endpoint to be tried. The function object should return the next iterator, but is permitted to return a different iterator so that endpoints may be skipped. The implementation guarantees that the function object will never be called with the end iterator.]]
+
+[[handler][The handler to be called when the connect operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ // Result of operation. if the sequence is empty, set to
+ // boost::asio::error::not_found. Otherwise, contains the
+ // error from the last connection attempt.
+ const boost::system::error_code& error,
+
+ // On success, an iterator denoting the successfully
+ // connected endpoint. Otherwise, the end iterator.
+ Iterator iterator
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Example]
+
+The following connect condition function object can be used to output information about the individual connection attempts:
+
+ struct my_connect_condition
+ {
+ template <typename Iterator>
+ Iterator operator()(
+ const boost::system::error_code& ec,
+ Iterator next)
+ {
+ if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ std::cout << "Trying: " << next->endpoint() << std::endl;
+ return next;
+ }
+ };
+
+
+It would be used with the `boost::asio::connect` function as follows:
+
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+
+ // ...
+
+ r.async_resolve(q, resolve_handler);
+
+ // ...
+
+ void resolve_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ if (!ec)
+ {
+ tcp::resolver::iterator end;
+ boost::asio::async_connect(s, i, end,
+ my_connect_condition(),
+ connect_handler);
+ }
+ }
+
+ // ...
+
+ void connect_handler(
+ const boost::system::error_code& ec,
+ tcp::resolver::iterator i)
+ {
+ if (ec)
+ {
+ // An error occurred.
+ }
+ else
+ {
+ std::cout << "Connected to: " << i->endpoint() << std::endl;
+ }
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
 [section:async_read async_read]
 
 [indexterm1 async_read]
@@ -2311,15 +2829,22 @@
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
     [The native representation of a socket. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.basic_datagram_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.basic_datagram_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
   
   ]
 
@@ -2433,7 +2958,9 @@
 
      Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_datagram_socket on an existing native socket. ]
+ Construct a basic_datagram_socket on an existing native socket.
+
+ Move-construct a basic_datagram_socket from another. ]
   ]
   
   [
@@ -2472,11 +2999,6 @@
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
@@ -2495,15 +3017,39 @@
   
   [
     [[link boost_asio.reference.basic_datagram_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
     [Get the native socket representation. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
     [Open the socket using the specified protocol. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_datagram_socket from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
     [Receive some data on a connected socket. ]
   ]
@@ -2540,6 +3086,22 @@
   
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
 [heading Data Members]
 [table
   [[Name][Description]]
@@ -2555,6 +3117,11 @@
   ]
 
   [
+ [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
@@ -2572,12 +3139,12 @@
 
   [
     [[link boost_asio.reference.basic_datagram_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.basic_datagram_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -2607,12 +3174,12 @@
 
   void ``[link boost_asio.reference.basic_datagram_socket.assign.overload1 assign]``(
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
   `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.assign.overload1 more...]]``
 
   boost::system::error_code ``[link boost_asio.reference.basic_datagram_socket.assign.overload2 assign]``(
       const protocol_type & protocol,
- const native_type & native_socket,
+ const native_handle_type & native_socket,
       boost::system::error_code & ec);
   `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.assign.overload2 more...]]``
 
@@ -2628,7 +3195,7 @@
 
   void assign(
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
 
 
 
@@ -2647,7 +3214,7 @@
 
   boost::system::error_code assign(
       const protocol_type & protocol,
- const native_type & native_socket,
+ const native_handle_type & native_socket,
       boost::system::error_code & ec);
 
 
@@ -3464,11 +4031,19 @@
   ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 basic_datagram_socket]``(
       boost::asio::io_service & io_service,
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
   `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload4 more...]]``
 
 
-[section:overload1 basic_datagram_socket::basic_datagram_socket (1 of 4 overloads)]
+Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another.
+
+
+ ``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 basic_datagram_socket]``(
+ basic_datagram_socket && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload5 more...]]``
+
+
+[section:overload1 basic_datagram_socket::basic_datagram_socket (1 of 5 overloads)]
 
 
 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] without opening it.
@@ -3497,7 +4072,7 @@
 
 
 
-[section:overload2 basic_datagram_socket::basic_datagram_socket (2 of 4 overloads)]
+[section:overload2 basic_datagram_socket::basic_datagram_socket (2 of 5 overloads)]
 
 
 Construct and open a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`].
@@ -3539,7 +4114,7 @@
 
 
 
-[section:overload3 basic_datagram_socket::basic_datagram_socket (3 of 4 overloads)]
+[section:overload3 basic_datagram_socket::basic_datagram_socket (3 of 5 overloads)]
 
 
 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`], opening it and binding it to the given local endpoint.
@@ -3581,7 +4156,7 @@
 
 
 
-[section:overload4 basic_datagram_socket::basic_datagram_socket (4 of 4 overloads)]
+[section:overload4 basic_datagram_socket::basic_datagram_socket (4 of 5 overloads)]
 
 
 Construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] on an existing native socket.
@@ -3590,7 +4165,7 @@
   basic_datagram_socket(
       boost::asio::io_service & io_service,
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
 
 
 This constructor creates a datagram socket object to hold an existing native socket.
@@ -3625,6 +4200,40 @@
 [endsect]
 
 
+
+[section:overload5 basic_datagram_socket::basic_datagram_socket (5 of 5 overloads)]
+
+
+Move-construct a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another.
+
+
+ basic_datagram_socket(
+ basic_datagram_socket && other);
+
+
+This constructor moves a datagram socket from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
 [endsect]
 
 [section:bind basic_datagram_socket::bind]
@@ -3999,7 +4608,7 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
 
 ]
 
@@ -4036,7 +4645,7 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
 
 ]
 
@@ -4382,6 +4991,54 @@
 [endsect]
 
 
+[section:get_implementation basic_datagram_socket::get_implementation]
+
+[indexterm2 get_implementation..basic_datagram_socket]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.basic_datagram_socket.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.basic_datagram_socket.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_implementation.overload2 more...]]``
+
+
+[section:overload1 basic_datagram_socket::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_datagram_socket::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:get_io_service basic_datagram_socket::get_io_service]
 
@@ -4541,6 +5198,54 @@
 
 [endsect]
 
+[section:get_service basic_datagram_socket::get_service]
+
+[indexterm2 get_service..basic_datagram_socket]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.basic_datagram_socket.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.basic_datagram_socket.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.get_service.overload2 more...]]``
+
+
+[section:overload1 basic_datagram_socket::get_service (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ service_type & get_service();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_datagram_socket::get_service (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ const service_type & get_service() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:implementation basic_datagram_socket::implementation]
 
@@ -4548,7 +5253,7 @@
 ['Inherited from basic_io_object.]
 
 [indexterm2 implementation..basic_datagram_socket]
-The underlying implementation of the I/O object.
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
 
   implementation_type implementation;
@@ -4716,32 +5421,6 @@
 [endsect]
 
 
-[section:io_service basic_datagram_socket::io_service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 io_service..basic_datagram_socket]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
-
- boost::asio::io_service & io_service();
-
-
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
-
-
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
-
-
-
-
-[endsect]
-
-
-
 [section:is_open basic_datagram_socket::is_open]
 
 
@@ -5150,15 +5829,22 @@
 
   [
 
- [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
     [The native representation of a socket. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
   
   ]
 
@@ -5252,7 +5938,9 @@
 
      Construct a basic_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_socket on an existing native socket. ]
+ Construct a basic_socket on an existing native socket.
+
+ Move-construct a basic_socket from another. ]
   ]
   
   [
@@ -5291,11 +5979,6 @@
   ]
   
   [
- [[link boost_asio.reference.basic_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
@@ -5314,15 +5997,39 @@
   
   [
     [[link boost_asio.reference.basic_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
     [Get the native socket representation. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket.open [*open]]]
     [Open the socket using the specified protocol. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
     [Get the remote endpoint of the socket. ]
   ]
@@ -5344,6 +6051,16 @@
   [[Name][Description]]
 
   [
+ [[link boost_asio.reference.basic_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
     [Protected destructor to prevent deletion through this type. ]
   ]
@@ -5365,6 +6082,11 @@
   ]
 
   [
+ [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
@@ -5382,12 +6104,12 @@
 
   [
     [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.basic_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -5449,6 +6171,23 @@
 
 
 
+[section:message_end_of_record basic_datagram_socket::message_end_of_record]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_end_of_record..basic_datagram_socket]
+Specifies that the data marks the end of a record.
+
+
+ static const int message_end_of_record = implementation_defined;
+
+
+
+[endsect]
+
+
+
 [section:message_flags basic_datagram_socket::message_flags]
 
 
@@ -5513,7 +6252,7 @@
 ['Inherited from basic_socket.]
 
 [indexterm2 native..basic_datagram_socket]
-Get the native socket representation.
+(Deprecated: Use `native_handle()`.) Get the native socket representation.
 
 
   native_type native();
@@ -5526,34 +6265,561 @@
 
 
 
-[section:native_type basic_datagram_socket::native_type]
-
-[indexterm2 native_type..basic_datagram_socket]
-The native representation of a socket.
+[section:native_handle basic_datagram_socket::native_handle]
 
 
- typedef DatagramSocketService::native_type native_type;
+['Inherited from basic_socket.]
 
+[indexterm2 native_handle..basic_datagram_socket]
+Get the native socket representation.
 
 
-[heading Requirements]
+ native_handle_type native_handle();
 
-[*Header: ][^boost/asio/basic_datagram_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
 
 
 [endsect]
 
 
 
+[section:native_handle_type basic_datagram_socket::native_handle_type]
+
+[indexterm2 native_handle_type..basic_datagram_socket]
+The native representation of a socket.
+
+
+ typedef DatagramSocketService::native_handle_type native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_datagram_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:native_non_blocking basic_datagram_socket::native_non_blocking]
+
+[indexterm2 native_non_blocking..basic_datagram_socket]
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.native_non_blocking.overload3 more...]]``
+
+
+[section:overload1 basic_datagram_socket::native_non_blocking (1 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool native_non_blocking() const;
+
+
+This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Return Value]
+
+`true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
+
+
+[heading Remarks]
+
+The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_datagram_socket::native_non_blocking (2 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void native_non_blocking(
+ bool mode);
+
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
+
+]
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_datagram_socket::native_non_blocking (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ boost::system::error_code native_non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
+
+]
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:native_type basic_datagram_socket::native_type]
+
+[indexterm2 native_type..basic_datagram_socket]
+(Deprecated: Use native\_handle\_type.) The native representation of a socket.
+
+
+ typedef DatagramSocketService::native_handle_type native_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_datagram_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:non_blocking basic_datagram_socket::non_blocking]
+
+[indexterm2 non_blocking..basic_datagram_socket]
+Gets the non-blocking mode of the socket.
+
+
+ bool ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the socket.
+
+
+ void ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_datagram_socket.non_blocking.overload3 more...]]``
+
+
+[section:overload1 basic_datagram_socket::non_blocking (1 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Gets the non-blocking mode of the socket.
+
+
+ bool non_blocking() const;
+
+
+
+[heading Return Value]
+
+`true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_datagram_socket::non_blocking (2 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ void non_blocking(
+ bool mode);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_datagram_socket::non_blocking (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:non_blocking_io basic_datagram_socket::non_blocking_io]
 
 
 ['Inherited from socket_base.]
 
 [indexterm2 non_blocking_io..basic_datagram_socket]
-IO control command to set the blocking mode of the socket.
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
 
 
   typedef implementation_defined non_blocking_io;
@@ -5710,6 +6976,40 @@
 [endsect]
 
 
+[section:operator_eq_ basic_datagram_socket::operator=]
+
+[indexterm2 operator=..basic_datagram_socket]
+Move-assign a [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] from another.
+
+
+ basic_datagram_socket & operator=(
+ basic_datagram_socket && other);
+
+
+This assignment operator moves a datagram socket from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_datagram_socket(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
+
 [section:protocol_type basic_datagram_socket::protocol_type]
 
 [indexterm2 protocol_type..basic_datagram_socket]
@@ -6886,13 +8186,20 @@
 ['Inherited from basic_io_object.]
 
 [indexterm2 service..basic_datagram_socket]
-The service associated with the I/O object.
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
   service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
 [endsect]
 
 
@@ -7297,6 +8604,11 @@
   ]
   
   [
+ [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
+ [Cancels one asynchronous operation that is waiting on the timer. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
     [Get the timer's expiry time as an absolute time.
 
@@ -7316,13 +8628,24 @@
   ]
   
   [
- [[link boost_asio.reference.basic_deadline_timer.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
+ [Perform a blocking wait on the timer. ]
   ]
   
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
- [Perform a blocking wait on the timer. ]
+ [[link boost_asio.reference.basic_deadline_timer.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_deadline_timer.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
   
 ]
@@ -7333,12 +8656,12 @@
 
   [
     [[link boost_asio.reference.basic_deadline_timer.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.basic_deadline_timer.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -7347,7 +8670,7 @@
 
 A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
 
-Most applications will use the `boost::asio::deadline_timer` typedef.
+Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
 
 
 [heading Thread Safety]
@@ -7719,6 +9042,114 @@
 
 [endsect]
 
+[section:cancel_one basic_deadline_timer::cancel_one]
+
+[indexterm2 cancel_one..basic_deadline_timer]
+Cancels one asynchronous operation that is waiting on the timer.
+
+
+ std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 cancel_one]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload1 more...]]``
+
+ std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 cancel_one]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.cancel_one.overload2 more...]]``
+
+
+[section:overload1 basic_deadline_timer::cancel_one (1 of 2 overloads)]
+
+
+Cancels one asynchronous operation that is waiting on the timer.
+
+
+ std::size_t cancel_one();
+
+
+This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
+
+Cancelling the timer does not change the expiry time.
+
+
+[heading Return Value]
+
+The number of asynchronous operations that were cancelled. That is, either 0 or 1.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
+
+
+* have already been invoked; or
+
+
+* have been queued for invocation in the near future.
+
+These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
+
+
+[endsect]
+
+
+
+[section:overload2 basic_deadline_timer::cancel_one (2 of 2 overloads)]
+
+
+Cancels one asynchronous operation that is waiting on the timer.
+
+
+ std::size_t cancel_one(
+ boost::system::error_code & ec);
+
+
+This function forces the completion of one pending asynchronous wait operation against the timer. Handlers are cancelled in FIFO order. The handler for the cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
+
+Cancelling the timer does not change the expiry time.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of asynchronous operations that were cancelled. That is, either 0 or 1.
+
+
+[heading Remarks]
+
+If the timer has already expired when `cancel_one()` is called, then the handlers for asynchronous wait operations will:
+
+
+* have already been invoked; or
+
+
+* have been queued for invocation in the near future.
+
+These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:duration_type basic_deadline_timer::duration_type]
 
@@ -8026,6 +9457,54 @@
 
 [endsect]
 
+[section:get_implementation basic_deadline_timer::get_implementation]
+
+[indexterm2 get_implementation..basic_deadline_timer]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.basic_deadline_timer.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.basic_deadline_timer.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.get_implementation.overload2 more...]]``
+
+
+[section:overload1 basic_deadline_timer::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_deadline_timer::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:get_io_service basic_deadline_timer::get_io_service]
 
@@ -8052,17 +9531,29 @@
 [endsect]
 
 
+[section:get_service basic_deadline_timer::get_service]
 
-[section:implementation basic_deadline_timer::implementation]
+[indexterm2 get_service..basic_deadline_timer]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.basic_deadline_timer.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.basic_deadline_timer.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_deadline_timer.get_service.overload2 more...]]``
+
+
+[section:overload1 basic_deadline_timer::get_service (1 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation..basic_deadline_timer]
-The underlying implementation of the I/O object.
 
+Get the service associated with the I/O object.
 
- implementation_type implementation;
+
+ service_type & get_service();
 
 
 
@@ -8070,50 +9561,60 @@
 
 
 
-[section:implementation_type basic_deadline_timer::implementation_type]
+[section:overload2 basic_deadline_timer::get_service (2 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..basic_deadline_timer]
-The underlying implementation type of I/O object.
 
+Get the service associated with the I/O object.
 
- typedef service_type::implementation_type implementation_type;
 
+ const service_type & get_service() const;
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_deadline_timer.hpp]
+[endsect]
+
+
+[endsect]
+
+
+[section:implementation basic_deadline_timer::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_deadline_timer]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:io_service basic_deadline_timer::io_service]
+[section:implementation_type basic_deadline_timer::implementation_type]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 io_service..basic_deadline_timer]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
+[indexterm2 implementation_type..basic_deadline_timer]
+The underlying implementation type of I/O object.
 
- boost::asio::io_service & io_service();
 
+ typedef service_type::implementation_type implementation_type;
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_deadline_timer.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
@@ -8126,13 +9627,20 @@
 ['Inherited from basic_io_object.]
 
 [indexterm2 service..basic_deadline_timer]
-The service associated with the I/O object.
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
   service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
 [endsect]
 
 
@@ -8285,8 +9793,7 @@
 
   template<
       typename ``[link boost_asio.reference.IoObjectService IoObjectService]``>
- class basic_io_object :
- noncopyable
+ class basic_io_object
 
 
 [heading Types]
@@ -8318,11 +9825,6 @@
     [Get the io_service associated with the object. ]
   ]
   
- [
- [[link boost_asio.reference.basic_io_object.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
 ]
 
 [heading Protected Member Functions]
@@ -8331,7 +9833,24 @@
 
   [
     [[link boost_asio.reference.basic_io_object.basic_io_object [*basic_io_object]]]
- [Construct a basic_io_object. ]
+ [Construct a basic_io_object.
+
+ Move-construct a basic_io_object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_io_object.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_io_object.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_io_object.operator_eq_ [*operator=]]]
+ [Move-assign a basic_io_object. ]
   ]
   
   [
@@ -8347,44 +9866,143 @@
 
   [
     [[link boost_asio.reference.basic_io_object.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.basic_io_object.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
+
+[heading Remarks]
+
+All I/O objects are non-copyable. However, when using C++0x, certain I/O objects do support move construction and move assignment.
+
+
+
 [heading Requirements]
 
 [*Header: ][^boost/asio/basic_io_object.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-
 [section:basic_io_object basic_io_object::basic_io_object]
 
 [indexterm2 basic_io_object..basic_io_object]
 Construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
 
 
+ explicit ``[link boost_asio.reference.basic_io_object.basic_io_object.overload1 basic_io_object]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload1 more...]]``
+
+
+Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
+
+
+ ``[link boost_asio.reference.basic_io_object.basic_io_object.overload2 basic_io_object]``(
+ basic_io_object && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.basic_io_object.overload2 more...]]``
+
+
+[section:overload1 basic_io_object::basic_io_object (1 of 2 overloads)]
+
+
+Construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
+
+
   basic_io_object(
       boost::asio::io_service & io_service);
 
 
 Performs:
 
- service.construct(implementation);
+ get_service().construct(get_implementation());
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_io_object::basic_io_object (2 of 2 overloads)]
+
+
+Move-construct a [link boost_asio.reference.basic_io_object `basic_io_object`].
+
+
+ basic_io_object(
+ basic_io_object && other);
+
+
+Performs:
+
+ get_service().move_construct(
+ get_implementation(), other.get_implementation());
+
+
+
+
+
+[heading Remarks]
+
+Available only for services that support movability,
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:get_implementation basic_io_object::get_implementation]
+
+[indexterm2 get_implementation..basic_io_object]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.basic_io_object.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_implementation.overload2 more...]]``
+
+
+[section:overload1 basic_io_object::get_implementation (1 of 2 overloads)]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
 
 
+[section:overload2 basic_io_object::get_implementation (2 of 2 overloads)]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
 
 
 
 [endsect]
 
 
+[endsect]
+
 
 [section:get_io_service basic_io_object::get_io_service]
 
@@ -8408,11 +10026,53 @@
 [endsect]
 
 
+[section:get_service basic_io_object::get_service]
+
+[indexterm2 get_service..basic_io_object]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.basic_io_object.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_io_object.get_service.overload2 more...]]``
+
+
+[section:overload1 basic_io_object::get_service (1 of 2 overloads)]
+
+
+Get the service associated with the I/O object.
+
+
+ service_type & get_service();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_io_object::get_service (2 of 2 overloads)]
+
+
+Get the service associated with the I/O object.
+
+
+ const service_type & get_service() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:implementation basic_io_object::implementation]
 
 [indexterm2 implementation..basic_io_object]
-The underlying implementation of the I/O object.
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
 
   implementation_type implementation;
@@ -8444,21 +10104,28 @@
 
 
 
-[section:io_service basic_io_object::io_service]
+[section:operator_eq_ basic_io_object::operator=]
 
-[indexterm2 io_service..basic_io_object]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+[indexterm2 operator=..basic_io_object]
+Move-assign a [link boost_asio.reference.basic_io_object `basic_io_object`].
 
 
- boost::asio::io_service & io_service();
+ basic_io_object & operator=(
+ basic_io_object && other);
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+Performs:
 
+ get_service().move_assign(get_implementation(),
+ other.get_service(), other.get_implementation());
 
-[heading Return Value]
+
+
+
+
+[heading Remarks]
       
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+Available only for services that support movability,
 
 
 
@@ -8470,13 +10137,20 @@
 [section:service basic_io_object::service]
 
 [indexterm2 service..basic_io_object]
-The service associated with the I/O object.
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
   service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
 [endsect]
 
 
@@ -8513,7 +10187,7 @@
 
 Performs:
 
- service.destroy(implementation);
+ get_service().destroy(get_implementation());
 
 
 
@@ -8621,15 +10295,22 @@
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
     [The native representation of a socket. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.basic_raw_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.basic_raw_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
   
   ]
 
@@ -8743,7 +10424,9 @@
 
      Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_raw_socket on an existing native socket. ]
+ Construct a basic_raw_socket on an existing native socket.
+
+ Move-construct a basic_raw_socket from another. ]
   ]
   
   [
@@ -8782,11 +10465,6 @@
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
@@ -8805,15 +10483,39 @@
   
   [
     [[link boost_asio.reference.basic_raw_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
     [Get the native socket representation. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_raw_socket.open [*open]]]
     [Open the socket using the specified protocol. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_raw_socket from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
     [Receive some data on a connected socket. ]
   ]
@@ -8850,6 +10552,22 @@
   
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
 [heading Data Members]
 [table
   [[Name][Description]]
@@ -8865,6 +10583,11 @@
   ]
 
   [
+ [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
@@ -8882,12 +10605,12 @@
 
   [
     [[link boost_asio.reference.basic_raw_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.basic_raw_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -8917,12 +10640,12 @@
 
   void ``[link boost_asio.reference.basic_raw_socket.assign.overload1 assign]``(
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
   `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.assign.overload1 more...]]``
 
   boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.assign.overload2 assign]``(
       const protocol_type & protocol,
- const native_type & native_socket,
+ const native_handle_type & native_socket,
       boost::system::error_code & ec);
   `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.assign.overload2 more...]]``
 
@@ -8938,7 +10661,7 @@
 
   void assign(
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
 
 
 
@@ -8957,7 +10680,7 @@
 
   boost::system::error_code assign(
       const protocol_type & protocol,
- const native_type & native_socket,
+ const native_handle_type & native_socket,
       boost::system::error_code & ec);
 
 
@@ -9774,11 +11497,19 @@
   ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 basic_raw_socket]``(
       boost::asio::io_service & io_service,
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
   `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload4 more...]]``
 
 
-[section:overload1 basic_raw_socket::basic_raw_socket (1 of 4 overloads)]
+Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another.
+
+
+ ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 basic_raw_socket]``(
+ basic_raw_socket && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload5 more...]]``
+
+
+[section:overload1 basic_raw_socket::basic_raw_socket (1 of 5 overloads)]
 
 
 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] without opening it.
@@ -9807,7 +11538,7 @@
 
 
 
-[section:overload2 basic_raw_socket::basic_raw_socket (2 of 4 overloads)]
+[section:overload2 basic_raw_socket::basic_raw_socket (2 of 5 overloads)]
 
 
 Construct and open a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`].
@@ -9849,7 +11580,7 @@
 
 
 
-[section:overload3 basic_raw_socket::basic_raw_socket (3 of 4 overloads)]
+[section:overload3 basic_raw_socket::basic_raw_socket (3 of 5 overloads)]
 
 
 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`], opening it and binding it to the given local endpoint.
@@ -9891,7 +11622,7 @@
 
 
 
-[section:overload4 basic_raw_socket::basic_raw_socket (4 of 4 overloads)]
+[section:overload4 basic_raw_socket::basic_raw_socket (4 of 5 overloads)]
 
 
 Construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] on an existing native socket.
@@ -9900,7 +11631,7 @@
   basic_raw_socket(
       boost::asio::io_service & io_service,
       const protocol_type & protocol,
- const native_type & native_socket);
+ const native_handle_type & native_socket);
 
 
 This constructor creates a raw socket object to hold an existing native socket.
@@ -9935,6 +11666,40 @@
 [endsect]
 
 
+
+[section:overload5 basic_raw_socket::basic_raw_socket (5 of 5 overloads)]
+
+
+Move-construct a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another.
+
+
+ basic_raw_socket(
+ basic_raw_socket && other);
+
+
+This constructor moves a raw socket from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
 [endsect]
 
 [section:bind basic_raw_socket::bind]
@@ -10309,7 +12074,7 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
 
 ]
 
@@ -10346,7 +12111,7 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
 
 ]
 
@@ -10692,6 +12457,54 @@
 [endsect]
 
 
+[section:get_implementation basic_raw_socket::get_implementation]
+
+[indexterm2 get_implementation..basic_raw_socket]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.basic_raw_socket.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.basic_raw_socket.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_implementation.overload2 more...]]``
+
+
+[section:overload1 basic_raw_socket::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_raw_socket::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:get_io_service basic_raw_socket::get_io_service]
 
@@ -10851,6 +12664,54 @@
 
 [endsect]
 
+[section:get_service basic_raw_socket::get_service]
+
+[indexterm2 get_service..basic_raw_socket]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.basic_raw_socket.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.basic_raw_socket.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.get_service.overload2 more...]]``
+
+
+[section:overload1 basic_raw_socket::get_service (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ service_type & get_service();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_raw_socket::get_service (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ const service_type & get_service() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:implementation basic_raw_socket::implementation]
 
@@ -10858,7 +12719,7 @@
 ['Inherited from basic_io_object.]
 
 [indexterm2 implementation..basic_raw_socket]
-The underlying implementation of the I/O object.
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
 
   implementation_type implementation;
@@ -11026,32 +12887,6 @@
 [endsect]
 
 
-[section:io_service basic_raw_socket::io_service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 io_service..basic_raw_socket]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
-
- boost::asio::io_service & io_service();
-
-
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
-
-
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
-
-
-
-
-[endsect]
-
-
-
 [section:is_open basic_raw_socket::is_open]
 
 
@@ -11460,15 +13295,22 @@
 
   [
 
- [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
     [The native representation of a socket. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
   
   ]
 
@@ -11562,7 +13404,9 @@
 
      Construct a basic_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_socket on an existing native socket. ]
+ Construct a basic_socket on an existing native socket.
+
+ Move-construct a basic_socket from another. ]
   ]
   
   [
@@ -11601,11 +13445,6 @@
   ]
   
   [
- [[link boost_asio.reference.basic_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
@@ -11624,15 +13463,39 @@
   
   [
     [[link boost_asio.reference.basic_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
     [Get the native socket representation. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket.open [*open]]]
     [Open the socket using the specified protocol. ]
   ]
   
   [
+ [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
     [Get the remote endpoint of the socket. ]
   ]
@@ -11654,6 +13517,16 @@
   [[Name][Description]]
 
   [
+ [[link boost_asio.reference.basic_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
     [Protected destructor to prevent deletion through this type. ]
   ]
@@ -11675,6 +13548,11 @@
   ]
 
   [
+ [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
@@ -11692,12 +13570,12 @@
 
   [
     [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.basic_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -11759,6 +13637,23 @@
 
 
 
+[section:message_end_of_record basic_raw_socket::message_end_of_record]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_end_of_record..basic_raw_socket]
+Specifies that the data marks the end of a record.
+
+
+ static const int message_end_of_record = implementation_defined;
+
+
+
+[endsect]
+
+
+
 [section:message_flags basic_raw_socket::message_flags]
 
 
@@ -11823,7 +13718,7 @@
 ['Inherited from basic_socket.]
 
 [indexterm2 native..basic_raw_socket]
-Get the native socket representation.
+(Deprecated: Use `native_handle()`.) Get the native socket representation.
 
 
   native_type native();
@@ -11836,13 +13731,32 @@
 
 
 
-[section:native_type basic_raw_socket::native_type]
+[section:native_handle basic_raw_socket::native_handle]
 
-[indexterm2 native_type..basic_raw_socket]
+
+['Inherited from basic_socket.]
+
+[indexterm2 native_handle..basic_raw_socket]
+Get the native socket representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type basic_raw_socket::native_handle_type]
+
+[indexterm2 native_handle_type..basic_raw_socket]
 The native representation of a socket.
 
 
- typedef RawSocketService::native_type native_type;
+ typedef RawSocketService::native_handle_type native_handle_type;
 
 
 
@@ -11856,78 +13770,147 @@
 [endsect]
 
 
+[section:native_non_blocking basic_raw_socket::native_non_blocking]
 
-[section:non_blocking_io basic_raw_socket::non_blocking_io]
+[indexterm2 native_non_blocking..basic_raw_socket]
+Gets the non-blocking mode of the native socket implementation.
 
 
-['Inherited from socket_base.]
+ bool ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload1 more...]]``
 
-[indexterm2 non_blocking_io..basic_raw_socket]
-IO control command to set the blocking mode of the socket.
 
+Sets the non-blocking mode of the native socket implementation.
 
- typedef implementation_defined non_blocking_io;
 
+ void ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload2 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.native_non_blocking.overload3 more...]]``
 
-Implements the FIONBIO IO control command.
 
+[section:overload1 basic_raw_socket::native_non_blocking (1 of 3 overloads)]
 
-[heading Example]
-
 
+['Inherited from basic_socket.]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
 
+Gets the non-blocking mode of the native socket implementation.
 
 
+ bool native_non_blocking() const;
 
 
+This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
 
 
-[heading Requirements]
+[heading Return Value]
+
+`true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
 
-[*Header: ][^boost/asio/basic_raw_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Remarks]
+
+The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
 
 
-[endsect]
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
 
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
 
-[section:open basic_raw_socket::open]
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
 
-[indexterm2 open..basic_raw_socket]
-Open the socket using the specified protocol.
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
- void ``[link boost_asio.reference.basic_raw_socket.open.overload1 open]``(
- const protocol_type & protocol = protocol_type());
- `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.open.overload2 open]``(
- const protocol_type & protocol,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload2 more...]]``
 
 
-[section:overload1 basic_raw_socket::open (1 of 2 overloads)]
+
+
+[endsect]
+
+
+
+[section:overload2 basic_raw_socket::native_non_blocking (2 of 3 overloads)]
 
 
 ['Inherited from basic_socket.]
 
 
-Open the socket using the specified protocol.
+Sets the non-blocking mode of the native socket implementation.
 
 
- void open(
- const protocol_type & protocol = protocol_type());
+ void native_non_blocking(
+ bool mode);
 
 
-This function opens the socket so that it will use the specified protocol.
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
 
 
 [heading Parameters]
@@ -11935,7 +13918,7 @@
 
 [variablelist
   
-[[protocol][An object specifying protocol parameters to be used.]]
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
 ]
 
@@ -11945,17 +13928,79 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
 
 ]
 
 
 [heading Example]
   
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
 
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
 
- boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
 
@@ -11967,21 +14012,21 @@
 
 
 
-[section:overload2 basic_raw_socket::open (2 of 2 overloads)]
+[section:overload3 basic_raw_socket::native_non_blocking (3 of 3 overloads)]
 
 
 ['Inherited from basic_socket.]
 
 
-Open the socket using the specified protocol.
+Sets the non-blocking mode of the native socket implementation.
 
 
- boost::system::error_code open(
- const protocol_type & protocol,
+ boost::system::error_code native_non_blocking(
+ bool mode,
       boost::system::error_code & ec);
 
 
-This function opens the socket so that it will use the specified protocol.
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
 
 
 [heading Parameters]
@@ -11989,24 +14034,81 @@
 
 [variablelist
   
-[[protocol][An object specifying which protocol is to be used.]]
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
 
 ]
 
 
 [heading Example]
   
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
 
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
 
- boost::asio::ip::tcp::socket socket(io_service);
- boost::system::error_code ec;
- socket.open(boost::asio::ip::tcp::v4(), ec);
- if (ec)
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
    {
- // An error occurred.
- }
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
 
@@ -12020,13 +14122,13 @@
 [endsect]
 
 
-[section:protocol_type basic_raw_socket::protocol_type]
+[section:native_type basic_raw_socket::native_type]
 
-[indexterm2 protocol_type..basic_raw_socket]
-The protocol type.
+[indexterm2 native_type..basic_raw_socket]
+(Deprecated: Use native\_handle\_type.) The native representation of a socket.
 
 
- typedef Protocol protocol_type;
+ typedef RawSocketService::native_handle_type native_type;
 
 
 
@@ -12040,106 +14142,460 @@
 [endsect]
 
 
-[section:receive basic_raw_socket::receive]
+[section:non_blocking basic_raw_socket::non_blocking]
 
-[indexterm2 receive..basic_raw_socket]
-Receive some data on a connected socket.
+[indexterm2 non_blocking..basic_raw_socket]
+Gets the non-blocking mode of the socket.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload1 receive]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload1 more...]]``
+ bool ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload2 receive]``(
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags);
- `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload2 more...]]``
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload3 receive]``(
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload3 more...]]``
+Sets the non-blocking mode of the socket.
 
 
-[section:overload1 basic_raw_socket::receive (1 of 3 overloads)]
+ void ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload2 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.non_blocking.overload3 more...]]``
 
-Receive some data on a connected socket.
 
+[section:overload1 basic_raw_socket::non_blocking (1 of 3 overloads)]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
- const MutableBufferSequence & buffers);
 
+['Inherited from basic_socket.]
 
-This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
 
+Gets the non-blocking mode of the socket.
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be received.]]
+ bool non_blocking() const;
 
-]
 
 
 [heading Return Value]
       
-The number of bytes received.
-
-
-[heading Exceptions]
-
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
-
-]
+`true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
 
 
 [heading Remarks]
       
-The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket.
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
 
-[heading Example]
-
-To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- socket.receive(boost::asio::buffer(data, size));
 
+[endsect]
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
+[section:overload2 basic_raw_socket::non_blocking (2 of 3 overloads)]
 
 
-[endsect]
+['Inherited from basic_socket.]
 
 
+Sets the non-blocking mode of the socket.
 
-[section:overload2 basic_raw_socket::receive (2 of 3 overloads)]
 
+ void non_blocking(
+ bool mode);
 
-Receive some data on a connected socket.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags);
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_raw_socket::non_blocking (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:non_blocking_io basic_raw_socket::non_blocking_io]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 non_blocking_io..basic_raw_socket]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
+
+
+ typedef implementation_defined non_blocking_io;
+
+
+
+Implements the FIONBIO IO control command.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::non_blocking_io command(true);
+ socket.io_control(command);
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_raw_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:open basic_raw_socket::open]
+
+[indexterm2 open..basic_raw_socket]
+Open the socket using the specified protocol.
+
+
+ void ``[link boost_asio.reference.basic_raw_socket.open.overload1 open]``(
+ const protocol_type & protocol = protocol_type());
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.open.overload2 more...]]``
+
+
+[section:overload1 basic_raw_socket::open (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Open the socket using the specified protocol.
+
+
+ void open(
+ const protocol_type & protocol = protocol_type());
+
+
+This function opens the socket so that it will use the specified protocol.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[protocol][An object specifying protocol parameters to be used.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_raw_socket::open (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Open the socket using the specified protocol.
+
+
+ boost::system::error_code open(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+
+
+This function opens the socket so that it will use the specified protocol.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[protocol][An object specifying which protocol is to be used.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::system::error_code ec;
+ socket.open(boost::asio::ip::tcp::v4(), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:operator_eq_ basic_raw_socket::operator=]
+
+[indexterm2 operator=..basic_raw_socket]
+Move-assign a [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] from another.
+
+
+ basic_raw_socket & operator=(
+ basic_raw_socket && other);
+
+
+This assignment operator moves a raw socket from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_raw_socket(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
+
+[section:protocol_type basic_raw_socket::protocol_type]
+
+[indexterm2 protocol_type..basic_raw_socket]
+The protocol type.
+
+
+ typedef Protocol protocol_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_raw_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:receive basic_raw_socket::receive]
+
+[indexterm2 receive..basic_raw_socket]
+Receive some data on a connected socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload1 receive]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload2 receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload2 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.receive.overload3 receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_raw_socket.receive.overload3 more...]]``
+
+
+[section:overload1 basic_raw_socket::receive (1 of 3 overloads)]
+
+
+Receive some data on a connected socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers);
+
+
+This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes received.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The receive operation can only be used with a connected socket. Use the receive\_from function to receive data on an unconnected raw socket.
+
+
+[heading Example]
+
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.receive(boost::asio::buffer(data, size));
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_raw_socket::receive (2 of 3 overloads)]
+
+
+Receive some data on a connected socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags);
 
 
 This function is used to receive data on the raw socket. The function call will block until data has been received successfully or an error occurs.
@@ -13196,13 +15652,20 @@
 ['Inherited from basic_io_object.]
 
 [indexterm2 service..basic_raw_socket]
-The service associated with the I/O object.
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
   service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
 [endsect]
 
 
@@ -13528,17 +15991,17 @@
 
 [endsect]
 
-[section:basic_serial_port basic_serial_port]
+[section:basic_seq_packet_socket basic_seq_packet_socket]
 
 
-Provides serial port functionality.
+Provides sequenced packet socket functionality.
 
 
   template<
- typename ``[link boost_asio.reference.SerialPortService SerialPortService]`` = serial_port_service>
- class basic_serial_port :
- public basic_io_object< SerialPortService >,
- public serial_port_base
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SeqPacketSocketService SeqPacketSocketService]`` = seq_packet_socket_service<Protocol>>
+ class basic_seq_packet_socket :
+ public basic_socket< Protocol, SeqPacketSocketService >
 
 
 [heading Types]
@@ -13547,129 +16010,367 @@
 
   [
 
- [[link boost_asio.reference.basic_serial_port.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
- [A basic_serial_port is always the lowest layer. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
- [The native representation of a serial port. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_serial_port.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
   
   ]
 
-]
+ [
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+ [[link boost_asio.reference.basic_seq_packet_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
 
   [
- [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
- [Assign an existing native serial port to the serial port. ]
+
+ [[link boost_asio.reference.basic_seq_packet_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
+ ]
+
   [
- [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
+
+ [[link boost_asio.reference.basic_seq_packet_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
   
+ ]
+
   [
- [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
+
+ [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
   
+ ]
+
   [
- [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
- [Construct a basic_serial_port without opening it.
 
- Construct and open a basic_serial_port.
+ [[link boost_asio.reference.basic_seq_packet_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
+
+ [
 
- Construct a basic_serial_port on an existing native serial port. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
   
+ ]
+
   [
- [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the serial port. ]
+
+ [[link boost_asio.reference.basic_seq_packet_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
   
+ ]
+
   [
- [[link boost_asio.reference.basic_serial_port.close [*close]]]
- [Close the serial port. ]
+
+ [[link boost_asio.reference.basic_seq_packet_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
   
+ ]
+
   [
- [[link boost_asio.reference.basic_serial_port.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+
+ [[link boost_asio.reference.basic_seq_packet_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
   
+ ]
+
   [
- [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
- [Get an option from the serial port. ]
+
+ [[link boost_asio.reference.basic_seq_packet_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_seq_packet_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
   
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.basic_serial_port.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
- [Determine whether the serial port is open. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
-
- Get a const reference to the lowest layer. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.async_receive [*async_receive]]]
+ [Start an asynchronous receive. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.native [*native]]]
- [Get the native serial port representation. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.async_send [*async_send]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.open [*open]]]
- [Open the serial port using the specified device name. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
- [Read some data from the serial port. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
- [Send a break sequence to the serial port. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket [*basic_seq_packet_socket]]]
+ [Construct a basic_seq_packet_socket without opening it.
+
+ Construct and open a basic_seq_packet_socket.
+
+ Construct a basic_seq_packet_socket, opening it and binding it to the given local endpoint.
+
+ Construct a basic_seq_packet_socket on an existing native socket.
+
+ Move-construct a basic_seq_packet_socket from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
- [Set an option on the serial port. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
- [Write some data to the serial port. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
   ]
   
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_seq_packet_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.receive [*receive]]]
+ [Receive some data on the socket.
+
+ Receive some data on a connected socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.send [*send]]]
+ [Send some data on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_seq_packet_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
+
 ]
 
 [heading Protected Data Members]
@@ -13677,18 +16378,18 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_serial_port.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.basic_serial_port.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.basic_seq_packet_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class template provides functionality that is common to all serial ports.
+The [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] class template provides asynchronous and blocking sequenced packet socket functionality.
 
 
 [heading Thread Safety]
@@ -13701,34 +16402,40 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_serial_port.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:assign basic_serial_port::assign]
+[section:assign basic_seq_packet_socket::assign]
 
-[indexterm2 assign..basic_serial_port]
-Assign an existing native serial port to the serial port.
+[indexterm2 assign..basic_seq_packet_socket]
+Assign an existing native socket to the socket.
 
 
- void ``[link boost_asio.reference.basic_serial_port.assign.overload1 assign]``(
- const native_type & native_serial_port);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_serial_port.assign.overload2 assign]``(
- const native_type & native_serial_port,
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.assign.overload2 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.assign.overload2 more...]]``
 
 
-[section:overload1 basic_serial_port::assign (1 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::assign (1 of 2 overloads)]
 
 
-Assign an existing native serial port to the serial port.
+['Inherited from basic_socket.]
+
+
+Assign an existing native socket to the socket.
 
 
   void assign(
- const native_type & native_serial_port);
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
 
 
 
@@ -13736,14 +16443,18 @@
 
 
 
-[section:overload2 basic_serial_port::assign (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::assign (2 of 2 overloads)]
 
 
-Assign an existing native serial port to the serial port.
+['Inherited from basic_socket.]
+
+
+Assign an existing native socket to the socket.
 
 
   boost::system::error_code assign(
- const native_type & native_serial_port,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
       boost::system::error_code & ec);
 
 
@@ -13754,21 +16465,25 @@
 [endsect]
 
 
-[section:async_read_some basic_serial_port::async_read_some]
+[section:async_connect basic_seq_packet_socket::async_connect]
 
-[indexterm2 async_read_some..basic_serial_port]
-Start an asynchronous read.
+
+['Inherited from basic_socket.]
+
+[indexterm2 async_connect..basic_seq_packet_socket]
+Start an asynchronous connect.
 
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_read_some(
- const MutableBufferSequence & buffers,
- ReadHandler handler);
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
 
 
-This function is used to asynchronously read data from the serial port. The function call always returns immediately.
+This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
 
 
 [heading Parameters]
@@ -13776,13 +16491,12 @@
 
 [variablelist
   
-[[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
 
-[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
    void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes read.
+ const boost::system::error_code& error // Result of operation
    );
 ``
 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
@@ -13790,19 +16504,27 @@
 ]
 
 
-[heading Remarks]
-
-The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
-
-
 [heading Example]
   
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- serial_port.async_read_some(boost::asio::buffer(data, size), handler);
+
+ void connect_handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Connect succeeded.
+ }
+ }
+
+ ...
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.async_connect(endpoint, connect_handler);
+
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -13810,22 +16532,48 @@
 [endsect]
 
 
+[section:async_receive basic_seq_packet_socket::async_receive]
 
-[section:async_write_some basic_serial_port::async_write_some]
+[indexterm2 async_receive..basic_seq_packet_socket]
+Start an asynchronous receive.
 
-[indexterm2 async_write_some..basic_serial_port]
-Start an asynchronous write.
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_seq_packet_socket.async_receive.overload1 async_receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags & out_flags,
+ ReadHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload1 more...]]``
 
   template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_seq_packet_socket.async_receive.overload2 async_receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags,
+ ReadHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.async_receive.overload2 more...]]``
 
 
-This function is used to asynchronously write data to the serial port. The function call always returns immediately.
+[section:overload1 basic_seq_packet_socket::async_receive (1 of 2 overloads)]
+
+
+Start an asynchronous receive.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags & out_flags,
+ ReadHandler handler);
+
+
+This function is used to asynchronously receive data from the sequenced packet socket. The function call always returns immediately.
 
 
 [heading Parameters]
@@ -13833,13 +16581,15 @@
 
 [variablelist
   
-[[buffers][One or more data buffers to be written to the serial port. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
 
-[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+[[out_flags][Once the asynchronous operation completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record. The caller must guarantee that the referenced variable remains valid until the handler is called.]]
+
+[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
 ``
    void handler(
      const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes written.
+ std::size_t bytes_transferred // Number of bytes received.
    );
 ``
 Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
@@ -13847,19 +16597,14 @@
 ]
 
 
-[heading Remarks]
-
-The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
-
-
 [heading Example]
   
-To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- serial_port.async_write_some(boost::asio::buffer(data, size), handler);
+ socket.async_receive(boost::asio::buffer(data, size), out_flags, handler);
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -13867,61 +16612,59 @@
 [endsect]
 
 
-[section:basic_serial_port basic_serial_port::basic_serial_port]
-
-[indexterm2 basic_serial_port..basic_serial_port]
-Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it.
-
-
- explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 basic_serial_port]``(
- boost::asio::io_service & io_service);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 more...]]``
-
-
-Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
 
+[section:overload2 basic_seq_packet_socket::async_receive (2 of 2 overloads)]
 
- explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 basic_serial_port]``(
- boost::asio::io_service & io_service,
- const char * device);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 more...]]``
 
- explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 basic_serial_port]``(
- boost::asio::io_service & io_service,
- const std::string & device);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 more...]]``
+Start an asynchronous receive.
 
 
-Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port.
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags,
+ ReadHandler handler);
 
 
- ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 basic_serial_port]``(
- boost::asio::io_service & io_service,
- const native_type & native_serial_port);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 more...]]``
+This function is used to asynchronously receive data from the sequenced data socket. The function call always returns immediately.
 
 
-[section:overload1 basic_serial_port::basic_serial_port (1 of 4 overloads)]
+[heading Parameters]
+
 
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
 
-Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it.
+[[in_flags][Flags specifying how the receive call is to be made.]]
 
+[[out_flags][Once the asynchronous operation completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record. The caller must guarantee that the referenced variable remains valid until the handler is called.]]
 
- basic_serial_port(
- boost::asio::io_service & io_service);
+[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes received.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
+]
 
-This constructor creates a serial port without opening it.
 
+[heading Example]
+
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
-[heading Parameters]
-
+ socket.async_receive(
+ boost::asio::buffer(data, size),
+ 0, out_flags, handler);
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port. ]]
 
-]
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -13929,19 +16672,25 @@
 [endsect]
 
 
+[endsect]
 
-[section:overload2 basic_serial_port::basic_serial_port (2 of 4 overloads)]
 
+[section:async_send basic_seq_packet_socket::async_send]
 
-Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
+[indexterm2 async_send..basic_seq_packet_socket]
+Start an asynchronous send.
 
 
- basic_serial_port(
- boost::asio::io_service & io_service,
- const char * device);
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ WriteHandler handler);
 
 
-This constructor creates and opens a serial port for the specified device name.
+This function is used to asynchronously send data on the sequenced packet socket. The function call always returns immediately.
 
 
 [heading Parameters]
@@ -13949,41 +16698,77 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port.]]
+[[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
 
-[[device][The platform-specific device name for this serial port. ]]
+[[flags][Flags specifying how the send call is to be made.]]
+
+[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes sent.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
 ]
 
 
+[heading Example]
+
+To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.async_send(boost::asio::buffer(data, size), 0, handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
 
 
 [endsect]
 
 
+[section:at_mark basic_seq_packet_socket::at_mark]
 
-[section:overload3 basic_serial_port::basic_serial_port (3 of 4 overloads)]
+[indexterm2 at_mark..basic_seq_packet_socket]
+Determine whether the socket is at the out-of-band data mark.
 
 
-Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
+ bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 at_mark]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload1 more...]]``
 
+ bool ``[link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.at_mark.overload2 more...]]``
 
- basic_serial_port(
- boost::asio::io_service & io_service,
- const std::string & device);
 
+[section:overload1 basic_seq_packet_socket::at_mark (1 of 2 overloads)]
 
-This constructor creates and opens a serial port for the specified device name.
 
+['Inherited from basic_socket.]
 
-[heading Parameters]
+
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool at_mark() const;
+
+
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+
+
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
+
+
+[heading Exceptions]
     
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port.]]
-
-[[device][The platform-specific device name for this serial port. ]]
+[[boost::system::system_error][Thrown on failure. ]]
 
 ]
 
@@ -13994,18 +16779,20 @@
 
 
 
-[section:overload4 basic_serial_port::basic_serial_port (4 of 4 overloads)]
+[section:overload2 basic_seq_packet_socket::at_mark (2 of 2 overloads)]
 
 
-Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port.
+['Inherited from basic_socket.]
 
 
- basic_serial_port(
- boost::asio::io_service & io_service,
- const native_type & native_serial_port);
+Determine whether the socket is at the out-of-band data mark.
 
 
-This constructor creates a serial port object to hold an existing native serial port.
+ bool at_mark(
+ boost::system::error_code & ec) const;
+
+
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
 
 
 [heading Parameters]
@@ -14013,54 +16800,55 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port.]]
-
-[[native_serial_port][A native serial port.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Exceptions]
-
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
 
 
+[endsect]
 
 
 [endsect]
 
+[section:available basic_seq_packet_socket::available]
 
-[endsect]
+[indexterm2 available..basic_seq_packet_socket]
+Determine the number of bytes available for reading.
 
-[section:cancel basic_serial_port::cancel]
 
-[indexterm2 cancel..basic_serial_port]
-Cancel all asynchronous operations associated with the serial port.
+ std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload1 available]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.available.overload1 more...]]``
 
+ std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.available.overload2 available]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.available.overload2 more...]]``
 
- void ``[link boost_asio.reference.basic_serial_port.cancel.overload1 cancel]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_serial_port.cancel.overload2 cancel]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload2 more...]]``
+[section:overload1 basic_seq_packet_socket::available (1 of 2 overloads)]
 
 
-[section:overload1 basic_serial_port::cancel (1 of 2 overloads)]
+['Inherited from basic_socket.]
 
 
-Cancel all asynchronous operations associated with the serial port.
+Determine the number of bytes available for reading.
 
 
- void cancel();
+ std::size_t available() const;
 
 
-This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+This function is used to determine the number of bytes that may be read without blocking.
+
+
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
 
 
 [heading Exceptions]
@@ -14079,17 +16867,20 @@
 
 
 
-[section:overload2 basic_serial_port::cancel (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::available (2 of 2 overloads)]
 
 
-Cancel all asynchronous operations associated with the serial port.
+['Inherited from basic_socket.]
 
 
- boost::system::error_code cancel(
- boost::system::error_code & ec);
+Determine the number of bytes available for reading.
 
 
-This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+ std::size_t available(
+ boost::system::error_code & ec) const;
+
+
+This function is used to determine the number of bytes that may be read without blocking.
 
 
 [heading Parameters]
@@ -14097,71 +16888,81 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
 
 
-[endsect]
 
 
 [endsect]
 
-[section:close basic_serial_port::close]
 
-[indexterm2 close..basic_serial_port]
-Close the serial port.
+[endsect]
 
+[section:basic_seq_packet_socket basic_seq_packet_socket::basic_seq_packet_socket]
 
- void ``[link boost_asio.reference.basic_serial_port.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload1 more...]]``
+[indexterm2 basic_seq_packet_socket..basic_seq_packet_socket]
+Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it.
 
- boost::system::error_code ``[link boost_asio.reference.basic_serial_port.close.overload2 close]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload2 more...]]``
 
+ explicit ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 basic_seq_packet_socket]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload1 more...]]``
 
-[section:overload1 basic_serial_port::close (1 of 2 overloads)]
 
+Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`].
 
-Close the serial port.
 
+ ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 basic_seq_packet_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload2 more...]]``
 
- void close();
 
+Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint.
 
-This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
+ ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 basic_seq_packet_socket]``(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload3 more...]]``
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket.
 
-]
 
+ ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 basic_seq_packet_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload4 more...]]``
 
 
+Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another.
 
-[endsect]
 
+ ``[link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 basic_seq_packet_socket]``(
+ basic_seq_packet_socket && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.basic_seq_packet_socket.overload5 more...]]``
 
 
-[section:overload2 basic_serial_port::close (2 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::basic_seq_packet_socket (1 of 5 overloads)]
 
 
-Close the serial port.
+Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] without opening it.
 
 
- boost::system::error_code close(
- boost::system::error_code & ec);
+ basic_seq_packet_socket(
+ boost::asio::io_service & io_service);
 
 
-This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+This constructor creates a sequenced packet socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
 
 
 [heading Parameters]
@@ -14169,7 +16970,7 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any. ]]
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the sequenced packet socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]]
 
 ]
 
@@ -14179,67 +16980,61 @@
 [endsect]
 
 
-[endsect]
 
+[section:overload2 basic_seq_packet_socket::basic_seq_packet_socket (2 of 5 overloads)]
 
-[section:get_io_service basic_serial_port::get_io_service]
 
+Construct and open a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`].
 
-['Inherited from basic_io_object.]
 
-[indexterm2 get_io_service..basic_serial_port]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+ basic_seq_packet_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
 
 
- boost::asio::io_service & get_io_service();
+This constructor creates and opens a sequenced\_packet socket. The socket needs to be connected or accepted before data can be sent or received on it.
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the sequenced packet socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[[protocol][An object specifying protocol parameters to be used.]]
 
+]
 
 
+[heading Exceptions]
+
 
-[endsect]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
-[section:get_option basic_serial_port::get_option]
 
-[indexterm2 get_option..basic_serial_port]
-Get an option from the serial port.
 
 
- template<
- typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
- void ``[link boost_asio.reference.basic_serial_port.get_option.overload1 get_option]``(
- GettableSerialPortOption & option);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload1 more...]]``
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
- boost::system::error_code ``[link boost_asio.reference.basic_serial_port.get_option.overload2 get_option]``(
- GettableSerialPortOption & option,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload2 more...]]``
 
 
-[section:overload1 basic_serial_port::get_option (1 of 2 overloads)]
+[section:overload3 basic_seq_packet_socket::basic_seq_packet_socket (3 of 5 overloads)]
 
 
-Get an option from the serial port.
+Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`], opening it and binding it to the given local endpoint.
 
 
- template<
- typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
- void get_option(
- GettableSerialPortOption & option);
+ basic_seq_packet_socket(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
 
 
-This function is used to get the current value of an option on the serial port.
+This constructor creates a sequenced packet socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
 
 
 [heading Parameters]
@@ -14247,7 +17042,9 @@
 
 [variablelist
   
-[[option][The option value to be obtained from the serial port.]]
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the sequenced packet socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+
+[[endpoint][An endpoint on the local machine to which the sequenced packet socket will be bound.]]
 
 ]
 
@@ -14257,32 +17054,30 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. ]]
 
 ]
 
 
 
 
-
 [endsect]
 
 
 
-[section:overload2 basic_serial_port::get_option (2 of 2 overloads)]
+[section:overload4 basic_seq_packet_socket::basic_seq_packet_socket (4 of 5 overloads)]
 
 
-Get an option from the serial port.
+Construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] on an existing native socket.
 
 
- template<
- typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
- boost::system::error_code get_option(
- GettableSerialPortOption & option,
- boost::system::error_code & ec);
+ basic_seq_packet_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
 
 
-This function is used to get the current value of an option on the serial port.
+This constructor creates a sequenced packet socket object to hold an existing native socket.
 
 
 [heading Parameters]
@@ -14290,157 +17085,182 @@
 
 [variablelist
   
-[[option][The option value to be obtained from the serial port.]]
-
-[[ec][Set to indicate what error occured, if any.]]
-
-]
-
-
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the sequenced packet socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
 
+[[protocol][An object specifying protocol parameters to be used.]]
 
+[[native_socket][The new underlying socket implementation.]]
 
-[endsect]
+]
 
 
-[endsect]
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
-[section:implementation basic_serial_port::implementation]
+]
 
 
-['Inherited from basic_io_object.]
 
-[indexterm2 implementation..basic_serial_port]
-The underlying implementation of the I/O object.
 
+[endsect]
 
- implementation_type implementation;
 
 
+[section:overload5 basic_seq_packet_socket::basic_seq_packet_socket (5 of 5 overloads)]
 
-[endsect]
 
+Move-construct a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another.
 
 
-[section:implementation_type basic_serial_port::implementation_type]
+ basic_seq_packet_socket(
+ basic_seq_packet_socket && other);
 
 
-['Inherited from basic_io_object.]
+This constructor moves a sequenced packet socket from one object to another.
 
-[indexterm2 implementation_type..basic_serial_port]
-The underlying implementation type of I/O object.
 
+[heading Parameters]
+
 
- typedef service_type::implementation_type implementation_type;
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
 
+]
 
 
-[heading Requirements]
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(io_service&) constructor`.
 
-[*Header: ][^boost/asio/basic_serial_port.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:io_service basic_serial_port::io_service]
+[section:bind basic_seq_packet_socket::bind]
 
+[indexterm2 bind..basic_seq_packet_socket]
+Bind the socket to the given local endpoint.
 
-['Inherited from basic_io_object.]
 
-[indexterm2 io_service..basic_serial_port]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+ void ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.bind.overload2 more...]]``
 
- boost::asio::io_service & io_service();
 
+[section:overload1 basic_seq_packet_socket::bind (1 of 2 overloads)]
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
+['Inherited from basic_socket.]
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
+Bind the socket to the given local endpoint.
 
 
+ void bind(
+ const endpoint_type & endpoint);
 
-[endsect]
 
+This function binds the socket to the specified endpoint on the local machine.
 
 
-[section:is_open basic_serial_port::is_open]
+[heading Parameters]
+
 
-[indexterm2 is_open..basic_serial_port]
-Determine whether the serial port is open.
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
 
+]
 
- bool is_open() const;
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[endsect]
+]
 
 
-[section:lowest_layer basic_serial_port::lowest_layer]
+[heading Example]
+
 
-[indexterm2 lowest_layer..basic_serial_port]
-Get a reference to the lowest layer.
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345));
 
- lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload1 more...]]``
 
 
-Get a const reference to the lowest layer.
 
 
- const lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload2 more...]]``
 
 
-[section:overload1 basic_serial_port::lowest_layer (1 of 2 overloads)]
+[endsect]
 
 
-Get a reference to the lowest layer.
 
+[section:overload2 basic_seq_packet_socket::bind (2 of 2 overloads)]
 
- lowest_layer_type & lowest_layer();
 
+['Inherited from basic_socket.]
 
-This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
 
+Bind the socket to the given local endpoint.
 
-[heading Return Value]
-
-A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
+ boost::system::error_code bind(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
 
 
+This function binds the socket to the specified endpoint on the local machine.
 
-[endsect]
 
+[heading Parameters]
+
 
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
 
-[section:overload2 basic_serial_port::lowest_layer (2 of 2 overloads)]
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
-Get a const reference to the lowest layer.
 
+[heading Example]
+
 
- const lowest_layer_type & lowest_layer() const;
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+ boost::system::error_code ec;
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
-This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
 
 
-[heading Return Value]
-
-A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
 
 
@@ -14451,177 +17271,52 @@
 [endsect]
 
 
-[section:lowest_layer_type basic_serial_port::lowest_layer_type]
-
-[indexterm2 lowest_layer_type..basic_serial_port]
-A [link boost_asio.reference.basic_serial_port `basic_serial_port`] is always the lowest layer.
-
-
- typedef basic_serial_port< SerialPortService > lowest_layer_type;
-
-
-[heading Types]
-[table
- [[Name][Description]]
-
- [
+[section:broadcast basic_seq_packet_socket::broadcast]
 
- [[link boost_asio.reference.basic_serial_port.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+['Inherited from socket_base.]
 
- [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
- [A basic_serial_port is always the lowest layer. ]
-
- ]
+[indexterm2 broadcast..basic_seq_packet_socket]
+Socket option to permit sending of broadcast messages.
 
- [
 
- [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
- [The native representation of a serial port. ]
-
- ]
+ typedef implementation_defined broadcast;
 
- [
 
- [[link boost_asio.reference.basic_serial_port.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
 
-]
+Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
- [Assign an existing native serial port to the serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
- ]
+[heading Examples]
   
- [
- [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
- [Construct a basic_serial_port without opening it.
-
- Construct and open a basic_serial_port.
+Setting the option:
 
- Construct a basic_serial_port on an existing native serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.close [*close]]]
- [Close the serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
- [Get an option from the serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
- [Determine whether the serial port is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option(true);
+ socket.set_option(option);
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.native [*native]]]
- [Get the native serial port representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.open [*open]]]
- [Open the serial port using the specified device name. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
- [Read some data from the serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
- [Send a break sequence to the serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
- [Set an option on the serial port. ]
- ]
-
- [
- [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
- [Write some data to the serial port. ]
- ]
-
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_serial_port.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
 
- [
- [[link boost_asio.reference.basic_serial_port.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
+Getting the current option value:
 
-The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class template provides functionality that is common to all serial ports.
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_serial_port.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -14630,35 +17325,41 @@
 
 
 
-[section:native basic_serial_port::native]
+[section:bytes_readable basic_seq_packet_socket::bytes_readable]
 
-[indexterm2 native..basic_serial_port]
-Get the native serial port representation.
 
+['Inherited from socket_base.]
 
- native_type native();
+[indexterm2 bytes_readable..basic_seq_packet_socket]
+IO control command to get the amount of data that can be read without blocking.
 
 
-This function may be used to obtain the underlying representation of the serial port. This is intended to allow access to native serial port functionality that is not otherwise provided.
+ typedef implementation_defined bytes_readable;
 
 
-[endsect]
+
+Implements the FIONREAD IO control command.
 
 
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::bytes_readable command(true);
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
 
-[section:native_type basic_serial_port::native_type]
 
-[indexterm2 native_type..basic_serial_port]
-The native representation of a serial port.
 
 
- typedef SerialPortService::native_type native_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_serial_port.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -14666,73 +17367,84 @@
 [endsect]
 
 
-[section:open basic_serial_port::open]
+[section:cancel basic_seq_packet_socket::cancel]
 
-[indexterm2 open..basic_serial_port]
-Open the serial port using the specified device name.
+[indexterm2 cancel..basic_seq_packet_socket]
+Cancel all asynchronous operations associated with the socket.
 
 
- void ``[link boost_asio.reference.basic_serial_port.open.overload1 open]``(
- const std::string & device);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_serial_port.open.overload2 open]``(
- const std::string & device,
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 cancel]``(
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.cancel.overload2 more...]]``
 
 
-[section:overload1 basic_serial_port::open (1 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::cancel (1 of 2 overloads)]
 
 
-Open the serial port using the specified device name.
+['Inherited from basic_socket.]
 
 
- void open(
- const std::string & device);
+Cancel all asynchronous operations associated with the socket.
 
 
-This function opens the serial port for the specified device name.
+ void cancel();
 
 
-[heading Parameters]
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[heading Exceptions]
     
 
 [variablelist
   
-[[device][The platform-specific device name.]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
-[heading Exceptions]
-
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+* It will only cancel asynchronous operations that were initiated in the current thread.
+
+
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
+
+For portable cancellation, consider using one of the following alternatives:
+
+
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
+
 
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
 
 [endsect]
 
 
 
-[section:overload2 basic_serial_port::open (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::cancel (2 of 2 overloads)]
 
 
-Open the serial port using the specified device name.
+['Inherited from basic_socket.]
 
 
- boost::system::error_code open(
- const std::string & device,
+Cancel all asynchronous operations associated with the socket.
+
+
+ boost::system::error_code cancel(
       boost::system::error_code & ec);
 
 
-This function opens the serial port using the given platform-specific device name.
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
 
 [heading Parameters]
@@ -14740,68 +17452,64 @@
 
 [variablelist
   
-[[device][The platform-specific device name.]]
-
-[[ec][Set the indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
 
 
-[endsect]
+* It will only cancel asynchronous operations that were initiated in the current thread.
 
 
-[endsect]
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
 
-[section:read_some basic_serial_port::read_some]
+For portable cancellation, consider using one of the following alternatives:
 
-[indexterm2 read_some..basic_serial_port]
-Read some data from the serial port.
 
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload1 read_some]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload2 read_some]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload2 more...]]``
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
-[section:overload1 basic_serial_port::read_some (1 of 2 overloads)]
 
+[endsect]
 
-Read some data from the serial port.
 
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers);
+[section:close basic_seq_packet_socket::close]
 
+[indexterm2 close..basic_seq_packet_socket]
+Close the socket.
 
-This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
+ void ``[link boost_asio.reference.basic_seq_packet_socket.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.close.overload1 more...]]``
 
-[heading Parameters]
-
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.close.overload2 more...]]``
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be read.]]
 
-]
+[section:overload1 basic_seq_packet_socket::close (1 of 2 overloads)]
 
 
-[heading Return Value]
-
-The number of bytes read.
+['Inherited from basic_socket.]
+
+
+Close the socket.
+
+
+ void close();
+
+
+This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
 
 [heading Exceptions]
@@ -14809,46 +17517,36 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
 
 ]
 
 
 [heading Remarks]
       
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
-
-
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
-
- serial_port.read_some(boost::asio::buffer(data, size));
+For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
+[endsect]
 
 
-[endsect]
 
+[section:overload2 basic_seq_packet_socket::close (2 of 2 overloads)]
 
 
-[section:overload2 basic_serial_port::read_some (2 of 2 overloads)]
+['Inherited from basic_socket.]
 
 
-Read some data from the serial port.
+Close the socket.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers,
+ boost::system::error_code close(
       boost::system::error_code & ec);
 
 
-This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
+This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
 
 [heading Parameters]
@@ -14856,21 +17554,31 @@
 
 [variablelist
   
-[[buffers][One or more buffers into which the data will be read.]]
-
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
 
 ]
 
 
-[heading Return Value]
-
-The number of bytes read. Returns 0 if an error occurred.
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.close(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
 
 
 [heading Remarks]
       
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
 
 
 
@@ -14880,30 +17588,48 @@
 
 [endsect]
 
-[section:send_break basic_serial_port::send_break]
+[section:connect basic_seq_packet_socket::connect]
 
-[indexterm2 send_break..basic_serial_port]
-Send a break sequence to the serial port.
+[indexterm2 connect..basic_seq_packet_socket]
+Connect the socket to the specified endpoint.
 
 
- void ``[link boost_asio.reference.basic_serial_port.send_break.overload1 send_break]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload1 connect]``(
+ const endpoint_type & peer_endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_serial_port.send_break.overload2 send_break]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.connect.overload2 connect]``(
+ const endpoint_type & peer_endpoint,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.connect.overload2 more...]]``
 
 
-[section:overload1 basic_serial_port::send_break (1 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::connect (1 of 2 overloads)]
 
 
-Send a break sequence to the serial port.
+['Inherited from basic_socket.]
 
 
- void send_break();
+Connect the socket to the specified endpoint.
 
 
-This function causes a break sequence of platform-specific duration to be sent out the serial port.
+ void connect(
+ const endpoint_type & peer_endpoint);
+
+
+This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+
+]
 
 
 [heading Exceptions]
@@ -14911,28 +17637,47 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.connect(endpoint);
+
+
+
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 basic_serial_port::send_break (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::connect (2 of 2 overloads)]
 
 
-Send a break sequence to the serial port.
+['Inherited from basic_socket.]
 
 
- boost::system::error_code send_break(
+Connect the socket to the specified endpoint.
+
+
+ boost::system::error_code connect(
+ const endpoint_type & peer_endpoint,
       boost::system::error_code & ec);
 
 
-This function causes a break sequence of platform-specific duration to be sent out the serial port.
+This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
 
 
 [heading Parameters]
@@ -14940,11 +17685,31 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any. ]]
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ boost::system::error_code ec;
+ socket.connect(endpoint, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
 
 
 [endsect]
@@ -14953,39 +17718,52 @@
 [endsect]
 
 
-[section:service basic_serial_port::service]
+[section:debug basic_seq_packet_socket::debug]
 
 
-['Inherited from basic_io_object.]
+['Inherited from socket_base.]
 
-[indexterm2 service..basic_serial_port]
-The service associated with the I/O object.
+[indexterm2 debug..basic_seq_packet_socket]
+Socket option to enable socket-level debugging.
 
 
- service_type & service;
+ typedef implementation_defined debug;
 
 
 
-[endsect]
+Implements the SOL\_SOCKET/SO\_DEBUG socket option.
 
 
+[heading Examples]
+
+Setting the option:
 
-[section:service_type basic_serial_port::service_type]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option(true);
+ socket.set_option(option);
 
 
-['Inherited from basic_io_object.]
 
-[indexterm2 service_type..basic_serial_port]
-The type of the service that will be used to provide I/O operations.
 
 
- typedef SerialPortService service_type;
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_serial_port.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -14993,137 +17771,241 @@
 [endsect]
 
 
-[section:set_option basic_serial_port::set_option]
 
-[indexterm2 set_option..basic_serial_port]
-Set an option on the serial port.
+[section:do_not_route basic_seq_packet_socket::do_not_route]
 
 
- template<
- typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
- void ``[link boost_asio.reference.basic_serial_port.set_option.overload1 set_option]``(
- const SettableSerialPortOption & option);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload1 more...]]``
+['Inherited from socket_base.]
 
- template<
- typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
- boost::system::error_code ``[link boost_asio.reference.basic_serial_port.set_option.overload2 set_option]``(
- const SettableSerialPortOption & option,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload2 more...]]``
+[indexterm2 do_not_route..basic_seq_packet_socket]
+Socket option to prevent routing, use local interfaces only.
 
 
-[section:overload1 basic_serial_port::set_option (1 of 2 overloads)]
+ typedef implementation_defined do_not_route;
 
 
-Set an option on the serial port.
 
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
 
- template<
- typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
- void set_option(
- const SettableSerialPortOption & option);
 
+[heading Examples]
+
+Setting the option:
 
-This function is used to set an option on the serial port.
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option(true);
+ socket.set_option(option);
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[option][The option value to be set on the serial port.]]
 
-]
 
+Getting the current option value:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
 
 
 
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
 
 [endsect]
 
 
 
-[section:overload2 basic_serial_port::set_option (2 of 2 overloads)]
+[section:enable_connection_aborted basic_seq_packet_socket::enable_connection_aborted]
 
 
-Set an option on the serial port.
+['Inherited from socket_base.]
 
+[indexterm2 enable_connection_aborted..basic_seq_packet_socket]
+Socket option to report aborted connections on accept.
 
- template<
- typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
- boost::system::error_code set_option(
- const SettableSerialPortOption & option,
- boost::system::error_code & ec);
 
+ typedef implementation_defined enable_connection_aborted;
 
-This function is used to set an option on the serial port.
 
 
-[heading Parameters]
-
+Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
 
-[variablelist
+
+[heading Examples]
   
-[[option][The option value to be set on the serial port.]]
+Setting the option:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option(true);
+ acceptor.set_option(option);
+
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
 
 
+Getting the current option value:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+
+[section:endpoint_type basic_seq_packet_socket::endpoint_type]
+
+[indexterm2 endpoint_type..basic_seq_packet_socket]
+The endpoint type.
+
+
+ typedef Protocol::endpoint endpoint_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
 [endsect]
 
-[section:write_some basic_serial_port::write_some]
 
-[indexterm2 write_some..basic_serial_port]
-Write some data to the serial port.
+[section:get_implementation basic_seq_packet_socket::get_implementation]
 
+[indexterm2 get_implementation..basic_seq_packet_socket]
+Get the underlying implementation of the I/O object.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload1 write_some]``(
- const ConstBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload2 write_some]``(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload2 more...]]``
+ implementation_type & ``[link boost_asio.reference.basic_seq_packet_socket.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_implementation.overload1 more...]]``
 
+ const implementation_type & ``[link boost_asio.reference.basic_seq_packet_socket.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_implementation.overload2 more...]]``
 
-[section:overload1 basic_serial_port::write_some (1 of 2 overloads)]
 
+[section:overload1 basic_seq_packet_socket::get_implementation (1 of 2 overloads)]
 
-Write some data to the serial port.
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_seq_packet_socket::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:get_io_service basic_seq_packet_socket::get_io_service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 get_io_service..basic_seq_packet_socket]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+
+
+ boost::asio::io_service & get_io_service();
+
+
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+
+
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+[section:get_option basic_seq_packet_socket::get_option]
+
+[indexterm2 get_option..basic_seq_packet_socket]
+Get an option from the socket.
+
+
+ void ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 get_option]``(
+ GettableSocketOption & option) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 get_option]``(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_option.overload2 more...]]``
+
+
+[section:overload1 basic_seq_packet_socket::get_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get an option from the socket.
 
 
   template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers);
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void get_option(
+ GettableSocketOption & option) const;
 
 
-This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
+This function is used to get the current value of an option on the socket.
 
 
 [heading Parameters]
@@ -15131,39 +18013,34 @@
 
 [variablelist
   
-[[buffers][One or more data buffers to be written to the serial port.]]
+[[option][The option value to be obtained from the socket.]]
 
 ]
 
 
-[heading Return Value]
-
-The number of bytes written.
-
-
 [heading Exceptions]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
-[heading Remarks]
-
-The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
-
 
 [heading Example]
   
-To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.get();
 
- serial_port.write_some(boost::asio::buffer(data, size));
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -15172,20 +18049,23 @@
 
 
 
-[section:overload2 basic_serial_port::write_some (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::get_option (2 of 2 overloads)]
 
 
-Write some data to the serial port.
+['Inherited from basic_socket.]
+
+
+Get an option from the socket.
 
 
   template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
 
 
-This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
+This function is used to get the current value of an option on the socket.
 
 
 [heading Parameters]
@@ -15193,26 +18073,33 @@
 
 [variablelist
   
-[[buffers][One or more data buffers to be written to the serial port.]]
+[[option][The option value to be obtained from the socket.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Return Value]
-
-The number of bytes written. Returns 0 if an error occurred.
 
+[heading Example]
+
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
+ boost::system::error_code ec;
+ socket.get_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ bool is_set = option.get();
 
-[heading Remarks]
-
-The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
 
 
 
-[endsect]
 
 
 [endsect]
@@ -15220,389 +18107,163 @@
 
 [endsect]
 
-[section:basic_socket basic_socket]
+[section:get_service basic_seq_packet_socket::get_service]
 
+[indexterm2 get_service..basic_seq_packet_socket]
+Get the service associated with the I/O object.
 
-Provides socket functionality.
 
+ service_type & ``[link boost_asio.reference.basic_seq_packet_socket.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_service.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- class basic_socket :
- public basic_io_object< SocketService >,
- public socket_base
+ const service_type & ``[link boost_asio.reference.basic_seq_packet_socket.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.get_service.overload2 more...]]``
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[section:overload1 basic_seq_packet_socket::get_service (1 of 2 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+['Inherited from basic_io_object.]
 
- [
 
- [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+Get the service associated with the I/O object.
 
- [
 
- [[link boost_asio.reference.basic_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+ service_type & get_service();
 
- [
 
- [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
+[section:overload2 basic_seq_packet_socket::get_service (2 of 2 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+['Inherited from basic_io_object.]
 
- [
 
- [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
+Get the service associated with the I/O object.
 
- [
 
- [[link boost_asio.reference.basic_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
+ const service_type & get_service() const;
 
- [
 
- [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
 
- [
+[section:implementation basic_seq_packet_socket::implementation]
 
- [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
 
- [
+['Inherited from basic_io_object.]
 
- [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+[indexterm2 implementation..basic_seq_packet_socket]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
- [
 
- [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
+ implementation_type implementation;
 
- [
 
- [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
+[section:implementation_type basic_seq_packet_socket::implementation_type]
 
- [
 
- [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
+['Inherited from basic_io_object.]
 
- [
+[indexterm2 implementation_type..basic_seq_packet_socket]
+The underlying implementation type of I/O object.
 
- [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
 
- [
+ typedef service_type::implementation_type implementation_type;
 
- [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[heading Requirements]
 
- [
- [[link boost_asio.reference.basic_socket.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
- [Construct a basic_socket without opening it.
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
- Construct and open a basic_socket.
-
- Construct a basic_socket, opening it and binding it to the given local endpoint.
+[*Convenience header: ][^boost/asio.hpp]
 
- Construct a basic_socket on an existing native socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.close [*close]]]
- [Close the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
- [Get an option from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.open [*open]]]
- [Open the socket using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
-
-]
+[endsect]
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
- [Protected destructor to prevent deletion through this type. ]
- ]
-
-]
+[section:io_control basic_seq_packet_socket::io_control]
 
-[heading Data Members]
-[table
- [[Name][Description]]
+[indexterm2 io_control..basic_seq_packet_socket]
+Perform an IO control command on the socket.
 
- [
- [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
+ void ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 io_control]``(
+ IoControlCommand & command);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload1 more...]]``
 
- [
- [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 io_control]``(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.io_control.overload2 more...]]``
 
- [
- [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
 
-]
+[section:overload1 basic_seq_packet_socket::io_control (1 of 2 overloads)]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
+['Inherited from basic_socket.]
 
- [
- [[link boost_asio.reference.basic_socket.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
+Perform an IO control command on the socket.
 
-The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
 
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void io_control(
+ IoControlCommand & command);
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+This function is used to execute an IO control command on the socket.
 
 
+[heading Parameters]
+
 
-[heading Requirements]
+[variablelist
+
+[[command][The IO control command to be performed on the socket.]]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+]
 
-[*Convenience header: ][^boost/asio.hpp]
 
-[section:assign basic_socket::assign]
+[heading Exceptions]
+
 
-[indexterm2 assign..basic_socket]
-Assign an existing native socket to the socket.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
+]
 
- void ``[link boost_asio.reference.basic_socket.assign.overload1 assign]``(
- const protocol_type & protocol,
- const native_type & native_socket);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket.assign.overload2 assign]``(
- const protocol_type & protocol,
- const native_type & native_socket,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload2 more...]]``
 
+[heading Example]
+
+Getting the number of bytes ready to read:
 
-[section:overload1 basic_socket::assign (1 of 2 overloads)]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
 
 
-Assign an existing native socket to the socket.
 
 
- void assign(
- const protocol_type & protocol,
- const native_type & native_socket);
 
 
 
@@ -15610,41 +18271,23 @@
 
 
 
-[section:overload2 basic_socket::assign (2 of 2 overloads)]
-
-
-Assign an existing native socket to the socket.
-
-
- boost::system::error_code assign(
- const protocol_type & protocol,
- const native_type & native_socket,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
+[section:overload2 basic_seq_packet_socket::io_control (2 of 2 overloads)]
 
-[endsect]
 
+['Inherited from basic_socket.]
 
-[section:async_connect basic_socket::async_connect]
 
-[indexterm2 async_connect..basic_socket]
-Start an asynchronous connect.
+Perform an IO control command on the socket.
 
 
   template<
- typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
- void async_connect(
- const endpoint_type & peer_endpoint,
- ConnectHandler handler);
-
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
 
-This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
 
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+This function is used to execute an IO control command on the socket.
 
 
 [heading Parameters]
@@ -15652,261 +18295,242 @@
 
 [variablelist
   
-[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
+[[command][The IO control command to be performed on the socket.]]
 
-[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error // Result of operation
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+
 [heading Example]
   
+Getting the number of bytes ready to read:
 
-
- void connect_handler(const boost::system::error_code& error)
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ boost::system::error_code ec;
+ socket.io_control(command, ec);
+ if (ec)
    {
- if (!error)
- {
- // Connect succeeded.
- }
+ // An error occurred.
    }
+ std::size_t bytes_readable = command.get();
 
- ...
 
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- socket.async_connect(endpoint, connect_handler);
 
 
 
 
 
+[endsect]
 
 
 [endsect]
 
 
-[section:at_mark basic_socket::at_mark]
+[section:is_open basic_seq_packet_socket::is_open]
 
-[indexterm2 at_mark..basic_socket]
-Determine whether the socket is at the out-of-band data mark.
 
+['Inherited from basic_socket.]
 
- bool ``[link boost_asio.reference.basic_socket.at_mark.overload1 at_mark]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload1 more...]]``
+[indexterm2 is_open..basic_seq_packet_socket]
+Determine whether the socket is open.
 
- bool ``[link boost_asio.reference.basic_socket.at_mark.overload2 at_mark]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload2 more...]]``
 
+ bool is_open() const;
 
-[section:overload1 basic_socket::at_mark (1 of 2 overloads)]
 
 
-Determine whether the socket is at the out-of-band data mark.
+[endsect]
 
 
- bool at_mark() const;
 
+[section:keep_alive basic_seq_packet_socket::keep_alive]
 
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
 
+['Inherited from socket_base.]
 
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
+[indexterm2 keep_alive..basic_seq_packet_socket]
+Socket option to send keep-alives.
 
 
-[heading Exceptions]
-
+ typedef implementation_defined keep_alive;
 
-[variablelist
+
+
+Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
+
+
+[heading Examples]
   
-[[boost::system::system_error][Thrown on failure. ]]
+Setting the option:
 
-]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option(true);
+ socket.set_option(option);
 
 
 
 
-[endsect]
 
+Getting the current option value:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
-[section:overload2 basic_socket::at_mark (2 of 2 overloads)]
 
 
-Determine whether the socket is at the out-of-band data mark.
 
 
- bool at_mark(
- boost::system::error_code & ec) const;
 
 
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
-[heading Parameters]
-
+[*Convenience header: ][^boost/asio.hpp]
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[endsect]
 
 
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
 
+[section:linger basic_seq_packet_socket::linger]
 
 
+['Inherited from socket_base.]
 
-[endsect]
+[indexterm2 linger..basic_seq_packet_socket]
+Socket option to specify whether the socket lingers on close if unsent data is present.
 
 
-[endsect]
+ typedef implementation_defined linger;
 
-[section:available basic_socket::available]
 
-[indexterm2 available..basic_socket]
-Determine the number of bytes available for reading.
 
+Implements the SOL\_SOCKET/SO\_LINGER socket option.
 
- std::size_t ``[link boost_asio.reference.basic_socket.available.overload1 available]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload1 more...]]``
 
- std::size_t ``[link boost_asio.reference.basic_socket.available.overload2 available]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload2 more...]]``
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option(true, 30);
+ socket.set_option(option);
 
-[section:overload1 basic_socket::available (1 of 2 overloads)]
 
 
-Determine the number of bytes available for reading.
 
 
- std::size_t available() const;
+Getting the current option value:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option;
+ socket.get_option(option);
+ bool is_set = option.enabled();
+ unsigned short timeout = option.timeout();
 
-This function is used to determine the number of bytes that may be read without blocking.
 
 
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:local_endpoint basic_seq_packet_socket::local_endpoint]
 
-[section:overload2 basic_socket::available (2 of 2 overloads)]
-
+[indexterm2 local_endpoint..basic_seq_packet_socket]
+Get the local endpoint of the socket.
 
-Determine the number of bytes available for reading.
 
+ endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 local_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload1 more...]]``
 
- std::size_t available(
+ endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 local_endpoint]``(
       boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.local_endpoint.overload2 more...]]``
 
 
-This function is used to determine the number of bytes that may be read without blocking.
+[section:overload1 basic_seq_packet_socket::local_endpoint (1 of 2 overloads)]
 
 
-[heading Parameters]
-
+['Inherited from basic_socket.]
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+Get the local endpoint of the socket.
 
 
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
+ endpoint_type local_endpoint() const;
 
 
+This function is used to obtain the locally bound endpoint of the socket.
 
 
-[endsect]
+[heading Return Value]
+
+An object that represents the local endpoint of the socket.
 
 
-[endsect]
+[heading Exceptions]
+
 
-[section:basic_socket basic_socket::basic_socket]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[indexterm2 basic_socket..basic_socket]
-Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it.
+]
 
 
- explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload1 basic_socket]``(
- boost::asio::io_service & io_service);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload1 more...]]``
+[heading Example]
+
 
 
-Construct and open a [link boost_asio.reference.basic_socket `basic_socket`].
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
 
 
- ``[link boost_asio.reference.basic_socket.basic_socket.overload2 basic_socket]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload2 more...]]``
 
 
-Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint.
 
 
- ``[link boost_asio.reference.basic_socket.basic_socket.overload3 basic_socket]``(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload3 more...]]``
 
+[endsect]
 
-Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket.
 
 
- ``[link boost_asio.reference.basic_socket.basic_socket.overload4 basic_socket]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_socket);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload4 more...]]``
+[section:overload2 basic_seq_packet_socket::local_endpoint (2 of 2 overloads)]
 
 
-[section:overload1 basic_socket::basic_socket (1 of 4 overloads)]
+['Inherited from basic_socket.]
 
 
-Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it.
+Get the local endpoint of the socket.
 
 
- basic_socket(
- boost::asio::io_service & io_service);
+ endpoint_type local_endpoint(
+ boost::system::error_code & ec) const;
 
 
-This constructor creates a socket without opening it.
+This function is used to obtain the locally bound endpoint of the socket.
 
 
 [heading Parameters]
@@ -15914,356 +18538,581 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Return Value]
+
+An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
 
 
-[endsect]
+[heading Example]
+
 
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
-[section:overload2 basic_socket::basic_socket (2 of 4 overloads)]
 
 
-Construct and open a [link boost_asio.reference.basic_socket `basic_socket`].
 
 
- basic_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
 
 
-This constructor creates and opens a socket.
+[endsect]
 
 
-[heading Parameters]
-
+[endsect]
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+[section:lowest_layer basic_seq_packet_socket::lowest_layer]
 
-[[protocol][An object specifying protocol parameters to be used.]]
+[indexterm2 lowest_layer..basic_seq_packet_socket]
+Get a reference to the lowest layer.
 
-]
 
+ lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload1 more...]]``
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+Get a const reference to the lowest layer.
 
-]
 
+ const lowest_layer_type & ``[link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.lowest_layer.overload2 more...]]``
 
 
+[section:overload1 basic_seq_packet_socket::lowest_layer (1 of 2 overloads)]
 
-[endsect]
 
+['Inherited from basic_socket.]
 
 
-[section:overload3 basic_socket::basic_socket (3 of 4 overloads)]
+Get a reference to the lowest layer.
 
 
-Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint.
+ lowest_layer_type & lowest_layer();
 
 
- basic_socket(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint);
+This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
 
 
-This constructor creates a socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
+[heading Return Value]
+
+A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
 
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[endsect]
 
-]
 
 
-[heading Exceptions]
-
+[section:overload2 basic_seq_packet_socket::lowest_layer (2 of 2 overloads)]
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+['Inherited from basic_socket.]
 
 
+Get a const reference to the lowest layer.
 
 
-[endsect]
+ const lowest_layer_type & lowest_layer() const;
 
 
+This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
 
-[section:overload4 basic_socket::basic_socket (4 of 4 overloads)]
 
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
-Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket.
 
 
- basic_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_socket);
 
+[endsect]
 
-This constructor creates a socket object to hold an existing native socket.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+[section:lowest_layer_type basic_seq_packet_socket::lowest_layer_type]
 
-[[protocol][An object specifying protocol parameters to be used.]]
 
-[[native_socket][A native socket.]]
+['Inherited from basic_socket.]
 
-]
+[indexterm2 lowest_layer_type..basic_seq_packet_socket]
+A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
 
 
-[heading Exceptions]
-
+ typedef basic_socket< Protocol, SeqPacketSocketService > lowest_layer_type;
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
 
-[section:bind basic_socket::bind]
+ [
 
-[indexterm2 bind..basic_socket]
-Bind the socket to the given local endpoint.
+ [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
 
+ [
 
- void ``[link boost_asio.reference.basic_socket.bind.overload1 bind]``(
- const endpoint_type & endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload1 more...]]``
+ [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket.bind.overload2 bind]``(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload2 more...]]``
+ [
 
+ [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
-[section:overload1 basic_socket::bind (1 of 2 overloads)]
+ [
 
+ [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
-Bind the socket to the given local endpoint.
+ [
 
+ [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
 
- void bind(
- const endpoint_type & endpoint);
+ [
 
+ [[link boost_asio.reference.basic_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
 
-This function binds the socket to the specified endpoint on the local machine.
+ [
 
+ [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
 
-[heading Parameters]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
   
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+ ]
 
-]
+ [
 
+ [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
 
-[heading Exceptions]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
   
-[[boost::system::system_error][Thrown on failure.]]
+ ]
 
-]
+ [
+
+ [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
 
+ [
 
-[heading Example]
+ [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
   
+ ]
 
+ [
 
- boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345));
+ [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
 
+ [
 
-[section:overload2 basic_socket::bind (2 of 2 overloads)]
+ [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+ [
 
-Bind the socket to the given local endpoint.
+ [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
 
+]
 
- boost::system::error_code bind(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
+ [Construct a basic_socket without opening it.
 
-This function binds the socket to the specified endpoint on the local machine.
+ Construct and open a basic_socket.
 
+ Construct a basic_socket, opening it and binding it to the given local endpoint.
 
-[heading Parameters]
-
+ Construct a basic_socket on an existing native socket.
 
-[variablelist
+ Move-construct a basic_socket from another. ]
+ ]
   
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+ [
+ [[link boost_asio.reference.basic_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
-[[ec][Set to indicate what error occurred, if any.]]
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[heading Example]
+ [
+ [[link boost_asio.reference.basic_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
   
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
- boost::system::error_code ec;
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345), ec);
- if (ec)
- {
- // An error occurred.
- }
+ [
+ [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
 
+]
 
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
-[endsect]
+ [
+ [[link boost_asio.reference.basic_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
+]
 
-[endsect]
+The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
 
 
-[section:broadcast basic_socket::broadcast]
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
-['Inherited from socket_base.]
 
-[indexterm2 broadcast..basic_socket]
-Socket option to permit sending of broadcast messages.
 
 
- typedef implementation_defined broadcast;
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
 
+[endsect]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::broadcast option(true);
- socket.set_option(option);
 
+[section:max_connections basic_seq_packet_socket::max_connections]
 
 
+['Inherited from socket_base.]
 
+[indexterm2 max_connections..basic_seq_packet_socket]
+The maximum length of the queue of pending incoming connections.
 
-Getting the current option value:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::broadcast option;
- socket.get_option(option);
- bool is_set = option.value();
+ static const int max_connections = implementation_defined;
 
 
 
+[endsect]
 
 
 
+[section:message_do_not_route basic_seq_packet_socket::message_do_not_route]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+['Inherited from socket_base.]
+
+[indexterm2 message_do_not_route..basic_seq_packet_socket]
+Specify that the data should not be subject to routing.
+
+
+ static const int message_do_not_route = implementation_defined;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:bytes_readable basic_socket::bytes_readable]
+[section:message_end_of_record basic_seq_packet_socket::message_end_of_record]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 bytes_readable..basic_socket]
-IO control command to get the amount of data that can be read without blocking.
+[indexterm2 message_end_of_record..basic_seq_packet_socket]
+Specifies that the data marks the end of a record.
 
 
- typedef implementation_defined bytes_readable;
+ static const int message_end_of_record = implementation_defined;
 
 
 
-Implements the FIONREAD IO control command.
+[endsect]
 
 
-[heading Example]
-
 
+[section:message_flags basic_seq_packet_socket::message_flags]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::bytes_readable command(true);
- socket.io_control(command);
- std::size_t bytes_readable = command.get();
 
+['Inherited from socket_base.]
 
+[indexterm2 message_flags..basic_seq_packet_socket]
+Bitmask type for flags that can be passed to send and receive operations.
 
 
+ typedef int message_flags;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -16271,244 +19120,240 @@
 [endsect]
 
 
-[section:cancel basic_socket::cancel]
 
-[indexterm2 cancel..basic_socket]
-Cancel all asynchronous operations associated with the socket.
+[section:message_out_of_band basic_seq_packet_socket::message_out_of_band]
 
 
- void ``[link boost_asio.reference.basic_socket.cancel.overload1 cancel]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload1 more...]]``
+['Inherited from socket_base.]
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket.cancel.overload2 cancel]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload2 more...]]``
+[indexterm2 message_out_of_band..basic_seq_packet_socket]
+Process out-of-band data.
 
 
-[section:overload1 basic_socket::cancel (1 of 2 overloads)]
+ static const int message_out_of_band = implementation_defined;
 
 
-Cancel all asynchronous operations associated with the socket.
 
+[endsect]
 
- void cancel();
 
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+[section:message_peek basic_seq_packet_socket::message_peek]
 
 
-[heading Exceptions]
-
+['Inherited from socket_base.]
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+[indexterm2 message_peek..basic_seq_packet_socket]
+Peek at incoming data without removing it from the input queue.
 
-]
 
+ static const int message_peek = implementation_defined;
 
-[heading Remarks]
-
-Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
 
 
-* It will only cancel asynchronous operations that were initiated in the current thread.
+[endsect]
 
 
-* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
 
-For portable cancellation, consider using one of the following alternatives:
+[section:native basic_seq_packet_socket::native]
 
 
-* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
+['Inherited from basic_socket.]
 
+[indexterm2 native..basic_seq_packet_socket]
+(Deprecated: Use `native_handle()`.) Get the native socket representation.
 
-* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
-When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
+ native_type native();
 
 
-[endsect]
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
 
 
+[endsect]
 
-[section:overload2 basic_socket::cancel (2 of 2 overloads)]
 
 
-Cancel all asynchronous operations associated with the socket.
+[section:native_handle basic_seq_packet_socket::native_handle]
 
 
- boost::system::error_code cancel(
- boost::system::error_code & ec);
+['Inherited from basic_socket.]
 
+[indexterm2 native_handle..basic_seq_packet_socket]
+Get the native socket representation.
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
+ native_handle_type native_handle();
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
 
-]
 
+[endsect]
 
-[heading Remarks]
-
-Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
 
 
-* It will only cancel asynchronous operations that were initiated in the current thread.
+[section:native_handle_type basic_seq_packet_socket::native_handle_type]
 
+[indexterm2 native_handle_type..basic_seq_packet_socket]
+The native representation of a socket.
 
-* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
 
-For portable cancellation, consider using one of the following alternatives:
+ typedef SeqPacketSocketService::native_handle_type native_handle_type;
 
 
-* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
 
+[heading Requirements]
 
-* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
-When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[endsect]
+[section:native_non_blocking basic_seq_packet_socket::native_non_blocking]
 
-[section:close basic_socket::close]
+[indexterm2 native_non_blocking..basic_seq_packet_socket]
+Gets the non-blocking mode of the native socket implementation.
 
-[indexterm2 close..basic_socket]
-Close the socket.
 
+ bool ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload1 more...]]``
 
- void ``[link boost_asio.reference.basic_socket.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket.close.overload2 close]``(
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.native_non_blocking.overload3 more...]]``
 
 
-[section:overload1 basic_socket::close (1 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::native_non_blocking (1 of 3 overloads)]
 
 
-Close the socket.
+['Inherited from basic_socket.]
 
 
- void close();
+Gets the non-blocking mode of the native socket implementation.
 
 
-This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+ bool native_non_blocking() const;
 
 
-[heading Exceptions]
-
+This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
+[heading Return Value]
+
+`true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
 
 
 [heading Remarks]
       
-For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
+The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
 
 
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
 
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
 
-[endsect]
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
 
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
-[section:overload2 basic_socket::close (2 of 2 overloads)]
 
 
-Close the socket.
 
 
- boost::system::error_code close(
- boost::system::error_code & ec);
 
-
-This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
-
-
-[heading Parameters]
-
-
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
-
-]
-
-
-[heading Example]
-
-
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- socket.close(ec);
- if (ec)
- {
- // An error occurred.
- }
-
-
-
-
-
-[heading Remarks]
-
-For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
+[endsect]
 
 
 
-
-[endsect]
-
-
-[endsect]
-
-[section:connect basic_socket::connect]
-
-[indexterm2 connect..basic_socket]
-Connect the socket to the specified endpoint.
-
-
- void ``[link boost_asio.reference.basic_socket.connect.overload1 connect]``(
- const endpoint_type & peer_endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload1 more...]]``
-
- boost::system::error_code ``[link boost_asio.reference.basic_socket.connect.overload2 connect]``(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload2 more...]]``
+[section:overload2 basic_seq_packet_socket::native_non_blocking (2 of 3 overloads)]
 
 
-[section:overload1 basic_socket::connect (1 of 2 overloads)]
-
+['Inherited from basic_socket.]
 
-Connect the socket to the specified endpoint.
 
+Sets the non-blocking mode of the native socket implementation.
 
- void connect(
- const endpoint_type & peer_endpoint);
 
+ void native_non_blocking(
+ bool mode);
 
-This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
 
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
 
 
 [heading Parameters]
@@ -16516,7 +19361,7 @@
 
 [variablelist
   
-[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
 ]
 
@@ -16526,19 +19371,79 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
 
 ]
 
 
 [heading Example]
   
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
 
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
 
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- socket.connect(endpoint);
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
 
@@ -16550,20 +19455,21 @@
 
 
 
-[section:overload2 basic_socket::connect (2 of 2 overloads)]
+[section:overload3 basic_seq_packet_socket::native_non_blocking (3 of 3 overloads)]
 
 
-Connect the socket to the specified endpoint.
+['Inherited from basic_socket.]
 
 
- boost::system::error_code connect(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
+Sets the non-blocking mode of the native socket implementation.
 
 
-This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
+ boost::system::error_code native_non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
 
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
 
 
 [heading Parameters]
@@ -16571,280 +19477,322 @@
 
 [variablelist
   
-[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
 
 ]
 
 
 [heading Example]
   
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
 
-
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- boost::system::error_code ec;
- socket.connect(endpoint, ec);
- if (ec)
+ template <typename Handler>
+ struct sendfile_op
    {
- // An error occurred.
- }
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
 
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
 
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
 
 
 
-[endsect]
 
 
 [endsect]
 
 
-[section:debug basic_socket::debug]
-
-
-['Inherited from socket_base.]
-
-[indexterm2 debug..basic_socket]
-Socket option to enable socket-level debugging.
-
-
- typedef implementation_defined debug;
-
+[endsect]
 
 
-Implements the SOL\_SOCKET/SO\_DEBUG socket option.
+[section:native_type basic_seq_packet_socket::native_type]
 
+[indexterm2 native_type..basic_seq_packet_socket]
+(Deprecated: Use native\_handle\_type.) The native representation of a socket.
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option(true);
- socket.set_option(option);
+ typedef SeqPacketSocketService::native_handle_type native_type;
 
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
-Getting the current option value:
+[*Convenience header: ][^boost/asio.hpp]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option;
- socket.get_option(option);
- bool is_set = option.value();
 
+[endsect]
 
 
+[section:non_blocking basic_seq_packet_socket::non_blocking]
 
+[indexterm2 non_blocking..basic_seq_packet_socket]
+Gets the non-blocking mode of the socket.
 
 
+ bool ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload1 more...]]``
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+Sets the non-blocking mode of the socket.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ void ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload2 more...]]``
 
-[endsect]
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.non_blocking.overload3 more...]]``
 
 
+[section:overload1 basic_seq_packet_socket::non_blocking (1 of 3 overloads)]
 
-[section:do_not_route basic_socket::do_not_route]
 
+['Inherited from basic_socket.]
 
-['Inherited from socket_base.]
 
-[indexterm2 do_not_route..basic_socket]
-Socket option to prevent routing, use local interfaces only.
+Gets the non-blocking mode of the socket.
 
 
- typedef implementation_defined do_not_route;
+ bool non_blocking() const;
 
 
 
-Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
+[heading Return Value]
+
+`true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
 
 
-[heading Examples]
-
-Setting the option:
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option(true);
- socket.set_option(option);
 
 
 
+[endsect]
 
 
-Getting the current option value:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option;
- socket.get_option(option);
- bool is_set = option.value();
+[section:overload2 basic_seq_packet_socket::non_blocking (2 of 3 overloads)]
 
 
+['Inherited from basic_socket.]
 
 
+Sets the non-blocking mode of the socket.
 
 
+ void non_blocking(
+ bool mode);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Parameters]
+
 
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
 
-[endsect]
+]
 
 
+[heading Exceptions]
+
 
-[section:enable_connection_aborted basic_socket::enable_connection_aborted]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
+]
 
-['Inherited from socket_base.]
 
-[indexterm2 enable_connection_aborted..basic_socket]
-Socket option to report aborted connections on accept.
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
 
- typedef implementation_defined enable_connection_aborted;
 
 
+[endsect]
 
-Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
 
 
-[heading Examples]
-
-Setting the option:
+[section:overload3 basic_seq_packet_socket::non_blocking (3 of 3 overloads)]
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option(true);
- acceptor.set_option(option);
 
+['Inherited from basic_socket.]
 
 
+Sets the non-blocking mode of the socket.
 
 
-Getting the current option value:
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option;
- acceptor.get_option(option);
- bool is_set = option.value();
 
 
+[heading Parameters]
+
 
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
-[heading Requirements]
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:endpoint_type basic_socket::endpoint_type]
 
-[indexterm2 endpoint_type..basic_socket]
-The endpoint type.
+[section:non_blocking_io basic_seq_packet_socket::non_blocking_io]
 
 
- typedef Protocol::endpoint endpoint_type;
+['Inherited from socket_base.]
 
+[indexterm2 non_blocking_io..basic_seq_packet_socket]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
 
 
-[heading Requirements]
+ typedef implementation_defined non_blocking_io;
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+Implements the FIONBIO IO control command.
 
-[endsect]
 
+[heading Example]
+
 
 
-[section:get_io_service basic_socket::get_io_service]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::non_blocking_io command(true);
+ socket.io_control(command);
 
 
-['Inherited from basic_io_object.]
 
-[indexterm2 get_io_service..basic_socket]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
- boost::asio::io_service & get_io_service();
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
-[endsect]
+[section:open basic_seq_packet_socket::open]
 
+[indexterm2 open..basic_seq_packet_socket]
+Open the socket using the specified protocol.
 
-[section:get_option basic_socket::get_option]
 
-[indexterm2 get_option..basic_socket]
-Get an option from the socket.
+ void ``[link boost_asio.reference.basic_seq_packet_socket.open.overload1 open]``(
+ const protocol_type & protocol = protocol_type());
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.open.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.open.overload2 more...]]``
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- void ``[link boost_asio.reference.basic_socket.get_option.overload1 get_option]``(
- GettableSocketOption & option) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket.get_option.overload2 get_option]``(
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload2 more...]]``
+[section:overload1 basic_seq_packet_socket::open (1 of 2 overloads)]
 
 
-[section:overload1 basic_socket::get_option (1 of 2 overloads)]
+['Inherited from basic_socket.]
 
 
-Get an option from the socket.
+Open the socket using the specified protocol.
 
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- void get_option(
- GettableSocketOption & option) const;
+ void open(
+ const protocol_type & protocol = protocol_type());
 
 
-This function is used to get the current value of an option on the socket.
+This function opens the socket so that it will use the specified protocol.
 
 
 [heading Parameters]
@@ -16852,7 +19800,7 @@
 
 [variablelist
   
-[[option][The option value to be obtained from the socket.]]
+[[protocol][An object specifying protocol parameters to be used.]]
 
 ]
 
@@ -16867,16 +19815,12 @@
 ]
 
 
-
 [heading Example]
   
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
 
    boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::keep_alive option;
- socket.get_option(option);
- bool is_set = option.get();
+ socket.open(boost::asio::ip::tcp::v4());
 
 
 
@@ -16888,20 +19832,21 @@
 
 
 
-[section:overload2 basic_socket::get_option (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::open (2 of 2 overloads)]
 
 
-Get an option from the socket.
+['Inherited from basic_socket.]
 
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code get_option(
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
+Open the socket using the specified protocol.
 
 
-This function is used to get the current value of an option on the socket.
+ boost::system::error_code open(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+
+
+This function opens the socket so that it will use the specified protocol.
 
 
 [heading Parameters]
@@ -16909,28 +19854,24 @@
 
 [variablelist
   
-[[option][The option value to be obtained from the socket.]]
+[[protocol][An object specifying which protocol is to be used.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-
 [heading Example]
   
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
 
    boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::keep_alive option;
    boost::system::error_code ec;
- socket.get_option(option, ec);
+ socket.open(boost::asio::ip::tcp::v4(), ec);
    if (ec)
    {
      // An error occurred.
    }
- bool is_set = option.get();
 
 
 
@@ -16944,39 +19885,53 @@
 [endsect]
 
 
-[section:implementation basic_socket::implementation]
+[section:operator_eq_ basic_seq_packet_socket::operator=]
 
+[indexterm2 operator=..basic_seq_packet_socket]
+Move-assign a [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] from another.
 
-['Inherited from basic_io_object.]
 
-[indexterm2 implementation..basic_socket]
-The underlying implementation of the I/O object.
+ basic_seq_packet_socket & operator=(
+ basic_seq_packet_socket && other);
 
 
- implementation_type implementation;
+This assignment operator moves a sequenced packet socket from one object to another.
 
 
+[heading Parameters]
+
 
-[endsect]
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_seq_packet_socket `basic_seq_packet_socket`] object from which the move will occur.]]
 
+]
 
 
-[section:implementation_type basic_socket::implementation_type]
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_seq_packet_socket(io_service&) constructor`.
 
 
-['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..basic_socket]
-The underlying implementation type of I/O object.
+
+[endsect]
 
 
- typedef service_type::implementation_type implementation_type;
+
+[section:protocol_type basic_seq_packet_socket::protocol_type]
+
+[indexterm2 protocol_type..basic_seq_packet_socket]
+The protocol type.
+
+
+ typedef Protocol protocol_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -16984,39 +19939,55 @@
 [endsect]
 
 
-[section:io_control basic_socket::io_control]
+[section:receive basic_seq_packet_socket::receive]
 
-[indexterm2 io_control..basic_socket]
-Perform an IO control command on the socket.
+[indexterm2 receive..basic_seq_packet_socket]
+Receive some data on the socket.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void ``[link boost_asio.reference.basic_socket.io_control.overload1 io_control]``(
- IoControlCommand & command);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload1 more...]]``
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload1 receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags & out_flags);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload1 more...]]``
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket.io_control.overload2 io_control]``(
- IoControlCommand & command,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload2 receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload2 more...]]``
+
+
+Receive some data on a connected socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.receive.overload3 receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.receive.overload3 more...]]``
 
 
-[section:overload1 basic_socket::io_control (1 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::receive (1 of 3 overloads)]
 
 
-Perform an IO control command on the socket.
+Receive some data on the socket.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void io_control(
- IoControlCommand & command);
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags & out_flags);
 
 
-This function is used to execute an IO control command on the socket.
+This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -17024,34 +19995,36 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the socket.]]
+[[buffers][One or more buffers into which the data will be received.]]
+
+[[out_flags][After the receive call completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record.]]
 
 ]
 
 
+[heading Return Value]
+
+The number of bytes received.
+
+
 [heading Exceptions]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
 
 ]
 
 
-
 [heading Example]
   
-Getting the number of bytes ready to read:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::bytes_readable command;
- socket.io_control(command);
- std::size_t bytes_readable = command.get();
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ socket.receive(boost::asio::buffer(data, size), out_flags);
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -17060,20 +20033,21 @@
 
 
 
-[section:overload2 basic_socket::io_control (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::receive (2 of 3 overloads)]
 
 
-Perform an IO control command on the socket.
+Receive some data on the socket.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- IoControlCommand & command,
- boost::system::error_code & ec);
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags);
 
 
-This function is used to execute an IO control command on the socket.
+This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -17081,95 +20055,117 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the socket.]]
+[[buffers][One or more buffers into which the data will be received.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[[in_flags][Flags specifying how the receive call is to be made.]]
+
+[[out_flags][After the receive call completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record.]]
 
 ]
 
 
+[heading Return Value]
+
+The number of bytes received.
 
-[heading Example]
+
+[heading Exceptions]
+
+
+[variablelist
   
-Getting the number of bytes ready to read:
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::bytes_readable command;
- boost::system::error_code ec;
- socket.io_control(command, ec);
- if (ec)
- {
- // An error occurred.
- }
- std::size_t bytes_readable = command.get();
+]
+
+
+[heading Remarks]
+
+The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
 
+[heading Example]
+
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ socket.receive(boost::asio::buffer(data, size), 0, out_flags);
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
-[endsect]
 
 
 [endsect]
 
 
-[section:io_service basic_socket::io_service]
 
+[section:overload3 basic_seq_packet_socket::receive (3 of 3 overloads)]
 
-['Inherited from basic_io_object.]
 
-[indexterm2 io_service..basic_socket]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+Receive some data on a connected socket.
 
 
- boost::asio::io_service & io_service();
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags,
+ boost::system::error_code & ec);
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+This function is used to receive data on the sequenced packet socket. The function call will block until data has been received successfully, or until an error occurs.
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Parameters]
+
 
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received.]]
 
+[[in_flags][Flags specifying how the receive call is to be made.]]
 
+[[out_flags][After the receive call completes, contains flags associated with the received data. For example, if the `socket_base::message_end_of_record` bit is set then the received data marks the end of a record.]]
 
-[endsect]
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
-[section:is_open basic_socket::is_open]
+[heading Return Value]
+
+The number of bytes received. Returns 0 if an error occurred.
 
-[indexterm2 is_open..basic_socket]
-Determine whether the socket is open.
 
+[heading Remarks]
+
+The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
- bool is_open() const;
 
 
 
 [endsect]
 
 
+[endsect]
+
 
-[section:keep_alive basic_socket::keep_alive]
+[section:receive_buffer_size basic_seq_packet_socket::receive_buffer_size]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 keep_alive..basic_socket]
-Socket option to send keep-alives.
+[indexterm2 receive_buffer_size..basic_seq_packet_socket]
+Socket option for the receive buffer size of a socket.
 
 
- typedef implementation_defined keep_alive;
+ typedef implementation_defined receive_buffer_size;
 
 
 
-Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
+Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
 
 
 [heading Examples]
@@ -17178,7 +20174,7 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::keep_alive option(true);
+ boost::asio::socket_base::receive_buffer_size option(8192);
    socket.set_option(option);
 
 
@@ -17189,9 +20185,9 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::keep_alive option;
+ boost::asio::socket_base::receive_buffer_size option;
    socket.get_option(option);
- bool is_set = option.value();
+ int size = option.value();
 
 
 
@@ -17201,7 +20197,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -17210,20 +20206,20 @@
 
 
 
-[section:linger basic_socket::linger]
+[section:receive_low_watermark basic_seq_packet_socket::receive_low_watermark]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 linger..basic_socket]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+[indexterm2 receive_low_watermark..basic_seq_packet_socket]
+Socket option for the receive low watermark.
 
 
- typedef implementation_defined linger;
+ typedef implementation_defined receive_low_watermark;
 
 
 
-Implements the SOL\_SOCKET/SO\_LINGER socket option.
+Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
 
 
 [heading Examples]
@@ -17232,7 +20228,7 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::linger option(true, 30);
+ boost::asio::socket_base::receive_low_watermark option(1024);
    socket.set_option(option);
 
 
@@ -17243,10 +20239,9 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::linger option;
+ boost::asio::socket_base::receive_low_watermark option;
    socket.get_option(option);
- bool is_set = option.enabled();
- unsigned short timeout = option.timeout();
+ int size = option.value();
 
 
 
@@ -17256,7 +20251,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -17264,35 +20259,38 @@
 [endsect]
 
 
-[section:local_endpoint basic_socket::local_endpoint]
+[section:remote_endpoint basic_seq_packet_socket::remote_endpoint]
 
-[indexterm2 local_endpoint..basic_socket]
-Get the local endpoint of the socket.
+[indexterm2 remote_endpoint..basic_seq_packet_socket]
+Get the remote endpoint of the socket.
 
 
- endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload1 local_endpoint]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload1 more...]]``
+ endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 remote_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload1 more...]]``
 
- endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload2 local_endpoint]``(
+ endpoint_type ``[link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 remote_endpoint]``(
       boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.remote_endpoint.overload2 more...]]``
 
 
-[section:overload1 basic_socket::local_endpoint (1 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::remote_endpoint (1 of 2 overloads)]
 
 
-Get the local endpoint of the socket.
+['Inherited from basic_socket.]
 
 
- endpoint_type local_endpoint() const;
+Get the remote endpoint of the socket.
 
 
-This function is used to obtain the locally bound endpoint of the socket.
+ endpoint_type remote_endpoint() const;
+
+
+This function is used to obtain the remote endpoint of the socket.
 
 
 [heading Return Value]
       
-An object that represents the local endpoint of the socket.
+An object that represents the remote endpoint of the socket.
 
 
 [heading Exceptions]
@@ -17311,7 +20309,7 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
 
 
 
@@ -17323,17 +20321,20 @@
 
 
 
-[section:overload2 basic_socket::local_endpoint (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::remote_endpoint (2 of 2 overloads)]
 
 
-Get the local endpoint of the socket.
+['Inherited from basic_socket.]
 
 
- endpoint_type local_endpoint(
+Get the remote endpoint of the socket.
+
+
+ endpoint_type remote_endpoint(
       boost::system::error_code & ec) const;
 
 
-This function is used to obtain the locally bound endpoint of the socket.
+This function is used to obtain the remote endpoint of the socket.
 
 
 [heading Parameters]
@@ -17348,7 +20349,7 @@
 
 [heading Return Value]
       
-An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
 
 
 [heading Example]
@@ -17358,7 +20359,7 @@
    boost::asio::ip::tcp::socket socket(io_service);
    ...
    boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
    if (ec)
    {
      // An error occurred.
@@ -17375,420 +20376,236 @@
 
 [endsect]
 
-[section:lowest_layer basic_socket::lowest_layer]
-
-[indexterm2 lowest_layer..basic_socket]
-Get a reference to the lowest layer.
 
+[section:reuse_address basic_seq_packet_socket::reuse_address]
 
- lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload1 more...]]``
 
+['Inherited from socket_base.]
 
-Get a const reference to the lowest layer.
+[indexterm2 reuse_address..basic_seq_packet_socket]
+Socket option to allow the socket to be bound to an address that is already in use.
 
 
- const lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload2 more...]]``
+ typedef implementation_defined reuse_address;
 
 
-[section:overload1 basic_socket::lowest_layer (1 of 2 overloads)]
 
+Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
 
-Get a reference to the lowest layer.
 
+[heading Examples]
+
+Setting the option:
 
- lowest_layer_type & lowest_layer();
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option(true);
+ acceptor.set_option(option);
 
 
-This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
 
 
-[heading Return Value]
-
-A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
+Getting the current option value:
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
 
 
-[endsect]
 
 
 
-[section:overload2 basic_socket::lowest_layer (2 of 2 overloads)]
 
 
-Get a const reference to the lowest layer.
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
- const lowest_layer_type & lowest_layer() const;
+[*Convenience header: ][^boost/asio.hpp]
 
 
-This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
+[endsect]
 
 
-[heading Return Value]
-
-A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+[section:send basic_seq_packet_socket::send]
 
+[indexterm2 send..basic_seq_packet_socket]
+Send some data on the socket.
 
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload1 send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.send.overload1 more...]]``
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_seq_packet_socket.send.overload2 send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.send.overload2 more...]]``
 
 
-[endsect]
+[section:overload1 basic_seq_packet_socket::send (1 of 2 overloads)]
 
 
-[section:lowest_layer_type basic_socket::lowest_layer_type]
+Send some data on the socket.
 
-[indexterm2 lowest_layer_type..basic_socket]
-A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags);
 
- typedef basic_socket< Protocol, SocketService > lowest_layer_type;
 
+This function is used to send data on the sequenced packet socket. The function call will block until the data has been sent successfully, or an until error occurs.
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+[heading Parameters]
+
 
- [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
+[variablelist
   
- ]
-
- [
+[[buffers][One or more data buffers to be sent on the socket.]]
 
- [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+[[flags][Flags specifying how the send call is to be made.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
 
- [
+[heading Return Value]
+
+The number of bytes sent.
 
- [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+[heading Exceptions]
+
 
- [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
+[variablelist
   
- ]
+[[boost::system::system_error][Thrown on failure.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
+
+[heading Example]
   
- ]
+To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- [
+ socket.send(boost::asio::buffer(data, size), 0);
 
- [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
- [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
+[section:overload2 basic_seq_packet_socket::send (2 of 2 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
+Send some data on the socket.
 
- [
 
- [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
- [
 
- [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+This function is used to send data on the sequenced packet socket. The function call will block the data has been sent successfully, or an until error occurs.
 
- [
 
- [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
+[heading Parameters]
+
+
+[variablelist
   
- ]
+[[buffers][One or more data buffers to be sent on the socket.]]
 
- [
+[[flags][Flags specifying how the send call is to be made.]]
 
- [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
+[[ec][Set to indicate what error occurred, if any.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
 
- [
+[heading Return Value]
+
+The number of bytes sent. Returns 0 if an error occurred.
 
- [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
 
- [
+[heading Remarks]
+
+The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
- [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
 
-]
+[endsect]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
- [Construct a basic_socket without opening it.
+[section:send_buffer_size basic_seq_packet_socket::send_buffer_size]
 
- Construct and open a basic_socket.
 
- Construct a basic_socket, opening it and binding it to the given local endpoint.
+['Inherited from socket_base.]
 
- Construct a basic_socket on an existing native socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.close [*close]]]
- [Close the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
- [Get an option from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
+[indexterm2 send_buffer_size..basic_seq_packet_socket]
+Socket option for the send buffer size of a socket.
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.open [*open]]]
- [Open the socket using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
-
-]
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
+ typedef implementation_defined send_buffer_size;
 
- [
- [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
- [Protected destructor to prevent deletion through this type. ]
- ]
-
-]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
+Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
 
- [
- [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
+[heading Examples]
+
+Setting the option:
 
- [
- [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option(8192);
+ socket.set_option(option);
 
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
+Getting the current option value:
 
-The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -17797,56 +20614,52 @@
 
 
 
-[section:max_connections basic_socket::max_connections]
+[section:send_low_watermark basic_seq_packet_socket::send_low_watermark]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 max_connections..basic_socket]
-The maximum length of the queue of pending incoming connections.
-
-
- static const int max_connections = implementation_defined;
-
-
-
-[endsect]
-
+[indexterm2 send_low_watermark..basic_seq_packet_socket]
+Socket option for the send low watermark.
 
 
-[section:message_do_not_route basic_socket::message_do_not_route]
+ typedef implementation_defined send_low_watermark;
 
 
-['Inherited from socket_base.]
 
-[indexterm2 message_do_not_route..basic_socket]
-Specify that the data should not be subject to routing.
+Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
 
 
- static const int message_do_not_route = implementation_defined;
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option(1024);
+ socket.set_option(option);
 
 
-[endsect]
 
 
 
-[section:message_flags basic_socket::message_flags]
+Getting the current option value:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
 
-['Inherited from socket_base.]
 
-[indexterm2 message_flags..basic_socket]
-Bitmask type for flags that can be passed to send and receive operations.
 
 
- typedef int message_flags;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -17855,101 +20668,116 @@
 
 
 
-[section:message_out_of_band basic_socket::message_out_of_band]
-
-
-['Inherited from socket_base.]
+[section:service basic_seq_packet_socket::service]
 
-[indexterm2 message_out_of_band..basic_socket]
-Process out-of-band data.
 
+['Inherited from basic_io_object.]
 
- static const int message_out_of_band = implementation_defined;
+[indexterm2 service..basic_seq_packet_socket]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
+ service_type & service;
 
-[endsect]
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
 
-[section:message_peek basic_socket::message_peek]
 
 
-['Inherited from socket_base.]
 
-[indexterm2 message_peek..basic_socket]
-Peek at incoming data without removing it from the input queue.
+[endsect]
 
 
- static const int message_peek = implementation_defined;
 
+[section:service_type basic_seq_packet_socket::service_type]
 
 
-[endsect]
+['Inherited from basic_io_object.]
 
+[indexterm2 service_type..basic_seq_packet_socket]
+The type of the service that will be used to provide I/O operations.
 
 
-[section:native basic_socket::native]
+ typedef SeqPacketSocketService service_type;
 
-[indexterm2 native..basic_socket]
-Get the native socket representation.
 
 
- native_type native();
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_seq_packet_socket.hpp]
 
-This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:set_option basic_seq_packet_socket::set_option]
 
-[section:native_type basic_socket::native_type]
+[indexterm2 set_option..basic_seq_packet_socket]
+Set an option on the socket.
 
-[indexterm2 native_type..basic_socket]
-The native representation of a socket.
 
+ void ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 set_option]``(
+ const SettableSocketOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload1 more...]]``
 
- typedef SocketService::native_type native_type;
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.set_option.overload2 more...]]``
 
 
+[section:overload1 basic_seq_packet_socket::set_option (1 of 2 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+['Inherited from basic_socket.]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+Set an option on the socket.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void set_option(
+ const SettableSocketOption & option);
 
 
-[section:non_blocking_io basic_socket::non_blocking_io]
+This function is used to set an option on the socket.
 
 
-['Inherited from socket_base.]
+[heading Parameters]
+
 
-[indexterm2 non_blocking_io..basic_socket]
-IO control command to set the blocking mode of the socket.
+[variablelist
+
+[[option][The new option value to be set on the socket.]]
+
+]
 
 
- typedef implementation_defined non_blocking_io;
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
+]
 
-Implements the FIONBIO IO control command.
 
 
 [heading Example]
   
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
 
-
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
+ boost::asio::ip::tcp::no_delay option(true);
+ socket.set_option(option);
 
 
 
@@ -17957,43 +20785,97 @@
 
 
 
-[heading Requirements]
+[endsect]
+
+
+
+[section:overload2 basic_seq_packet_socket::set_option (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Set an option on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+
+
+This function is used to set an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The new option value to be set on the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+
+[heading Example]
+
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ boost::system::error_code ec;
+ socket.set_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:open basic_socket::open]
+[endsect]
 
-[indexterm2 open..basic_socket]
-Open the socket using the specified protocol.
+[section:shutdown basic_seq_packet_socket::shutdown]
 
+[indexterm2 shutdown..basic_seq_packet_socket]
+Disable sends or receives on the socket.
 
- void ``[link boost_asio.reference.basic_socket.open.overload1 open]``(
- const protocol_type & protocol = protocol_type());
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket.open.overload2 open]``(
- const protocol_type & protocol,
+ void ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 shutdown]``(
+ shutdown_type what);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 shutdown]``(
+ shutdown_type what,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_seq_packet_socket.shutdown.overload2 more...]]``
 
 
-[section:overload1 basic_socket::open (1 of 2 overloads)]
+[section:overload1 basic_seq_packet_socket::shutdown (1 of 2 overloads)]
 
 
-Open the socket using the specified protocol.
+['Inherited from basic_socket.]
 
 
- void open(
- const protocol_type & protocol = protocol_type());
+Disable sends or receives on the socket.
 
 
-This function opens the socket so that it will use the specified protocol.
+ void shutdown(
+ shutdown_type what);
+
+
+This function is used to disable send operations, receive operations, or both.
 
 
 [heading Parameters]
@@ -18001,7 +20883,7 @@
 
 [variablelist
   
-[[protocol][An object specifying protocol parameters to be used.]]
+[[what][Determines what types of operation will no longer be allowed.]]
 
 ]
 
@@ -18018,10 +20900,11 @@
 
 [heading Example]
   
-
+Shutting down the send side of the socket:
 
    boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+ ...
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
 
 
 
@@ -18033,18 +20916,21 @@
 
 
 
-[section:overload2 basic_socket::open (2 of 2 overloads)]
+[section:overload2 basic_seq_packet_socket::shutdown (2 of 2 overloads)]
 
 
-Open the socket using the specified protocol.
+['Inherited from basic_socket.]
 
 
- boost::system::error_code open(
- const protocol_type & protocol,
+Disable sends or receives on the socket.
+
+
+ boost::system::error_code shutdown(
+ shutdown_type what,
       boost::system::error_code & ec);
 
 
-This function opens the socket so that it will use the specified protocol.
+This function is used to disable send operations, receive operations, or both.
 
 
 [heading Parameters]
@@ -18052,7 +20938,7 @@
 
 [variablelist
   
-[[protocol][An object specifying which protocol is to be used.]]
+[[what][Determines what types of operation will no longer be allowed.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -18061,11 +20947,12 @@
 
 [heading Example]
   
-
+Shutting down the send side of the socket:
 
    boost::asio::ip::tcp::socket socket(io_service);
+ ...
    boost::system::error_code ec;
- socket.open(boost::asio::ip::tcp::v4(), ec);
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
    if (ec)
    {
      // An error occurred.
@@ -18083,185 +20970,354 @@
 [endsect]
 
 
-[section:protocol_type basic_socket::protocol_type]
+[section:shutdown_type basic_seq_packet_socket::shutdown_type]
 
-[indexterm2 protocol_type..basic_socket]
-The protocol type.
 
+['Inherited from socket_base.]
 
- typedef Protocol protocol_type;
+[indexterm2 shutdown_type..basic_seq_packet_socket]
+Different ways a socket may be shutdown.
 
 
+ enum shutdown_type
 
-[heading Requirements]
+[indexterm2 shutdown_receive..basic_seq_packet_socket]
+[indexterm2 shutdown_send..basic_seq_packet_socket]
+[indexterm2 shutdown_both..basic_seq_packet_socket]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+[heading Values]
+[variablelist
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
+ [shutdown_receive]
+ [Shutdown the receive side of the socket. ]
+ ]
 
+ [
+ [shutdown_send]
+ [Shutdown the send side of the socket. ]
+ ]
 
-[endsect]
+ [
+ [shutdown_both]
+ [Shutdown both send and receive on the socket. ]
+ ]
 
+]
 
 
-[section:receive_buffer_size basic_socket::receive_buffer_size]
 
+[endsect]
 
-['Inherited from socket_base.]
 
-[indexterm2 receive_buffer_size..basic_socket]
-Socket option for the receive buffer size of a socket.
 
+[endsect]
 
- typedef implementation_defined receive_buffer_size;
+[section:basic_serial_port basic_serial_port]
 
 
+Provides serial port functionality.
 
-Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
 
+ template<
+ typename ``[link boost_asio.reference.SerialPortService SerialPortService]`` = serial_port_service>
+ class basic_serial_port :
+ public basic_io_object< SerialPortService >,
+ public serial_port_base
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option(8192);
- socket.set_option(option);
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
+ [[link boost_asio.reference.basic_serial_port.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_serial_port is always the lowest layer. ]
+
+ ]
 
-Getting the current option value:
+ [
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option;
- socket.get_option(option);
- int size = option.value();
+ [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
+ [The native representation of a serial port. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a serial port. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_serial_port.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[heading Requirements]
+ [
+ [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
+ [Assign an existing native serial port to the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
+ [Construct a basic_serial_port without opening it.
 
-[*Header: ][^boost/asio/basic_socket.hpp]
+ Construct and open a basic_serial_port.
 
-[*Convenience header: ][^boost/asio.hpp]
+ Construct a basic_serial_port on an existing native serial port.
 
+ Move-construct a basic_serial_port from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.close [*close]]]
+ [Close the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
+ [Get an option from the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
+ [Determine whether the serial port is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
-[endsect]
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native serial port representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
+ [Get the native serial port representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.open [*open]]]
+ [Open the serial port using the specified device name. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
+ [Move-assign a basic_serial_port from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
+ [Read some data from the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
+ [Send a break sequence to the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
+ [Set an option on the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
+ [Write some data to the serial port. ]
+ ]
+
+]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_serial_port.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
 
-[section:receive_low_watermark basic_socket::receive_low_watermark]
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_serial_port.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
-['Inherited from socket_base.]
+ [
+ [[link boost_asio.reference.basic_serial_port.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
-[indexterm2 receive_low_watermark..basic_socket]
-Socket option for the receive low watermark.
+]
 
+The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class template provides functionality that is common to all serial ports.
 
- typedef implementation_defined receive_low_watermark;
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
-Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
 
 
-[heading Examples]
-
-Setting the option:
+[heading Requirements]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option(1024);
- socket.set_option(option);
+[*Header: ][^boost/asio/basic_serial_port.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
+[section:assign basic_serial_port::assign]
 
+[indexterm2 assign..basic_serial_port]
+Assign an existing native serial port to the serial port.
 
 
-Getting the current option value:
+ void ``[link boost_asio.reference.basic_serial_port.assign.overload1 assign]``(
+ const native_handle_type & native_serial_port);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload1 more...]]``
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option;
- socket.get_option(option);
- int size = option.value();
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.assign.overload2 assign]``(
+ const native_handle_type & native_serial_port,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.assign.overload2 more...]]``
 
 
+[section:overload1 basic_serial_port::assign (1 of 2 overloads)]
 
 
+Assign an existing native serial port to the serial port.
 
 
+ void assign(
+ const native_handle_type & native_serial_port);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
-[endsect]
 
+[section:overload2 basic_serial_port::assign (2 of 2 overloads)]
 
-[section:remote_endpoint basic_socket::remote_endpoint]
 
-[indexterm2 remote_endpoint..basic_socket]
-Get the remote endpoint of the socket.
+Assign an existing native serial port to the serial port.
 
 
- endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload1 remote_endpoint]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload1 more...]]``
+ boost::system::error_code assign(
+ const native_handle_type & native_serial_port,
+ boost::system::error_code & ec);
 
- endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload2 remote_endpoint]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload2 more...]]``
 
 
-[section:overload1 basic_socket::remote_endpoint (1 of 2 overloads)]
+[endsect]
 
 
-Get the remote endpoint of the socket.
+[endsect]
 
 
- endpoint_type remote_endpoint() const;
+[section:async_read_some basic_serial_port::async_read_some]
+
+[indexterm2 async_read_some..basic_serial_port]
+Start an asynchronous read.
 
 
-This function is used to obtain the remote endpoint of the socket.
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_some(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
 
 
-[heading Return Value]
-
-An object that represents the remote endpoint of the socket.
+This function is used to asynchronously read data from the serial port. The function call always returns immediately.
 
 
-[heading Exceptions]
+[heading Parameters]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes read.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
 ]
 
 
-[heading Example]
-
+[heading Remarks]
+
+The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
 
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ serial_port.async_read_some(boost::asio::buffer(data, size), handler);
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -18270,17 +21326,21 @@
 
 
 
-[section:overload2 basic_socket::remote_endpoint (2 of 2 overloads)]
-
+[section:async_write_some basic_serial_port::async_write_some]
 
-Get the remote endpoint of the socket.
+[indexterm2 async_write_some..basic_serial_port]
+Start an asynchronous write.
 
 
- endpoint_type remote_endpoint(
- boost::system::error_code & ec) const;
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_some(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
 
 
-This function is used to obtain the remote endpoint of the socket.
+This function is used to asynchronously write data to the serial port. The function call always returns immediately.
 
 
 [heading Parameters]
@@ -18288,213 +21348,287 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any.]]
+[[buffers][One or more data buffers to be written to the serial port. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes written.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
 ]
 
 
-[heading Return Value]
+[heading Remarks]
       
-An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
 
 
 [heading Example]
   
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ serial_port.async_write_some(boost::asio::buffer(data, size), handler);
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
- if (ec)
- {
- // An error occurred.
- }
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
 
+[endsect]
 
 
-[endsect]
+[section:basic_serial_port basic_serial_port::basic_serial_port]
 
+[indexterm2 basic_serial_port..basic_serial_port]
+Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it.
 
-[endsect]
 
+ explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 basic_serial_port]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 more...]]``
 
-[section:reuse_address basic_socket::reuse_address]
 
+Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
 
-['Inherited from socket_base.]
 
-[indexterm2 reuse_address..basic_socket]
-Socket option to allow the socket to be bound to an address that is already in use.
+ explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 basic_serial_port]``(
+ boost::asio::io_service & io_service,
+ const char * device);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 more...]]``
 
+ explicit ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 basic_serial_port]``(
+ boost::asio::io_service & io_service,
+ const std::string & device);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 more...]]``
 
- typedef implementation_defined reuse_address;
 
+Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port.
 
 
-Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
+ ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 basic_serial_port]``(
+ boost::asio::io_service & io_service,
+ const native_handle_type & native_serial_port);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload4 more...]]``
 
 
-[heading Examples]
-
-Setting the option:
+Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another.
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option(true);
- acceptor.set_option(option);
 
+ ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 basic_serial_port]``(
+ basic_serial_port && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.basic_serial_port.overload5 more...]]``
 
 
+[section:overload1 basic_serial_port::basic_serial_port (1 of 5 overloads)]
 
 
-Getting the current option value:
+Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] without opening it.
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option;
- acceptor.get_option(option);
- bool is_set = option.value();
 
+ basic_serial_port(
+ boost::asio::io_service & io_service);
 
 
+This constructor creates a serial port without opening it.
 
 
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port. ]]
 
-[heading Requirements]
+]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:send_buffer_size basic_socket::send_buffer_size]
+[section:overload2 basic_serial_port::basic_serial_port (2 of 5 overloads)]
 
 
-['Inherited from socket_base.]
+Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
 
-[indexterm2 send_buffer_size..basic_socket]
-Socket option for the send buffer size of a socket.
 
-
- typedef implementation_defined send_buffer_size;
+ basic_serial_port(
+ boost::asio::io_service & io_service,
+ const char * device);
 
 
+This constructor creates and opens a serial port for the specified device name.
 
-Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
 
+[heading Parameters]
+
 
-[heading Examples]
+[variablelist
   
-Setting the option:
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port.]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option(8192);
- socket.set_option(option);
+[[device][The platform-specific device name for this serial port. ]]
 
+]
 
 
 
 
-Getting the current option value:
+[endsect]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option;
- socket.get_option(option);
- int size = option.value();
 
 
+[section:overload3 basic_serial_port::basic_serial_port (3 of 5 overloads)]
 
 
+Construct and open a [link boost_asio.reference.basic_serial_port `basic_serial_port`].
+
 
+ basic_serial_port(
+ boost::asio::io_service & io_service,
+ const std::string & device);
 
 
-[heading Requirements]
+This constructor creates and opens a serial port for the specified device name.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port.]]
+
+[[device][The platform-specific device name for this serial port. ]]
+
+]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:send_low_watermark basic_socket::send_low_watermark]
+[section:overload4 basic_serial_port::basic_serial_port (4 of 5 overloads)]
 
 
-['Inherited from socket_base.]
+Construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] on an existing native serial port.
 
-[indexterm2 send_low_watermark..basic_socket]
-Socket option for the send low watermark.
 
+ basic_serial_port(
+ boost::asio::io_service & io_service,
+ const native_handle_type & native_serial_port);
 
- typedef implementation_defined send_low_watermark;
+
+This constructor creates a serial port object to hold an existing native serial port.
 
 
+[heading Parameters]
+
 
-Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port.]]
+
+[[native_serial_port][A native serial port.]]
+
+]
 
 
-[heading Examples]
+[heading Exceptions]
+
+
+[variablelist
   
-Setting the option:
+[[boost::system::system_error][Thrown on failure. ]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_low_watermark option(1024);
- socket.set_option(option);
+]
 
 
 
 
+[endsect]
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_low_watermark option;
- socket.get_option(option);
- int size = option.value();
 
+[section:overload5 basic_serial_port::basic_serial_port (5 of 5 overloads)]
 
 
+Move-construct a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another.
 
 
+ basic_serial_port(
+ basic_serial_port && other);
 
 
-[heading Requirements]
+This constructor moves a serial port from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(io_service&) constructor`.
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:service basic_socket::service]
+[section:cancel basic_serial_port::cancel]
 
+[indexterm2 cancel..basic_serial_port]
+Cancel all asynchronous operations associated with the serial port.
 
-['Inherited from basic_io_object.]
 
-[indexterm2 service..basic_socket]
-The service associated with the I/O object.
+ void ``[link boost_asio.reference.basic_serial_port.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.cancel.overload2 more...]]``
+
+
+[section:overload1 basic_serial_port::cancel (1 of 2 overloads)]
+
+
+Cancel all asynchronous operations associated with the serial port.
+
+
+ void cancel();
+
+
+This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
 
- service_type & service;
 
 
 
@@ -18502,185 +21636,215 @@
 
 
 
-[section:service_type basic_socket::service_type]
+[section:overload2 basic_serial_port::cancel (2 of 2 overloads)]
 
 
-['Inherited from basic_io_object.]
+Cancel all asynchronous operations associated with the serial port.
 
-[indexterm2 service_type..basic_socket]
-The type of the service that will be used to provide I/O operations.
 
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
 
- typedef SocketService service_type;
+
+This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
 
+[heading Parameters]
+
 
-[heading Requirements]
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. ]]
+
+]
 
-[*Header: ][^boost/asio/basic_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:set_option basic_socket::set_option]
+[endsect]
 
-[indexterm2 set_option..basic_socket]
-Set an option on the socket.
+[section:close basic_serial_port::close]
 
+[indexterm2 close..basic_serial_port]
+Close the serial port.
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void ``[link boost_asio.reference.basic_socket.set_option.overload1 set_option]``(
- const SettableSocketOption & option);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket.set_option.overload2 set_option]``(
- const SettableSocketOption & option,
+ void ``[link boost_asio.reference.basic_serial_port.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.close.overload2 close]``(
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.close.overload2 more...]]``
 
 
-[section:overload1 basic_socket::set_option (1 of 2 overloads)]
+[section:overload1 basic_serial_port::close (1 of 2 overloads)]
 
 
-Set an option on the socket.
+Close the serial port.
 
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void set_option(
- const SettableSocketOption & option);
+ void close();
 
 
-This function is used to set an option on the socket.
+This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
 
-[heading Parameters]
+[heading Exceptions]
     
 
 [variablelist
   
-[[option][The new option value to be set on the socket.]]
+[[boost::system::system_error][Thrown on failure. ]]
 
 ]
 
 
-[heading Exceptions]
+
+
+[endsect]
+
+
+
+[section:overload2 basic_serial_port::close (2 of 2 overloads)]
+
+
+Close the serial port.
+
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+This function is used to close the serial port. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+
+
+[heading Parameters]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[ec][Set to indicate what error occurred, if any. ]]
 
 ]
 
 
 
-[heading Example]
-
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::no_delay option(true);
- socket.set_option(option);
+[endsect]
 
 
+[endsect]
 
+[section:get_implementation basic_serial_port::get_implementation]
 
+[indexterm2 get_implementation..basic_serial_port]
+Get the underlying implementation of the I/O object.
 
 
+ implementation_type & ``[link boost_asio.reference.basic_serial_port.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_implementation.overload1 more...]]``
 
-[endsect]
+ const implementation_type & ``[link boost_asio.reference.basic_serial_port.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_implementation.overload2 more...]]``
 
 
+[section:overload1 basic_serial_port::get_implementation (1 of 2 overloads)]
 
-[section:overload2 basic_socket::set_option (2 of 2 overloads)]
 
+['Inherited from basic_io_object.]
 
-Set an option on the socket.
 
+Get the underlying implementation of the I/O object.
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code set_option(
- const SettableSocketOption & option,
- boost::system::error_code & ec);
 
+ implementation_type & get_implementation();
 
-This function is used to set an option on the socket.
 
 
-[heading Parameters]
-
+[endsect]
 
-[variablelist
-
-[[option][The new option value to be set on the socket.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[section:overload2 basic_serial_port::get_implementation (2 of 2 overloads)]
 
 
+['Inherited from basic_io_object.]
 
-[heading Example]
-
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::no_delay option(true);
- boost::system::error_code ec;
- socket.set_option(option, ec);
- if (ec)
- {
- // An error occurred.
- }
+Get the underlying implementation of the I/O object.
 
 
+ const implementation_type & get_implementation() const;
 
 
 
+[endsect]
 
 
 [endsect]
 
 
+[section:get_io_service basic_serial_port::get_io_service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 get_io_service..basic_serial_port]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+
+
+ boost::asio::io_service & get_io_service();
+
+
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+
+
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+
+
+
+
 [endsect]
 
-[section:shutdown basic_socket::shutdown]
 
-[indexterm2 shutdown..basic_socket]
-Disable sends or receives on the socket.
+[section:get_option basic_serial_port::get_option]
 
+[indexterm2 get_option..basic_serial_port]
+Get an option from the serial port.
 
- void ``[link boost_asio.reference.basic_socket.shutdown.overload1 shutdown]``(
- shutdown_type what);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket.shutdown.overload2 shutdown]``(
- shutdown_type what,
+ template<
+ typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
+ void ``[link boost_asio.reference.basic_serial_port.get_option.overload1 get_option]``(
+ GettableSerialPortOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.get_option.overload2 get_option]``(
+ GettableSerialPortOption & option,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_option.overload2 more...]]``
 
 
-[section:overload1 basic_socket::shutdown (1 of 2 overloads)]
+[section:overload1 basic_serial_port::get_option (1 of 2 overloads)]
 
 
-Disable sends or receives on the socket.
+Get an option from the serial port.
 
 
- void shutdown(
- shutdown_type what);
+ template<
+ typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
+ void get_option(
+ GettableSerialPortOption & option);
 
 
-This function is used to disable send operations, receive operations, or both.
+This function is used to get the current value of an option on the serial port.
 
 
 [heading Parameters]
@@ -18688,7 +21852,7 @@
 
 [variablelist
   
-[[what][Determines what types of operation will no longer be allowed.]]
+[[option][The option value to be obtained from the serial port.]]
 
 ]
 
@@ -18703,17 +21867,6 @@
 ]
 
 
-[heading Example]
-
-Shutting down the send side of the socket:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
-
-
-
-
 
 
 
@@ -18721,18 +21874,20 @@
 
 
 
-[section:overload2 basic_socket::shutdown (2 of 2 overloads)]
+[section:overload2 basic_serial_port::get_option (2 of 2 overloads)]
 
 
-Disable sends or receives on the socket.
+Get an option from the serial port.
 
 
- boost::system::error_code shutdown(
- shutdown_type what,
+ template<
+ typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
+ boost::system::error_code get_option(
+ GettableSerialPortOption & option,
       boost::system::error_code & ec);
 
 
-This function is used to disable send operations, receive operations, or both.
+This function is used to get the current value of an option on the serial port.
 
 
 [heading Parameters]
@@ -18740,250 +21895,234 @@
 
 [variablelist
   
-[[what][Determines what types of operation will no longer be allowed.]]
+[[option][The option value to be obtained from the serial port.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set to indicate what error occured, if any.]]
 
 ]
 
 
-[heading Example]
-
-Shutting down the send side of the socket:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
- if (ec)
- {
- // An error occurred.
- }
 
 
+[endsect]
 
 
+[endsect]
 
+[section:get_service basic_serial_port::get_service]
 
+[indexterm2 get_service..basic_serial_port]
+Get the service associated with the I/O object.
 
-[endsect]
 
+ service_type & ``[link boost_asio.reference.basic_serial_port.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_service.overload1 more...]]``
 
-[endsect]
+ const service_type & ``[link boost_asio.reference.basic_serial_port.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.get_service.overload2 more...]]``
 
 
-[section:shutdown_type basic_socket::shutdown_type]
+[section:overload1 basic_serial_port::get_service (1 of 2 overloads)]
 
 
-['Inherited from socket_base.]
+['Inherited from basic_io_object.]
 
-[indexterm2 shutdown_type..basic_socket]
-Different ways a socket may be shutdown.
 
+Get the service associated with the I/O object.
 
- enum shutdown_type
 
-[indexterm2 shutdown_receive..basic_socket]
-[indexterm2 shutdown_send..basic_socket]
-[indexterm2 shutdown_both..basic_socket]
+ service_type & get_service();
 
-[heading Values]
-[variablelist
 
- [
- [shutdown_receive]
- [Shutdown the receive side of the socket. ]
- ]
 
- [
- [shutdown_send]
- [Shutdown the send side of the socket. ]
- ]
+[endsect]
 
- [
- [shutdown_both]
- [Shutdown both send and receive on the socket. ]
- ]
 
-]
 
+[section:overload2 basic_serial_port::get_service (2 of 2 overloads)]
 
 
-[endsect]
+['Inherited from basic_io_object.]
 
 
+Get the service associated with the I/O object.
 
-[section:_basic_socket basic_socket::~basic_socket]
 
-[indexterm2 ~basic_socket..basic_socket]
-Protected destructor to prevent deletion through this type.
+ const service_type & get_service() const;
 
 
- ~basic_socket();
 
+[endsect]
 
 
 [endsect]
 
 
+[section:implementation basic_serial_port::implementation]
 
-[endsect]
 
-[section:basic_socket_acceptor basic_socket_acceptor]
+['Inherited from basic_io_object.]
 
+[indexterm2 implementation..basic_serial_port]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
-Provides the ability to accept new connections.
 
+ implementation_type implementation;
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.SocketAcceptorService SocketAcceptorService]`` = socket_acceptor_service<Protocol>>
- class basic_socket_acceptor :
- public basic_io_object< SocketAcceptorService >,
- public socket_base
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
 
- [
+[section:implementation_type basic_serial_port::implementation_type]
 
- [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
 
- [
+['Inherited from basic_io_object.]
 
- [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+[indexterm2 implementation_type..basic_serial_port]
+The underlying implementation type of I/O object.
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
+ typedef service_type::implementation_type implementation_type;
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
+[heading Requirements]
 
- [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
+[*Header: ][^boost/asio/basic_serial_port.hpp]
 
- [
+[*Convenience header: ][^boost/asio.hpp]
 
- [[link boost_asio.reference.basic_socket_acceptor.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
+[section:is_open basic_serial_port::is_open]
 
- [
+[indexterm2 is_open..basic_serial_port]
+Determine whether the serial port is open.
 
- [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
 
- [
+ bool is_open() const;
 
- [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
- [The native representation of an acceptor. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+[section:lowest_layer basic_serial_port::lowest_layer]
 
- [
+[indexterm2 lowest_layer..basic_serial_port]
+Get a reference to the lowest layer.
 
- [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
 
- [
+ lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload1 more...]]``
 
- [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
 
- [
+Get a const reference to the lowest layer.
 
- [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
 
- [
+ const lowest_layer_type & ``[link boost_asio.reference.basic_serial_port.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.lowest_layer.overload2 more...]]``
 
- [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
+
+[section:overload1 basic_serial_port::lowest_layer (1 of 2 overloads)]
+
+
+Get a reference to the lowest layer.
+
+
+ lowest_layer_type & lowest_layer();
+
+
+This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_serial_port::lowest_layer (2 of 2 overloads)]
+
+
+Get a const reference to the lowest layer.
+
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_serial_port `basic_serial_port`] cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:lowest_layer_type basic_serial_port::lowest_layer_type]
+
+[indexterm2 lowest_layer_type..basic_serial_port]
+A [link boost_asio.reference.basic_serial_port `basic_serial_port`] is always the lowest layer.
+
+
+ typedef basic_serial_port< SerialPortService > lowest_layer_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
+ [[link boost_asio.reference.basic_serial_port.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_serial_port is always the lowest layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
+ [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
+ [The native representation of a serial port. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a serial port. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_serial_port.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
@@ -18994,119 +22133,119 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
- [Accept a new connection.
-
- Accept a new connection and obtain the endpoint of the peer. ]
+ [[link boost_asio.reference.basic_serial_port.assign [*assign]]]
+ [Assign an existing native serial port to the serial port. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
- [Assigns an existing native acceptor to the acceptor. ]
+ [[link boost_asio.reference.basic_serial_port.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
- [Start an asynchronous accept. ]
+ [[link boost_asio.reference.basic_serial_port.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
- [Construct an acceptor without opening it.
+ [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
+ [Construct a basic_serial_port without opening it.
 
- Construct an open acceptor.
+ Construct and open a basic_serial_port.
 
- Construct an acceptor opened on the given endpoint.
+ Construct a basic_serial_port on an existing native serial port.
 
- Construct a basic_socket_acceptor on an existing native acceptor. ]
+ Move-construct a basic_serial_port from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
- [Bind the acceptor to the given local endpoint. ]
+ [[link boost_asio.reference.basic_serial_port.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the serial port. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the acceptor. ]
+ [[link boost_asio.reference.basic_serial_port.close [*close]]]
+ [Close the serial port. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
- [Close the acceptor. ]
+ [[link boost_asio.reference.basic_serial_port.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_serial_port.get_option [*get_option]]]
+ [Get an option from the serial port. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
- [Get an option from the acceptor. ]
+ [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
+ [Determine whether the serial port is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_serial_port.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native serial port representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
- [Determine whether the acceptor is open. ]
+ [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
+ [Get the native serial port representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
- [Place the acceptor into the state where it will listen for new connections. ]
+ [[link boost_asio.reference.basic_serial_port.open [*open]]]
+ [Open the serial port using the specified device name. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the acceptor. ]
+ [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
+ [Move-assign a basic_serial_port from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.native [*native]]]
- [Get the native acceptor representation. ]
+ [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
+ [Read some data from the serial port. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
- [Open the acceptor using the specified protocol. ]
+ [[link boost_asio.reference.basic_serial_port.send_break [*send_break]]]
+ [Send a break sequence to the serial port. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
- [Set an option on the acceptor. ]
+ [[link boost_asio.reference.basic_serial_port.set_option [*set_option]]]
+ [Set an option on the serial port. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.write_some [*write_some]]]
+ [Write some data to the serial port. ]
   ]
   
 ]
 
-[heading Data Members]
+[heading Protected Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
+ [[link boost_asio.reference.basic_serial_port.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
+ [[link boost_asio.reference.basic_serial_port.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
-
+
 ]
 
 [heading Protected Data Members]
@@ -19114,101 +22253,140 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.basic_serial_port.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.basic_serial_port.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
+The [link boost_asio.reference.basic_serial_port `basic_serial_port`] class template provides functionality that is common to all serial ports.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
 
 
-[heading Example]
-
-Opening a socket acceptor with the SO\_REUSEADDR option enabled:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
- acceptor.open(endpoint.protocol());
- acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
- acceptor.bind(endpoint);
- acceptor.listen();
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_serial_port.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:native basic_serial_port::native]
+
+[indexterm2 native..basic_serial_port]
+(Deprecated: Use `native_handle()`.) Get the native serial port representation.
+
+
+ native_type native();
+
+
+This function may be used to obtain the underlying representation of the serial port. This is intended to allow access to native serial port functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle basic_serial_port::native_handle]
+
+[indexterm2 native_handle..basic_serial_port]
+Get the native serial port representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the serial port. This is intended to allow access to native serial port functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type basic_serial_port::native_handle_type]
+
+[indexterm2 native_handle_type..basic_serial_port]
+The native representation of a serial port.
 
 
+ typedef SerialPortService::native_handle_type native_handle_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+[*Header: ][^boost/asio/basic_serial_port.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:accept basic_socket_acceptor::accept]
 
-[indexterm2 accept..basic_socket_acceptor]
-Accept a new connection.
+[endsect]
 
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload1 accept]``(
- basic_socket< protocol_type, SocketService > & peer);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.accept.overload2 accept]``(
- basic_socket< protocol_type, SocketService > & peer,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload2 more...]]``
+[section:native_type basic_serial_port::native_type]
 
+[indexterm2 native_type..basic_serial_port]
+(Deprecated: Use native\_handle\_type.) The native representation of a serial port.
 
-Accept a new connection and obtain the endpoint of the peer.
 
+ typedef SerialPortService::native_handle_type native_type;
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload3 accept]``(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload3 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.accept.overload4 accept]``(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint,
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_serial_port.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:open basic_serial_port::open]
+
+[indexterm2 open..basic_serial_port]
+Open the serial port using the specified device name.
+
+
+ void ``[link boost_asio.reference.basic_serial_port.open.overload1 open]``(
+ const std::string & device);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.open.overload2 open]``(
+ const std::string & device,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload4 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.open.overload2 more...]]``
 
 
-[section:overload1 basic_socket_acceptor::accept (1 of 4 overloads)]
+[section:overload1 basic_serial_port::open (1 of 2 overloads)]
 
 
-Accept a new connection.
+Open the serial port using the specified device name.
 
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- void accept(
- basic_socket< protocol_type, SocketService > & peer);
+ void open(
+ const std::string & device);
 
 
-This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
+This function opens the serial port for the specified device name.
 
 
 [heading Parameters]
@@ -19216,7 +22394,7 @@
 
 [variablelist
   
-[[peer][The socket into which the new connection will be accepted.]]
+[[device][The platform-specific device name.]]
 
 ]
 
@@ -19226,22 +22404,41 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. ]]
 
 ]
 
 
-[heading Example]
-
 
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::socket socket(io_service);
- acceptor.accept(socket);
+[endsect]
+
+
+
+[section:overload2 basic_serial_port::open (2 of 2 overloads)]
+
+
+Open the serial port using the specified device name.
+
+
+ boost::system::error_code open(
+ const std::string & device,
+ boost::system::error_code & ec);
+
+
+This function opens the serial port using the given platform-specific device name.
+
+
+[heading Parameters]
+
 
+[variablelist
+
+[[device][The platform-specific device name.]]
 
+[[ec][Set the indicate what error occurred, if any. ]]
 
+]
 
 
 
@@ -19249,21 +22446,20 @@
 [endsect]
 
 
+[endsect]
 
-[section:overload2 basic_socket_acceptor::accept (2 of 4 overloads)]
 
+[section:operator_eq_ basic_serial_port::operator=]
 
-Accept a new connection.
+[indexterm2 operator=..basic_serial_port]
+Move-assign a [link boost_asio.reference.basic_serial_port `basic_serial_port`] from another.
 
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- boost::system::error_code accept(
- basic_socket< protocol_type, SocketService > & peer,
- boost::system::error_code & ec);
+ basic_serial_port & operator=(
+ basic_serial_port && other);
 
 
-This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
+This assignment operator moves a serial port from one object to another.
 
 
 [heading Parameters]
@@ -19271,51 +22467,54 @@
 
 [variablelist
   
-[[peer][The socket into which the new connection will be accepted.]]
-
-[[ec][Set to indicate what error occurred, if any.]]
+[[other][The other [link boost_asio.reference.basic_serial_port `basic_serial_port`] object from which the move will occur.]]
 
 ]
 
 
-[heading Example]
-
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_serial_port(io_service&) constructor`.
 
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::soocket socket(io_service);
- boost::system::error_code ec;
- acceptor.accept(socket, ec);
- if (ec)
- {
- // An error occurred.
- }
 
 
+[endsect]
 
 
+[section:read_some basic_serial_port::read_some]
 
+[indexterm2 read_some..basic_serial_port]
+Read some data from the serial port.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload1 read_some]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload1 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_serial_port.read_some.overload2 read_some]``(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.read_some.overload2 more...]]``
 
 
-[section:overload3 basic_socket_acceptor::accept (3 of 4 overloads)]
+[section:overload1 basic_serial_port::read_some (1 of 2 overloads)]
 
 
-Accept a new connection and obtain the endpoint of the peer.
+Read some data from the serial port.
 
 
   template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- void accept(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint);
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
 
 
-This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
+This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -19323,35 +22522,39 @@
 
 [variablelist
   
-[[peer][The socket into which the new connection will be accepted.]]
-
-[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
+[[buffers][One or more buffers into which the data will be read.]]
 
 ]
 
 
+[heading Return Value]
+
+The number of bytes read.
+
+
 [heading Exceptions]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
 
 ]
 
 
-[heading Example]
-
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint;
- acceptor.accept(socket, endpoint);
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ serial_port.read_some(boost::asio::buffer(data, size));
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -19360,21 +22563,20 @@
 
 
 
-[section:overload4 basic_socket_acceptor::accept (4 of 4 overloads)]
+[section:overload2 basic_serial_port::read_some (2 of 2 overloads)]
 
 
-Accept a new connection and obtain the endpoint of the peer.
+Read some data from the serial port.
 
 
   template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- boost::system::error_code accept(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers,
       boost::system::error_code & ec);
 
 
-This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
+This function is used to read data from the serial port. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -19382,32 +22584,21 @@
 
 [variablelist
   
-[[peer][The socket into which the new connection will be accepted.]]
-
-[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
+[[buffers][One or more buffers into which the data will be read.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Example]
-
-
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint;
- boost::system::error_code ec;
- acceptor.accept(socket, endpoint, ec);
- if (ec)
- {
- // An error occurred.
- }
-
+[heading Return Value]
+
+The number of bytes read. Returns 0 if an error occurred.
 
 
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
 
 
@@ -19417,97 +22608,59 @@
 
 [endsect]
 
-[section:assign basic_socket_acceptor::assign]
+[section:send_break basic_serial_port::send_break]
 
-[indexterm2 assign..basic_socket_acceptor]
-Assigns an existing native acceptor to the acceptor.
+[indexterm2 send_break..basic_serial_port]
+Send a break sequence to the serial port.
 
 
- void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload1 assign]``(
- const protocol_type & protocol,
- const native_type & native_acceptor);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_serial_port.send_break.overload1 send_break]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.assign.overload2 assign]``(
- const protocol_type & protocol,
- const native_type & native_acceptor,
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.send_break.overload2 send_break]``(
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.send_break.overload2 more...]]``
 
 
-[section:overload1 basic_socket_acceptor::assign (1 of 2 overloads)]
+[section:overload1 basic_serial_port::send_break (1 of 2 overloads)]
 
 
-Assigns an existing native acceptor to the acceptor.
+Send a break sequence to the serial port.
 
 
- void assign(
- const protocol_type & protocol,
- const native_type & native_acceptor);
+ void send_break();
 
 
+This function causes a break sequence of platform-specific duration to be sent out the serial port.
 
-[endsect]
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
-[section:overload2 basic_socket_acceptor::assign (2 of 2 overloads)]
+]
 
 
-Assigns an existing native acceptor to the acceptor.
 
 
- boost::system::error_code assign(
- const protocol_type & protocol,
- const native_type & native_acceptor,
- boost::system::error_code & ec);
+[endsect]
 
 
 
-[endsect]
+[section:overload2 basic_serial_port::send_break (2 of 2 overloads)]
 
 
-[endsect]
+Send a break sequence to the serial port.
 
-[section:async_accept basic_socket_acceptor::async_accept]
 
-[indexterm2 async_accept..basic_socket_acceptor]
-Start an asynchronous accept.
+ boost::system::error_code send_break(
+ boost::system::error_code & ec);
 
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``,
- typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 async_accept]``(
- basic_socket< protocol_type, SocketService > & peer,
- AcceptHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 more...]]``
-
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``,
- typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 async_accept]``(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint,
- AcceptHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 more...]]``
-
-
-[section:overload1 basic_socket_acceptor::async_accept (1 of 2 overloads)]
-
-
-Start an asynchronous accept.
-
-
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``,
- typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
- void async_accept(
- basic_socket< protocol_type, SocketService > & peer,
- AcceptHandler handler);
-
-
-This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately.
+This function causes a break sequence of platform-specific duration to be sent out the serial port.
 
 
 [heading Parameters]
@@ -19515,174 +22668,142 @@
 
 [variablelist
   
-[[peer][The socket into which the new connection will be accepted. Ownership of the peer object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
-
-[[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error // Result of operation.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+[[ec][Set to indicate what error occurred, if any. ]]
 
 ]
 
 
-[heading Example]
-
-
-
- void accept_handler(const boost::system::error_code& error)
- {
- if (!error)
- {
- // Accept succeeded.
- }
- }
-
- ...
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::socket socket(io_service);
- acceptor.async_accept(socket, accept_handler);
-
 
 
+[endsect]
 
 
+[endsect]
 
 
-[endsect]
+[section:service basic_serial_port::service]
 
 
+['Inherited from basic_io_object.]
 
-[section:overload2 basic_socket_acceptor::async_accept (2 of 2 overloads)]
+[indexterm2 service..basic_serial_port]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
-Start an asynchronous accept.
+ service_type & service;
 
 
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``,
- typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
- void async_accept(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint,
- AcceptHandler handler);
 
+[heading Remarks]
+
+Available only for services that do not support movability.
 
-This function is used to asynchronously accept a new connection into a socket, and additionally obtain the endpoint of the remote peer. The function call always returns immediately.
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[peer][The socket into which the new connection will be accepted. Ownership of the peer object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
+[endsect]
 
-[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written. Ownership of the peer\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
 
-[[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error // Result of operation.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`. ]]
 
-]
+[section:service_type basic_serial_port::service_type]
 
 
+['Inherited from basic_io_object.]
 
+[indexterm2 service_type..basic_serial_port]
+The type of the service that will be used to provide I/O operations.
 
-[endsect]
 
+ typedef SerialPortService service_type;
 
-[endsect]
 
-[section:basic_socket_acceptor basic_socket_acceptor::basic_socket_acceptor]
 
-[indexterm2 basic_socket_acceptor..basic_socket_acceptor]
-Construct an acceptor without opening it.
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_serial_port.hpp]
 
- explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 basic_socket_acceptor]``(
- boost::asio::io_service & io_service);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 more...]]``
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Construct an open acceptor.
+[endsect]
 
 
- ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 basic_socket_acceptor]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 more...]]``
+[section:set_option basic_serial_port::set_option]
 
+[indexterm2 set_option..basic_serial_port]
+Set an option on the serial port.
 
-Construct an acceptor opened on the given endpoint.
 
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ void ``[link boost_asio.reference.basic_serial_port.set_option.overload1 set_option]``(
+ const SettableSerialPortOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload1 more...]]``
 
- ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 basic_socket_acceptor]``(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint,
- bool reuse_addr = true);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 more...]]``
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.set_option.overload2 set_option]``(
+ const SettableSerialPortOption & option,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.set_option.overload2 more...]]``
 
 
-Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor.
+[section:overload1 basic_serial_port::set_option (1 of 2 overloads)]
 
 
- ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 basic_socket_acceptor]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_acceptor);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 more...]]``
+Set an option on the serial port.
 
 
-[section:overload1 basic_socket_acceptor::basic_socket_acceptor (1 of 4 overloads)]
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ void set_option(
+ const SettableSerialPortOption & option);
 
 
-Construct an acceptor without opening it.
+This function is used to set an option on the serial port.
 
 
- basic_socket_acceptor(
- boost::asio::io_service & io_service);
+[heading Parameters]
+
 
+[variablelist
+
+[[option][The option value to be set on the serial port.]]
 
-This constructor creates an acceptor without opening it to listen for new connections. The `open()` function must be called before the acceptor can accept new socket connections.
+]
 
 
-[heading Parameters]
+[heading Exceptions]
     
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
 
 
+
 [endsect]
 
 
 
-[section:overload2 basic_socket_acceptor::basic_socket_acceptor (2 of 4 overloads)]
+[section:overload2 basic_serial_port::set_option (2 of 2 overloads)]
 
 
-Construct an open acceptor.
+Set an option on the serial port.
 
 
- basic_socket_acceptor(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ boost::system::error_code set_option(
+ const SettableSerialPortOption & option,
+ boost::system::error_code & ec);
 
 
-This constructor creates an acceptor and automatically opens it.
+This function is used to set an option on the serial port.
 
 
 [heading Parameters]
@@ -19690,42 +22811,54 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
+[[option][The option value to be set on the serial port.]]
 
-[[protocol][An object specifying protocol parameters to be used.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Exceptions]
-
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
 
 
+[endsect]
 
 
 [endsect]
 
+[section:write_some basic_serial_port::write_some]
+
+[indexterm2 write_some..basic_serial_port]
+Write some data to the serial port.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_serial_port.write_some.overload2 write_some]``(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_serial_port.write_some.overload2 more...]]``
 
 
-[section:overload3 basic_socket_acceptor::basic_socket_acceptor (3 of 4 overloads)]
+[section:overload1 basic_serial_port::write_some (1 of 2 overloads)]
 
 
-Construct an acceptor opened on the given endpoint.
+Write some data to the serial port.
 
 
- basic_socket_acceptor(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint,
- bool reuse_addr = true);
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers);
 
 
-This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
+This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -19733,13 +22866,14 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
+[[buffers][One or more data buffers to be written to the serial port.]]
 
-[[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]]
+]
 
-[[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]]
 
-]
+[heading Return Value]
+
+The number of bytes written.
 
 
 [heading Exceptions]
@@ -19747,24 +22881,24 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
 
 ]
 
 
 [heading Remarks]
       
-This constructor is equivalent to the following code:
+The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
- basic_socket_acceptor<Protocol> acceptor(io_service);
- acceptor.open(endpoint.protocol());
- if (reuse_addr)
- acceptor.set_option(socket_base::reuse_address(true));
- acceptor.bind(endpoint);
- acceptor.listen(listen_backlog);
 
+[heading Example]
+
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ serial_port.write_some(boost::asio::buffer(data, size));
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -19773,19 +22907,20 @@
 
 
 
-[section:overload4 basic_socket_acceptor::basic_socket_acceptor (4 of 4 overloads)]
+[section:overload2 basic_serial_port::write_some (2 of 2 overloads)]
 
 
-Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor.
+Write some data to the serial port.
 
 
- basic_socket_acceptor(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_acceptor);
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
 
 
-This constructor creates an acceptor object to hold an existing native acceptor.
+This function is used to write data to the serial port. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -19793,23 +22928,21 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
-
-[[protocol][An object specifying protocol parameters to be used.]]
+[[buffers][One or more data buffers to be written to the serial port.]]
 
-[[native_acceptor][A native acceptor.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Exceptions]
-
+[heading Return Value]
+
+The number of bytes written. Returns 0 if an error occurred.
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+[heading Remarks]
+
+The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
 
 
@@ -19819,273 +22952,374 @@
 
 [endsect]
 
-[section:bind basic_socket_acceptor::bind]
 
-[indexterm2 bind..basic_socket_acceptor]
-Bind the acceptor to the given local endpoint.
+[endsect]
 
+[section:basic_signal_set basic_signal_set]
 
- void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload1 bind]``(
- const endpoint_type & endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.bind.overload2 bind]``(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload2 more...]]``
+Provides signal functionality.
 
 
-[section:overload1 basic_socket_acceptor::bind (1 of 2 overloads)]
+ template<
+ typename ``[link boost_asio.reference.SignalSetService SignalSetService]`` = signal_set_service>
+ class basic_signal_set :
+ public basic_io_object< SignalSetService >
 
 
-Bind the acceptor to the given local endpoint.
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
- void bind(
- const endpoint_type & endpoint);
+ [[link boost_asio.reference.basic_signal_set.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
+ [
 
-This function binds the socket acceptor to the specified endpoint on the local machine.
+ [[link boost_asio.reference.basic_signal_set.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+]
 
-[heading Parameters]
-
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[variablelist
+ [
+ [[link boost_asio.reference.basic_signal_set.add [*add]]]
+ [Add a signal to a signal_set. ]
+ ]
   
-[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
-
-]
+ [
+ [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
+ [Start an asynchronous operation to wait for a signal to be delivered. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
+ [Construct a signal set without adding any signals.
 
+ Construct a signal set and add one signal.
 
-[heading Exceptions]
-
+ Construct a signal set and add two signals.
 
-[variablelist
+ Construct a signal set and add three signals. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
+ [Cancel all operations associated with the signal set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
+ [Remove all signals from a signal_set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
+ [Remove a signal from a signal_set. ]
+ ]
   
-[[boost::system::system_error][Thrown on failure.]]
-
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[heading Example]
+ [
+ [[link boost_asio.reference.basic_signal_set.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_signal_set.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
 
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- acceptor.open(boost::asio::ip::tcp::v4());
- acceptor.bind(boost::asio::ip::tcp::endpoint(12345));
-
+ [
+ [[link boost_asio.reference.basic_signal_set.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_signal_set.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
+]
 
+The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class template provides the ability to perform an asynchronous wait for one or more signals to occur.
 
+Most applications will use the [link boost_asio.reference.signal_set `signal_set`] typedef.
 
 
-[endsect]
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
 
-[section:overload2 basic_socket_acceptor::bind (2 of 2 overloads)]
+[heading Example]
+
+Performing an asynchronous wait:
 
+ void handler(
+ const boost::system::error_code& error,
+ int signal_number)
+ {
+ if (!error)
+ {
+ // A signal occurred.
+ }
+ }
 
-Bind the acceptor to the given local endpoint.
+ ...
 
+ // Construct a signal set registered for process termination.
+ boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
 
- boost::system::error_code bind(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+ // Start an asynchronous wait for one of the signals to occur.
+ signals.async_wait(handler);
 
 
-This function binds the socket acceptor to the specified endpoint on the local machine.
 
 
-[heading Parameters]
-
 
-[variablelist
+[heading Queueing of signal notifications]
   
-[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
 
+If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
 
-[heading Example]
+
+[heading Multiple registration of signals]
   
 
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- acceptor.open(boost::asio::ip::tcp::v4());
- boost::system::error_code ec;
- acceptor.bind(boost::asio::ip::tcp::endpoint(12345), ec);
- if (ec)
- {
- // An error occurred.
- }
+The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
 
+Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
 
 
+[heading Signal masking on POSIX platforms]
+
 
 
+POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread.
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/basic_signal_set.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[endsect]
+[section:add basic_signal_set::add]
 
+[indexterm2 add..basic_signal_set]
+Add a signal to a signal\_set.
 
-[section:broadcast basic_socket_acceptor::broadcast]
 
+ void ``[link boost_asio.reference.basic_signal_set.add.overload1 add]``(
+ int signal_number);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.add.overload1 more...]]``
 
-['Inherited from socket_base.]
+ boost::system::error_code ``[link boost_asio.reference.basic_signal_set.add.overload2 add]``(
+ int signal_number,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.add.overload2 more...]]``
 
-[indexterm2 broadcast..basic_socket_acceptor]
-Socket option to permit sending of broadcast messages.
 
+[section:overload1 basic_signal_set::add (1 of 2 overloads)]
 
- typedef implementation_defined broadcast;
 
+Add a signal to a signal\_set.
 
 
-Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
+ void add(
+ int signal_number);
 
 
-[heading Examples]
-
-Setting the option:
+This function adds the specified signal to the set. It has no effect if the signal is already in the set.
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::broadcast option(true);
- socket.set_option(option);
 
+[heading Parameters]
+
+
+[variablelist
+
+[[signal_number][The signal to be added to the set.]]
 
+]
 
 
+[heading Exceptions]
+
 
-Getting the current option value:
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::broadcast option;
- socket.get_option(option);
- bool is_set = option.value();
+]
 
 
 
 
+[endsect]
 
 
 
-[heading Requirements]
+[section:overload2 basic_signal_set::add (2 of 2 overloads)]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Add a signal to a signal\_set.
 
 
-[endsect]
+ boost::system::error_code add(
+ int signal_number,
+ boost::system::error_code & ec);
 
 
+This function adds the specified signal to the set. It has no effect if the signal is already in the set.
 
-[section:bytes_readable basic_socket_acceptor::bytes_readable]
 
+[heading Parameters]
+
 
-['Inherited from socket_base.]
+[variablelist
+
+[[signal_number][The signal to be added to the set.]]
 
-[indexterm2 bytes_readable..basic_socket_acceptor]
-IO control command to get the amount of data that can be read without blocking.
+[[ec][Set to indicate what error occurred, if any. ]]
 
+]
 
- typedef implementation_defined bytes_readable;
 
 
 
-Implements the FIONREAD IO control command.
+[endsect]
 
 
-[heading Example]
-
+[endsect]
 
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::bytes_readable command(true);
- socket.io_control(command);
- std::size_t bytes_readable = command.get();
+[section:async_wait basic_signal_set::async_wait]
 
+[indexterm2 async_wait..basic_signal_set]
+Start an asynchronous operation to wait for a signal to be delivered.
 
 
+ template<
+ typename ``[link boost_asio.reference.SignalHandler SignalHandler]``>
+ void async_wait(
+ SignalHandler handler);
 
 
+This function may be used to initiate an asynchronous wait against the signal set. It always returns immediately.
 
+For each call to `async_wait()`, the supplied handler will be called exactly once. The handler will be called when:
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+* One of the registered signals in the signal set occurs; or
 
-[*Convenience header: ][^boost/asio.hpp]
 
+* The signal set was cancelled, in which case the handler is passed the error code `boost::asio::error::operation_aborted`.
 
-[endsect]
 
+[heading Parameters]
+
 
-[section:cancel basic_socket_acceptor::cancel]
+[variablelist
+
+[[handler][The handler to be called when the signal occurs. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ int signal_number // Indicates which signal occurred.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`. ]]
 
-[indexterm2 cancel..basic_socket_acceptor]
-Cancel all asynchronous operations associated with the acceptor.
+]
 
 
- void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload1 cancel]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload2 cancel]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload2 more...]]``
 
+[endsect]
 
-[section:overload1 basic_socket_acceptor::cancel (1 of 2 overloads)]
 
+[section:basic_signal_set basic_signal_set::basic_signal_set]
 
-Cancel all asynchronous operations associated with the acceptor.
+[indexterm2 basic_signal_set..basic_signal_set]
+Construct a signal set without adding any signals.
 
 
- void cancel();
+ explicit ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 basic_signal_set]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload1 more...]]``
 
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+Construct a signal set and add one signal.
 
 
-[heading Exceptions]
-
+ ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 basic_signal_set]``(
+ boost::asio::io_service & io_service,
+ int signal_number_1);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload2 more...]]``
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+Construct a signal set and add two signals.
 
 
+ ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 basic_signal_set]``(
+ boost::asio::io_service & io_service,
+ int signal_number_1,
+ int signal_number_2);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload3 more...]]``
 
 
-[endsect]
+Construct a signal set and add three signals.
 
 
+ ``[link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 basic_signal_set]``(
+ boost::asio::io_service & io_service,
+ int signal_number_1,
+ int signal_number_2,
+ int signal_number_3);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.basic_signal_set.overload4 more...]]``
 
-[section:overload2 basic_socket_acceptor::cancel (2 of 2 overloads)]
 
+[section:overload1 basic_signal_set::basic_signal_set (1 of 4 overloads)]
 
-Cancel all asynchronous operations associated with the acceptor.
 
+Construct a signal set without adding any signals.
 
- boost::system::error_code cancel(
- boost::system::error_code & ec);
+
+ basic_signal_set(
+ boost::asio::io_service & io_service);
 
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+This constructor creates a signal set without registering for any signals.
 
 
 [heading Parameters]
@@ -20093,7 +23327,7 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any. ]]
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the signal set will use to dispatch handlers for any asynchronous operations performed on the set. ]]
 
 ]
 
@@ -20103,44 +23337,42 @@
 [endsect]
 
 
-[endsect]
 
-[section:close basic_socket_acceptor::close]
+[section:overload2 basic_signal_set::basic_signal_set (2 of 4 overloads)]
 
-[indexterm2 close..basic_socket_acceptor]
-Close the acceptor.
 
+Construct a signal set and add one signal.
 
- void ``[link boost_asio.reference.basic_socket_acceptor.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.close.overload2 close]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload2 more...]]``
+ basic_signal_set(
+ boost::asio::io_service & io_service,
+ int signal_number_1);
 
 
-[section:overload1 basic_socket_acceptor::close (1 of 2 overloads)]
+This constructor creates a signal set and registers for one signal.
 
 
-Close the acceptor.
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the signal set will use to dispatch handlers for any asynchronous operations performed on the set.]]
 
- void close();
+[[signal_number_1][The signal number to be added.]]
 
+]
 
-This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
 
-A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
+[heading Remarks]
+
+This constructor is equivalent to performing:
 
+ boost::asio::signal_set signals(io_service);
+ signals.add(signal_number_1);
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
 
 
 
@@ -20149,19 +23381,19 @@
 
 
 
-[section:overload2 basic_socket_acceptor::close (2 of 2 overloads)]
-
+[section:overload3 basic_signal_set::basic_signal_set (3 of 4 overloads)]
 
-Close the acceptor.
 
+Construct a signal set and add two signals.
 
- boost::system::error_code close(
- boost::system::error_code & ec);
 
+ basic_signal_set(
+ boost::asio::io_service & io_service,
+ int signal_number_1,
+ int signal_number_2);
 
-This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
 
-A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
+This constructor creates a signal set and registers for two signals.
 
 
 [heading Parameters]
@@ -20169,287 +23401,207 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any.]]
-
-]
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the signal set will use to dispatch handlers for any asynchronous operations performed on the set.]]
 
+[[signal_number_1][The first signal number to be added.]]
 
-[heading Example]
-
+[[signal_number_2][The second signal number to be added.]]
 
+]
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::system::error_code ec;
- acceptor.close(ec);
- if (ec)
- {
- // An error occurred.
- }
 
+[heading Remarks]
+
+This constructor is equivalent to performing:
 
+ boost::asio::signal_set signals(io_service);
+ signals.add(signal_number_1);
+ signals.add(signal_number_2);
 
 
 
 
 
-[endsect]
 
 
 [endsect]
 
 
-[section:debug basic_socket_acceptor::debug]
 
+[section:overload4 basic_signal_set::basic_signal_set (4 of 4 overloads)]
 
-['Inherited from socket_base.]
 
-[indexterm2 debug..basic_socket_acceptor]
-Socket option to enable socket-level debugging.
+Construct a signal set and add three signals.
 
 
- typedef implementation_defined debug;
+ basic_signal_set(
+ boost::asio::io_service & io_service,
+ int signal_number_1,
+ int signal_number_2,
+ int signal_number_3);
 
 
+This constructor creates a signal set and registers for three signals.
 
-Implements the SOL\_SOCKET/SO\_DEBUG socket option.
 
+[heading Parameters]
+
 
-[heading Examples]
+[variablelist
   
-Setting the option:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option(true);
- socket.set_option(option);
-
-
-
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the signal set will use to dispatch handlers for any asynchronous operations performed on the set.]]
 
+[[signal_number_1][The first signal number to be added.]]
 
-Getting the current option value:
+[[signal_number_2][The second signal number to be added.]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option;
- socket.get_option(option);
- bool is_set = option.value();
+[[signal_number_3][The third signal number to be added.]]
 
+]
 
 
+[heading Remarks]
+
+This constructor is equivalent to performing:
 
+ boost::asio::signal_set signals(io_service);
+ signals.add(signal_number_1);
+ signals.add(signal_number_2);
+ signals.add(signal_number_3);
 
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:do_not_route basic_socket_acceptor::do_not_route]
-
-
-['Inherited from socket_base.]
+[section:cancel basic_signal_set::cancel]
 
-[indexterm2 do_not_route..basic_socket_acceptor]
-Socket option to prevent routing, use local interfaces only.
+[indexterm2 cancel..basic_signal_set]
+Cancel all operations associated with the signal set.
 
 
- typedef implementation_defined do_not_route;
+ void ``[link boost_asio.reference.basic_signal_set.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.cancel.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_signal_set.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.cancel.overload2 more...]]``
 
 
-Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
+[section:overload1 basic_signal_set::cancel (1 of 2 overloads)]
 
 
-[heading Examples]
-
-Setting the option:
+Cancel all operations associated with the signal set.
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option(true);
- socket.set_option(option);
 
+ void cancel();
 
 
+This function forces the completion of any pending asynchronous wait operations against the signal set. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
 
+Cancellation does not alter the set of registered signals.
 
-Getting the current option value:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option;
- socket.get_option(option);
- bool is_set = option.value();
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
+]
 
 
+[heading Remarks]
+
+If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will:
 
 
+* have already been invoked; or
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+* have been queued for invocation in the near future.
 
-[*Convenience header: ][^boost/asio.hpp]
+These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
 
 
 [endsect]
 
 
 
-[section:enable_connection_aborted basic_socket_acceptor::enable_connection_aborted]
+[section:overload2 basic_signal_set::cancel (2 of 2 overloads)]
 
 
-['Inherited from socket_base.]
+Cancel all operations associated with the signal set.
 
-[indexterm2 enable_connection_aborted..basic_socket_acceptor]
-Socket option to report aborted connections on accept.
 
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
 
- typedef implementation_defined enable_connection_aborted;
 
+This function forces the completion of any pending asynchronous wait operations against the signal set. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
 
+Cancellation does not alter the set of registered signals.
 
-Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
 
+[heading Parameters]
+
 
-[heading Examples]
+[variablelist
   
-Setting the option:
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option(true);
- acceptor.set_option(option);
-
-
-
-
-
-Getting the current option value:
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option;
- acceptor.get_option(option);
- bool is_set = option.value();
-
-
-
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:endpoint_type basic_socket_acceptor::endpoint_type]
+[[ec][Set to indicate what error occurred, if any.]]
 
-[indexterm2 endpoint_type..basic_socket_acceptor]
-The endpoint type.
+]
 
 
- typedef Protocol::endpoint endpoint_type;
+[heading Remarks]
+
+If a registered signal occurred before `cancel()` is called, then the handlers for asynchronous wait operations will:
 
 
+* have already been invoked; or
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+* have been queued for invocation in the near future.
 
-[*Convenience header: ][^boost/asio.hpp]
+These handlers can no longer be cancelled, and therefore are passed an error code that indicates the successful completion of the wait operation.
 
 
 [endsect]
 
 
-
-[section:get_io_service basic_socket_acceptor::get_io_service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 get_io_service..basic_socket_acceptor]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
-
- boost::asio::io_service & get_io_service();
-
-
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
-
-
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
-
-
-
-
 [endsect]
 
+[section:clear basic_signal_set::clear]
 
-[section:get_option basic_socket_acceptor::get_option]
-
-[indexterm2 get_option..basic_socket_acceptor]
-Get an option from the acceptor.
+[indexterm2 clear..basic_signal_set]
+Remove all signals from a signal\_set.
 
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload1 get_option]``(
- GettableSocketOption & option);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_signal_set.clear.overload1 clear]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.clear.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload2 get_option]``(
- GettableSocketOption & option,
+ boost::system::error_code ``[link boost_asio.reference.basic_signal_set.clear.overload2 clear]``(
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload2 more...]]``
-
-
-[section:overload1 basic_socket_acceptor::get_option (1 of 2 overloads)]
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.clear.overload2 more...]]``
 
 
-Get an option from the acceptor.
-
-
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- void get_option(
- GettableSocketOption & option);
+[section:overload1 basic_signal_set::clear (1 of 2 overloads)]
 
 
-This function is used to get the current value of an option on the acceptor.
+Remove all signals from a signal\_set.
 
 
-[heading Parameters]
-
+ void clear();
 
-[variablelist
-
-[[option][The option value to be obtained from the acceptor.]]
 
-]
+This function removes all signals from the set. It has no effect if the set is already empty.
 
 
 [heading Exceptions]
@@ -20462,19 +23614,9 @@
 ]
 
 
-
-[heading Example]
-
-Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option:
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::acceptor::reuse_address option;
- acceptor.get_option(option);
- bool is_set = option.get();
-
-
-
+[heading Remarks]
+
+Removes all queued notifications.
 
 
 
@@ -20483,20 +23625,17 @@
 
 
 
-[section:overload2 basic_socket_acceptor::get_option (2 of 2 overloads)]
+[section:overload2 basic_signal_set::clear (2 of 2 overloads)]
 
 
-Get an option from the acceptor.
+Remove all signals from a signal\_set.
 
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code get_option(
- GettableSocketOption & option,
+ boost::system::error_code clear(
       boost::system::error_code & ec);
 
 
-This function is used to get the current value of an option on the acceptor.
+This function removes all signals from the set. It has no effect if the set is already empty.
 
 
 [heading Parameters]
@@ -20504,51 +23643,46 @@
 
 [variablelist
   
-[[option][The option value to be obtained from the acceptor.]]
-
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Removes all queued notifications.
 
-[heading Example]
-
-Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::acceptor::reuse_address option;
- boost::system::error_code ec;
- acceptor.get_option(option, ec);
- if (ec)
- {
- // An error occurred.
- }
- bool is_set = option.get();
 
 
+[endsect]
 
 
+[endsect]
 
+[section:get_implementation basic_signal_set::get_implementation]
 
+[indexterm2 get_implementation..basic_signal_set]
+Get the underlying implementation of the I/O object.
 
-[endsect]
 
+ implementation_type & ``[link boost_asio.reference.basic_signal_set.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.get_implementation.overload1 more...]]``
 
-[endsect]
+ const implementation_type & ``[link boost_asio.reference.basic_signal_set.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.get_implementation.overload2 more...]]``
 
 
-[section:implementation basic_socket_acceptor::implementation]
+[section:overload1 basic_signal_set::get_implementation (1 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation..basic_socket_acceptor]
-The underlying implementation of the I/O object.
 
+Get the underlying implementation of the I/O object.
 
- implementation_type implementation;
+
+ implementation_type & get_implementation();
 
 
 
@@ -20556,40 +23690,35 @@
 
 
 
-[section:implementation_type basic_socket_acceptor::implementation_type]
+[section:overload2 basic_signal_set::get_implementation (2 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..basic_socket_acceptor]
-The underlying implementation type of I/O object.
-
 
- typedef service_type::implementation_type implementation_type;
+Get the underlying implementation of the I/O object.
 
 
+ const implementation_type & get_implementation() const;
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
 
-
-[section:io_service basic_socket_acceptor::io_service]
+[section:get_io_service basic_signal_set::get_io_service]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 io_service..basic_socket_acceptor]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+[indexterm2 get_io_service..basic_signal_set]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
- boost::asio::io_service & io_service();
+ boost::asio::io_service & get_io_service();
 
 
 This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
@@ -20605,122 +23734,88 @@
 [endsect]
 
 
+[section:get_service basic_signal_set::get_service]
 
-[section:is_open basic_socket_acceptor::is_open]
-
-[indexterm2 is_open..basic_socket_acceptor]
-Determine whether the acceptor is open.
-
-
- bool is_open() const;
-
-
-
-[endsect]
-
-
-
-[section:keep_alive basic_socket_acceptor::keep_alive]
-
-
-['Inherited from socket_base.]
+[indexterm2 get_service..basic_signal_set]
+Get the service associated with the I/O object.
 
-[indexterm2 keep_alive..basic_socket_acceptor]
-Socket option to send keep-alives.
 
+ service_type & ``[link boost_asio.reference.basic_signal_set.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.get_service.overload1 more...]]``
 
- typedef implementation_defined keep_alive;
+ const service_type & ``[link boost_asio.reference.basic_signal_set.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.get_service.overload2 more...]]``
 
 
+[section:overload1 basic_signal_set::get_service (1 of 2 overloads)]
 
-Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
 
+['Inherited from basic_io_object.]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::keep_alive option(true);
- socket.set_option(option);
+Get the service associated with the I/O object.
 
 
+ service_type & get_service();
 
 
 
-Getting the current option value:
+[endsect]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::keep_alive option;
- socket.get_option(option);
- bool is_set = option.value();
 
 
+[section:overload2 basic_signal_set::get_service (2 of 2 overloads)]
 
 
+['Inherited from basic_io_object.]
 
 
+Get the service associated with the I/O object.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+ const service_type & get_service() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-
-[section:linger basic_socket_acceptor::linger]
-
-
-['Inherited from socket_base.]
-
-[indexterm2 linger..basic_socket_acceptor]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+[endsect]
 
 
- typedef implementation_defined linger;
+[section:implementation basic_signal_set::implementation]
 
 
+['Inherited from basic_io_object.]
 
-Implements the SOL\_SOCKET/SO\_LINGER socket option.
+[indexterm2 implementation..basic_signal_set]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
 
-[heading Examples]
-
-Setting the option:
+ implementation_type implementation;
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::linger option(true, 30);
- socket.set_option(option);
 
 
+[endsect]
 
 
 
-Getting the current option value:
+[section:implementation_type basic_signal_set::implementation_type]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::linger option;
- socket.get_option(option);
- bool is_set = option.enabled();
- unsigned short timeout = option.timeout();
 
+['Inherited from basic_io_object.]
 
+[indexterm2 implementation_type..basic_signal_set]
+The underlying implementation type of I/O object.
 
 
+ typedef service_type::implementation_type implementation_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+[*Header: ][^boost/asio/basic_signal_set.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -20728,33 +23823,33 @@
 [endsect]
 
 
-[section:listen basic_socket_acceptor::listen]
+[section:remove basic_signal_set::remove]
 
-[indexterm2 listen..basic_socket_acceptor]
-Place the acceptor into the state where it will listen for new connections.
+[indexterm2 remove..basic_signal_set]
+Remove a signal from a signal\_set.
 
 
- void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload1 listen]``(
- int backlog = socket_base::max_connections);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_signal_set.remove.overload1 remove]``(
+ int signal_number);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.remove.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.listen.overload2 listen]``(
- int backlog,
+ boost::system::error_code ``[link boost_asio.reference.basic_signal_set.remove.overload2 remove]``(
+ int signal_number,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_signal_set.remove.overload2 more...]]``
 
 
-[section:overload1 basic_socket_acceptor::listen (1 of 2 overloads)]
+[section:overload1 basic_signal_set::remove (1 of 2 overloads)]
 
 
-Place the acceptor into the state where it will listen for new connections.
+Remove a signal from a signal\_set.
 
 
- void listen(
- int backlog = socket_base::max_connections);
+ void remove(
+ int signal_number);
 
 
-This function puts the socket acceptor into the state where it may accept new connections.
+This function removes the specified signal from the set. It has no effect if the signal is not in the set.
 
 
 [heading Parameters]
@@ -20762,7 +23857,7 @@
 
 [variablelist
   
-[[backlog][The maximum length of the queue of pending connections.]]
+[[signal_number][The signal to be removed from the set.]]
 
 ]
 
@@ -20772,29 +23867,34 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Removes any notifications that have been queued for the specified signal number.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 basic_socket_acceptor::listen (2 of 2 overloads)]
+[section:overload2 basic_signal_set::remove (2 of 2 overloads)]
 
 
-Place the acceptor into the state where it will listen for new connections.
+Remove a signal from a signal\_set.
 
 
- boost::system::error_code listen(
- int backlog,
+ boost::system::error_code remove(
+ int signal_number,
       boost::system::error_code & ec);
 
 
-This function puts the socket acceptor into the state where it may accept new connections.
+This function removes the specified signal from the set. It has no effect if the signal is not in the set.
 
 
 [heading Parameters]
@@ -20802,28 +23902,16 @@
 
 [variablelist
   
-[[backlog][The maximum length of the queue of pending connections.]]
+[[signal_number][The signal to be removed from the set.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Example]
-
-
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::system::error_code ec;
- acceptor.listen(boost::asio::socket_base::max_connections, ec);
- if (ec)
- {
- // An error occurred.
- }
-
-
-
+[heading Remarks]
+
+Removes any notifications that have been queued for the specified signal number.
 
 
 
@@ -20833,325 +23921,602 @@
 
 [endsect]
 
-[section:local_endpoint basic_socket_acceptor::local_endpoint]
-
-[indexterm2 local_endpoint..basic_socket_acceptor]
-Get the local endpoint of the acceptor.
 
+[section:service basic_signal_set::service]
 
- endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 local_endpoint]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 more...]]``
 
- endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 local_endpoint]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 more...]]``
+['Inherited from basic_io_object.]
 
+[indexterm2 service..basic_signal_set]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
-[section:overload1 basic_socket_acceptor::local_endpoint (1 of 2 overloads)]
 
+ service_type & service;
 
-Get the local endpoint of the acceptor.
 
 
- endpoint_type local_endpoint() const;
+[heading Remarks]
+
+Available only for services that do not support movability.
 
 
-This function is used to obtain the locally bound endpoint of the acceptor.
 
 
-[heading Return Value]
-
-An object that represents the local endpoint of the acceptor.
+[endsect]
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+[section:service_type basic_signal_set::service_type]
 
-]
 
+['Inherited from basic_io_object.]
 
-[heading Example]
-
+[indexterm2 service_type..basic_signal_set]
+The type of the service that will be used to provide I/O operations.
 
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
+ typedef SignalSetService service_type;
 
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_signal_set.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 basic_socket_acceptor::local_endpoint (2 of 2 overloads)]
+[endsect]
 
+[section:basic_socket basic_socket]
 
-Get the local endpoint of the acceptor.
 
+Provides socket functionality.
 
- endpoint_type local_endpoint(
- boost::system::error_code & ec) const;
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ class basic_socket :
+ public basic_io_object< SocketService >,
+ public socket_base
 
-This function is used to obtain the locally bound endpoint of the acceptor.
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-[heading Parameters]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
   
-[[ec][Set to indicate what error occurred, if any.]]
-
-]
+ ]
 
+ [
 
-[heading Return Value]
-
-An object that represents the local endpoint of the acceptor. Returns a default-constructed endpoint object if an error occurred and the error handler did not throw an exception.
+ [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
+ [
 
-[heading Example]
+ [[link boost_asio.reference.basic_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
   
+ ]
 
+ [
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
- if (ec)
- {
- // An error occurred.
- }
-
+ [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
 
+ [
 
-[section:max_connections basic_socket_acceptor::max_connections]
+ [[link boost_asio.reference.basic_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
 
+ [
 
-['Inherited from socket_base.]
+ [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
 
-[indexterm2 max_connections..basic_socket_acceptor]
-The maximum length of the queue of pending incoming connections.
+ [
+
+ [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
 
+ [
 
- static const int max_connections = implementation_defined;
+ [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
 
+ [
 
-[section:message_do_not_route basic_socket_acceptor::message_do_not_route]
+ [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
+ [
 
-['Inherited from socket_base.]
+ [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
-[indexterm2 message_do_not_route..basic_socket_acceptor]
-Specify that the data should not be subject to routing.
+ [
 
+ [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
- static const int message_do_not_route = implementation_defined;
+ [
 
+ [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
 
-[section:message_flags basic_socket_acceptor::message_flags]
+ [
 
+ [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
-['Inherited from socket_base.]
+ [
 
-[indexterm2 message_flags..basic_socket_acceptor]
-Bitmask type for flags that can be passed to send and receive operations.
+ [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
 
+]
 
- typedef int message_flags;
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
+ [Construct a basic_socket without opening it.
 
+ Construct and open a basic_socket.
 
-[heading Requirements]
+ Construct a basic_socket, opening it and binding it to the given local endpoint.
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+ Construct a basic_socket on an existing native socket.
 
-[*Convenience header: ][^boost/asio.hpp]
+ Move-construct a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
 
-[endsect]
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[section:message_out_of_band basic_socket_acceptor::message_out_of_band]
+ [
+ [[link boost_asio.reference.basic_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
-['Inherited from socket_base.]
+ [
+ [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
 
-[indexterm2 message_out_of_band..basic_socket_acceptor]
-Process out-of-band data.
+ [
+ [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
 
- static const int message_out_of_band = implementation_defined;
+ [
+ [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
 
+]
 
-[endsect]
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
-[section:message_peek basic_socket_acceptor::message_peek]
+]
 
+The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
 
-['Inherited from socket_base.]
 
-[indexterm2 message_peek..basic_socket_acceptor]
-Peek at incoming data without removing it from the input queue.
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
- static const int message_peek = implementation_defined;
 
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
+[section:assign basic_socket::assign]
 
-[section:native basic_socket_acceptor::native]
+[indexterm2 assign..basic_socket]
+Assign an existing native socket to the socket.
 
-[indexterm2 native..basic_socket_acceptor]
-Get the native acceptor representation.
 
+ void ``[link boost_asio.reference.basic_socket.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload1 more...]]``
 
- native_type native();
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.assign.overload2 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.assign.overload2 more...]]``
 
 
-This function may be used to obtain the underlying representation of the acceptor. This is intended to allow access to native acceptor functionality that is not otherwise provided.
+[section:overload1 basic_socket::assign (1 of 2 overloads)]
 
 
-[endsect]
+Assign an existing native socket to the socket.
 
 
+ void assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
 
-[section:native_type basic_socket_acceptor::native_type]
 
-[indexterm2 native_type..basic_socket_acceptor]
-The native representation of an acceptor.
 
+[endsect]
 
- typedef SocketAcceptorService::native_type native_type;
 
 
+[section:overload2 basic_socket::assign (2 of 2 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+Assign an existing native socket to the socket.
+
+
+ boost::system::error_code assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:non_blocking_io basic_socket_acceptor::non_blocking_io]
 
+[section:async_connect basic_socket::async_connect]
 
-['Inherited from socket_base.]
+[indexterm2 async_connect..basic_socket]
+Start an asynchronous connect.
 
-[indexterm2 non_blocking_io..basic_socket_acceptor]
-IO control command to set the blocking mode of the socket.
 
+ template<
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
 
- typedef implementation_defined non_blocking_io;
 
+This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
 
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
 
-Implements the FIONBIO IO control command.
 
+[heading Parameters]
+
 
-[heading Example]
+[variablelist
   
+[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
 
+[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error // Result of operation
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
+]
 
 
+[heading Example]
+
 
 
+ void connect_handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Connect succeeded.
+ }
+ }
 
+ ...
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.async_connect(endpoint, connect_handler);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
 
 
-[section:open basic_socket_acceptor::open]
+[endsect]
 
-[indexterm2 open..basic_socket_acceptor]
-Open the acceptor using the specified protocol.
 
+[section:at_mark basic_socket::at_mark]
 
- void ``[link boost_asio.reference.basic_socket_acceptor.open.overload1 open]``(
- const protocol_type & protocol = protocol_type());
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload1 more...]]``
+[indexterm2 at_mark..basic_socket]
+Determine whether the socket is at the out-of-band data mark.
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.open.overload2 open]``(
- const protocol_type & protocol,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload2 more...]]``
 
+ bool ``[link boost_asio.reference.basic_socket.at_mark.overload1 at_mark]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload1 more...]]``
 
-[section:overload1 basic_socket_acceptor::open (1 of 2 overloads)]
+ bool ``[link boost_asio.reference.basic_socket.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.at_mark.overload2 more...]]``
 
 
-Open the acceptor using the specified protocol.
+[section:overload1 basic_socket::at_mark (1 of 2 overloads)]
 
 
- void open(
- const protocol_type & protocol = protocol_type());
+Determine whether the socket is at the out-of-band data mark.
 
 
-This function opens the socket acceptor so that it will use the specified protocol.
+ bool at_mark() const;
 
 
-[heading Parameters]
-
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
 
-[variablelist
-
-[[protocol][An object specifying which protocol is to be used.]]
 
-]
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
 
 
 [heading Exceptions]
@@ -21159,40 +24524,28 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. ]]
 
 ]
 
 
-[heading Example]
-
-
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- acceptor.open(boost::asio::ip::tcp::v4());
-
-
-
-
-
 
 
 [endsect]
 
 
 
-[section:overload2 basic_socket_acceptor::open (2 of 2 overloads)]
+[section:overload2 basic_socket::at_mark (2 of 2 overloads)]
 
 
-Open the acceptor using the specified protocol.
+Determine whether the socket is at the out-of-band data mark.
 
 
- boost::system::error_code open(
- const protocol_type & protocol,
- boost::system::error_code & ec);
+ bool at_mark(
+ boost::system::error_code & ec) const;
 
 
-This function opens the socket acceptor so that it will use the specified protocol.
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
 
 
 [heading Parameters]
@@ -21200,27 +24553,14 @@
 
 [variablelist
   
-[[protocol][An object specifying which protocol is to be used.]]
-
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Example]
-
-
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- boost::system::error_code ec;
- acceptor.open(boost::asio::ip::tcp::v4(), ec);
- if (ec)
- {
- // An error occurred.
- }
-
-
-
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
 
 
 
@@ -21230,371 +24570,355 @@
 
 [endsect]
 
+[section:available basic_socket::available]
 
-[section:protocol_type basic_socket_acceptor::protocol_type]
-
-[indexterm2 protocol_type..basic_socket_acceptor]
-The protocol type.
+[indexterm2 available..basic_socket]
+Determine the number of bytes available for reading.
 
 
- typedef Protocol protocol_type;
+ std::size_t ``[link boost_asio.reference.basic_socket.available.overload1 available]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload1 more...]]``
 
+ std::size_t ``[link boost_asio.reference.basic_socket.available.overload2 available]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.available.overload2 more...]]``
 
 
-[heading Requirements]
+[section:overload1 basic_socket::available (1 of 2 overloads)]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Determine the number of bytes available for reading.
 
 
-[endsect]
+ std::size_t available() const;
 
 
+This function is used to determine the number of bytes that may be read without blocking.
 
-[section:receive_buffer_size basic_socket_acceptor::receive_buffer_size]
 
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
 
-['Inherited from socket_base.]
 
-[indexterm2 receive_buffer_size..basic_socket_acceptor]
-Socket option for the receive buffer size of a socket.
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
- typedef implementation_defined receive_buffer_size;
+]
 
 
 
-Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
 
+[endsect]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option(8192);
- socket.set_option(option);
 
+[section:overload2 basic_socket::available (2 of 2 overloads)]
 
 
+Determine the number of bytes available for reading.
 
 
-Getting the current option value:
+ std::size_t available(
+ boost::system::error_code & ec) const;
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option;
- socket.get_option(option);
- int size = option.value();
 
+This function is used to determine the number of bytes that may be read without blocking.
 
 
+[heading Parameters]
+
 
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
-[heading Requirements]
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:receive_low_watermark basic_socket_acceptor::receive_low_watermark]
-
-
-['Inherited from socket_base.]
+[section:basic_socket basic_socket::basic_socket]
 
-[indexterm2 receive_low_watermark..basic_socket_acceptor]
-Socket option for the receive low watermark.
+[indexterm2 basic_socket..basic_socket]
+Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it.
 
 
- typedef implementation_defined receive_low_watermark;
+ explicit ``[link boost_asio.reference.basic_socket.basic_socket.overload1 basic_socket]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload1 more...]]``
 
 
+Construct and open a [link boost_asio.reference.basic_socket `basic_socket`].
 
-Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
 
+ ``[link boost_asio.reference.basic_socket.basic_socket.overload2 basic_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload2 more...]]``
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option(1024);
- socket.set_option(option);
+Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint.
 
 
+ ``[link boost_asio.reference.basic_socket.basic_socket.overload3 basic_socket]``(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload3 more...]]``
 
 
+Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket.
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option;
- socket.get_option(option);
- int size = option.value();
+ ``[link boost_asio.reference.basic_socket.basic_socket.overload4 basic_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload4 more...]]``
 
 
+Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another.
 
 
+ ``[link boost_asio.reference.basic_socket.basic_socket.overload5 basic_socket]``(
+ basic_socket && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.basic_socket.overload5 more...]]``
 
 
+[section:overload1 basic_socket::basic_socket (1 of 5 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+Construct a [link boost_asio.reference.basic_socket `basic_socket`] without opening it.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ basic_socket(
+ boost::asio::io_service & io_service);
 
-[endsect]
 
+This constructor creates a socket without opening it.
 
 
-[section:reuse_address basic_socket_acceptor::reuse_address]
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]]
 
-['Inherited from socket_base.]
+]
 
-[indexterm2 reuse_address..basic_socket_acceptor]
-Socket option to allow the socket to be bound to an address that is already in use.
 
 
- typedef implementation_defined reuse_address;
 
+[endsect]
 
 
-Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
 
+[section:overload2 basic_socket::basic_socket (2 of 5 overloads)]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option(true);
- acceptor.set_option(option);
+Construct and open a [link boost_asio.reference.basic_socket `basic_socket`].
 
 
+ basic_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
 
 
+This constructor creates and opens a socket.
 
-Getting the current option value:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option;
- acceptor.get_option(option);
- bool is_set = option.value();
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
 
+[[protocol][An object specifying protocol parameters to be used.]]
 
+]
 
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
-[heading Requirements]
+]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:send_buffer_size basic_socket_acceptor::send_buffer_size]
-
+[section:overload3 basic_socket::basic_socket (3 of 5 overloads)]
 
-['Inherited from socket_base.]
 
-[indexterm2 send_buffer_size..basic_socket_acceptor]
-Socket option for the send buffer size of a socket.
+Construct a [link boost_asio.reference.basic_socket `basic_socket`], opening it and binding it to the given local endpoint.
 
 
- typedef implementation_defined send_buffer_size;
+ basic_socket(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
 
 
+This constructor creates a socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
 
-Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
 
+[heading Parameters]
+
 
-[heading Examples]
+[variablelist
   
-Setting the option:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option(8192);
- socket.set_option(option);
-
-
-
-
-
-Getting the current option value:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option;
- socket.get_option(option);
- int size = option.value();
-
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
 
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
 
+]
 
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
-[heading Requirements]
+]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:send_low_watermark basic_socket_acceptor::send_low_watermark]
-
+[section:overload4 basic_socket::basic_socket (4 of 5 overloads)]
 
-['Inherited from socket_base.]
 
-[indexterm2 send_low_watermark..basic_socket_acceptor]
-Socket option for the send low watermark.
+Construct a [link boost_asio.reference.basic_socket `basic_socket`] on an existing native socket.
 
 
- typedef implementation_defined send_low_watermark;
+ basic_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
 
 
+This constructor creates a socket object to hold an existing native socket.
 
-Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
 
+[heading Parameters]
+
 
-[heading Examples]
+[variablelist
   
-Setting the option:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_low_watermark option(1024);
- socket.set_option(option);
-
-
-
-
-
-Getting the current option value:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_low_watermark option;
- socket.get_option(option);
- int size = option.value();
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
 
+[[protocol][An object specifying protocol parameters to be used.]]
 
+[[native_socket][A native socket.]]
 
+]
 
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
-[heading Requirements]
+]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:service basic_socket_acceptor::service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 service..basic_socket_acceptor]
-The service associated with the I/O object.
-
-
- service_type & service;
+[section:overload5 basic_socket::basic_socket (5 of 5 overloads)]
 
 
+Move-construct a [link boost_asio.reference.basic_socket `basic_socket`] from another.
 
-[endsect]
 
+ basic_socket(
+ basic_socket && other);
 
 
-[section:service_type basic_socket_acceptor::service_type]
+This constructor moves a socket from one object to another.
 
 
-['Inherited from basic_io_object.]
+[heading Parameters]
+
 
-[indexterm2 service_type..basic_socket_acceptor]
-The type of the service that will be used to provide I/O operations.
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
 
+]
 
- typedef SocketAcceptorService service_type;
 
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(io_service&) constructor`.
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
+[section:bind basic_socket::bind]
 
-[section:set_option basic_socket_acceptor::set_option]
-
-[indexterm2 set_option..basic_socket_acceptor]
-Set an option on the acceptor.
+[indexterm2 bind..basic_socket]
+Bind the socket to the given local endpoint.
 
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload1 set_option]``(
- const SettableSocketOption & option);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_socket.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload2 set_option]``(
- const SettableSocketOption & option,
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.bind.overload2 more...]]``
 
 
-[section:overload1 basic_socket_acceptor::set_option (1 of 2 overloads)]
+[section:overload1 basic_socket::bind (1 of 2 overloads)]
 
 
-Set an option on the acceptor.
+Bind the socket to the given local endpoint.
 
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void set_option(
- const SettableSocketOption & option);
+ void bind(
+ const endpoint_type & endpoint);
 
 
-This function is used to set an option on the acceptor.
+This function binds the socket to the specified endpoint on the local machine.
 
 
 [heading Parameters]
@@ -21602,7 +24926,7 @@
 
 [variablelist
   
-[[option][The new option value to be set on the acceptor.]]
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
 
 ]
 
@@ -21617,15 +24941,14 @@
 ]
 
 
-
 [heading Example]
   
-Setting the SOL\_SOCKET/SO\_REUSEADDR option:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::acceptor::reuse_address option(true);
- acceptor.set_option(option);
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345));
 
 
 
@@ -21637,20 +24960,18 @@
 
 
 
-[section:overload2 basic_socket_acceptor::set_option (2 of 2 overloads)]
+[section:overload2 basic_socket::bind (2 of 2 overloads)]
 
 
-Set an option on the acceptor.
+Bind the socket to the given local endpoint.
 
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code set_option(
- const SettableSocketOption & option,
+ boost::system::error_code bind(
+ const endpoint_type & endpoint,
       boost::system::error_code & ec);
 
 
-This function is used to set an option on the acceptor.
+This function binds the socket to the specified endpoint on the local machine.
 
 
 [heading Parameters]
@@ -21658,23 +24979,22 @@
 
 [variablelist
   
-[[option][The new option value to be set on the acceptor.]]
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-
 [heading Example]
   
-Setting the SOL\_SOCKET/SO\_REUSEADDR option:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::acceptor::reuse_address option(true);
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
    boost::system::error_code ec;
- acceptor.set_option(option, ec);
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345), ec);
    if (ec)
    {
      // An error occurred.
@@ -21692,649 +25012,393 @@
 [endsect]
 
 
-[section:shutdown_type basic_socket_acceptor::shutdown_type]
+[section:broadcast basic_socket::broadcast]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 shutdown_type..basic_socket_acceptor]
-Different ways a socket may be shutdown.
-
-
- enum shutdown_type
-
-[indexterm2 shutdown_receive..basic_socket_acceptor]
-[indexterm2 shutdown_send..basic_socket_acceptor]
-[indexterm2 shutdown_both..basic_socket_acceptor]
+[indexterm2 broadcast..basic_socket]
+Socket option to permit sending of broadcast messages.
 
-[heading Values]
-[variablelist
 
- [
- [shutdown_receive]
- [Shutdown the receive side of the socket. ]
- ]
+ typedef implementation_defined broadcast;
 
- [
- [shutdown_send]
- [Shutdown the send side of the socket. ]
- ]
 
- [
- [shutdown_both]
- [Shutdown both send and receive on the socket. ]
- ]
 
-]
+Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
 
 
+[heading Examples]
+
+Setting the option:
 
-[endsect]
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option(true);
+ socket.set_option(option);
 
 
 
-[endsect]
 
-[section:basic_socket_iostream basic_socket_iostream]
 
+Getting the current option value:
 
-Iostream interface for a socket.
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.StreamSocketService StreamSocketService]`` = stream_socket_service<Protocol>>
- class basic_socket_iostream
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
- [Construct a basic_socket_iostream without establishing a connection.
 
- Establish a connection to an endpoint corresponding to a resolver query. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
- [Close the connection. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
- [Establish a connection to an endpoint corresponding to a resolver query. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
- [Return a pointer to the underlying streambuf. ]
- ]
-
-]
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_iostream.hpp]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:basic_socket_iostream basic_socket_iostream::basic_socket_iostream]
 
-[indexterm2 basic_socket_iostream..basic_socket_iostream]
-Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection.
+[endsect]
 
 
- ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 basic_socket_iostream]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 more...]]``
 
+[section:bytes_readable basic_socket::bytes_readable]
 
-Establish a connection to an endpoint corresponding to a resolver query.
 
+['Inherited from socket_base.]
 
- template<
- typename T1,
- ... ,
- typename TN>
- explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 basic_socket_iostream]``(
- T1 t1,
- ... ,
- TN tn);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 more...]]``
+[indexterm2 bytes_readable..basic_socket]
+IO control command to get the amount of data that can be read without blocking.
 
 
-[section:overload1 basic_socket_iostream::basic_socket_iostream (1 of 2 overloads)]
+ typedef implementation_defined bytes_readable;
 
 
-Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection.
 
+Implements the FIONREAD IO control command.
 
- basic_socket_iostream();
 
+[heading Example]
+
 
 
-[endsect]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::bytes_readable command(true);
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
 
 
 
-[section:overload2 basic_socket_iostream::basic_socket_iostream (2 of 2 overloads)]
 
 
-Establish a connection to an endpoint corresponding to a resolver query.
 
 
- template<
- typename T1,
- ... ,
- typename TN>
- basic_socket_iostream(
- T1 t1,
- ... ,
- TN tn);
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket.hpp]
 
-This constructor automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[endsect]
+[section:cancel basic_socket::cancel]
 
+[indexterm2 cancel..basic_socket]
+Cancel all asynchronous operations associated with the socket.
 
-[section:close basic_socket_iostream::close]
 
-[indexterm2 close..basic_socket_iostream]
-Close the connection.
+ void ``[link boost_asio.reference.basic_socket.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.cancel.overload2 more...]]``
 
- void close();
 
+[section:overload1 basic_socket::cancel (1 of 2 overloads)]
 
 
-[endsect]
+Cancel all asynchronous operations associated with the socket.
 
 
+ void cancel();
 
-[section:connect basic_socket_iostream::connect]
 
-[indexterm2 connect..basic_socket_iostream]
-Establish a connection to an endpoint corresponding to a resolver query.
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
 
- template<
- typename T1,
- ... ,
- typename TN>
- void connect(
- T1 t1,
- ... ,
- TN tn);
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
+]
 
 
-[endsect]
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
 
 
+* It will only cancel asynchronous operations that were initiated in the current thread.
 
-[section:rdbuf basic_socket_iostream::rdbuf]
 
-[indexterm2 rdbuf..basic_socket_iostream]
-Return a pointer to the underlying streambuf.
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
 
+For portable cancellation, consider using one of the following alternatives:
 
- basic_socket_streambuf< Protocol, StreamSocketService > * rdbuf() const;
 
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
 
 
-[endsect]
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
 
 [endsect]
 
-[section:basic_socket_streambuf basic_socket_streambuf]
 
 
-Iostream streambuf for a socket.
+[section:overload2 basic_socket::cancel (2 of 2 overloads)]
 
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.StreamSocketService StreamSocketService]`` = stream_socket_service<Protocol>>
- class basic_socket_streambuf :
- public basic_socket< Protocol, StreamSocketService >
+Cancel all asynchronous operations associated with the socket.
 
 
-[heading Types]
-[table
- [[Name][Description]]
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
+[heading Parameters]
+
+
+[variablelist
   
- ]
+[[ec][Set to indicate what error occurred, if any.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_socket_streambuf.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
 
- [
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
 
- [[link boost_asio.reference.basic_socket_streambuf.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+* It will only cancel asynchronous operations that were initiated in the current thread.
 
- [[link boost_asio.reference.basic_socket_streambuf.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
 
- [[link boost_asio.reference.basic_socket_streambuf.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
+For portable cancellation, consider using one of the following alternatives:
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
- [
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
- [[link boost_asio.reference.basic_socket_streambuf.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_streambuf.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_streambuf.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
+[section:close basic_socket::close]
 
- [
+[indexterm2 close..basic_socket]
+Close the socket.
 
- [[link boost_asio.reference.basic_socket_streambuf.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
 
- [
+ void ``[link boost_asio.reference.basic_socket.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload1 more...]]``
 
- [[link boost_asio.reference.basic_socket_streambuf.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.close.overload2 more...]]``
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+[section:overload1 basic_socket::close (1 of 2 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
+Close the socket.
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
+ void close();
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
+This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
+[heading Exceptions]
+
+
+[variablelist
   
- ]
+[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_socket_streambuf.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
 
- [
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
 
- [[link boost_asio.reference.basic_socket_streambuf.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_streambuf.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
 
-]
+[endsect]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf [*basic_socket_streambuf]]]
- [Construct a basic_socket_streambuf without establishing a connection. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.close [*close]]]
- [Close the connection.
 
- Close the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.connect [*connect]]]
- [Establish a connection.
+[section:overload2 basic_socket::close (2 of 2 overloads)]
 
- Connect the socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.get_option [*get_option]]]
- [Get an option from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.open [*open]]]
- [Open the socket using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.set_option [*set_option]]]
- [Set an option on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf._basic_socket_streambuf [*~basic_socket_streambuf]]]
- [Destructor flushes buffered data. ]
- ]
+Close the socket.
+
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+
+
+[heading Parameters]
+
+
+[variablelist
   
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
+
 ]
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.overflow [*overflow]]]
- []
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.setbuf [*setbuf]]]
- []
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.sync [*sync]]]
- []
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.underflow [*underflow]]]
- []
- ]
+[heading Example]
   
-]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.close(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
 
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket_streambuf.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
-[section:assign basic_socket_streambuf::assign]
+[section:connect basic_socket::connect]
 
-[indexterm2 assign..basic_socket_streambuf]
-Assign an existing native socket to the socket.
+[indexterm2 connect..basic_socket]
+Connect the socket to the specified endpoint.
 
 
- void ``[link boost_asio.reference.basic_socket_streambuf.assign.overload1 assign]``(
- const protocol_type & protocol,
- const native_type & native_socket);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.assign.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_socket.connect.overload1 connect]``(
+ const endpoint_type & peer_endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.assign.overload2 assign]``(
- const protocol_type & protocol,
- const native_type & native_socket,
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.connect.overload2 connect]``(
+ const endpoint_type & peer_endpoint,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.assign.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.connect.overload2 more...]]``
 
 
-[section:overload1 basic_socket_streambuf::assign (1 of 2 overloads)]
+[section:overload1 basic_socket::connect (1 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+Connect the socket to the specified endpoint.
 
 
-Assign an existing native socket to the socket.
+ void connect(
+ const endpoint_type & peer_endpoint);
 
 
- void assign(
- const protocol_type & protocol,
- const native_type & native_socket);
+This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
 
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
 
 
-[endsect]
+[heading Parameters]
+
+
+[variablelist
+
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
 
+]
 
 
-[section:overload2 basic_socket_streambuf::assign (2 of 2 overloads)]
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-['Inherited from basic_socket.]
+]
 
 
-Assign an existing native socket to the socket.
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.connect(endpoint);
 
 
- boost::system::error_code assign(
- const protocol_type & protocol,
- const native_type & native_socket,
- boost::system::error_code & ec);
 
 
 
-[endsect]
 
 
 [endsect]
 
 
-[section:async_connect basic_socket_streambuf::async_connect]
 
+[section:overload2 basic_socket::connect (2 of 2 overloads)]
 
-['Inherited from basic_socket.]
 
-[indexterm2 async_connect..basic_socket_streambuf]
-Start an asynchronous connect.
+Connect the socket to the specified endpoint.
 
 
- template<
- typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
- void async_connect(
+ boost::system::error_code connect(
       const endpoint_type & peer_endpoint,
- ConnectHandler handler);
+ boost::system::error_code & ec);
 
 
-This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
+This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
 
 The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
 
@@ -22344,15 +25408,9 @@
 
 [variablelist
   
-[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
 
-[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error // Result of operation
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
@@ -22361,20 +25419,15 @@
   
 
 
- void connect_handler(const boost::system::error_code& error)
- {
- if (!error)
- {
- // Connect succeeded.
- }
- }
-
- ...
-
    boost::asio::ip::tcp::socket socket(io_service);
    boost::asio::ip::tcp::endpoint endpoint(
        boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- socket.async_connect(endpoint, connect_handler);
+ boost::system::error_code ec;
+ socket.connect(endpoint, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
 
 
@@ -22385,226 +25438,298 @@
 [endsect]
 
 
-[section:at_mark basic_socket_streambuf::at_mark]
+[endsect]
 
-[indexterm2 at_mark..basic_socket_streambuf]
-Determine whether the socket is at the out-of-band data mark.
 
+[section:debug basic_socket::debug]
 
- bool ``[link boost_asio.reference.basic_socket_streambuf.at_mark.overload1 at_mark]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.at_mark.overload1 more...]]``
 
- bool ``[link boost_asio.reference.basic_socket_streambuf.at_mark.overload2 at_mark]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.at_mark.overload2 more...]]``
+['Inherited from socket_base.]
 
+[indexterm2 debug..basic_socket]
+Socket option to enable socket-level debugging.
 
-[section:overload1 basic_socket_streambuf::at_mark (1 of 2 overloads)]
 
+ typedef implementation_defined debug;
 
-['Inherited from basic_socket.]
 
 
-Determine whether the socket is at the out-of-band data mark.
+Implements the SOL\_SOCKET/SO\_DEBUG socket option.
 
 
- bool at_mark() const;
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option(true);
+ socket.set_option(option);
 
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
 
 
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
 
 
-[heading Exceptions]
-
+Getting the current option value:
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
-]
 
 
 
 
-[endsect]
 
 
+[heading Requirements]
 
-[section:overload2 basic_socket_streambuf::at_mark (2 of 2 overloads)]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-['Inherited from basic_socket.]
 
+[endsect]
 
-Determine whether the socket is at the out-of-band data mark.
 
 
- bool at_mark(
- boost::system::error_code & ec) const;
+[section:do_not_route basic_socket::do_not_route]
 
 
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+['Inherited from socket_base.]
 
+[indexterm2 do_not_route..basic_socket]
+Socket option to prevent routing, use local interfaces only.
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+ typedef implementation_defined do_not_route;
 
-]
 
 
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
 
 
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option(true);
+ socket.set_option(option);
 
-[endsect]
 
 
-[endsect]
 
-[section:available basic_socket_streambuf::available]
 
-[indexterm2 available..basic_socket_streambuf]
-Determine the number of bytes available for reading.
+Getting the current option value:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
- std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload1 available]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.available.overload1 more...]]``
 
- std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload2 available]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.available.overload2 more...]]``
 
 
-[section:overload1 basic_socket_streambuf::available (1 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
 
+[heading Requirements]
 
-Determine the number of bytes available for reading.
+[*Header: ][^boost/asio/basic_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
- std::size_t available() const;
 
+[endsect]
 
-This function is used to determine the number of bytes that may be read without blocking.
 
 
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
+[section:enable_connection_aborted basic_socket::enable_connection_aborted]
 
 
-[heading Exceptions]
-
+['Inherited from socket_base.]
 
-[variablelist
+[indexterm2 enable_connection_aborted..basic_socket]
+Socket option to report aborted connections on accept.
+
+
+ typedef implementation_defined enable_connection_aborted;
+
+
+
+Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
+
+
+[heading Examples]
   
-[[boost::system::system_error][Thrown on failure. ]]
+Setting the option:
 
-]
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option(true);
+ acceptor.set_option(option);
 
 
 
 
-[endsect]
 
+Getting the current option value:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
 
 
-[section:overload2 basic_socket_streambuf::available (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
 
 
-Determine the number of bytes available for reading.
 
+[heading Requirements]
 
- std::size_t available(
- boost::system::error_code & ec) const;
+[*Header: ][^boost/asio/basic_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
-This function is used to determine the number of bytes that may be read without blocking.
+[endsect]
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+[section:endpoint_type basic_socket::endpoint_type]
 
-]
+[indexterm2 endpoint_type..basic_socket]
+The endpoint type.
+
+
+ typedef Protocol::endpoint endpoint_type;
 
 
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:get_implementation basic_socket::get_implementation]
+
+[indexterm2 get_implementation..basic_socket]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.basic_socket.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.basic_socket.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_implementation.overload2 more...]]``
+
+
+[section:overload1 basic_socket::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
 [endsect]
 
 
-[section:basic_socket_streambuf basic_socket_streambuf::basic_socket_streambuf]
 
-[indexterm2 basic_socket_streambuf..basic_socket_streambuf]
-Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection.
+[section:overload2 basic_socket::get_implementation (2 of 2 overloads)]
 
 
- basic_socket_streambuf();
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
 
 
 
 [endsect]
 
 
-[section:bind basic_socket_streambuf::bind]
+[endsect]
 
-[indexterm2 bind..basic_socket_streambuf]
-Bind the socket to the given local endpoint.
 
+[section:get_io_service basic_socket::get_io_service]
 
- void ``[link boost_asio.reference.basic_socket_streambuf.bind.overload1 bind]``(
- const endpoint_type & endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.bind.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.bind.overload2 bind]``(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.bind.overload2 more...]]``
+['Inherited from basic_io_object.]
+
+[indexterm2 get_io_service..basic_socket]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
-[section:overload1 basic_socket_streambuf::bind (1 of 2 overloads)]
+ boost::asio::io_service & get_io_service();
 
 
-['Inherited from basic_socket.]
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
-Bind the socket to the given local endpoint.
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
 
- void bind(
- const endpoint_type & endpoint);
 
 
-This function binds the socket to the specified endpoint on the local machine.
+[endsect]
+
+
+[section:get_option basic_socket::get_option]
+
+[indexterm2 get_option..basic_socket]
+Get an option from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket.get_option.overload1 get_option]``(
+ GettableSocketOption & option) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.get_option.overload2 get_option]``(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_option.overload2 more...]]``
+
+
+[section:overload1 basic_socket::get_option (1 of 2 overloads)]
+
+
+Get an option from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void get_option(
+ GettableSocketOption & option) const;
+
+
+This function is used to get the current value of an option on the socket.
 
 
 [heading Parameters]
@@ -22612,7 +25737,7 @@
 
 [variablelist
   
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[[option][The option value to be obtained from the socket.]]
 
 ]
 
@@ -22627,14 +25752,16 @@
 ]
 
 
+
 [heading Example]
   
-
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
 
    boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345));
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.get();
 
 
 
@@ -22646,21 +25773,20 @@
 
 
 
-[section:overload2 basic_socket_streambuf::bind (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::get_option (2 of 2 overloads)]
 
 
-Bind the socket to the given local endpoint.
+Get an option from the socket.
 
 
- boost::system::error_code bind(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
 
 
-This function binds the socket to the specified endpoint on the local machine.
+This function is used to get the current value of an option on the socket.
 
 
 [heading Parameters]
@@ -22668,26 +25794,28 @@
 
 [variablelist
   
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[[option][The option value to be obtained from the socket.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+
 [heading Example]
   
-
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
 
    boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
    boost::system::error_code ec;
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345), ec);
+ socket.get_option(option, ec);
    if (ec)
    {
      // An error occurred.
    }
+ bool is_set = option.get();
 
 
 
@@ -22700,96 +25828,88 @@
 
 [endsect]
 
+[section:get_service basic_socket::get_service]
 
-[section:broadcast basic_socket_streambuf::broadcast]
+[indexterm2 get_service..basic_socket]
+Get the service associated with the I/O object.
 
 
-['Inherited from socket_base.]
+ service_type & ``[link boost_asio.reference.basic_socket.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_service.overload1 more...]]``
 
-[indexterm2 broadcast..basic_socket_streambuf]
-Socket option to permit sending of broadcast messages.
+ const service_type & ``[link boost_asio.reference.basic_socket.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.get_service.overload2 more...]]``
 
 
- typedef implementation_defined broadcast;
+[section:overload1 basic_socket::get_service (1 of 2 overloads)]
 
 
+['Inherited from basic_io_object.]
 
-Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
 
+Get the service associated with the I/O object.
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::broadcast option(true);
- socket.set_option(option);
+ service_type & get_service();
 
 
 
+[endsect]
 
 
-Getting the current option value:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::broadcast option;
- socket.get_option(option);
- bool is_set = option.value();
+[section:overload2 basic_socket::get_service (2 of 2 overloads)]
 
 
+['Inherited from basic_io_object.]
 
 
+Get the service associated with the I/O object.
 
 
+ const service_type & get_service() const;
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
 
-
-[section:bytes_readable basic_socket_streambuf::bytes_readable]
+[section:implementation basic_socket::implementation]
 
 
-['Inherited from socket_base.]
+['Inherited from basic_io_object.]
 
-[indexterm2 bytes_readable..basic_socket_streambuf]
-IO control command to get the amount of data that can be read without blocking.
+[indexterm2 implementation..basic_socket]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
 
- typedef implementation_defined bytes_readable;
+ implementation_type implementation;
 
 
 
-Implements the FIONREAD IO control command.
+[endsect]
 
 
-[heading Example]
-
 
+[section:implementation_type basic_socket::implementation_type]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::bytes_readable command(true);
- socket.io_control(command);
- std::size_t bytes_readable = command.get();
 
+['Inherited from basic_io_object.]
 
+[indexterm2 implementation_type..basic_socket]
+The underlying implementation type of I/O object.
 
 
+ typedef service_type::implementation_type implementation_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -22797,33 +25917,49 @@
 [endsect]
 
 
-[section:cancel basic_socket_streambuf::cancel]
+[section:io_control basic_socket::io_control]
 
-[indexterm2 cancel..basic_socket_streambuf]
-Cancel all asynchronous operations associated with the socket.
+[indexterm2 io_control..basic_socket]
+Perform an IO control command on the socket.
 
 
- void ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload1 cancel]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.cancel.overload1 more...]]``
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void ``[link boost_asio.reference.basic_socket.io_control.overload1 io_control]``(
+ IoControlCommand & command);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload2 cancel]``(
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.io_control.overload2 io_control]``(
+ IoControlCommand & command,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.cancel.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.io_control.overload2 more...]]``
 
 
-[section:overload1 basic_socket_streambuf::cancel (1 of 2 overloads)]
+[section:overload1 basic_socket::io_control (1 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+Perform an IO control command on the socket.
 
 
-Cancel all asynchronous operations associated with the socket.
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void io_control(
+ IoControlCommand & command);
 
 
- void cancel();
+This function is used to execute an IO control command on the socket.
 
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+[heading Parameters]
+
+
+[variablelist
+
+[[command][The IO control command to be performed on the socket.]]
+
+]
 
 
 [heading Exceptions]
@@ -22836,45 +25972,41 @@
 ]
 
 
-[heading Remarks]
-
-Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
-
-
-* It will only cancel asynchronous operations that were initiated in the current thread.
-
 
-* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
+[heading Example]
+
+Getting the number of bytes ready to read:
 
-For portable cancellation, consider using one of the following alternatives:
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
 
 
-* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
 
 
-* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
-When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
 
 [endsect]
 
 
 
-[section:overload2 basic_socket_streambuf::cancel (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::io_control (2 of 2 overloads)]
 
 
-Cancel all asynchronous operations associated with the socket.
+Perform an IO control command on the socket.
 
 
- boost::system::error_code cancel(
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ IoControlCommand & command,
       boost::system::error_code & ec);
 
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+This function is used to execute an IO control command on the socket.
 
 
 [heading Parameters]
@@ -22882,30 +26014,33 @@
 
 [variablelist
   
+[[command][The IO control command to be performed on the socket.]]
+
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Remarks]
-
-Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
-
-
-* It will only cancel asynchronous operations that were initiated in the current thread.
-
 
-* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
+[heading Example]
+
+Getting the number of bytes ready to read:
 
-For portable cancellation, consider using one of the following alternatives:
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ boost::system::error_code ec;
+ socket.io_control(command, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ std::size_t bytes_readable = command.get();
 
 
-* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
 
 
-* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
-When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
 
 [endsect]
@@ -22913,201 +26048,199 @@
 
 [endsect]
 
-[section:close basic_socket_streambuf::close]
 
-[indexterm2 close..basic_socket_streambuf]
-Close the connection.
+[section:is_open basic_socket::is_open]
 
+[indexterm2 is_open..basic_socket]
+Determine whether the socket is open.
 
- basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.close.overload1 more...]]``
 
+ bool is_open() const;
 
-Close the socket.
 
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.close.overload2 close]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.close.overload2 more...]]``
+[endsect]
 
 
-[section:overload1 basic_socket_streambuf::close (1 of 2 overloads)]
 
+[section:keep_alive basic_socket::keep_alive]
 
-Close the connection.
 
+['Inherited from socket_base.]
 
- basic_socket_streambuf< Protocol, StreamSocketService > * close();
+[indexterm2 keep_alive..basic_socket]
+Socket option to send keep-alives.
 
 
+ typedef implementation_defined keep_alive;
 
-[heading Return Value]
-
-`this` if a connection was successfully established, a null pointer otherwise.
 
 
+Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
 
 
-[endsect]
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option(true);
+ socket.set_option(option);
 
 
-[section:overload2 basic_socket_streambuf::close (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
 
+Getting the current option value:
 
-Close the socket.
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
 
- boost::system::error_code close(
- boost::system::error_code & ec);
 
 
-This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+[heading Requirements]
 
-]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[heading Example]
-
 
+[endsect]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- socket.close(ec);
- if (ec)
- {
- // An error occurred.
- }
 
 
+[section:linger basic_socket::linger]
 
 
+['Inherited from socket_base.]
 
-[heading Remarks]
-
-For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
+[indexterm2 linger..basic_socket]
+Socket option to specify whether the socket lingers on close if unsent data is present.
 
 
+ typedef implementation_defined linger;
 
 
-[endsect]
 
+Implements the SOL\_SOCKET/SO\_LINGER socket option.
 
-[endsect]
 
-[section:connect basic_socket_streambuf::connect]
+[heading Examples]
+
+Setting the option:
 
-[indexterm2 connect..basic_socket_streambuf]
-Establish a connection.
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option(true, 30);
+ socket.set_option(option);
 
 
- basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload1 connect]``(
- const endpoint_type & endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload1 more...]]``
 
- template<
- typename T1,
- ... ,
- typename TN>
- basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload2 connect]``(
- T1 t1,
- ... ,
- TN tn);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload2 more...]]``
 
 
-Connect the socket to the specified endpoint.
+Getting the current option value:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option;
+ socket.get_option(option);
+ bool is_set = option.enabled();
+ unsigned short timeout = option.timeout();
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.connect.overload3 connect]``(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload3 more...]]``
 
 
-[section:overload1 basic_socket_streambuf::connect (1 of 3 overloads)]
 
 
-Establish a connection.
 
 
- basic_socket_streambuf< Protocol, StreamSocketService > * connect(
- const endpoint_type & endpoint);
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket.hpp]
 
-This function establishes a connection to the specified endpoint.
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Return Value]
-
-`this` if a connection was successfully established, a null pointer otherwise.
+[endsect]
 
 
+[section:local_endpoint basic_socket::local_endpoint]
 
+[indexterm2 local_endpoint..basic_socket]
+Get the local endpoint of the socket.
 
-[endsect]
 
+ endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload1 local_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload1 more...]]``
 
+ endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload2 local_endpoint]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.local_endpoint.overload2 more...]]``
 
-[section:overload2 basic_socket_streambuf::connect (2 of 3 overloads)]
 
+[section:overload1 basic_socket::local_endpoint (1 of 2 overloads)]
 
-Establish a connection.
 
+Get the local endpoint of the socket.
 
- template<
- typename T1,
- ... ,
- typename TN>
- basic_socket_streambuf< Protocol, StreamSocketService > * connect(
- T1 t1,
- ... ,
- TN tn);
+
+ endpoint_type local_endpoint() const;
 
 
-This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
+This function is used to obtain the locally bound endpoint of the socket.
 
 
 [heading Return Value]
       
-`this` if a connection was successfully established, a null pointer otherwise.
+An object that represents the local endpoint of the socket.
 
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[endsect]
+]
 
 
+[heading Example]
+
 
-[section:overload3 basic_socket_streambuf::connect (3 of 3 overloads)]
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
 
-['Inherited from basic_socket.]
 
 
-Connect the socket to the specified endpoint.
 
 
- boost::system::error_code connect(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
 
 
-This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
+[endsect]
 
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+
+[section:overload2 basic_socket::local_endpoint (2 of 2 overloads)]
+
+
+Get the local endpoint of the socket.
+
+
+ endpoint_type local_endpoint(
+ boost::system::error_code & ec) const;
+
+
+This function is used to obtain the locally bound endpoint of the socket.
 
 
 [heading Parameters]
@@ -23115,22 +26248,24 @@
 
 [variablelist
   
-[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
-
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Return Value]
+
+An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+
+
 [heading Example]
   
 
 
    boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ ...
    boost::system::error_code ec;
- socket.connect(endpoint, ec);
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
    if (ec)
    {
      // An error occurred.
@@ -23147,382 +26282,625 @@
 
 [endsect]
 
+[section:lowest_layer basic_socket::lowest_layer]
 
-[section:debug basic_socket_streambuf::debug]
+[indexterm2 lowest_layer..basic_socket]
+Get a reference to the lowest layer.
 
 
-['Inherited from socket_base.]
+ lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload1 more...]]``
 
-[indexterm2 debug..basic_socket_streambuf]
-Socket option to enable socket-level debugging.
 
+Get a const reference to the lowest layer.
 
- typedef implementation_defined debug;
 
+ const lowest_layer_type & ``[link boost_asio.reference.basic_socket.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.lowest_layer.overload2 more...]]``
 
 
-Implements the SOL\_SOCKET/SO\_DEBUG socket option.
+[section:overload1 basic_socket::lowest_layer (1 of 2 overloads)]
 
 
-[heading Examples]
-
-Setting the option:
+Get a reference to the lowest layer.
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option(true);
- socket.set_option(option);
 
+ lowest_layer_type & lowest_layer();
 
 
+This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
 
 
-Getting the current option value:
+[heading Return Value]
+
+A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option;
- socket.get_option(option);
- bool is_set = option.value();
 
 
 
+[endsect]
 
 
 
+[section:overload2 basic_socket::lowest_layer (2 of 2 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+Get a const reference to the lowest layer.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ const lowest_layer_type & lowest_layer() const;
 
-[endsect]
 
+This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
 
 
-[section:do_not_route basic_socket_streambuf::do_not_route]
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
 
-['Inherited from socket_base.]
 
-[indexterm2 do_not_route..basic_socket_streambuf]
-Socket option to prevent routing, use local interfaces only.
 
+[endsect]
 
- typedef implementation_defined do_not_route;
 
+[endsect]
 
 
-Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
+[section:lowest_layer_type basic_socket::lowest_layer_type]
 
+[indexterm2 lowest_layer_type..basic_socket]
+A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option(true);
- socket.set_option(option);
+ typedef basic_socket< Protocol, SocketService > lowest_layer_type;
 
 
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
 
-Getting the current option value:
+ [
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option;
- socket.get_option(option);
- bool is_set = option.value();
+ [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
 
-[heading Requirements]
+ [
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+ [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
 
+ [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
 
+ [
 
-[section:enable_connection_aborted basic_socket_streambuf::enable_connection_aborted]
+ [[link boost_asio.reference.basic_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
 
+ [
 
-['Inherited from socket_base.]
+ [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
 
-[indexterm2 enable_connection_aborted..basic_socket_streambuf]
-Socket option to report aborted connections on accept.
+ [
 
+ [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
 
- typedef implementation_defined enable_connection_aborted;
+ [
 
+ [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
 
+ [
 
-Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
+ [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
 
+ [
 
-[heading Examples]
+ [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
   
-Setting the option:
+ ]
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option(true);
- acceptor.set_option(option);
+ [
 
+ [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
+ [
 
-Getting the current option value:
+ [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option;
- acceptor.get_option(option);
- bool is_set = option.value();
+ [
 
+ [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
 
+ [
 
-[heading Requirements]
+ [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+ [
 
-[*Convenience header: ][^boost/asio.hpp]
+ [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
 
+]
 
-[endsect]
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
+ [Construct a basic_socket without opening it.
 
+ Construct and open a basic_socket.
 
-[section:endpoint_type basic_socket_streambuf::endpoint_type]
+ Construct a basic_socket, opening it and binding it to the given local endpoint.
 
-[indexterm2 endpoint_type..basic_socket_streambuf]
-The endpoint type.
+ Construct a basic_socket on an existing native socket.
 
+ Move-construct a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
- typedef Protocol::endpoint endpoint_type;
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
 
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+]
 
-[heading Requirements]
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+ [
+ [[link boost_asio.reference.basic_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
 
-[endsect]
+ [
+ [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
 
-[section:get_io_service basic_socket_streambuf::get_io_service]
+ [
+ [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
 
+]
 
-['Inherited from basic_io_object.]
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
-[indexterm2 get_io_service..basic_socket_streambuf]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+ [
+ [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
- boost::asio::io_service & get_io_service();
+]
 
+The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[*Shared] [*objects:] Unsafe.
 
 
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket.hpp]
 
-[section:get_option basic_socket_streambuf::get_option]
+[*Convenience header: ][^boost/asio.hpp]
 
-[indexterm2 get_option..basic_socket_streambuf]
-Get an option from the socket.
 
+[endsect]
 
- void ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload1 get_option]``(
- GettableSocketOption & option) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_option.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload2 get_option]``(
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_option.overload2 more...]]``
 
+[section:max_connections basic_socket::max_connections]
 
-[section:overload1 basic_socket_streambuf::get_option (1 of 2 overloads)]
 
+['Inherited from socket_base.]
 
-['Inherited from basic_socket.]
+[indexterm2 max_connections..basic_socket]
+The maximum length of the queue of pending incoming connections.
 
 
-Get an option from the socket.
+ static const int max_connections = implementation_defined;
 
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- void get_option(
- GettableSocketOption & option) const;
 
+[endsect]
 
-This function is used to get the current value of an option on the socket.
 
 
-[heading Parameters]
-
+[section:message_do_not_route basic_socket::message_do_not_route]
 
-[variablelist
-
-[[option][The option value to be obtained from the socket.]]
 
-]
+['Inherited from socket_base.]
 
+[indexterm2 message_do_not_route..basic_socket]
+Specify that the data should not be subject to routing.
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+ static const int message_do_not_route = implementation_defined;
 
-]
 
 
+[endsect]
 
-[heading Example]
-
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::keep_alive option;
- socket.get_option(option);
- bool is_set = option.get();
 
+[section:message_end_of_record basic_socket::message_end_of_record]
 
 
+['Inherited from socket_base.]
 
+[indexterm2 message_end_of_record..basic_socket]
+Specifies that the data marks the end of a record.
 
 
+ static const int message_end_of_record = implementation_defined;
 
-[endsect]
 
 
+[endsect]
 
-[section:overload2 basic_socket_streambuf::get_option (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+[section:message_flags basic_socket::message_flags]
 
 
-Get an option from the socket.
+['Inherited from socket_base.]
 
+[indexterm2 message_flags..basic_socket]
+Bitmask type for flags that can be passed to send and receive operations.
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code get_option(
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
 
+ typedef int message_flags;
 
-This function is used to get the current value of an option on the socket.
 
 
-[heading Parameters]
-
+[heading Requirements]
 
-[variablelist
-
-[[option][The option value to be obtained from the socket.]]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[*Convenience header: ][^boost/asio.hpp]
 
-]
 
+[endsect]
 
 
-[heading Example]
-
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::keep_alive option;
- boost::system::error_code ec;
- socket.get_option(option, ec);
- if (ec)
- {
- // An error occurred.
- }
- bool is_set = option.get();
+[section:message_out_of_band basic_socket::message_out_of_band]
+
 
+['Inherited from socket_base.]
 
+[indexterm2 message_out_of_band..basic_socket]
+Process out-of-band data.
 
 
+ static const int message_out_of_band = implementation_defined;
 
 
 
 [endsect]
 
 
+
+[section:message_peek basic_socket::message_peek]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_peek..basic_socket]
+Peek at incoming data without removing it from the input queue.
+
+
+ static const int message_peek = implementation_defined;
+
+
+
 [endsect]
 
 
-[section:implementation basic_socket_streambuf::implementation]
 
+[section:native basic_socket::native]
 
-['Inherited from basic_io_object.]
+[indexterm2 native..basic_socket]
+(Deprecated: Use `native_handle()`.) Get the native socket representation.
 
-[indexterm2 implementation..basic_socket_streambuf]
-The underlying implementation of the I/O object.
 
+ native_type native();
 
- implementation_type implementation;
 
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
 
 
 [endsect]
 
 
 
-[section:implementation_type basic_socket_streambuf::implementation_type]
+[section:native_handle basic_socket::native_handle]
+
+[indexterm2 native_handle..basic_socket]
+Get the native socket representation.
 
 
-['Inherited from basic_io_object.]
+ native_handle_type native_handle();
 
-[indexterm2 implementation_type..basic_socket_streambuf]
-The underlying implementation type of I/O object.
 
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
 
- typedef service_type::implementation_type implementation_type;
+
+[endsect]
+
+
+
+[section:native_handle_type basic_socket::native_handle_type]
+
+[indexterm2 native_handle_type..basic_socket]
+The native representation of a socket.
+
+
+ typedef SocketService::native_handle_type native_handle_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -23530,38 +26908,141 @@
 [endsect]
 
 
-[section:io_control basic_socket_streambuf::io_control]
+[section:native_non_blocking basic_socket::native_non_blocking]
 
-[indexterm2 io_control..basic_socket_streambuf]
-Perform an IO control command on the socket.
+[indexterm2 native_non_blocking..basic_socket]
+Gets the non-blocking mode of the native socket implementation.
 
 
- void ``[link boost_asio.reference.basic_socket_streambuf.io_control.overload1 io_control]``(
- IoControlCommand & command);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.io_control.overload1 more...]]``
+ bool ``[link boost_asio.reference.basic_socket.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.io_control.overload2 io_control]``(
- IoControlCommand & command,
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void ``[link boost_asio.reference.basic_socket.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.io_control.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.native_non_blocking.overload3 more...]]``
 
 
-[section:overload1 basic_socket_streambuf::io_control (1 of 2 overloads)]
+[section:overload1 basic_socket::native_non_blocking (1 of 3 overloads)]
 
 
-['Inherited from basic_socket.]
+Gets the non-blocking mode of the native socket implementation.
 
 
-Perform an IO control command on the socket.
+ bool native_non_blocking() const;
 
 
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void io_control(
- IoControlCommand & command);
+This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
 
 
-This function is used to execute an IO control command on the socket.
+[heading Return Value]
+
+`true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
+
+
+[heading Remarks]
+
+The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket::native_non_blocking (2 of 3 overloads)]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void native_non_blocking(
+ bool mode);
+
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
 
 
 [heading Parameters]
@@ -23569,7 +27050,7 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the socket.]]
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
 ]
 
@@ -23579,49 +27060,102 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
 
 ]
 
 
-
 [heading Example]
   
-Getting the number of bytes ready to read:
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::bytes_readable command;
- socket.io_control(command);
- std::size_t bytes_readable = command.get();
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
 
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
 
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
 
 
 
-[endsect]
 
 
+[endsect]
 
-[section:overload2 basic_socket_streambuf::io_control (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+[section:overload3 basic_socket::native_non_blocking (3 of 3 overloads)]
 
 
-Perform an IO control command on the socket.
+Sets the non-blocking mode of the native socket implementation.
 
 
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- IoControlCommand & command,
+ boost::system::error_code native_non_blocking(
+ bool mode,
       boost::system::error_code & ec);
 
 
-This function is used to execute an IO control command on the socket.
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
 
 
 [heading Parameters]
@@ -23629,28 +27163,81 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the socket.]]
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
 
 ]
 
 
-
 [heading Example]
   
-Getting the number of bytes ready to read:
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::bytes_readable command;
- boost::system::error_code ec;
- socket.io_control(command, ec);
- if (ec)
+ template <typename Handler>
+ struct sendfile_op
    {
- // An error occurred.
- }
- std::size_t bytes_readable = command.get();
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
 
 
 
@@ -23664,42 +27251,68 @@
 [endsect]
 
 
-[section:io_service basic_socket_streambuf::io_service]
+[section:native_type basic_socket::native_type]
+
+[indexterm2 native_type..basic_socket]
+(Deprecated: Use native\_handle\_type.) The native representation of a socket.
 
 
-['Inherited from basic_io_object.]
+ typedef SocketService::native_handle_type native_type;
 
-[indexterm2 io_service..basic_socket_streambuf]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
- boost::asio::io_service & io_service();
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket.hpp]
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[endsect]
 
 
+[section:non_blocking basic_socket::non_blocking]
 
+[indexterm2 non_blocking..basic_socket]
+Gets the non-blocking mode of the socket.
 
-[endsect]
 
+ bool ``[link boost_asio.reference.basic_socket.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload1 more...]]``
 
 
-[section:is_open basic_socket_streambuf::is_open]
+Sets the non-blocking mode of the socket.
 
 
-['Inherited from basic_socket.]
+ void ``[link boost_asio.reference.basic_socket.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload2 more...]]``
 
-[indexterm2 is_open..basic_socket_streambuf]
-Determine whether the socket is open.
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.non_blocking.overload3 more...]]``
 
 
- bool is_open() const;
+[section:overload1 basic_socket::non_blocking (1 of 3 overloads)]
+
+
+Gets the non-blocking mode of the socket.
+
+
+ bool non_blocking() const;
+
+
+
+[heading Return Value]
+
+`true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
 
 
 
@@ -23707,97 +27320,109 @@
 
 
 
-[section:keep_alive basic_socket_streambuf::keep_alive]
+[section:overload2 basic_socket::non_blocking (2 of 3 overloads)]
 
 
-['Inherited from socket_base.]
+Sets the non-blocking mode of the socket.
 
-[indexterm2 keep_alive..basic_socket_streambuf]
-Socket option to send keep-alives.
 
+ void non_blocking(
+ bool mode);
 
- typedef implementation_defined keep_alive;
 
 
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
 
-Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
+]
 
 
-[heading Examples]
+[heading Exceptions]
+
+
+[variablelist
   
-Setting the option:
+[[boost::system::system_error][Thrown on failure.]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::keep_alive option(true);
- socket.set_option(option);
+]
 
 
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
 
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::keep_alive option;
- socket.get_option(option);
- bool is_set = option.value();
+[endsect]
 
 
 
+[section:overload3 basic_socket::non_blocking (3 of 3 overloads)]
 
 
+Sets the non-blocking mode of the socket.
 
 
-[heading Requirements]
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[heading Parameters]
+
 
-[endsect]
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
-[section:linger basic_socket_streambuf::linger]
 
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
-['Inherited from socket_base.]
 
-[indexterm2 linger..basic_socket_streambuf]
-Socket option to specify whether the socket lingers on close if unsent data is present.
 
 
- typedef implementation_defined linger;
+[endsect]
 
 
+[endsect]
 
-Implements the SOL\_SOCKET/SO\_LINGER socket option.
 
+[section:non_blocking_io basic_socket::non_blocking_io]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::linger option(true, 30);
- socket.set_option(option);
+['Inherited from socket_base.]
+
+[indexterm2 non_blocking_io..basic_socket]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
 
 
+ typedef implementation_defined non_blocking_io;
 
 
 
-Getting the current option value:
+Implements the FIONBIO IO control command.
+
+
+[heading Example]
+
+
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::linger option;
- socket.get_option(option);
- bool is_set = option.enabled();
- unsigned short timeout = option.timeout();
+ boost::asio::socket_base::non_blocking_io command(true);
+ socket.io_control(command);
 
 
 
@@ -23807,7 +27432,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -23815,38 +27440,43 @@
 [endsect]
 
 
-[section:local_endpoint basic_socket_streambuf::local_endpoint]
+[section:open basic_socket::open]
 
-[indexterm2 local_endpoint..basic_socket_streambuf]
-Get the local endpoint of the socket.
+[indexterm2 open..basic_socket]
+Open the socket using the specified protocol.
 
 
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload1 local_endpoint]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_socket.open.overload1 open]``(
+ const protocol_type & protocol = protocol_type());
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload1 more...]]``
 
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload2 local_endpoint]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload2 more...]]``
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.open.overload2 more...]]``
 
 
-[section:overload1 basic_socket_streambuf::local_endpoint (1 of 2 overloads)]
+[section:overload1 basic_socket::open (1 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+Open the socket using the specified protocol.
 
 
-Get the local endpoint of the socket.
+ void open(
+ const protocol_type & protocol = protocol_type());
 
 
- endpoint_type local_endpoint() const;
+This function opens the socket so that it will use the specified protocol.
 
 
-This function is used to obtain the locally bound endpoint of the socket.
+[heading Parameters]
+
 
+[variablelist
+
+[[protocol][An object specifying protocol parameters to be used.]]
 
-[heading Return Value]
-
-An object that represents the local endpoint of the socket.
+]
 
 
 [heading Exceptions]
@@ -23864,8 +27494,7 @@
 
 
    boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
+ socket.open(boost::asio::ip::tcp::v4());
 
 
 
@@ -23877,20 +27506,18 @@
 
 
 
-[section:overload2 basic_socket_streambuf::local_endpoint (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::open (2 of 2 overloads)]
 
 
-Get the local endpoint of the socket.
+Open the socket using the specified protocol.
 
 
- endpoint_type local_endpoint(
- boost::system::error_code & ec) const;
+ boost::system::error_code open(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
 
 
-This function is used to obtain the locally bound endpoint of the socket.
+This function opens the socket so that it will use the specified protocol.
 
 
 [heading Parameters]
@@ -23898,24 +27525,20 @@
 
 [variablelist
   
+[[protocol][An object specifying which protocol is to be used.]]
+
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Return Value]
-
-An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
-
-
 [heading Example]
   
 
 
    boost::asio::ip::tcp::socket socket(io_service);
- ...
    boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
+ socket.open(boost::asio::ip::tcp::v4(), ec);
    if (ec)
    {
      // An error occurred.
@@ -23932,487 +27555,327 @@
 
 [endsect]
 
-[section:lowest_layer basic_socket_streambuf::lowest_layer]
 
-[indexterm2 lowest_layer..basic_socket_streambuf]
-Get a reference to the lowest layer.
+[section:operator_eq_ basic_socket::operator=]
 
+[indexterm2 operator=..basic_socket]
+Move-assign a [link boost_asio.reference.basic_socket `basic_socket`] from another.
 
- lowest_layer_type & ``[link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload1 more...]]``
 
+ basic_socket & operator=(
+ basic_socket && other);
 
-Get a const reference to the lowest layer.
 
+This assignment operator moves a socket from one object to another.
 
- const lowest_layer_type & ``[link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload2 more...]]``
 
+[heading Parameters]
+
 
-[section:overload1 basic_socket_streambuf::lowest_layer (1 of 2 overloads)]
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_socket `basic_socket`] object from which the move will occur.]]
 
+]
 
-['Inherited from basic_socket.]
 
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_socket(io_service&) constructor`.
 
-Get a reference to the lowest layer.
 
 
- lowest_layer_type & lowest_layer();
 
+[endsect]
 
-This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
 
 
-[heading Return Value]
-
-A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+[section:protocol_type basic_socket::protocol_type]
 
+[indexterm2 protocol_type..basic_socket]
+The protocol type.
 
 
+ typedef Protocol protocol_type;
 
-[endsect]
 
 
+[heading Requirements]
 
-[section:overload2 basic_socket_streambuf::lowest_layer (2 of 2 overloads)]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-['Inherited from basic_socket.]
 
+[endsect]
 
-Get a const reference to the lowest layer.
 
 
- const lowest_layer_type & lowest_layer() const;
+[section:receive_buffer_size basic_socket::receive_buffer_size]
 
 
-This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
+['Inherited from socket_base.]
 
+[indexterm2 receive_buffer_size..basic_socket]
+Socket option for the receive buffer size of a socket.
 
-[heading Return Value]
-
-A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
+ typedef implementation_defined receive_buffer_size;
 
 
 
-[endsect]
+Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
 
 
-[endsect]
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_buffer_size option(8192);
+ socket.set_option(option);
 
-[section:lowest_layer_type basic_socket_streambuf::lowest_layer_type]
 
 
-['Inherited from basic_socket.]
 
-[indexterm2 lowest_layer_type..basic_socket_streambuf]
-A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
 
+Getting the current option value:
 
- typedef basic_socket< Protocol, StreamSocketService > lowest_layer_type;
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
 
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
 
- [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
 
- [
+[heading Requirements]
 
- [[link boost_asio.reference.basic_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
- [
+[*Convenience header: ][^boost/asio.hpp]
 
- [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
+[section:receive_low_watermark basic_socket::receive_low_watermark]
 
- [
 
- [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+['Inherited from socket_base.]
 
- [
+[indexterm2 receive_low_watermark..basic_socket]
+Socket option for the receive low watermark.
 
- [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
 
- [
+ typedef implementation_defined receive_low_watermark;
 
- [[link boost_asio.reference.basic_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
+Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
 
- [
 
- [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
+[heading Examples]
   
- ]
+Setting the option:
 
- [
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_low_watermark option(1024);
+ socket.set_option(option);
 
- [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+Getting the current option value:
 
- [
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
 
- [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
+[heading Requirements]
 
- [
+[*Header: ][^boost/asio/basic_socket.hpp]
 
- [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
+[*Convenience header: ][^boost/asio.hpp]
 
- [
 
- [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
+[section:remote_endpoint basic_socket::remote_endpoint]
 
-]
+[indexterm2 remote_endpoint..basic_socket]
+Get the remote endpoint of the socket.
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
- [Construct a basic_socket without opening it.
+ endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload1 remote_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload1 more...]]``
 
- Construct and open a basic_socket.
+ endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload2 remote_endpoint]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.remote_endpoint.overload2 more...]]``
 
- Construct a basic_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_socket on an existing native socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.close [*close]]]
- [Close the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
- [Get an option from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
+[section:overload1 basic_socket::remote_endpoint (1 of 2 overloads)]
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.open [*open]]]
- [Open the socket using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
+
+Get the remote endpoint of the socket.
+
+
+ endpoint_type remote_endpoint() const;
+
+
+This function is used to obtain the remote endpoint of the socket.
+
+
+[heading Return Value]
+
+An object that represents the remote endpoint of the socket.
+
+
+[heading Exceptions]
+
+
+[variablelist
   
+[[boost::system::system_error][Thrown on failure.]]
+
 ]
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
- [Protected destructor to prevent deletion through this type. ]
- ]
+[heading Example]
   
-]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
 
- [
- [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
 
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.service [*service]]]
- [The service associated with the I/O object. ]
- ]
+[endsect]
 
-]
 
-The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
 
+[section:overload2 basic_socket::remote_endpoint (2 of 2 overloads)]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+Get the remote endpoint of the socket.
 
 
+ endpoint_type remote_endpoint(
+ boost::system::error_code & ec) const;
 
 
-[heading Requirements]
+This function is used to obtain the remote endpoint of the socket.
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
-[endsect]
 
+[heading Return Value]
+
+An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
 
 
-[section:max_connections basic_socket_streambuf::max_connections]
+[heading Example]
+
 
 
-['Inherited from socket_base.]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
 
-[indexterm2 max_connections..basic_socket_streambuf]
-The maximum length of the queue of pending incoming connections.
 
 
- static const int max_connections = implementation_defined;
 
 
 
 [endsect]
 
 
+[endsect]
+
 
-[section:message_do_not_route basic_socket_streambuf::message_do_not_route]
+[section:reuse_address basic_socket::reuse_address]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 message_do_not_route..basic_socket_streambuf]
-Specify that the data should not be subject to routing.
+[indexterm2 reuse_address..basic_socket]
+Socket option to allow the socket to be bound to an address that is already in use.
 
 
- static const int message_do_not_route = implementation_defined;
+ typedef implementation_defined reuse_address;
 
 
 
-[endsect]
+Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
+
 
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option(true);
+ acceptor.set_option(option);
 
-[section:message_flags basic_socket_streambuf::message_flags]
 
 
-['Inherited from socket_base.]
 
-[indexterm2 message_flags..basic_socket_streambuf]
-Bitmask type for flags that can be passed to send and receive operations.
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
+
+
 
 
- typedef int message_flags;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -24421,75 +27884,106 @@
 
 
 
-[section:message_out_of_band basic_socket_streambuf::message_out_of_band]
+[section:send_buffer_size basic_socket::send_buffer_size]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 message_out_of_band..basic_socket_streambuf]
-Process out-of-band data.
+[indexterm2 send_buffer_size..basic_socket]
+Socket option for the send buffer size of a socket.
 
 
- static const int message_out_of_band = implementation_defined;
+ typedef implementation_defined send_buffer_size;
 
 
 
-[endsect]
+Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
 
 
+[heading Examples]
+
+Setting the option:
 
-[section:message_peek basic_socket_streambuf::message_peek]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option(8192);
+ socket.set_option(option);
 
 
-['Inherited from socket_base.]
 
-[indexterm2 message_peek..basic_socket_streambuf]
-Peek at incoming data without removing it from the input queue.
 
 
- static const int message_peek = implementation_defined;
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
 
 
 
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
 [endsect]
 
 
 
-[section:native basic_socket_streambuf::native]
+[section:send_low_watermark basic_socket::send_low_watermark]
 
 
-['Inherited from basic_socket.]
+['Inherited from socket_base.]
 
-[indexterm2 native..basic_socket_streambuf]
-Get the native socket representation.
+[indexterm2 send_low_watermark..basic_socket]
+Socket option for the send low watermark.
 
 
- native_type native();
+ typedef implementation_defined send_low_watermark;
 
 
-This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+
+Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
 
 
-[endsect]
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option(1024);
+ socket.set_option(option);
 
 
-[section:native_type basic_socket_streambuf::native_type]
 
 
-['Inherited from basic_socket.]
 
-[indexterm2 native_type..basic_socket_streambuf]
-The native representation of a socket.
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
+
+
 
 
- typedef StreamSocketService::native_type native_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -24498,40 +27992,46 @@
 
 
 
-[section:non_blocking_io basic_socket_streambuf::non_blocking_io]
+[section:service basic_socket::service]
 
 
-['Inherited from socket_base.]
+['Inherited from basic_io_object.]
 
-[indexterm2 non_blocking_io..basic_socket_streambuf]
-IO control command to set the blocking mode of the socket.
+[indexterm2 service..basic_socket]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
- typedef implementation_defined non_blocking_io;
+ service_type & service;
 
 
 
-Implements the FIONBIO IO control command.
+[heading Remarks]
+
+Available only for services that do not support movability.
 
 
-[heading Example]
-
 
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
+[endsect]
+
+
 
+[section:service_type basic_socket::service_type]
+
+
+['Inherited from basic_io_object.]
 
+[indexterm2 service_type..basic_socket]
+The type of the service that will be used to provide I/O operations.
 
 
+ typedef SocketService service_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+[*Header: ][^boost/asio/basic_socket.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -24539,36 +28039,39 @@
 [endsect]
 
 
-[section:open basic_socket_streambuf::open]
+[section:set_option basic_socket::set_option]
 
-[indexterm2 open..basic_socket_streambuf]
-Open the socket using the specified protocol.
+[indexterm2 set_option..basic_socket]
+Set an option on the socket.
 
 
- void ``[link boost_asio.reference.basic_socket_streambuf.open.overload1 open]``(
- const protocol_type & protocol = protocol_type());
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.open.overload1 more...]]``
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket.set_option.overload1 set_option]``(
+ const SettableSocketOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.open.overload2 open]``(
- const protocol_type & protocol,
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.open.overload2 more...]]``
-
-
-[section:overload1 basic_socket_streambuf::open (1 of 2 overloads)]
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.set_option.overload2 more...]]``
 
 
-['Inherited from basic_socket.]
+[section:overload1 basic_socket::set_option (1 of 2 overloads)]
 
 
-Open the socket using the specified protocol.
+Set an option on the socket.
 
 
- void open(
- const protocol_type & protocol = protocol_type());
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void set_option(
+ const SettableSocketOption & option);
 
 
-This function opens the socket so that it will use the specified protocol.
+This function is used to set an option on the socket.
 
 
 [heading Parameters]
@@ -24576,7 +28079,7 @@
 
 [variablelist
   
-[[protocol][An object specifying protocol parameters to be used.]]
+[[option][The new option value to be set on the socket.]]
 
 ]
 
@@ -24591,12 +28094,15 @@
 ]
 
 
+
 [heading Example]
   
-
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
 
    boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ socket.set_option(option);
 
 
 
@@ -24608,21 +28114,20 @@
 
 
 
-[section:overload2 basic_socket_streambuf::open (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::set_option (2 of 2 overloads)]
 
 
-Open the socket using the specified protocol.
+Set an option on the socket.
 
 
- boost::system::error_code open(
- const protocol_type & protocol,
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ const SettableSocketOption & option,
       boost::system::error_code & ec);
 
 
-This function opens the socket so that it will use the specified protocol.
+This function is used to set an option on the socket.
 
 
 [heading Parameters]
@@ -24630,20 +28135,23 @@
 
 [variablelist
   
-[[protocol][An object specifying which protocol is to be used.]]
+[[option][The new option value to be set on the socket.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+
 [heading Example]
   
-
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
 
    boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
    boost::system::error_code ec;
- socket.open(boost::asio::ip::tcp::v4(), ec);
+ socket.set_option(option, ec);
    if (ec)
    {
      // An error occurred.
@@ -24660,503 +28168,722 @@
 
 [endsect]
 
+[section:shutdown basic_socket::shutdown]
 
-[section:overflow basic_socket_streambuf::overflow]
+[indexterm2 shutdown..basic_socket]
+Disable sends or receives on the socket.
 
-[indexterm2 overflow..basic_socket_streambuf]
 
- int_type overflow(
- int_type c);
+ void ``[link boost_asio.reference.basic_socket.shutdown.overload1 shutdown]``(
+ shutdown_type what);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.shutdown.overload2 shutdown]``(
+ shutdown_type what,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket.shutdown.overload2 more...]]``
 
 
-[endsect]
+[section:overload1 basic_socket::shutdown (1 of 2 overloads)]
 
 
+Disable sends or receives on the socket.
 
-[section:protocol_type basic_socket_streambuf::protocol_type]
 
+ void shutdown(
+ shutdown_type what);
 
-['Inherited from basic_socket.]
 
-[indexterm2 protocol_type..basic_socket_streambuf]
-The protocol type.
+This function is used to disable send operations, receive operations, or both.
 
 
- typedef Protocol protocol_type;
+[heading Parameters]
+
 
+[variablelist
+
+[[what][Determines what types of operation will no longer be allowed.]]
 
+]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+[heading Exceptions]
+
 
-[*Convenience header: ][^boost/asio.hpp]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
+]
 
-[endsect]
 
+[heading Example]
+
+Shutting down the send side of the socket:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
 
-[section:receive_buffer_size basic_socket_streambuf::receive_buffer_size]
 
 
-['Inherited from socket_base.]
 
-[indexterm2 receive_buffer_size..basic_socket_streambuf]
-Socket option for the receive buffer size of a socket.
 
 
- typedef implementation_defined receive_buffer_size;
 
+[endsect]
 
 
-Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
 
+[section:overload2 basic_socket::shutdown (2 of 2 overloads)]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option(8192);
- socket.set_option(option);
+Disable sends or receives on the socket.
 
 
+ boost::system::error_code shutdown(
+ shutdown_type what,
+ boost::system::error_code & ec);
 
 
+This function is used to disable send operations, receive operations, or both.
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option;
- socket.get_option(option);
- int size = option.value();
+[heading Parameters]
+
 
+[variablelist
+
+[[what][Determines what types of operation will no longer be allowed.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
+[heading Example]
+
+Shutting down the send side of the socket:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
 
 
+[endsect]
 
-[section:receive_low_watermark basic_socket_streambuf::receive_low_watermark]
 
+[endsect]
 
-['Inherited from socket_base.]
 
-[indexterm2 receive_low_watermark..basic_socket_streambuf]
-Socket option for the receive low watermark.
+[section:shutdown_type basic_socket::shutdown_type]
 
 
- typedef implementation_defined receive_low_watermark;
+['Inherited from socket_base.]
 
+[indexterm2 shutdown_type..basic_socket]
+Different ways a socket may be shutdown.
 
 
-Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
+ enum shutdown_type
 
+[indexterm2 shutdown_receive..basic_socket]
+[indexterm2 shutdown_send..basic_socket]
+[indexterm2 shutdown_both..basic_socket]
 
-[heading Examples]
-
-Setting the option:
+[heading Values]
+[variablelist
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option(1024);
- socket.set_option(option);
+ [
+ [shutdown_receive]
+ [Shutdown the receive side of the socket. ]
+ ]
 
+ [
+ [shutdown_send]
+ [Shutdown the send side of the socket. ]
+ ]
 
+ [
+ [shutdown_both]
+ [Shutdown both send and receive on the socket. ]
+ ]
 
+]
 
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option;
- socket.get_option(option);
- int size = option.value();
+[endsect]
 
 
 
+[section:_basic_socket basic_socket::~basic_socket]
 
+[indexterm2 ~basic_socket..basic_socket]
+Protected destructor to prevent deletion through this type.
 
 
+ ~basic_socket();
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
+
 
 
 [endsect]
 
+[section:basic_socket_acceptor basic_socket_acceptor]
 
-[section:remote_endpoint basic_socket_streambuf::remote_endpoint]
 
-[indexterm2 remote_endpoint..basic_socket_streambuf]
-Get the remote endpoint of the socket.
+Provides the ability to accept new connections.
 
 
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload1 remote_endpoint]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload1 more...]]``
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketAcceptorService SocketAcceptorService]`` = socket_acceptor_service<Protocol>>
+ class basic_socket_acceptor :
+ public basic_io_object< SocketAcceptorService >,
+ public socket_base
 
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload2 remote_endpoint]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload2 more...]]``
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-[section:overload1 basic_socket_streambuf::remote_endpoint (1 of 2 overloads)]
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
 
-['Inherited from basic_socket.]
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
-Get the remote endpoint of the socket.
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
 
- endpoint_type remote_endpoint() const;
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
 
-This function is used to obtain the remote endpoint of the socket.
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
 
-[heading Return Value]
-
-An object that represents the remote endpoint of the socket.
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
-[heading Exceptions]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.basic_socket_acceptor.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
-[[boost::system::system_error][Thrown on failure.]]
+ ]
 
-]
+ [
+
+ [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
 
+ [
 
-[heading Example]
+ [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
   
+ ]
 
+ [
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
+ [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
+
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
+ [The native representation of an acceptor. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of an acceptor. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
-[section:overload2 basic_socket_streambuf::remote_endpoint (2 of 2 overloads)]
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
-['Inherited from basic_socket.]
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
 
-Get the remote endpoint of the socket.
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
 
- endpoint_type remote_endpoint(
- boost::system::error_code & ec) const;
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
 
-This function is used to obtain the remote endpoint of the socket.
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
-[heading Parameters]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
   
-[[ec][Set to indicate what error occurred, if any.]]
+ ]
 
 ]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[heading Return Value]
-
-An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
-
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
+ [Accept a new connection.
 
-[heading Example]
+ Accept a new connection and obtain the endpoint of the peer. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
+ [Assigns an existing native acceptor to the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
+ [Start an asynchronous accept. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
+ [Construct an acceptor without opening it.
 
+ Construct an open acceptor.
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
- if (ec)
- {
- // An error occurred.
- }
-
+ Construct an acceptor opened on the given endpoint.
 
+ Construct a basic_socket_acceptor on an existing native acceptor.
 
+ Move-construct a basic_socket_acceptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
+ [Bind the acceptor to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
+ [Close the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
+ [Get an option from the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
+ [Perform an IO control command on the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
+ [Determine whether the acceptor is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
+ [Place the acceptor into the state where it will listen for new connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native acceptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
+ [Get the native acceptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native acceptor implementation.
 
+ Sets the non-blocking mode of the native acceptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the acceptor.
 
+ Sets the non-blocking mode of the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
+ [Open the acceptor using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket_acceptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
+ [Set an option on the acceptor. ]
+ ]
+
+]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
 
-[section:reuse_address basic_socket_streambuf::reuse_address]
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
 
-['Inherited from socket_base.]
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
 
-[indexterm2 reuse_address..basic_socket_streambuf]
-Socket option to allow the socket to be bound to an address that is already in use.
+]
 
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
- typedef implementation_defined reuse_address;
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
+]
 
-Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
+The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
 
 
-[heading Examples]
+[heading Thread Safety]
   
-Setting the option:
+[*Distinct] [*objects:] Safe.
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option(true);
- acceptor.set_option(option);
+[*Shared] [*objects:] Unsafe.
 
 
+[heading Example]
+
+Opening a socket acceptor with the SO\_REUSEADDR option enabled:
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
+ acceptor.open(endpoint.protocol());
+ acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
+ acceptor.bind(endpoint);
+ acceptor.listen();
 
 
-Getting the current option value:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option;
- acceptor.get_option(option);
- bool is_set = option.value();
 
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
+[section:accept basic_socket_acceptor::accept]
 
-[heading Requirements]
+[indexterm2 accept..basic_socket_acceptor]
+Accept a new connection.
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload1 accept]``(
+ basic_socket< protocol_type, SocketService > & peer);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload1 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.accept.overload2 accept]``(
+ basic_socket< protocol_type, SocketService > & peer,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload2 more...]]``
 
-[endsect]
 
+Accept a new connection and obtain the endpoint of the peer.
 
 
-[section:send_buffer_size basic_socket_streambuf::send_buffer_size]
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.accept.overload3 accept]``(
+ basic_socket< protocol_type, SocketService > & peer,
+ endpoint_type & peer_endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload3 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.accept.overload4 accept]``(
+ basic_socket< protocol_type, SocketService > & peer,
+ endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.accept.overload4 more...]]``
 
-['Inherited from socket_base.]
 
-[indexterm2 send_buffer_size..basic_socket_streambuf]
-Socket option for the send buffer size of a socket.
+[section:overload1 basic_socket_acceptor::accept (1 of 4 overloads)]
 
 
- typedef implementation_defined send_buffer_size;
+Accept a new connection.
 
 
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ void accept(
+ basic_socket< protocol_type, SocketService > & peer);
 
-Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
 
+This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option(8192);
- socket.set_option(option);
+[heading Parameters]
+
 
+[variablelist
+
+[[peer][The socket into which the new connection will be accepted.]]
 
+]
 
 
+[heading Exceptions]
+
 
-Getting the current option value:
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option;
- socket.get_option(option);
- int size = option.value();
+]
 
 
+[heading Example]
+
 
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::socket socket(io_service);
+ acceptor.accept(socket);
 
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:send_low_watermark basic_socket_streambuf::send_low_watermark]
+[section:overload2 basic_socket_acceptor::accept (2 of 4 overloads)]
 
 
-['Inherited from socket_base.]
-
-[indexterm2 send_low_watermark..basic_socket_streambuf]
-Socket option for the send low watermark.
+Accept a new connection.
 
 
- typedef implementation_defined send_low_watermark;
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ boost::system::error_code accept(
+ basic_socket< protocol_type, SocketService > & peer,
+ boost::system::error_code & ec);
 
 
+This function is used to accept a new connection from a peer into the given socket. The function call will block until a new connection has been accepted successfully or an error occurs.
 
-Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
 
+[heading Parameters]
+
 
-[heading Examples]
+[variablelist
   
-Setting the option:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_low_watermark option(1024);
- socket.set_option(option);
+[[peer][The socket into which the new connection will be accepted.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
+[heading Example]
+
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
    ...
- boost::asio::socket_base::send_low_watermark option;
- socket.get_option(option);
- int size = option.value();
-
-
-
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:service basic_socket_streambuf::service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 service..basic_socket_streambuf]
-The service associated with the I/O object.
-
-
- service_type & service;
-
-
-
-[endsect]
-
-
-
-[section:service_type basic_socket_streambuf::service_type]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 service_type..basic_socket_streambuf]
-The type of the service that will be used to provide I/O operations.
-
-
- typedef StreamSocketService service_type;
+ boost::asio::ip::tcp::soocket socket(io_service);
+ boost::system::error_code ec;
+ acceptor.accept(socket, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:set_option basic_socket_streambuf::set_option]
-
-[indexterm2 set_option..basic_socket_streambuf]
-Set an option on the socket.
-
-
- void ``[link boost_asio.reference.basic_socket_streambuf.set_option.overload1 set_option]``(
- const SettableSocketOption & option);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.set_option.overload1 more...]]``
-
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.set_option.overload2 set_option]``(
- const SettableSocketOption & option,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.set_option.overload2 more...]]``
-
 
-[section:overload1 basic_socket_streambuf::set_option (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload3 basic_socket_acceptor::accept (3 of 4 overloads)]
 
 
-Set an option on the socket.
+Accept a new connection and obtain the endpoint of the peer.
 
 
   template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void set_option(
- const SettableSocketOption & option);
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ void accept(
+ basic_socket< protocol_type, SocketService > & peer,
+ endpoint_type & peer_endpoint);
 
 
-This function is used to set an option on the socket.
+This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
 
 
 [heading Parameters]
@@ -25164,7 +28891,9 @@
 
 [variablelist
   
-[[option][The new option value to be set on the socket.]]
+[[peer][The socket into which the new connection will be accepted.]]
+
+[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
 
 ]
 
@@ -25179,15 +28908,15 @@
 ]
 
 
-
 [heading Example]
   
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
 
- boost::asio::ip::tcp::socket socket(io_service);
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
    ...
- boost::asio::ip::tcp::no_delay option(true);
- socket.set_option(option);
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint;
+ acceptor.accept(socket, endpoint);
 
 
 
@@ -25199,23 +28928,21 @@
 
 
 
-[section:overload2 basic_socket_streambuf::set_option (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload4 basic_socket_acceptor::accept (4 of 4 overloads)]
 
 
-Set an option on the socket.
+Accept a new connection and obtain the endpoint of the peer.
 
 
   template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code set_option(
- const SettableSocketOption & option,
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ boost::system::error_code accept(
+ basic_socket< protocol_type, SocketService > & peer,
+ endpoint_type & peer_endpoint,
       boost::system::error_code & ec);
 
 
-This function is used to set an option on the socket.
+This function is used to accept a new connection from a peer into the given socket, and additionally provide the endpoint of the remote peer. The function call will block until a new connection has been accepted successfully or an error occurs.
 
 
 [heading Parameters]
@@ -25223,23 +28950,25 @@
 
 [variablelist
   
-[[option][The new option value to be set on the socket.]]
+[[peer][The socket into which the new connection will be accepted.]]
+
+[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-
 [heading Example]
   
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
 
- boost::asio::ip::tcp::socket socket(io_service);
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
    ...
- boost::asio::ip::tcp::no_delay option(true);
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint;
    boost::system::error_code ec;
- socket.set_option(option, ec);
+ acceptor.accept(socket, endpoint, ec);
    if (ec)
    {
      // An error occurred.
@@ -25256,105 +28985,162 @@
 
 [endsect]
 
+[section:assign basic_socket_acceptor::assign]
 
-[section:setbuf basic_socket_streambuf::setbuf]
+[indexterm2 assign..basic_socket_acceptor]
+Assigns an existing native acceptor to the acceptor.
 
-[indexterm2 setbuf..basic_socket_streambuf]
 
- std::streambuf * setbuf(
- char_type * s,
- std::streamsize n);
+ void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_acceptor);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.assign.overload2 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_acceptor,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.assign.overload2 more...]]``
+
+
+[section:overload1 basic_socket_acceptor::assign (1 of 2 overloads)]
+
+
+Assigns an existing native acceptor to the acceptor.
+
+
+ void assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_acceptor);
 
 
 
 [endsect]
 
 
-[section:shutdown basic_socket_streambuf::shutdown]
 
-[indexterm2 shutdown..basic_socket_streambuf]
-Disable sends or receives on the socket.
+[section:overload2 basic_socket_acceptor::assign (2 of 2 overloads)]
 
 
- void ``[link boost_asio.reference.basic_socket_streambuf.shutdown.overload1 shutdown]``(
- shutdown_type what);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.shutdown.overload1 more...]]``
+Assigns an existing native acceptor to the acceptor.
 
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.shutdown.overload2 shutdown]``(
- shutdown_type what,
+
+ boost::system::error_code assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_acceptor,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.shutdown.overload2 more...]]``
 
 
-[section:overload1 basic_socket_streambuf::shutdown (1 of 2 overloads)]
 
+[endsect]
 
-['Inherited from basic_socket.]
 
+[endsect]
 
-Disable sends or receives on the socket.
+[section:async_accept basic_socket_acceptor::async_accept]
 
+[indexterm2 async_accept..basic_socket_acceptor]
+Start an asynchronous accept.
 
- void shutdown(
- shutdown_type what);
 
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 async_accept]``(
+ basic_socket< protocol_type, SocketService > & peer,
+ AcceptHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload1 more...]]``
 
-This function is used to disable send operations, receive operations, or both.
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 async_accept]``(
+ basic_socket< protocol_type, SocketService > & peer,
+ endpoint_type & peer_endpoint,
+ AcceptHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.async_accept.overload2 more...]]``
 
 
-[heading Parameters]
-
+[section:overload1 basic_socket_acceptor::async_accept (1 of 2 overloads)]
 
-[variablelist
-
-[[what][Determines what types of operation will no longer be allowed.]]
 
-]
+Start an asynchronous accept.
 
 
-[heading Exceptions]
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
+ void async_accept(
+ basic_socket< protocol_type, SocketService > & peer,
+ AcceptHandler handler);
+
+
+This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately.
+
+
+[heading Parameters]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[peer][The socket into which the new connection will be accepted. Ownership of the peer object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
+
+[[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error // Result of operation.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
 ]
 
 
 [heading Example]
   
-Shutting down the send side of the socket:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
 
+ void accept_handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Accept succeeded.
+ }
+ }
+
+ ...
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::socket socket(io_service);
+ acceptor.async_accept(socket, accept_handler);
 
 
 
 
 
-[endsect]
 
 
+[endsect]
 
-[section:overload2 basic_socket_streambuf::shutdown (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+[section:overload2 basic_socket_acceptor::async_accept (2 of 2 overloads)]
 
 
-Disable sends or receives on the socket.
+Start an asynchronous accept.
 
 
- boost::system::error_code shutdown(
- shutdown_type what,
- boost::system::error_code & ec);
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename ``[link boost_asio.reference.AcceptHandler AcceptHandler]``>
+ void async_accept(
+ basic_socket< protocol_type, SocketService > & peer,
+ endpoint_type & peer_endpoint,
+ AcceptHandler handler);
 
 
-This function is used to disable send operations, receive operations, or both.
+This function is used to asynchronously accept a new connection into a socket, and additionally obtain the endpoint of the remote peer. The function call always returns immediately.
 
 
 [heading Parameters]
@@ -25362,584 +29148,366 @@
 
 [variablelist
   
-[[what][Determines what types of operation will no longer be allowed.]]
+[[peer][The socket into which the new connection will be accepted. Ownership of the peer object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[[peer_endpoint][An endpoint object into which the endpoint of the remote peer will be written. Ownership of the peer\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
+
+[[handler][The handler to be called when the accept operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error // Result of operation.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`. ]]
 
 ]
 
 
-[heading Example]
-
-Shutting down the send side of the socket:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
- if (ec)
- {
- // An error occurred.
- }
+
+[endsect]
 
 
+[endsect]
 
+[section:basic_socket_acceptor basic_socket_acceptor::basic_socket_acceptor]
 
+[indexterm2 basic_socket_acceptor..basic_socket_acceptor]
+Construct an acceptor without opening it.
 
 
+ explicit ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 basic_socket_acceptor]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 more...]]``
 
-[endsect]
 
+Construct an open acceptor.
 
-[endsect]
 
+ ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 basic_socket_acceptor]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 more...]]``
 
-[section:shutdown_type basic_socket_streambuf::shutdown_type]
 
+Construct an acceptor opened on the given endpoint.
 
-['Inherited from socket_base.]
 
-[indexterm2 shutdown_type..basic_socket_streambuf]
-Different ways a socket may be shutdown.
+ ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 basic_socket_acceptor]``(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint,
+ bool reuse_addr = true);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload3 more...]]``
 
 
- enum shutdown_type
+Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor.
 
-[indexterm2 shutdown_receive..basic_socket_streambuf]
-[indexterm2 shutdown_send..basic_socket_streambuf]
-[indexterm2 shutdown_both..basic_socket_streambuf]
 
-[heading Values]
-[variablelist
+ ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 basic_socket_acceptor]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_acceptor);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload4 more...]]``
 
- [
- [shutdown_receive]
- [Shutdown the receive side of the socket. ]
- ]
 
- [
- [shutdown_send]
- [Shutdown the send side of the socket. ]
- ]
+Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another.
 
- [
- [shutdown_both]
- [Shutdown both send and receive on the socket. ]
- ]
 
-]
+ ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 basic_socket_acceptor]``(
+ basic_socket_acceptor && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload5 more...]]``
 
 
+[section:overload1 basic_socket_acceptor::basic_socket_acceptor (1 of 5 overloads)]
 
-[endsect]
 
+Construct an acceptor without opening it.
 
 
-[section:sync basic_socket_streambuf::sync]
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service);
 
-[indexterm2 sync..basic_socket_streambuf]
 
- int sync();
+This constructor creates an acceptor without opening it to listen for new connections. The `open()` function must be called before the acceptor can accept new socket connections.
 
 
+[heading Parameters]
+
 
-[endsect]
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor. ]]
 
+]
 
 
-[section:underflow basic_socket_streambuf::underflow]
 
-[indexterm2 underflow..basic_socket_streambuf]
 
- int_type underflow();
+[endsect]
 
 
 
-[endsect]
+[section:overload2 basic_socket_acceptor::basic_socket_acceptor (2 of 5 overloads)]
 
 
+Construct an open acceptor.
 
-[section:_basic_socket_streambuf basic_socket_streambuf::~basic_socket_streambuf]
 
-[indexterm2 ~basic_socket_streambuf..basic_socket_streambuf]
-Destructor flushes buffered data.
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
 
 
- virtual ~basic_socket_streambuf();
+This constructor creates an acceptor and automatically opens it.
 
 
+[heading Parameters]
+
 
-[endsect]
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
 
+[[protocol][An object specifying protocol parameters to be used.]]
 
+]
 
-[endsect]
 
-[section:basic_stream_socket basic_stream_socket]
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
-Provides stream-oriented socket functionality.
+]
 
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.StreamSocketService StreamSocketService]`` = stream_socket_service<Protocol>>
- class basic_stream_socket :
- public basic_socket< Protocol, StreamSocketService >
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
 
- [
+[section:overload3 basic_socket_acceptor::basic_socket_acceptor (3 of 5 overloads)]
 
- [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
 
- [
+Construct an acceptor opened on the given endpoint.
 
- [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
 
- [
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint,
+ bool reuse_addr = true);
 
- [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
 
- [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
+[heading Parameters]
+
 
- [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
+[variablelist
   
- ]
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
 
- [
+[[endpoint][An endpoint on the local machine on which the acceptor will listen for new connections.]]
 
- [[link boost_asio.reference.basic_stream_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+[[reuse_addr][Whether the constructor should set the socket option `socket_base::reuse_address`.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
 
- [
+[heading Exceptions]
+
 
- [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+[variablelist
   
- ]
+[[boost::system::system_error][Thrown on failure.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
 
- [
+[heading Remarks]
+
+This constructor is equivalent to the following code:
 
- [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
+ basic_socket_acceptor<Protocol> acceptor(io_service);
+ acceptor.open(endpoint.protocol());
+ if (reuse_addr)
+ acceptor.set_option(socket_base::reuse_address(true));
+ acceptor.bind(endpoint);
+ acceptor.listen(listen_backlog);
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
+[section:overload4 basic_socket_acceptor::basic_socket_acceptor (4 of 5 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
+Construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] on an existing native acceptor.
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_acceptor);
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
+This constructor creates an acceptor object to hold an existing native acceptor.
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+[heading Parameters]
+
+
+[variablelist
   
- ]
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
 
- [
+[[protocol][An object specifying protocol parameters to be used.]]
 
- [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
+[[native_acceptor][A native acceptor.]]
 
 ]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
- [Start an asynchronous receive. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
- [Start an asynchronous send. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
- [Construct a basic_stream_socket without opening it.
+[heading Exceptions]
+
 
- Construct and open a basic_stream_socket.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
- Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
+]
 
- Construct a basic_stream_socket on an existing native socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.close [*close]]]
- [Close the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
- [Get an option from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.open [*open]]]
- [Open the socket using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
- [Read some data from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
- [Receive some data on the socket.
 
- Receive some data on a connected socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.send [*send]]]
- [Send some data on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
- [Write some data to the socket. ]
- ]
-
-]
 
-[heading Data Members]
-[table
- [[Name][Description]]
+[endsect]
 
- [
- [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
 
- [
- [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
 
- [
- [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
+[section:overload5 basic_socket_acceptor::basic_socket_acceptor (5 of 5 overloads)]
 
- [
- [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
 
-]
+Move-construct a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another.
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_stream_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
+ basic_socket_acceptor(
+ basic_socket_acceptor && other);
 
- [
- [[link boost_asio.reference.basic_stream_socket.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
+This constructor moves an acceptor from one object to another.
 
-The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
 
+[heading Parameters]
+
 
-[heading Thread Safety]
+[variablelist
   
-[*Distinct] [*objects:] Safe.
+[[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
 
-[*Shared] [*objects:] Unsafe.
+]
 
 
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(io_service&) constructor`.
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
-[section:assign basic_stream_socket::assign]
 
-[indexterm2 assign..basic_stream_socket]
-Assign an existing native socket to the socket.
+[endsect]
 
+[section:bind basic_socket_acceptor::bind]
 
- void ``[link boost_asio.reference.basic_stream_socket.assign.overload1 assign]``(
- const protocol_type & protocol,
- const native_type & native_socket);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload1 more...]]``
+[indexterm2 bind..basic_socket_acceptor]
+Bind the acceptor to the given local endpoint.
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.assign.overload2 assign]``(
- const protocol_type & protocol,
- const native_type & native_socket,
+
+ void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.bind.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::assign (1 of 2 overloads)]
+[section:overload1 basic_socket_acceptor::bind (1 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+Bind the acceptor to the given local endpoint.
 
 
-Assign an existing native socket to the socket.
+ void bind(
+ const endpoint_type & endpoint);
 
 
- void assign(
- const protocol_type & protocol,
- const native_type & native_socket);
+This function binds the socket acceptor to the specified endpoint on the local machine.
 
 
+[heading Parameters]
+
 
-[endsect]
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
 
+]
 
 
-[section:overload2 basic_stream_socket::assign (2 of 2 overloads)]
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-['Inherited from basic_socket.]
+]
 
 
-Assign an existing native socket to the socket.
+[heading Example]
+
 
 
- boost::system::error_code assign(
- const protocol_type & protocol,
- const native_type & native_socket,
- boost::system::error_code & ec);
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ acceptor.open(boost::asio::ip::tcp::v4());
+ acceptor.bind(boost::asio::ip::tcp::endpoint(12345));
 
 
 
-[endsect]
 
 
-[endsect]
 
 
-[section:async_connect basic_stream_socket::async_connect]
+[endsect]
 
 
-['Inherited from basic_socket.]
 
-[indexterm2 async_connect..basic_stream_socket]
-Start an asynchronous connect.
+[section:overload2 basic_socket_acceptor::bind (2 of 2 overloads)]
 
 
- template<
- typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
- void async_connect(
- const endpoint_type & peer_endpoint,
- ConnectHandler handler);
+Bind the acceptor to the given local endpoint.
 
 
-This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
+ boost::system::error_code bind(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
 
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+This function binds the socket acceptor to the specified endpoint on the local machine.
 
 
 [heading Parameters]
@@ -25947,15 +29515,9 @@
 
 [variablelist
   
-[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
+[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
 
-[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error // Result of operation
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
@@ -25964,302 +29526,231 @@
   
 
 
- void connect_handler(const boost::system::error_code& error)
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ acceptor.open(boost::asio::ip::tcp::v4());
+ boost::system::error_code ec;
+ acceptor.bind(boost::asio::ip::tcp::endpoint(12345), ec);
+ if (ec)
    {
- if (!error)
- {
- // Connect succeeded.
- }
+ // An error occurred.
    }
 
- ...
 
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- socket.async_connect(endpoint, connect_handler);
 
 
 
 
 
+[endsect]
 
 
 [endsect]
 
 
+[section:broadcast basic_socket_acceptor::broadcast]
 
-[section:async_read_some basic_stream_socket::async_read_some]
 
-[indexterm2 async_read_some..basic_stream_socket]
-Start an asynchronous read.
+['Inherited from socket_base.]
 
+[indexterm2 broadcast..basic_socket_acceptor]
+Socket option to permit sending of broadcast messages.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_read_some(
- const MutableBufferSequence & buffers,
- ReadHandler handler);
 
+ typedef implementation_defined broadcast;
 
-This function is used to asynchronously read data from the stream socket. The function call always returns immediately.
 
 
-[heading Parameters]
-
+Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
 
-[variablelist
+
+[heading Examples]
   
-[[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+Setting the option:
 
-[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes read.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option(true);
+ socket.set_option(option);
 
-]
 
 
-[heading Remarks]
-
-The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
 
 
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+Getting the current option value:
 
- socket.async_read_some(boost::asio::buffer(data, size), handler);
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
 
-[endsect]
 
+[heading Requirements]
 
-[section:async_receive basic_stream_socket::async_receive]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[indexterm2 async_receive..basic_stream_socket]
-Start an asynchronous receive.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void ``[link boost_asio.reference.basic_stream_socket.async_receive.overload1 async_receive]``(
- const MutableBufferSequence & buffers,
- ReadHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload1 more...]]``
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void ``[link boost_asio.reference.basic_stream_socket.async_receive.overload2 async_receive]``(
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
- ReadHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::async_receive (1 of 2 overloads)]
+[section:bytes_readable basic_socket_acceptor::bytes_readable]
 
 
-Start an asynchronous receive.
+['Inherited from socket_base.]
 
+[indexterm2 bytes_readable..basic_socket_acceptor]
+IO control command to get the amount of data that can be read without blocking.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_receive(
- const MutableBufferSequence & buffers,
- ReadHandler handler);
 
+ typedef implementation_defined bytes_readable;
 
-This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
 
 
-[heading Parameters]
-
+Implements the FIONREAD IO control command.
 
-[variablelist
+
+[heading Example]
   
-[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
 
-[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes received.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
-]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::bytes_readable command(true);
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
 
 
-[heading Remarks]
-
-The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
 
 
-[heading Example]
-
-To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- socket.async_receive(boost::asio::buffer(data, size), handler);
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:cancel basic_socket_acceptor::cancel]
 
-[section:overload2 basic_stream_socket::async_receive (2 of 2 overloads)]
+[indexterm2 cancel..basic_socket_acceptor]
+Cancel all asynchronous operations associated with the acceptor.
 
 
-Start an asynchronous receive.
+ void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.cancel.overload2 more...]]``
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_receive(
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
- ReadHandler handler);
 
+[section:overload1 basic_socket_acceptor::cancel (1 of 2 overloads)]
 
-This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
 
+Cancel all asynchronous operations associated with the acceptor.
 
-[heading Parameters]
+
+ void cancel();
+
+
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[heading Exceptions]
     
 
 [variablelist
   
-[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+[[boost::system::system_error][Thrown on failure. ]]
 
-[[flags][Flags specifying how the receive call is to be made.]]
+]
 
-[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes received.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
-]
 
 
-[heading Remarks]
-
-The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
+[endsect]
 
 
-[heading Example]
-
-To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- socket.async_receive(boost::asio::buffer(data, size), 0, handler);
+[section:overload2 basic_socket_acceptor::cancel (2 of 2 overloads)]
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+Cancel all asynchronous operations associated with the acceptor.
 
 
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
 
 
-[endsect]
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
 
-[endsect]
+[heading Parameters]
+
 
-[section:async_send basic_stream_socket::async_send]
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. ]]
 
-[indexterm2 async_send..basic_stream_socket]
-Start an asynchronous send.
+]
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void ``[link boost_asio.reference.basic_stream_socket.async_send.overload1 async_send]``(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void ``[link boost_asio.reference.basic_stream_socket.async_send.overload2 async_send]``(
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
- WriteHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload2 more...]]``
 
+[endsect]
 
-[section:overload1 basic_stream_socket::async_send (1 of 2 overloads)]
 
+[endsect]
 
-Start an asynchronous send.
+[section:close basic_socket_acceptor::close]
 
+[indexterm2 close..basic_socket_acceptor]
+Close the acceptor.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_send(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
 
+ void ``[link boost_asio.reference.basic_socket_acceptor.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload1 more...]]``
 
-This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.close.overload2 more...]]``
 
 
-[heading Parameters]
-
+[section:overload1 basic_socket_acceptor::close (1 of 2 overloads)]
 
-[variablelist
-
-[[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
 
-[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes sent.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+Close the acceptor.
 
-]
 
+ void close();
 
-[heading Remarks]
-
-The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
 
+This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
 
-[heading Example]
-
-To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
 
- socket.async_send(boost::asio::buffer(data, size), handler);
 
+[heading Exceptions]
+
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
 
 
 
@@ -26268,22 +29759,19 @@
 
 
 
-[section:overload2 basic_stream_socket::async_send (2 of 2 overloads)]
+[section:overload2 basic_socket_acceptor::close (2 of 2 overloads)]
 
 
-Start an asynchronous send.
+Close the acceptor.
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_send(
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
- WriteHandler handler);
+ boost::system::error_code close(
+ boost::system::error_code & ec);
 
 
-This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
+This function is used to close the acceptor. Any asynchronous accept operations will be cancelled immediately.
+
+A subsequent call to `open()` is required before the acceptor can again be used to again perform socket accept operations.
 
 
 [heading Parameters]
@@ -26291,35 +29779,26 @@
 
 [variablelist
   
-[[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
-
-[[flags][Flags specifying how the send call is to be made.]]
-
-[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes sent.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Remarks]
-
-The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
-
-
 [heading Example]
   
-To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- socket.async_send(boost::asio::buffer(data, size), 0, handler);
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::system::error_code ec;
+ acceptor.close(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -26330,318 +29809,295 @@
 [endsect]
 
 
-[section:async_write_some basic_stream_socket::async_write_some]
+[section:debug basic_socket_acceptor::debug]
 
-[indexterm2 async_write_some..basic_stream_socket]
-Start an asynchronous write.
 
+['Inherited from socket_base.]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
+[indexterm2 debug..basic_socket_acceptor]
+Socket option to enable socket-level debugging.
 
 
-This function is used to asynchronously write data to the stream socket. The function call always returns immediately.
+ typedef implementation_defined debug;
 
 
-[heading Parameters]
-
 
-[variablelist
+Implements the SOL\_SOCKET/SO\_DEBUG socket option.
+
+
+[heading Examples]
   
-[[buffers][One or more data buffers to be written to the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+Setting the option:
 
-[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes written.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option(true);
+ socket.set_option(option);
 
-]
 
 
-[heading Remarks]
-
-The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
 
 
-[heading Example]
-
-To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+Getting the current option value:
 
- socket.async_write_some(boost::asio::buffer(data, size), handler);
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
 
-[endsect]
 
+[heading Requirements]
 
-[section:at_mark basic_stream_socket::at_mark]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-[indexterm2 at_mark..basic_stream_socket]
-Determine whether the socket is at the out-of-band data mark.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload1 at_mark]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload1 more...]]``
+[endsect]
 
- bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload2 at_mark]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::at_mark (1 of 2 overloads)]
+[section:do_not_route basic_socket_acceptor::do_not_route]
 
 
-['Inherited from basic_socket.]
+['Inherited from socket_base.]
 
+[indexterm2 do_not_route..basic_socket_acceptor]
+Socket option to prevent routing, use local interfaces only.
 
-Determine whether the socket is at the out-of-band data mark.
 
+ typedef implementation_defined do_not_route;
 
- bool at_mark() const;
 
 
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
 
 
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option(true);
+ socket.set_option(option);
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
 
 
+Getting the current option value:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
-[endsect]
 
 
 
-[section:overload2 basic_stream_socket::at_mark (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
 
+[heading Requirements]
 
-Determine whether the socket is at the out-of-band data mark.
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
- bool at_mark(
- boost::system::error_code & ec) const;
 
+[endsect]
 
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
 
 
-[heading Parameters]
-
+[section:enable_connection_aborted basic_socket_acceptor::enable_connection_aborted]
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+['Inherited from socket_base.]
 
+[indexterm2 enable_connection_aborted..basic_socket_acceptor]
+Socket option to report aborted connections on accept.
 
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
 
+ typedef implementation_defined enable_connection_aborted;
 
 
 
-[endsect]
+Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
 
 
-[endsect]
+[heading Examples]
+
+Setting the option:
 
-[section:available basic_stream_socket::available]
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option(true);
+ acceptor.set_option(option);
 
-[indexterm2 available..basic_stream_socket]
-Determine the number of bytes available for reading.
 
 
- std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload1 available]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload1 more...]]``
 
- std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload2 available]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload2 more...]]``
 
+Getting the current option value:
 
-[section:overload1 basic_stream_socket::available (1 of 2 overloads)]
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
 
 
-['Inherited from basic_socket.]
 
 
-Determine the number of bytes available for reading.
 
 
- std::size_t available() const;
 
+[heading Requirements]
 
-This function is used to determine the number of bytes that may be read without blocking.
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
 
+[endsect]
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+[section:endpoint_type basic_socket_acceptor::endpoint_type]
 
+[indexterm2 endpoint_type..basic_socket_acceptor]
+The endpoint type.
 
 
+ typedef Protocol::endpoint endpoint_type;
 
-[endsect]
 
 
+[heading Requirements]
 
-[section:overload2 basic_stream_socket::available (2 of 2 overloads)]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-['Inherited from basic_socket.]
 
+[endsect]
 
-Determine the number of bytes available for reading.
 
+[section:get_implementation basic_socket_acceptor::get_implementation]
 
- std::size_t available(
- boost::system::error_code & ec) const;
+[indexterm2 get_implementation..basic_socket_acceptor]
+Get the underlying implementation of the I/O object.
 
 
-This function is used to determine the number of bytes that may be read without blocking.
+ implementation_type & ``[link boost_asio.reference.basic_socket_acceptor.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_implementation.overload1 more...]]``
 
+ const implementation_type & ``[link boost_asio.reference.basic_socket_acceptor.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_implementation.overload2 more...]]``
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+[section:overload1 basic_socket_acceptor::get_implementation (1 of 2 overloads)]
 
-]
 
+['Inherited from basic_io_object.]
 
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
 
+Get the underlying implementation of the I/O object.
 
 
+ implementation_type & get_implementation();
 
-[endsect]
 
 
 [endsect]
 
-[section:basic_stream_socket basic_stream_socket::basic_stream_socket]
 
-[indexterm2 basic_stream_socket..basic_stream_socket]
-Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it.
 
+[section:overload2 basic_socket_acceptor::get_implementation (2 of 2 overloads)]
 
- explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 basic_stream_socket]``(
- boost::asio::io_service & io_service);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 more...]]``
 
+['Inherited from basic_io_object.]
 
-Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`].
 
+Get the underlying implementation of the I/O object.
 
- ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 basic_stream_socket]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 more...]]``
 
+ const implementation_type & get_implementation() const;
 
-Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint.
 
 
- ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 basic_stream_socket]``(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 more...]]``
+[endsect]
 
 
-Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket.
+[endsect]
 
 
- ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 basic_stream_socket]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_socket);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 more...]]``
+[section:get_io_service basic_socket_acceptor::get_io_service]
 
 
-[section:overload1 basic_stream_socket::basic_stream_socket (1 of 4 overloads)]
+['Inherited from basic_io_object.]
 
+[indexterm2 get_io_service..basic_socket_acceptor]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
-Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it.
 
+ boost::asio::io_service & get_io_service();
 
- basic_stream_socket(
- boost::asio::io_service & io_service);
 
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
-This constructor creates a stream socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
 
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
-[heading Parameters]
-
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]]
 
-]
 
+[endsect]
 
 
+[section:get_option basic_socket_acceptor::get_option]
 
-[endsect]
+[indexterm2 get_option..basic_socket_acceptor]
+Get an option from the acceptor.
 
 
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload1 get_option]``(
+ GettableSocketOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload1 more...]]``
 
-[section:overload2 basic_stream_socket::basic_stream_socket (2 of 4 overloads)]
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload2 get_option]``(
+ GettableSocketOption & option,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_option.overload2 more...]]``
 
 
-Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`].
+[section:overload1 basic_socket_acceptor::get_option (1 of 2 overloads)]
 
 
- basic_stream_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
+Get an option from the acceptor.
 
 
-This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it.
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void get_option(
+ GettableSocketOption & option);
+
+
+This function is used to get the current value of an option on the acceptor.
 
 
 [heading Parameters]
@@ -26649,9 +30105,7 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
-
-[[protocol][An object specifying protocol parameters to be used.]]
+[[option][The option value to be obtained from the acceptor.]]
 
 ]
 
@@ -26661,29 +30115,46 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
 
+[heading Example]
+
+Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::acceptor::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.get();
+
+
+
+
+
+
 
 [endsect]
 
 
 
-[section:overload3 basic_stream_socket::basic_stream_socket (3 of 4 overloads)]
+[section:overload2 basic_socket_acceptor::get_option (2 of 2 overloads)]
 
 
-Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint.
+Get an option from the acceptor.
 
 
- basic_stream_socket(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint);
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ GettableSocketOption & option,
+ boost::system::error_code & ec);
 
 
-This constructor creates a stream socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
+This function is used to get the current value of an option on the acceptor.
 
 
 [heading Parameters]
@@ -26691,105 +30162,162 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+[[option][The option value to be obtained from the acceptor.]]
 
-[[endpoint][An endpoint on the local machine to which the stream socket will be bound.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Exceptions]
-
 
-[variablelist
+[heading Example]
   
-[[boost::system::system_error][Thrown on failure. ]]
+Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option:
 
-]
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::acceptor::reuse_address option;
+ boost::system::error_code ec;
+ acceptor.get_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ bool is_set = option.get();
 
 
 
 
-[endsect]
 
 
 
-[section:overload4 basic_stream_socket::basic_stream_socket (4 of 4 overloads)]
+[endsect]
 
 
-Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket.
+[endsect]
 
+[section:get_service basic_socket_acceptor::get_service]
 
- basic_stream_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_socket);
+[indexterm2 get_service..basic_socket_acceptor]
+Get the service associated with the I/O object.
 
 
-This constructor creates a stream socket object to hold an existing native socket.
+ service_type & ``[link boost_asio.reference.basic_socket_acceptor.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_service.overload1 more...]]``
 
+ const service_type & ``[link boost_asio.reference.basic_socket_acceptor.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.get_service.overload2 more...]]``
 
-[heading Parameters]
-
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+[section:overload1 basic_socket_acceptor::get_service (1 of 2 overloads)]
 
-[[protocol][An object specifying protocol parameters to be used.]]
 
-[[native_socket][The new underlying socket implementation.]]
+['Inherited from basic_io_object.]
 
-]
 
+Get the service associated with the I/O object.
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+ service_type & get_service();
 
-]
 
 
+[endsect]
 
 
-[endsect]
 
+[section:overload2 basic_socket_acceptor::get_service (2 of 2 overloads)]
 
-[endsect]
 
-[section:bind basic_stream_socket::bind]
+['Inherited from basic_io_object.]
 
-[indexterm2 bind..basic_stream_socket]
-Bind the socket to the given local endpoint.
 
+Get the service associated with the I/O object.
 
- void ``[link boost_asio.reference.basic_stream_socket.bind.overload1 bind]``(
- const endpoint_type & endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.bind.overload2 bind]``(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload2 more...]]``
+ const service_type & get_service() const;
 
 
-[section:overload1 basic_stream_socket::bind (1 of 2 overloads)]
 
+[endsect]
 
-['Inherited from basic_socket.]
 
+[endsect]
 
-Bind the socket to the given local endpoint.
 
+[section:implementation basic_socket_acceptor::implementation]
 
- void bind(
- const endpoint_type & endpoint);
 
+['Inherited from basic_io_object.]
 
-This function binds the socket to the specified endpoint on the local machine.
+[indexterm2 implementation..basic_socket_acceptor]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
+[section:implementation_type basic_socket_acceptor::implementation_type]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation_type..basic_socket_acceptor]
+The underlying implementation type of I/O object.
+
+
+ typedef service_type::implementation_type implementation_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:io_control basic_socket_acceptor::io_control]
+
+[indexterm2 io_control..basic_socket_acceptor]
+Perform an IO control command on the acceptor.
+
+
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload1 io_control]``(
+ IoControlCommand & command);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.io_control.overload2 io_control]``(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.io_control.overload2 more...]]``
+
+
+[section:overload1 basic_socket_acceptor::io_control (1 of 2 overloads)]
+
+
+Perform an IO control command on the acceptor.
+
+
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void io_control(
+ IoControlCommand & command);
+
+
+This function is used to execute an IO control command on the acceptor.
 
 
 [heading Parameters]
@@ -26797,7 +30325,7 @@
 
 [variablelist
   
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[[command][The IO control command to be performed on the acceptor.]]
 
 ]
 
@@ -26812,14 +30340,15 @@
 ]
 
 
+
 [heading Example]
   
+Getting the number of bytes ready to read:
 
-
- boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345));
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
+ socket.io_control(command);
 
 
 
@@ -26831,21 +30360,20 @@
 
 
 
-[section:overload2 basic_stream_socket::bind (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket_acceptor::io_control (2 of 2 overloads)]
 
 
-Bind the socket to the given local endpoint.
+Perform an IO control command on the acceptor.
 
 
- boost::system::error_code bind(
- const endpoint_type & endpoint,
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ IoControlCommand & command,
       boost::system::error_code & ec);
 
 
-This function binds the socket to the specified endpoint on the local machine.
+This function is used to execute an IO control command on the acceptor.
 
 
 [heading Parameters]
@@ -26853,22 +30381,23 @@
 
 [variablelist
   
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[[command][The IO control command to be performed on the acceptor.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+
 [heading Example]
   
+Getting the number of bytes ready to read:
 
-
- boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::acceptor::non_blocking_io command(true);
    boost::system::error_code ec;
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345), ec);
+ socket.io_control(command, ec);
    if (ec)
    {
      // An error occurred.
@@ -26886,29 +30415,43 @@
 [endsect]
 
 
-[section:broadcast basic_stream_socket::broadcast]
+[section:is_open basic_socket_acceptor::is_open]
+
+[indexterm2 is_open..basic_socket_acceptor]
+Determine whether the acceptor is open.
+
+
+ bool is_open() const;
+
+
+
+[endsect]
+
+
+
+[section:keep_alive basic_socket_acceptor::keep_alive]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 broadcast..basic_stream_socket]
-Socket option to permit sending of broadcast messages.
+[indexterm2 keep_alive..basic_socket_acceptor]
+Socket option to send keep-alives.
 
 
- typedef implementation_defined broadcast;
+ typedef implementation_defined keep_alive;
 
 
 
-Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
+Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
 
 
 [heading Examples]
   
 Setting the option:
 
- boost::asio::ip::udp::socket socket(io_service);
+ boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::broadcast option(true);
+ boost::asio::socket_base::keep_alive option(true);
    socket.set_option(option);
 
 
@@ -26917,9 +30460,9 @@
 
 Getting the current option value:
 
- boost::asio::ip::udp::socket socket(io_service);
+ boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::broadcast option;
+ boost::asio::socket_base::keep_alive option;
    socket.get_option(option);
    bool is_set = option.value();
 
@@ -26931,7 +30474,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -26940,31 +30483,43 @@
 
 
 
-[section:bytes_readable basic_stream_socket::bytes_readable]
+[section:linger basic_socket_acceptor::linger]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 bytes_readable..basic_stream_socket]
-IO control command to get the amount of data that can be read without blocking.
+[indexterm2 linger..basic_socket_acceptor]
+Socket option to specify whether the socket lingers on close if unsent data is present.
 
 
- typedef implementation_defined bytes_readable;
+ typedef implementation_defined linger;
 
 
 
-Implements the FIONREAD IO control command.
+Implements the SOL\_SOCKET/SO\_LINGER socket option.
 
 
-[heading Example]
+[heading Examples]
   
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option(true, 30);
+ socket.set_option(option);
+
+
 
 
+
+Getting the current option value:
+
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::bytes_readable command(true);
- socket.io_control(command);
- std::size_t bytes_readable = command.get();
+ boost::asio::socket_base::linger option;
+ socket.get_option(option);
+ bool is_set = option.enabled();
+ unsigned short timeout = option.timeout();
 
 
 
@@ -26974,7 +30529,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -26982,84 +30537,73 @@
 [endsect]
 
 
-[section:cancel basic_stream_socket::cancel]
+[section:listen basic_socket_acceptor::listen]
 
-[indexterm2 cancel..basic_stream_socket]
-Cancel all asynchronous operations associated with the socket.
+[indexterm2 listen..basic_socket_acceptor]
+Place the acceptor into the state where it will listen for new connections.
 
 
- void ``[link boost_asio.reference.basic_stream_socket.cancel.overload1 cancel]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload1 listen]``(
+ int backlog = socket_base::max_connections);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.cancel.overload2 cancel]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.listen.overload2 listen]``(
+ int backlog,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload2 more...]]``
-
-
-[section:overload1 basic_stream_socket::cancel (1 of 2 overloads)]
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.listen.overload2 more...]]``
 
 
-['Inherited from basic_socket.]
+[section:overload1 basic_socket_acceptor::listen (1 of 2 overloads)]
 
 
-Cancel all asynchronous operations associated with the socket.
+Place the acceptor into the state where it will listen for new connections.
 
 
- void cancel();
+ void listen(
+ int backlog = socket_base::max_connections);
 
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+This function puts the socket acceptor into the state where it may accept new connections.
 
 
-[heading Exceptions]
+[heading Parameters]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[backlog][The maximum length of the queue of pending connections.]]
 
 ]
 
 
-[heading Remarks]
-
-Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
-
-
-* It will only cancel asynchronous operations that were initiated in the current thread.
-
-
-* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
-
-For portable cancellation, consider using one of the following alternatives:
-
+[heading Exceptions]
+
 
-* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
-* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
-When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
 
 [endsect]
 
 
 
-[section:overload2 basic_stream_socket::cancel (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket_acceptor::listen (2 of 2 overloads)]
 
 
-Cancel all asynchronous operations associated with the socket.
+Place the acceptor into the state where it will listen for new connections.
 
 
- boost::system::error_code cancel(
+ boost::system::error_code listen(
+ int backlog,
       boost::system::error_code & ec);
 
 
-This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+This function puts the socket acceptor into the state where it may accept new connections.
 
 
 [heading Parameters]
@@ -27067,30 +30611,30 @@
 
 [variablelist
   
+[[backlog][The maximum length of the queue of pending connections.]]
+
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Remarks]
-
-Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
-
-
-* It will only cancel asynchronous operations that were initiated in the current thread.
-
+[heading Example]
+
 
-* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
 
-For portable cancellation, consider using one of the following alternatives:
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::system::error_code ec;
+ acceptor.listen(boost::asio::socket_base::max_connections, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
 
-* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
 
 
-* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
 
-When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
 
 
 [endsect]
@@ -27098,33 +30642,35 @@
 
 [endsect]
 
-[section:close basic_stream_socket::close]
+[section:local_endpoint basic_socket_acceptor::local_endpoint]
 
-[indexterm2 close..basic_stream_socket]
-Close the socket.
+[indexterm2 local_endpoint..basic_socket_acceptor]
+Get the local endpoint of the acceptor.
 
 
- void ``[link boost_asio.reference.basic_stream_socket.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload1 more...]]``
+ endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 local_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.close.overload2 close]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload2 more...]]``
+ endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 local_endpoint]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::close (1 of 2 overloads)]
+[section:overload1 basic_socket_acceptor::local_endpoint (1 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+Get the local endpoint of the acceptor.
 
 
-Close the socket.
+ endpoint_type local_endpoint() const;
 
 
- void close();
+This function is used to obtain the locally bound endpoint of the acceptor.
 
 
-This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+[heading Return Value]
+
+An object that represents the local endpoint of the acceptor.
 
 
 [heading Exceptions]
@@ -27137,31 +30683,35 @@
 ]
 
 
-[heading Remarks]
-
-For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
+[heading Example]
+
 
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
 
 
-[endsect]
 
 
 
-[section:overload2 basic_stream_socket::close (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+[endsect]
 
 
-Close the socket.
 
+[section:overload2 basic_socket_acceptor::local_endpoint (2 of 2 overloads)]
 
- boost::system::error_code close(
- boost::system::error_code & ec);
+
+Get the local endpoint of the acceptor.
 
 
-This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+ endpoint_type local_endpoint(
+ boost::system::error_code & ec) const;
+
+
+This function is used to obtain the locally bound endpoint of the acceptor.
 
 
 [heading Parameters]
@@ -27174,14 +30724,19 @@
 ]
 
 
+[heading Return Value]
+
+An object that represents the local endpoint of the acceptor. Returns a default-constructed endpoint object if an error occurred and the error handler did not throw an exception.
+
+
 [heading Example]
   
 
 
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
    ...
    boost::system::error_code ec;
- socket.close(ec);
+ boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
    if (ec)
    {
      // An error occurred.
@@ -27191,194 +30746,168 @@
 
 
 
-[heading Remarks]
-
-For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
 
 
+[endsect]
 
 
 [endsect]
 
 
-[endsect]
+[section:max_connections basic_socket_acceptor::max_connections]
 
-[section:connect basic_stream_socket::connect]
 
-[indexterm2 connect..basic_stream_socket]
-Connect the socket to the specified endpoint.
+['Inherited from socket_base.]
 
+[indexterm2 max_connections..basic_socket_acceptor]
+The maximum length of the queue of pending incoming connections.
 
- void ``[link boost_asio.reference.basic_stream_socket.connect.overload1 connect]``(
- const endpoint_type & peer_endpoint);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.connect.overload2 connect]``(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload2 more...]]``
+ static const int max_connections = implementation_defined;
 
 
-[section:overload1 basic_stream_socket::connect (1 of 2 overloads)]
 
+[endsect]
 
-['Inherited from basic_socket.]
 
 
-Connect the socket to the specified endpoint.
+[section:message_do_not_route basic_socket_acceptor::message_do_not_route]
 
 
- void connect(
- const endpoint_type & peer_endpoint);
+['Inherited from socket_base.]
 
+[indexterm2 message_do_not_route..basic_socket_acceptor]
+Specify that the data should not be subject to routing.
 
-This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
 
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+ static const int message_do_not_route = implementation_defined;
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+[endsect]
 
-]
 
 
-[heading Exceptions]
-
+[section:message_end_of_record basic_socket_acceptor::message_end_of_record]
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
+['Inherited from socket_base.]
 
+[indexterm2 message_end_of_record..basic_socket_acceptor]
+Specifies that the data marks the end of a record.
 
-[heading Example]
-
 
+ static const int message_end_of_record = implementation_defined;
 
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- socket.connect(endpoint);
 
 
+[endsect]
 
 
 
+[section:message_flags basic_socket_acceptor::message_flags]
 
 
-[endsect]
+['Inherited from socket_base.]
 
+[indexterm2 message_flags..basic_socket_acceptor]
+Bitmask type for flags that can be passed to send and receive operations.
 
 
-[section:overload2 basic_stream_socket::connect (2 of 2 overloads)]
+ typedef int message_flags;
 
 
-['Inherited from basic_socket.]
 
+[heading Requirements]
 
-Connect the socket to the specified endpoint.
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
- boost::system::error_code connect(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
 
+[endsect]
 
-This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
 
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
 
+[section:message_out_of_band basic_socket_acceptor::message_out_of_band]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+['Inherited from socket_base.]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[indexterm2 message_out_of_band..basic_socket_acceptor]
+Process out-of-band data.
 
-]
 
+ static const int message_out_of_band = implementation_defined;
 
-[heading Example]
-
 
 
- boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint(
- boost::asio::ip::address::from_string("1.2.3.4"), 12345);
- boost::system::error_code ec;
- socket.connect(endpoint, ec);
- if (ec)
- {
- // An error occurred.
- }
+[endsect]
 
 
 
+[section:message_peek basic_socket_acceptor::message_peek]
+
 
+['Inherited from socket_base.]
 
+[indexterm2 message_peek..basic_socket_acceptor]
+Peek at incoming data without removing it from the input queue.
 
 
-[endsect]
+ static const int message_peek = implementation_defined;
+
 
 
 [endsect]
 
 
-[section:debug basic_stream_socket::debug]
 
+[section:native basic_socket_acceptor::native]
 
-['Inherited from socket_base.]
+[indexterm2 native..basic_socket_acceptor]
+(Deprecated: Use `native_handle()`.) Get the native acceptor representation.
 
-[indexterm2 debug..basic_stream_socket]
-Socket option to enable socket-level debugging.
 
+ native_type native();
 
- typedef implementation_defined debug;
 
+This function may be used to obtain the underlying representation of the acceptor. This is intended to allow access to native acceptor functionality that is not otherwise provided.
 
 
-Implements the SOL\_SOCKET/SO\_DEBUG socket option.
+[endsect]
 
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option(true);
- socket.set_option(option);
+[section:native_handle basic_socket_acceptor::native_handle]
 
+[indexterm2 native_handle..basic_socket_acceptor]
+Get the native acceptor representation.
 
 
+ native_handle_type native_handle();
 
 
-Getting the current option value:
+This function may be used to obtain the underlying representation of the acceptor. This is intended to allow access to native acceptor functionality that is not otherwise provided.
+
+
+[endsect]
+
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::debug option;
- socket.get_option(option);
- bool is_set = option.value();
 
+[section:native_handle_type basic_socket_acceptor::native_handle_type]
 
+[indexterm2 native_handle_type..basic_socket_acceptor]
+The native representation of an acceptor.
 
 
+ typedef SocketAcceptorService::native_handle_type native_handle_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -27386,128 +30915,143 @@
 [endsect]
 
 
+[section:native_non_blocking basic_socket_acceptor::native_non_blocking]
 
-[section:do_not_route basic_stream_socket::do_not_route]
+[indexterm2 native_non_blocking..basic_socket_acceptor]
+Gets the non-blocking mode of the native acceptor implementation.
 
 
-['Inherited from socket_base.]
+ bool ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload1 more...]]``
 
-[indexterm2 do_not_route..basic_stream_socket]
-Socket option to prevent routing, use local interfaces only.
 
+Sets the non-blocking mode of the native acceptor implementation.
 
- typedef implementation_defined do_not_route;
 
+ void ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload2 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.native_non_blocking.overload3 more...]]``
 
-Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
 
+[section:overload1 basic_socket_acceptor::native_non_blocking (1 of 3 overloads)]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option(true);
- socket.set_option(option);
+Gets the non-blocking mode of the native acceptor implementation.
 
 
+ bool native_non_blocking() const;
 
 
+This function is used to retrieve the non-blocking mode of the underlying native acceptor. This mode has no effect on the behaviour of the acceptor object's synchronous operations.
 
-Getting the current option value:
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::socket_base::do_not_route option;
- socket.get_option(option);
- bool is_set = option.value();
+[heading Return Value]
+
+`true` if the underlying acceptor is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
 
 
+[heading Remarks]
+
+The current non-blocking mode is cached by the acceptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native acceptor.
 
 
 
 
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[section:overload2 basic_socket_acceptor::native_non_blocking (2 of 3 overloads)]
 
 
-[endsect]
+Sets the non-blocking mode of the native acceptor implementation.
 
 
+ void native_non_blocking(
+ bool mode);
 
-[section:enable_connection_aborted basic_stream_socket::enable_connection_aborted]
 
+This function is used to modify the non-blocking mode of the underlying native acceptor. It has no effect on the behaviour of the acceptor object's synchronous operations.
 
-['Inherited from socket_base.]
 
-[indexterm2 enable_connection_aborted..basic_stream_socket]
-Socket option to report aborted connections on accept.
+[heading Parameters]
+
 
+[variablelist
+
+[[mode][If `true`, the underlying acceptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
- typedef implementation_defined enable_connection_aborted;
+]
 
 
+[heading Exceptions]
+
 
-Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
 
+]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option(true);
- acceptor.set_option(option);
 
 
+[endsect]
 
 
 
-Getting the current option value:
+[section:overload3 basic_socket_acceptor::native_non_blocking (3 of 3 overloads)]
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option;
- acceptor.get_option(option);
- bool is_set = option.value();
 
+Sets the non-blocking mode of the native acceptor implementation.
 
 
+ boost::system::error_code native_non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
 
 
+This function is used to modify the non-blocking mode of the underlying native acceptor. It has no effect on the behaviour of the acceptor object's synchronous operations.
 
 
-[heading Requirements]
+[heading Parameters]
+
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[variablelist
+
+[[mode][If `true`, the underlying acceptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
-[*Convenience header: ][^boost/asio.hpp]
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
 
+]
 
-[endsect]
 
 
 
-[section:endpoint_type basic_stream_socket::endpoint_type]
+[endsect]
 
-[indexterm2 endpoint_type..basic_stream_socket]
-The endpoint type.
 
+[endsect]
 
- typedef Protocol::endpoint endpoint_type;
+
+[section:native_type basic_socket_acceptor::native_type]
+
+[indexterm2 native_type..basic_socket_acceptor]
+(Deprecated: Use native\_handle\_type.) The native representation of an acceptor.
+
+
+ typedef SocketAcceptorService::native_handle_type native_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -27515,64 +31059,64 @@
 [endsect]
 
 
+[section:non_blocking basic_socket_acceptor::non_blocking]
 
-[section:get_io_service basic_stream_socket::get_io_service]
+[indexterm2 non_blocking..basic_socket_acceptor]
+Gets the non-blocking mode of the acceptor.
 
 
-['Inherited from basic_io_object.]
+ bool ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload1 more...]]``
 
-[indexterm2 get_io_service..basic_stream_socket]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
+Sets the non-blocking mode of the acceptor.
 
- boost::asio::io_service & get_io_service();
 
+ void ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload2 more...]]``
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.non_blocking.overload3 more...]]``
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[section:overload1 basic_socket_acceptor::non_blocking (1 of 3 overloads)]
 
 
+Gets the non-blocking mode of the acceptor.
 
 
-[endsect]
+ bool non_blocking() const;
 
 
-[section:get_option basic_stream_socket::get_option]
 
-[indexterm2 get_option..basic_stream_socket]
-Get an option from the socket.
+[heading Return Value]
+
+`true` if the acceptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
 
 
- void ``[link boost_asio.reference.basic_stream_socket.get_option.overload1 get_option]``(
- GettableSocketOption & option) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload1 more...]]``
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.get_option.overload2 get_option]``(
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::get_option (1 of 2 overloads)]
 
+[endsect]
 
-['Inherited from basic_socket.]
 
 
-Get an option from the socket.
+[section:overload2 basic_socket_acceptor::non_blocking (2 of 3 overloads)]
 
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- void get_option(
- GettableSocketOption & option) const;
+Sets the non-blocking mode of the acceptor.
 
 
-This function is used to get the current value of an option on the socket.
+ void non_blocking(
+ bool mode);
+
 
 
 [heading Parameters]
@@ -27580,7 +31124,7 @@
 
 [variablelist
   
-[[option][The option value to be obtained from the socket.]]
+[[mode][If `true`, the acceptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
 
 ]
 
@@ -27595,19 +31139,9 @@
 ]
 
 
-
-[heading Example]
-
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::keep_alive option;
- socket.get_option(option);
- bool is_set = option.get();
-
-
-
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
 
 
@@ -27616,23 +31150,16 @@
 
 
 
-[section:overload2 basic_stream_socket::get_option (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
-
+[section:overload3 basic_socket_acceptor::non_blocking (3 of 3 overloads)]
 
-Get an option from the socket.
 
+Sets the non-blocking mode of the acceptor.
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code get_option(
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
 
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
 
-This function is used to get the current value of an option on the socket.
 
 
 [heading Parameters]
@@ -27640,31 +31167,16 @@
 
 [variablelist
   
-[[option][The option value to be obtained from the socket.]]
+[[mode][If `true`, the acceptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-
-[heading Example]
-
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::keep_alive option;
- boost::system::error_code ec;
- socket.get_option(option, ec);
- if (ec)
- {
- // An error occurred.
- }
- bool is_set = option.get();
-
-
-
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
 
 
@@ -27675,39 +31187,40 @@
 [endsect]
 
 
-[section:implementation basic_stream_socket::implementation]
+[section:non_blocking_io basic_socket_acceptor::non_blocking_io]
 
 
-['Inherited from basic_io_object.]
+['Inherited from socket_base.]
 
-[indexterm2 implementation..basic_stream_socket]
-The underlying implementation of the I/O object.
+[indexterm2 non_blocking_io..basic_socket_acceptor]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
 
 
- implementation_type implementation;
+ typedef implementation_defined non_blocking_io;
 
 
 
-[endsect]
+Implements the FIONBIO IO control command.
 
 
+[heading Example]
+
 
-[section:implementation_type basic_stream_socket::implementation_type]
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::non_blocking_io command(true);
+ socket.io_control(command);
 
-['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..basic_stream_socket]
-The underlying implementation type of I/O object.
 
 
- typedef service_type::implementation_type implementation_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -27715,38 +31228,33 @@
 [endsect]
 
 
-[section:io_control basic_stream_socket::io_control]
+[section:open basic_socket_acceptor::open]
 
-[indexterm2 io_control..basic_stream_socket]
-Perform an IO control command on the socket.
+[indexterm2 open..basic_socket_acceptor]
+Open the acceptor using the specified protocol.
 
 
- void ``[link boost_asio.reference.basic_stream_socket.io_control.overload1 io_control]``(
- IoControlCommand & command);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload1 more...]]``
+ void ``[link boost_asio.reference.basic_socket_acceptor.open.overload1 open]``(
+ const protocol_type & protocol = protocol_type());
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.io_control.overload2 io_control]``(
- IoControlCommand & command,
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.open.overload2 open]``(
+ const protocol_type & protocol,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload2 more...]]``
-
-
-[section:overload1 basic_stream_socket::io_control (1 of 2 overloads)]
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.open.overload2 more...]]``
 
 
-['Inherited from basic_socket.]
+[section:overload1 basic_socket_acceptor::open (1 of 2 overloads)]
 
 
-Perform an IO control command on the socket.
+Open the acceptor using the specified protocol.
 
 
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void io_control(
- IoControlCommand & command);
+ void open(
+ const protocol_type & protocol = protocol_type());
 
 
-This function is used to execute an IO control command on the socket.
+This function opens the socket acceptor so that it will use the specified protocol.
 
 
 [heading Parameters]
@@ -27754,7 +31262,7 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the socket.]]
+[[protocol][An object specifying which protocol is to be used.]]
 
 ]
 
@@ -27769,44 +31277,35 @@
 ]
 
 
-
 [heading Example]
   
-Getting the number of bytes ready to read:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::bytes_readable command;
- socket.io_control(command);
- std::size_t bytes_readable = command.get();
 
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ acceptor.open(boost::asio::ip::tcp::v4());
 
 
 
 
 
-[endsect]
 
 
+[endsect]
 
-[section:overload2 basic_stream_socket::io_control (2 of 2 overloads)]
 
 
-['Inherited from basic_socket.]
+[section:overload2 basic_socket_acceptor::open (2 of 2 overloads)]
 
 
-Perform an IO control command on the socket.
+Open the acceptor using the specified protocol.
 
 
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- IoControlCommand & command,
+ boost::system::error_code open(
+ const protocol_type & protocol,
       boost::system::error_code & ec);
 
 
-This function is used to execute an IO control command on the socket.
+This function opens the socket acceptor so that it will use the specified protocol.
 
 
 [heading Parameters]
@@ -27814,28 +31313,24 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the socket.]]
+[[protocol][An object specifying which protocol is to be used.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-
 [heading Example]
   
-Getting the number of bytes ready to read:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::socket::bytes_readable command;
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
    boost::system::error_code ec;
- socket.io_control(command, ec);
+ acceptor.open(boost::asio::ip::tcp::v4(), ec);
    if (ec)
    {
      // An error occurred.
    }
- std::size_t bytes_readable = command.get();
 
 
 
@@ -27849,24 +31344,32 @@
 [endsect]
 
 
-[section:io_service basic_stream_socket::io_service]
+[section:operator_eq_ basic_socket_acceptor::operator=]
 
+[indexterm2 operator=..basic_socket_acceptor]
+Move-assign a [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] from another.
 
-['Inherited from basic_io_object.]
 
-[indexterm2 io_service..basic_stream_socket]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+ basic_socket_acceptor & operator=(
+ basic_socket_acceptor && other);
 
 
- boost::asio::io_service & io_service();
+This assignment operator moves an acceptor from one object to another.
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] object from which the move will occur.]]
+
+]
 
 
-[heading Return Value]
+[heading Remarks]
       
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+Following the move, the moved-from object is in the same state as if constructed using the `basic_socket_acceptor(io_service&) constructor`.
 
 
 
@@ -27875,37 +31378,41 @@
 
 
 
-[section:is_open basic_stream_socket::is_open]
+[section:protocol_type basic_socket_acceptor::protocol_type]
 
+[indexterm2 protocol_type..basic_socket_acceptor]
+The protocol type.
 
-['Inherited from basic_socket.]
 
-[indexterm2 is_open..basic_stream_socket]
-Determine whether the socket is open.
+ typedef Protocol protocol_type;
 
 
- bool is_open() const;
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:keep_alive basic_stream_socket::keep_alive]
+[section:receive_buffer_size basic_socket_acceptor::receive_buffer_size]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 keep_alive..basic_stream_socket]
-Socket option to send keep-alives.
+[indexterm2 receive_buffer_size..basic_socket_acceptor]
+Socket option for the receive buffer size of a socket.
 
 
- typedef implementation_defined keep_alive;
+ typedef implementation_defined receive_buffer_size;
 
 
 
-Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
+Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
 
 
 [heading Examples]
@@ -27914,7 +31421,7 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::keep_alive option(true);
+ boost::asio::socket_base::receive_buffer_size option(8192);
    socket.set_option(option);
 
 
@@ -27925,9 +31432,9 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::keep_alive option;
+ boost::asio::socket_base::receive_buffer_size option;
    socket.get_option(option);
- bool is_set = option.value();
+ int size = option.value();
 
 
 
@@ -27937,7 +31444,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -27946,20 +31453,20 @@
 
 
 
-[section:linger basic_stream_socket::linger]
+[section:receive_low_watermark basic_socket_acceptor::receive_low_watermark]
 
 
 ['Inherited from socket_base.]
 
-[indexterm2 linger..basic_stream_socket]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+[indexterm2 receive_low_watermark..basic_socket_acceptor]
+Socket option for the receive low watermark.
 
 
- typedef implementation_defined linger;
+ typedef implementation_defined receive_low_watermark;
 
 
 
-Implements the SOL\_SOCKET/SO\_LINGER socket option.
+Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
 
 
 [heading Examples]
@@ -27968,7 +31475,7 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::linger option(true, 30);
+ boost::asio::socket_base::receive_low_watermark option(1024);
    socket.set_option(option);
 
 
@@ -27979,10 +31486,9 @@
 
    boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::asio::socket_base::linger option;
+ boost::asio::socket_base::receive_low_watermark option;
    socket.get_option(option);
- bool is_set = option.enabled();
- unsigned short timeout = option.timeout();
+ int size = option.value();
 
 
 
@@ -27992,7 +31498,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -28000,111 +31506,97 @@
 [endsect]
 
 
-[section:local_endpoint basic_stream_socket::local_endpoint]
-
-[indexterm2 local_endpoint..basic_stream_socket]
-Get the local endpoint of the socket.
-
 
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 local_endpoint]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 more...]]``
+[section:reuse_address basic_socket_acceptor::reuse_address]
 
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 local_endpoint]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 more...]]``
 
+['Inherited from socket_base.]
 
-[section:overload1 basic_stream_socket::local_endpoint (1 of 2 overloads)]
+[indexterm2 reuse_address..basic_socket_acceptor]
+Socket option to allow the socket to be bound to an address that is already in use.
 
 
-['Inherited from basic_socket.]
+ typedef implementation_defined reuse_address;
 
 
-Get the local endpoint of the socket.
 
+Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
 
- endpoint_type local_endpoint() const;
 
+[heading Examples]
+
+Setting the option:
 
-This function is used to obtain the locally bound endpoint of the socket.
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option(true);
+ acceptor.set_option(option);
 
 
-[heading Return Value]
-
-An object that represents the local endpoint of the socket.
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+Getting the current option value:
 
-]
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
 
 
-[heading Example]
-
 
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
 
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 basic_stream_socket::local_endpoint (2 of 2 overloads)]
-
+[section:send_buffer_size basic_socket_acceptor::send_buffer_size]
 
-['Inherited from basic_socket.]
 
+['Inherited from socket_base.]
 
-Get the local endpoint of the socket.
+[indexterm2 send_buffer_size..basic_socket_acceptor]
+Socket option for the send buffer size of a socket.
 
 
- endpoint_type local_endpoint(
- boost::system::error_code & ec) const;
+ typedef implementation_defined send_buffer_size;
 
 
-This function is used to obtain the locally bound endpoint of the socket.
 
+Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
 
-[heading Parameters]
-
 
-[variablelist
+[heading Examples]
   
-[[ec][Set to indicate what error occurred, if any.]]
+Setting the option:
 
-]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option(8192);
+ socket.set_option(option);
 
 
-[heading Return Value]
-
-An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
 
 
-[heading Example]
-
 
+Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::socket socket(io_service);
    ...
- boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
- if (ec)
- {
- // An error occurred.
- }
+ boost::asio::socket_base::send_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
 
 
 
@@ -28112,492 +31604,499 @@
 
 
 
-[endsect]
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
-[section:lowest_layer basic_stream_socket::lowest_layer]
 
-[indexterm2 lowest_layer..basic_stream_socket]
-Get a reference to the lowest layer.
 
+[section:send_low_watermark basic_socket_acceptor::send_low_watermark]
 
- lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 more...]]``
 
+['Inherited from socket_base.]
 
-Get a const reference to the lowest layer.
+[indexterm2 send_low_watermark..basic_socket_acceptor]
+Socket option for the send low watermark.
 
 
- const lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 more...]]``
+ typedef implementation_defined send_low_watermark;
 
 
-[section:overload1 basic_stream_socket::lowest_layer (1 of 2 overloads)]
 
+Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
 
-['Inherited from basic_socket.]
 
+[heading Examples]
+
+Setting the option:
 
-Get a reference to the lowest layer.
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option(1024);
+ socket.set_option(option);
 
 
- lowest_layer_type & lowest_layer();
 
 
-This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
 
+Getting the current option value:
 
-[heading Return Value]
-
-A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
 
 
 
 
-[endsect]
 
 
 
-[section:overload2 basic_stream_socket::lowest_layer (2 of 2 overloads)]
+[heading Requirements]
 
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
-['Inherited from basic_socket.]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Get a const reference to the lowest layer.
+[endsect]
 
 
- const lowest_layer_type & lowest_layer() const;
+
+[section:service basic_socket_acceptor::service]
 
 
-This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_socket_acceptor]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
-[heading Return Value]
-
-A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+ service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
 
-[endsect]
 
 
 [endsect]
 
 
-[section:lowest_layer_type basic_stream_socket::lowest_layer_type]
 
+[section:service_type basic_socket_acceptor::service_type]
 
-['Inherited from basic_socket.]
 
-[indexterm2 lowest_layer_type..basic_stream_socket]
-A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
+['Inherited from basic_io_object.]
 
+[indexterm2 service_type..basic_socket_acceptor]
+The type of the service that will be used to provide I/O operations.
 
- typedef basic_socket< Protocol, StreamSocketService > lowest_layer_type;
 
+ typedef SocketAcceptorService service_type;
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
 
- [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+[heading Requirements]
 
- [
+[*Header: ][^boost/asio/basic_socket_acceptor.hpp]
 
- [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+[*Convenience header: ][^boost/asio.hpp]
 
- [
 
- [[link boost_asio.reference.basic_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
+[section:set_option basic_socket_acceptor::set_option]
 
- [
+[indexterm2 set_option..basic_socket_acceptor]
+Set an option on the acceptor.
 
- [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload1 set_option]``(
+ const SettableSocketOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload1 more...]]``
 
- [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_acceptor.set_option.overload2 more...]]``
 
- [
 
- [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+[section:overload1 basic_socket_acceptor::set_option (1 of 2 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
+Set an option on the acceptor.
 
- [
 
- [[link boost_asio.reference.basic_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void set_option(
+ const SettableSocketOption & option);
 
- [
 
- [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
+This function is used to set an option on the acceptor.
 
- [
 
- [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
+[heading Parameters]
+
+
+[variablelist
   
- ]
+[[option][The new option value to be set on the acceptor.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
 
- [
+[heading Exceptions]
+
 
- [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+[variablelist
   
- ]
+[[boost::system::system_error][Thrown on failure.]]
 
- [
+]
 
- [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
+[heading Example]
   
- ]
+Setting the SOL\_SOCKET/SO\_REUSEADDR option:
 
- [
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::acceptor::reuse_address option(true);
+ acceptor.set_option(option);
 
- [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
 
- [
+[section:overload2 basic_socket_acceptor::set_option (2 of 2 overloads)]
 
- [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
+
+Set an option on the acceptor.
+
+
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+
+
+This function is used to set an option on the acceptor.
+
+
+[heading Parameters]
+
+
+[variablelist
   
- ]
+[[option][The new option value to be set on the acceptor.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
+
+[heading Example]
   
+Setting the SOL\_SOCKET/SO\_REUSEADDR option:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::acceptor::reuse_address option(true);
+ boost::system::error_code ec;
+ acceptor.set_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:shutdown_type basic_socket_acceptor::shutdown_type]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 shutdown_type..basic_socket_acceptor]
+Different ways a socket may be shutdown.
+
+
+ enum shutdown_type
+
+[indexterm2 shutdown_receive..basic_socket_acceptor]
+[indexterm2 shutdown_send..basic_socket_acceptor]
+[indexterm2 shutdown_both..basic_socket_acceptor]
+
+[heading Values]
+[variablelist
+
   [
- [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
+ [shutdown_receive]
+ [Shutdown the receive side of the socket. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
+ [shutdown_send]
+ [Shutdown the send side of the socket. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
+ [shutdown_both]
+ [Shutdown both send and receive on the socket. ]
   ]
-
- [
- [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
- [Construct a basic_socket without opening it.
 
- Construct and open a basic_socket.
+]
 
- Construct a basic_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_socket on an existing native socket. ]
- ]
-
+
+[endsect]
+
+
+
+[endsect]
+
+[section:basic_socket_iostream basic_socket_iostream]
+
+
+Iostream interface for a socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.StreamSocketService StreamSocketService]`` = stream_socket_service<Protocol>,
+ typename Time = boost::posix_time::ptime,
+ typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits<Time>,
+ typename ``[link boost_asio.reference.TimerService TimerService]`` = deadline_timer_service<Time, TimeTraits>>
+ class basic_socket_iostream
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.basic_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
+
+ [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
+ [The duration type. ]
   
- [
- [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_socket.close [*close]]]
- [Close the socket. ]
- ]
+
+ [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
   
- [
- [[link boost_asio.reference.basic_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
+
+ [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
+ [The time type. ]
   
- [
- [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
- [Get an option from the socket. ]
   ]
-
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
+ [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
+ [Construct a basic_socket_iostream without establishing a connection.
+
+ Establish a connection to an endpoint corresponding to a resolver query. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
+ [Close the connection. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
- [Determine whether the socket is open. ]
+ [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
+ [Establish a connection to an endpoint corresponding to a resolver query. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
+ [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
+ [Get the last error associated with the stream. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
+ [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
+ [Get the stream's expiry time as an absolute time.
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.open [*open]]]
- [Open the socket using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
+ Set the stream's expiry time as an absolute time. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
+ [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
+ [Get the timer's expiry time relative to now.
+
+ Set the stream's expiry time relative to now. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
+ [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
+ [Return a pointer to the underlying streambuf. ]
   ]
   
 ]
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
+[heading Requirements]
 
- [
- [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
- [Protected destructor to prevent deletion through this type. ]
- ]
-
-]
+[*Header: ][^boost/asio/basic_socket_iostream.hpp]
 
-[heading Data Members]
-[table
- [[Name][Description]]
+[*Convenience header: ][^boost/asio.hpp]
 
- [
- [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
+[section:basic_socket_iostream basic_socket_iostream::basic_socket_iostream]
 
- [
- [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
+[indexterm2 basic_socket_iostream..basic_socket_iostream]
+Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection.
 
- [
- [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
+ ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 basic_socket_iostream]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 more...]]``
 
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
+Establish a connection to an endpoint corresponding to a resolver query.
 
- [
- [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket.service [*service]]]
- [The service associated with the I/O object. ]
- ]
+ template<
+ typename T1,
+ ... ,
+ typename TN>
+ explicit ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 basic_socket_iostream]``(
+ T1 t1,
+ ... ,
+ TN tn);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 more...]]``
 
-]
 
-The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
+[section:overload1 basic_socket_iostream::basic_socket_iostream (1 of 2 overloads)]
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+Construct a [link boost_asio.reference.basic_socket_iostream `basic_socket_iostream`] without establishing a connection.
 
-[*Shared] [*objects:] Unsafe.
+
+ basic_socket_iostream();
 
 
 
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[section:overload2 basic_socket_iostream::basic_socket_iostream (2 of 2 overloads)]
 
 
-[endsect]
+Establish a connection to an endpoint corresponding to a resolver query.
 
 
+ template<
+ typename T1,
+ ... ,
+ typename TN>
+ basic_socket_iostream(
+ T1 t1,
+ ... ,
+ TN tn);
 
-[section:max_connections basic_stream_socket::max_connections]
 
+This constructor automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
 
-['Inherited from socket_base.]
 
-[indexterm2 max_connections..basic_stream_socket]
-The maximum length of the queue of pending incoming connections.
+[endsect]
 
 
- static const int max_connections = implementation_defined;
+[endsect]
 
 
+[section:close basic_socket_iostream::close]
 
-[endsect]
+[indexterm2 close..basic_socket_iostream]
+Close the connection.
 
 
+ void close();
 
-[section:message_do_not_route basic_stream_socket::message_do_not_route]
 
 
-['Inherited from socket_base.]
+[endsect]
 
-[indexterm2 message_do_not_route..basic_stream_socket]
-Specify that the data should not be subject to routing.
 
 
- static const int message_do_not_route = implementation_defined;
+[section:connect basic_socket_iostream::connect]
 
+[indexterm2 connect..basic_socket_iostream]
+Establish a connection to an endpoint corresponding to a resolver query.
 
 
-[endsect]
+ template<
+ typename T1,
+ ... ,
+ typename TN>
+ void connect(
+ T1 t1,
+ ... ,
+ TN tn);
+
 
+This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
 
 
-[section:message_flags basic_stream_socket::message_flags]
+[endsect]
 
 
-['Inherited from socket_base.]
 
-[indexterm2 message_flags..basic_stream_socket]
-Bitmask type for flags that can be passed to send and receive operations.
+[section:duration_type basic_socket_iostream::duration_type]
 
+[indexterm2 duration_type..basic_socket_iostream]
+The duration type.
 
- typedef int message_flags;
+
+ typedef TimeTraits::duration_type duration_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[*Header: ][^boost/asio/basic_socket_iostream.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -28606,337 +32105,14313 @@
 
 
 
-[section:message_out_of_band basic_stream_socket::message_out_of_band]
+[section:endpoint_type basic_socket_iostream::endpoint_type]
 
+[indexterm2 endpoint_type..basic_socket_iostream]
+The endpoint type.
 
-['Inherited from socket_base.]
 
-[indexterm2 message_out_of_band..basic_stream_socket]
-Process out-of-band data.
+ typedef Protocol::endpoint endpoint_type;
 
 
- static const int message_out_of_band = implementation_defined;
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_iostream.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:message_peek basic_stream_socket::message_peek]
+[section:error basic_socket_iostream::error]
 
+[indexterm2 error..basic_socket_iostream]
+Get the last error associated with the stream.
 
-['Inherited from socket_base.]
 
-[indexterm2 message_peek..basic_stream_socket]
-Peek at incoming data without removing it from the input queue.
+ const boost::system::error_code & error() const;
 
 
- static const int message_peek = implementation_defined;
 
+[heading Return Value]
+
+An `error_code` corresponding to the last error from the stream.
 
 
-[endsect]
+[heading Example]
+
+To print the error associated with a failure to establish a connection:
 
+ tcp::iostream s("www.boost.org", "http");
+ if (!s)
+ {
+ std::cout << "Error: " << s.error().message() << std::endl;
+ }
 
 
-[section:native basic_stream_socket::native]
 
 
-['Inherited from basic_socket.]
 
-[indexterm2 native..basic_stream_socket]
-Get the native socket representation.
 
 
- native_type native();
+[endsect]
 
 
-This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+[section:expires_at basic_socket_iostream::expires_at]
 
+[indexterm2 expires_at..basic_socket_iostream]
+Get the stream's expiry time as an absolute time.
 
-[endsect]
 
+ time_type ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload1 expires_at]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload1 more...]]``
 
 
-[section:native_type basic_stream_socket::native_type]
+Set the stream's expiry time as an absolute time.
 
-[indexterm2 native_type..basic_stream_socket]
-The native representation of a socket.
 
+ void ``[link boost_asio.reference.basic_socket_iostream.expires_at.overload2 expires_at]``(
+ const time_type & expiry_time);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_at.overload2 more...]]``
 
- typedef StreamSocketService::native_type native_type;
 
+[section:overload1 basic_socket_iostream::expires_at (1 of 2 overloads)]
 
 
-[heading Requirements]
+Get the stream's expiry time as an absolute time.
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ time_type expires_at() const;
 
 
-[endsect]
 
+[heading Return Value]
+
+An absolute time value representing the stream's expiry time.
 
 
-[section:non_blocking_io basic_stream_socket::non_blocking_io]
 
 
-['Inherited from socket_base.]
+[endsect]
 
-[indexterm2 non_blocking_io..basic_stream_socket]
-IO control command to set the blocking mode of the socket.
 
 
- typedef implementation_defined non_blocking_io;
+[section:overload2 basic_socket_iostream::expires_at (2 of 2 overloads)]
 
 
+Set the stream's expiry time as an absolute time.
 
-Implements the FIONBIO IO control command.
+
+ void expires_at(
+ const time_type & expiry_time);
 
 
-[heading Example]
+This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
+
+
+[heading Parameters]
+
+
+[variablelist
   
+[[expiry_time][The expiry time to be used for the stream. ]]
 
+]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
 
 
 
+[endsect]
 
 
+[endsect]
 
+[section:expires_from_now basic_socket_iostream::expires_from_now]
 
-[heading Requirements]
+[indexterm2 expires_from_now..basic_socket_iostream]
+Get the timer's expiry time relative to now.
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ duration_type ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 expires_from_now]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload1 more...]]``
 
 
-[endsect]
+Set the stream's expiry time relative to now.
 
 
-[section:open basic_stream_socket::open]
+ void ``[link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 expires_from_now]``(
+ const duration_type & expiry_time);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_iostream.expires_from_now.overload2 more...]]``
 
-[indexterm2 open..basic_stream_socket]
-Open the socket using the specified protocol.
 
+[section:overload1 basic_socket_iostream::expires_from_now (1 of 2 overloads)]
 
- void ``[link boost_asio.reference.basic_stream_socket.open.overload1 open]``(
- const protocol_type & protocol = protocol_type());
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.open.overload2 open]``(
- const protocol_type & protocol,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload2 more...]]``
+Get the timer's expiry time relative to now.
 
 
-[section:overload1 basic_stream_socket::open (1 of 2 overloads)]
+ duration_type expires_from_now() const;
 
 
-['Inherited from basic_socket.]
+
+[heading Return Value]
+
+A relative time value representing the stream's expiry time.
 
 
-Open the socket using the specified protocol.
 
 
- void open(
- const protocol_type & protocol = protocol_type());
+[endsect]
 
 
-This function opens the socket so that it will use the specified protocol.
 
+[section:overload2 basic_socket_iostream::expires_from_now (2 of 2 overloads)]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[protocol][An object specifying protocol parameters to be used.]]
+Set the stream's expiry time relative to now.
 
-]
+
+ void expires_from_now(
+ const duration_type & expiry_time);
 
 
-[heading Exceptions]
+This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
+
+
+[heading Parameters]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[expiry_time][The expiry time to be used for the timer. ]]
 
 ]
 
 
-[heading Example]
-
 
 
- boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+[endsect]
 
 
+[endsect]
 
 
+[section:rdbuf basic_socket_iostream::rdbuf]
 
+[indexterm2 rdbuf..basic_socket_iostream]
+Return a pointer to the underlying streambuf.
 
 
-[endsect]
+ basic_socket_streambuf< Protocol, StreamSocketService, Time, TimeTraits, TimerService > * rdbuf() const;
 
 
 
-[section:overload2 basic_stream_socket::open (2 of 2 overloads)]
+[endsect]
 
 
-['Inherited from basic_socket.]
 
+[section:time_type basic_socket_iostream::time_type]
 
-Open the socket using the specified protocol.
+[indexterm2 time_type..basic_socket_iostream]
+The time type.
 
 
- boost::system::error_code open(
- const protocol_type & protocol,
- boost::system::error_code & ec);
+ typedef TimeTraits::time_type time_type;
 
 
-This function opens the socket so that it will use the specified protocol.
 
+[heading Requirements]
 
-[heading Parameters]
-
+[*Header: ][^boost/asio/basic_socket_iostream.hpp]
 
-[variablelist
-
-[[protocol][An object specifying which protocol is to be used.]]
+[*Convenience header: ][^boost/asio.hpp]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
+[endsect]
+
+
+
+[endsect]
+
+[section:basic_socket_streambuf basic_socket_streambuf]
+
+
+Iostream streambuf for a socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.StreamSocketService StreamSocketService]`` = stream_socket_service<Protocol>,
+ typename Time = boost::posix_time::ptime,
+ typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits<Time>,
+ typename ``[link boost_asio.reference.TimerService TimerService]`` = deadline_timer_service<Time, TimeTraits>>
+ class basic_socket_streambuf :
+ public basic_socket< Protocol, StreamSocketService >
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.duration_type [*duration_type]]]
+ [The duration type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_streambuf.time_type [*time_type]]]
+ [The time type. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.basic_socket_streambuf [*basic_socket_streambuf]]]
+ [Construct a basic_socket_streambuf without establishing a connection. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.close [*close]]]
+ [Close the connection.
+
+ Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.connect [*connect]]]
+ [Establish a connection.
+
+ Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.expires_at [*expires_at]]]
+ [Get the stream buffer's expiry time as an absolute time.
+
+ Set the stream buffer's expiry time as an absolute time. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.expires_from_now [*expires_from_now]]]
+ [Get the stream buffer's expiry time relative to now.
+
+ Set the stream buffer's expiry time relative to now. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.puberror [*puberror]]]
+ [Get the last error associated with the stream buffer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf._basic_socket_streambuf [*~basic_socket_streambuf]]]
+ [Destructor flushes buffered data. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.error [*error]]]
+ [Get the last error associated with the stream buffer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.overflow [*overflow]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.setbuf [*setbuf]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.sync [*sync]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.underflow [*underflow]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
+
+]
+
+[heading Friends]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.io_handler [*io_handler]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.timer_handler [*timer_handler]]]
+ []
+ ]
+
+]
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+[section:assign basic_socket_streambuf::assign]
+
+[indexterm2 assign..basic_socket_streambuf]
+Assign an existing native socket to the socket.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.assign.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.assign.overload2 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.assign.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::assign (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Assign an existing native socket to the socket.
+
+
+ void assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::assign (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Assign an existing native socket to the socket.
+
+
+ boost::system::error_code assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:async_connect basic_socket_streambuf::async_connect]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 async_connect..basic_socket_streambuf]
+Start an asynchronous connect.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
+
+
+This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
+
+[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error // Result of operation
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Example]
+
+
+
+ void connect_handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Connect succeeded.
+ }
+ }
+
+ ...
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.async_connect(endpoint, connect_handler);
+
+
+
+
+
+
+
+[endsect]
+
+
+[section:at_mark basic_socket_streambuf::at_mark]
+
+[indexterm2 at_mark..basic_socket_streambuf]
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool ``[link boost_asio.reference.basic_socket_streambuf.at_mark.overload1 at_mark]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.at_mark.overload1 more...]]``
+
+ bool ``[link boost_asio.reference.basic_socket_streambuf.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.at_mark.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::at_mark (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool at_mark() const;
+
+
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+
+
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::at_mark (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool at_mark(
+ boost::system::error_code & ec) const;
+
+
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:available basic_socket_streambuf::available]
+
+[indexterm2 available..basic_socket_streambuf]
+Determine the number of bytes available for reading.
+
+
+ std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload1 available]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.available.overload1 more...]]``
+
+ std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload2 available]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.available.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::available (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine the number of bytes available for reading.
+
+
+ std::size_t available() const;
+
+
+This function is used to determine the number of bytes that may be read without blocking.
+
+
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::available (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine the number of bytes available for reading.
+
+
+ std::size_t available(
+ boost::system::error_code & ec) const;
+
+
+This function is used to determine the number of bytes that may be read without blocking.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:basic_socket_streambuf basic_socket_streambuf::basic_socket_streambuf]
+
+[indexterm2 basic_socket_streambuf..basic_socket_streambuf]
+Construct a [link boost_asio.reference.basic_socket_streambuf `basic_socket_streambuf`] without establishing a connection.
+
+
+ basic_socket_streambuf();
+
+
+
+[endsect]
+
+
+[section:bind basic_socket_streambuf::bind]
+
+[indexterm2 bind..basic_socket_streambuf]
+Bind the socket to the given local endpoint.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.bind.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.bind.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::bind (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Bind the socket to the given local endpoint.
+
+
+ void bind(
+ const endpoint_type & endpoint);
+
+
+This function binds the socket to the specified endpoint on the local machine.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::bind (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Bind the socket to the given local endpoint.
+
+
+ boost::system::error_code bind(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+
+
+This function binds the socket to the specified endpoint on the local machine.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+ boost::system::error_code ec;
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:broadcast basic_socket_streambuf::broadcast]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 broadcast..basic_socket_streambuf]
+Socket option to permit sending of broadcast messages.
+
+
+ typedef implementation_defined broadcast;
+
+
+
+Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:bytes_readable basic_socket_streambuf::bytes_readable]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 bytes_readable..basic_socket_streambuf]
+IO control command to get the amount of data that can be read without blocking.
+
+
+ typedef implementation_defined bytes_readable;
+
+
+
+Implements the FIONREAD IO control command.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::bytes_readable command(true);
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:cancel basic_socket_streambuf::cancel]
+
+[indexterm2 cancel..basic_socket_streambuf]
+Cancel all asynchronous operations associated with the socket.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.cancel.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.cancel.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::cancel (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Cancel all asynchronous operations associated with the socket.
+
+
+ void cancel();
+
+
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
+
+
+* It will only cancel asynchronous operations that were initiated in the current thread.
+
+
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
+
+For portable cancellation, consider using one of the following alternatives:
+
+
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
+
+
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
+
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::cancel (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Cancel all asynchronous operations associated with the socket.
+
+
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
+
+
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
+
+
+* It will only cancel asynchronous operations that were initiated in the current thread.
+
+
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
+
+For portable cancellation, consider using one of the following alternatives:
+
+
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
+
+
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
+
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
+
+
+[endsect]
+
+
+[endsect]
+
+[section:close basic_socket_streambuf::close]
+
+[indexterm2 close..basic_socket_streambuf]
+Close the connection.
+
+
+ basic_socket_streambuf< Protocol, StreamSocketService, Time, TimeTraits, TimerService > * ``[link boost_asio.reference.basic_socket_streambuf.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.close.overload1 more...]]``
+
+
+Close the socket.
+
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.close.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::close (1 of 2 overloads)]
+
+
+Close the connection.
+
+
+ basic_socket_streambuf< Protocol, StreamSocketService, Time, TimeTraits, TimerService > * close();
+
+
+
+[heading Return Value]
+
+`this` if a connection was successfully established, a null pointer otherwise.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::close (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Close the socket.
+
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.close(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:connect basic_socket_streambuf::connect]
+
+[indexterm2 connect..basic_socket_streambuf]
+Establish a connection.
+
+
+ basic_socket_streambuf< Protocol, StreamSocketService, Time, TimeTraits, TimerService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload1 connect]``(
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload1 more...]]``
+
+ template<
+ typename T1,
+ ... ,
+ typename TN>
+ basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload2 connect]``(
+ T1 t1,
+ ... ,
+ TN tn);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload2 more...]]``
+
+
+Connect the socket to the specified endpoint.
+
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.connect.overload3 connect]``(
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.connect.overload3 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::connect (1 of 3 overloads)]
+
+
+Establish a connection.
+
+
+ basic_socket_streambuf< Protocol, StreamSocketService, Time, TimeTraits, TimerService > * connect(
+ const endpoint_type & endpoint);
+
+
+This function establishes a connection to the specified endpoint.
+
+
+[heading Return Value]
+
+`this` if a connection was successfully established, a null pointer otherwise.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::connect (2 of 3 overloads)]
+
+
+Establish a connection.
+
+
+ template<
+ typename T1,
+ ... ,
+ typename TN>
+ basic_socket_streambuf< Protocol, StreamSocketService > * connect(
+ T1 t1,
+ ... ,
+ TN tn);
+
+
+This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
+
+
+[heading Return Value]
+
+`this` if a connection was successfully established, a null pointer otherwise.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_socket_streambuf::connect (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Connect the socket to the specified endpoint.
+
+
+ boost::system::error_code connect(
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+
+
+This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ boost::system::error_code ec;
+ socket.connect(endpoint, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:debug basic_socket_streambuf::debug]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 debug..basic_socket_streambuf]
+Socket option to enable socket-level debugging.
+
+
+ typedef implementation_defined debug;
+
+
+
+Implements the SOL\_SOCKET/SO\_DEBUG socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:do_not_route basic_socket_streambuf::do_not_route]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 do_not_route..basic_socket_streambuf]
+Socket option to prevent routing, use local interfaces only.
+
+
+ typedef implementation_defined do_not_route;
+
+
+
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:duration_type basic_socket_streambuf::duration_type]
+
+[indexterm2 duration_type..basic_socket_streambuf]
+The duration type.
+
+
+ typedef TimeTraits::duration_type duration_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:enable_connection_aborted basic_socket_streambuf::enable_connection_aborted]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 enable_connection_aborted..basic_socket_streambuf]
+Socket option to report aborted connections on accept.
+
+
+ typedef implementation_defined enable_connection_aborted;
+
+
+
+Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option(true);
+ acceptor.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:endpoint_type basic_socket_streambuf::endpoint_type]
+
+[indexterm2 endpoint_type..basic_socket_streambuf]
+The endpoint type.
+
+
+ typedef Protocol::endpoint endpoint_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:error basic_socket_streambuf::error]
+
+[indexterm2 error..basic_socket_streambuf]
+Get the last error associated with the stream buffer.
+
+
+ virtual const boost::system::error_code & error() const;
+
+
+
+[heading Return Value]
+
+An `error_code` corresponding to the last error from the stream buffer.
+
+
+
+
+[endsect]
+
+
+[section:expires_at basic_socket_streambuf::expires_at]
+
+[indexterm2 expires_at..basic_socket_streambuf]
+Get the stream buffer's expiry time as an absolute time.
+
+
+ time_type ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 expires_at]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload1 more...]]``
+
+
+Set the stream buffer's expiry time as an absolute time.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 expires_at]``(
+ const time_type & expiry_time);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_at.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::expires_at (1 of 2 overloads)]
+
+
+Get the stream buffer's expiry time as an absolute time.
+
+
+ time_type expires_at() const;
+
+
+
+[heading Return Value]
+
+An absolute time value representing the stream buffer's expiry time.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::expires_at (2 of 2 overloads)]
+
+
+Set the stream buffer's expiry time as an absolute time.
+
+
+ void expires_at(
+ const time_type & expiry_time);
+
+
+This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[expiry_time][The expiry time to be used for the stream. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:expires_from_now basic_socket_streambuf::expires_from_now]
+
+[indexterm2 expires_from_now..basic_socket_streambuf]
+Get the stream buffer's expiry time relative to now.
+
+
+ duration_type ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 expires_from_now]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload1 more...]]``
+
+
+Set the stream buffer's expiry time relative to now.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 expires_from_now]``(
+ const duration_type & expiry_time);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.expires_from_now.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::expires_from_now (1 of 2 overloads)]
+
+
+Get the stream buffer's expiry time relative to now.
+
+
+ duration_type expires_from_now() const;
+
+
+
+[heading Return Value]
+
+A relative time value representing the stream buffer's expiry time.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::expires_from_now (2 of 2 overloads)]
+
+
+Set the stream buffer's expiry time relative to now.
+
+
+ void expires_from_now(
+ const duration_type & expiry_time);
+
+
+This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error `boost::asio::error::operation_aborted`.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[expiry_time][The expiry time to be used for the timer. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:get_implementation basic_socket_streambuf::get_implementation]
+
+[indexterm2 get_implementation..basic_socket_streambuf]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.basic_socket_streambuf.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.basic_socket_streambuf.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_implementation.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:get_io_service basic_socket_streambuf::get_io_service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 get_io_service..basic_socket_streambuf]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+
+
+ boost::asio::io_service & get_io_service();
+
+
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+
+
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+[section:get_option basic_socket_streambuf::get_option]
+
+[indexterm2 get_option..basic_socket_streambuf]
+Get an option from the socket.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload1 get_option]``(
+ GettableSocketOption & option) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_option.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload2 get_option]``(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_option.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::get_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get an option from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void get_option(
+ GettableSocketOption & option) const;
+
+
+This function is used to get the current value of an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The option value to be obtained from the socket.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::get_option (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get an option from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
+
+
+This function is used to get the current value of an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The option value to be obtained from the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
+ boost::system::error_code ec;
+ socket.get_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ bool is_set = option.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:get_service basic_socket_streambuf::get_service]
+
+[indexterm2 get_service..basic_socket_streambuf]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.basic_socket_streambuf.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.basic_socket_streambuf.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.get_service.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::get_service (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ service_type & get_service();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::get_service (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ const service_type & get_service() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:implementation basic_socket_streambuf::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_socket_streambuf]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
+[section:implementation_type basic_socket_streambuf::implementation_type]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation_type..basic_socket_streambuf]
+The underlying implementation type of I/O object.
+
+
+ typedef service_type::implementation_type implementation_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:io_control basic_socket_streambuf::io_control]
+
+[indexterm2 io_control..basic_socket_streambuf]
+Perform an IO control command on the socket.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.io_control.overload1 io_control]``(
+ IoControlCommand & command);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.io_control.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.io_control.overload2 io_control]``(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.io_control.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::io_control (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Perform an IO control command on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void io_control(
+ IoControlCommand & command);
+
+
+This function is used to execute an IO control command on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[command][The IO control command to be performed on the socket.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the number of bytes ready to read:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::io_control (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Perform an IO control command on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+
+
+This function is used to execute an IO control command on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[command][The IO control command to be performed on the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the number of bytes ready to read:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ boost::system::error_code ec;
+ socket.io_control(command, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ std::size_t bytes_readable = command.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:io_handler basic_socket_streambuf::io_handler]
+
+[indexterm2 io_handler..basic_socket_streambuf]
+
+ friend struct io_handler();
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:is_open basic_socket_streambuf::is_open]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 is_open..basic_socket_streambuf]
+Determine whether the socket is open.
+
+
+ bool is_open() const;
+
+
+
+[endsect]
+
+
+
+[section:keep_alive basic_socket_streambuf::keep_alive]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 keep_alive..basic_socket_streambuf]
+Socket option to send keep-alives.
+
+
+ typedef implementation_defined keep_alive;
+
+
+
+Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:linger basic_socket_streambuf::linger]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 linger..basic_socket_streambuf]
+Socket option to specify whether the socket lingers on close if unsent data is present.
+
+
+ typedef implementation_defined linger;
+
+
+
+Implements the SOL\_SOCKET/SO\_LINGER socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option(true, 30);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option;
+ socket.get_option(option);
+ bool is_set = option.enabled();
+ unsigned short timeout = option.timeout();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:local_endpoint basic_socket_streambuf::local_endpoint]
+
+[indexterm2 local_endpoint..basic_socket_streambuf]
+Get the local endpoint of the socket.
+
+
+ endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload1 local_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload1 more...]]``
+
+ endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload2 local_endpoint]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::local_endpoint (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the local endpoint of the socket.
+
+
+ endpoint_type local_endpoint() const;
+
+
+This function is used to obtain the locally bound endpoint of the socket.
+
+
+[heading Return Value]
+
+An object that represents the local endpoint of the socket.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::local_endpoint (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the local endpoint of the socket.
+
+
+ endpoint_type local_endpoint(
+ boost::system::error_code & ec) const;
+
+
+This function is used to obtain the locally bound endpoint of the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:lowest_layer basic_socket_streambuf::lowest_layer]
+
+[indexterm2 lowest_layer..basic_socket_streambuf]
+Get a reference to the lowest layer.
+
+
+ lowest_layer_type & ``[link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload1 more...]]``
+
+
+Get a const reference to the lowest layer.
+
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.lowest_layer.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::lowest_layer (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get a reference to the lowest layer.
+
+
+ lowest_layer_type & lowest_layer();
+
+
+This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get a const reference to the lowest layer.
+
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:lowest_layer_type basic_socket_streambuf::lowest_layer_type]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 lowest_layer_type..basic_socket_streambuf]
+A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
+
+
+ typedef basic_socket< Protocol, StreamSocketService > lowest_layer_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
+ [Construct a basic_socket without opening it.
+
+ Construct and open a basic_socket.
+
+ Construct a basic_socket, opening it and binding it to the given local endpoint.
+
+ Construct a basic_socket on an existing native socket.
+
+ Move-construct a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
+
+]
+
+The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:max_connections basic_socket_streambuf::max_connections]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 max_connections..basic_socket_streambuf]
+The maximum length of the queue of pending incoming connections.
+
+
+ static const int max_connections = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_do_not_route basic_socket_streambuf::message_do_not_route]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_do_not_route..basic_socket_streambuf]
+Specify that the data should not be subject to routing.
+
+
+ static const int message_do_not_route = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_end_of_record basic_socket_streambuf::message_end_of_record]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_end_of_record..basic_socket_streambuf]
+Specifies that the data marks the end of a record.
+
+
+ static const int message_end_of_record = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_flags basic_socket_streambuf::message_flags]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_flags..basic_socket_streambuf]
+Bitmask type for flags that can be passed to send and receive operations.
+
+
+ typedef int message_flags;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:message_out_of_band basic_socket_streambuf::message_out_of_band]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_out_of_band..basic_socket_streambuf]
+Process out-of-band data.
+
+
+ static const int message_out_of_band = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_peek basic_socket_streambuf::message_peek]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_peek..basic_socket_streambuf]
+Peek at incoming data without removing it from the input queue.
+
+
+ static const int message_peek = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:native basic_socket_streambuf::native]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 native..basic_socket_streambuf]
+(Deprecated: Use `native_handle()`.) Get the native socket representation.
+
+
+ native_type native();
+
+
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle basic_socket_streambuf::native_handle]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 native_handle..basic_socket_streambuf]
+Get the native socket representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type basic_socket_streambuf::native_handle_type]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 native_handle_type..basic_socket_streambuf]
+The native representation of a socket.
+
+
+ typedef StreamSocketService::native_handle_type native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:native_non_blocking basic_socket_streambuf::native_non_blocking]
+
+[indexterm2 native_non_blocking..basic_socket_streambuf]
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool ``[link boost_asio.reference.basic_socket_streambuf.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.native_non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.native_non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.native_non_blocking.overload3 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::native_non_blocking (1 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool native_non_blocking() const;
+
+
+This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Return Value]
+
+`true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
+
+
+[heading Remarks]
+
+The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::native_non_blocking (2 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void native_non_blocking(
+ bool mode);
+
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
+
+]
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_socket_streambuf::native_non_blocking (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ boost::system::error_code native_non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
+
+]
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:native_type basic_socket_streambuf::native_type]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 native_type..basic_socket_streambuf]
+(Deprecated: Use native\_handle\_type.) The native representation of a socket.
+
+
+ typedef StreamSocketService::native_handle_type native_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:non_blocking basic_socket_streambuf::non_blocking]
+
+[indexterm2 non_blocking..basic_socket_streambuf]
+Gets the non-blocking mode of the socket.
+
+
+ bool ``[link boost_asio.reference.basic_socket_streambuf.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the socket.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.non_blocking.overload3 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::non_blocking (1 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Gets the non-blocking mode of the socket.
+
+
+ bool non_blocking() const;
+
+
+
+[heading Return Value]
+
+`true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::non_blocking (2 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ void non_blocking(
+ bool mode);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_socket_streambuf::non_blocking (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:non_blocking_io basic_socket_streambuf::non_blocking_io]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 non_blocking_io..basic_socket_streambuf]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
+
+
+ typedef implementation_defined non_blocking_io;
+
+
+
+Implements the FIONBIO IO control command.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::non_blocking_io command(true);
+ socket.io_control(command);
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:open basic_socket_streambuf::open]
+
+[indexterm2 open..basic_socket_streambuf]
+Open the socket using the specified protocol.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.open.overload1 open]``(
+ const protocol_type & protocol = protocol_type());
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.open.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.open.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::open (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Open the socket using the specified protocol.
+
+
+ void open(
+ const protocol_type & protocol = protocol_type());
+
+
+This function opens the socket so that it will use the specified protocol.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[protocol][An object specifying protocol parameters to be used.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::open (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Open the socket using the specified protocol.
+
+
+ boost::system::error_code open(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+
+
+This function opens the socket so that it will use the specified protocol.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[protocol][An object specifying which protocol is to be used.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::system::error_code ec;
+ socket.open(boost::asio::ip::tcp::v4(), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:overflow basic_socket_streambuf::overflow]
+
+[indexterm2 overflow..basic_socket_streambuf]
+
+ int_type overflow(
+ int_type c);
+
+
+
+[endsect]
+
+
+
+[section:protocol_type basic_socket_streambuf::protocol_type]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 protocol_type..basic_socket_streambuf]
+The protocol type.
+
+
+ typedef Protocol protocol_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:puberror basic_socket_streambuf::puberror]
+
+[indexterm2 puberror..basic_socket_streambuf]
+Get the last error associated with the stream buffer.
+
+
+ const boost::system::error_code & puberror() const;
+
+
+
+[heading Return Value]
+
+An `error_code` corresponding to the last error from the stream buffer.
+
+
+
+
+[endsect]
+
+
+
+[section:receive_buffer_size basic_socket_streambuf::receive_buffer_size]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 receive_buffer_size..basic_socket_streambuf]
+Socket option for the receive buffer size of a socket.
+
+
+ typedef implementation_defined receive_buffer_size;
+
+
+
+Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_buffer_size option(8192);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:receive_low_watermark basic_socket_streambuf::receive_low_watermark]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 receive_low_watermark..basic_socket_streambuf]
+Socket option for the receive low watermark.
+
+
+ typedef implementation_defined receive_low_watermark;
+
+
+
+Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_low_watermark option(1024);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:remote_endpoint basic_socket_streambuf::remote_endpoint]
+
+[indexterm2 remote_endpoint..basic_socket_streambuf]
+Get the remote endpoint of the socket.
+
+
+ endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload1 remote_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload1 more...]]``
+
+ endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload2 remote_endpoint]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::remote_endpoint (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the remote endpoint of the socket.
+
+
+ endpoint_type remote_endpoint() const;
+
+
+This function is used to obtain the remote endpoint of the socket.
+
+
+[heading Return Value]
+
+An object that represents the remote endpoint of the socket.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::remote_endpoint (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the remote endpoint of the socket.
+
+
+ endpoint_type remote_endpoint(
+ boost::system::error_code & ec) const;
+
+
+This function is used to obtain the remote endpoint of the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:reuse_address basic_socket_streambuf::reuse_address]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 reuse_address..basic_socket_streambuf]
+Socket option to allow the socket to be bound to an address that is already in use.
+
+
+ typedef implementation_defined reuse_address;
+
+
+
+Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option(true);
+ acceptor.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:send_buffer_size basic_socket_streambuf::send_buffer_size]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 send_buffer_size..basic_socket_streambuf]
+Socket option for the send buffer size of a socket.
+
+
+ typedef implementation_defined send_buffer_size;
+
+
+
+Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option(8192);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:send_low_watermark basic_socket_streambuf::send_low_watermark]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 send_low_watermark..basic_socket_streambuf]
+Socket option for the send low watermark.
+
+
+ typedef implementation_defined send_low_watermark;
+
+
+
+Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option(1024);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:service basic_socket_streambuf::service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_socket_streambuf]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
+
+
+ service_type & service;
+
+
+
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
+[endsect]
+
+
+
+[section:service_type basic_socket_streambuf::service_type]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service_type..basic_socket_streambuf]
+The type of the service that will be used to provide I/O operations.
+
+
+ typedef StreamSocketService service_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:set_option basic_socket_streambuf::set_option]
+
+[indexterm2 set_option..basic_socket_streambuf]
+Set an option on the socket.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.set_option.overload1 set_option]``(
+ const SettableSocketOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.set_option.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.set_option.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::set_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Set an option on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void set_option(
+ const SettableSocketOption & option);
+
+
+This function is used to set an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The new option value to be set on the socket.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+
+[heading Example]
+
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ socket.set_option(option);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::set_option (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Set an option on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+
+
+This function is used to set an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The new option value to be set on the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+
+[heading Example]
+
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ boost::system::error_code ec;
+ socket.set_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:setbuf basic_socket_streambuf::setbuf]
+
+[indexterm2 setbuf..basic_socket_streambuf]
+
+ std::streambuf * setbuf(
+ char_type * s,
+ std::streamsize n);
+
+
+
+[endsect]
+
+
+[section:shutdown basic_socket_streambuf::shutdown]
+
+[indexterm2 shutdown..basic_socket_streambuf]
+Disable sends or receives on the socket.
+
+
+ void ``[link boost_asio.reference.basic_socket_streambuf.shutdown.overload1 shutdown]``(
+ shutdown_type what);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.shutdown.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.shutdown.overload2 shutdown]``(
+ shutdown_type what,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_socket_streambuf.shutdown.overload2 more...]]``
+
+
+[section:overload1 basic_socket_streambuf::shutdown (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Disable sends or receives on the socket.
+
+
+ void shutdown(
+ shutdown_type what);
+
+
+This function is used to disable send operations, receive operations, or both.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[what][Determines what types of operation will no longer be allowed.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+Shutting down the send side of the socket:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_streambuf::shutdown (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Disable sends or receives on the socket.
+
+
+ boost::system::error_code shutdown(
+ shutdown_type what,
+ boost::system::error_code & ec);
+
+
+This function is used to disable send operations, receive operations, or both.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[what][Determines what types of operation will no longer be allowed.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+Shutting down the send side of the socket:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:shutdown_type basic_socket_streambuf::shutdown_type]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 shutdown_type..basic_socket_streambuf]
+Different ways a socket may be shutdown.
+
+
+ enum shutdown_type
+
+[indexterm2 shutdown_receive..basic_socket_streambuf]
+[indexterm2 shutdown_send..basic_socket_streambuf]
+[indexterm2 shutdown_both..basic_socket_streambuf]
+
+[heading Values]
+[variablelist
+
+ [
+ [shutdown_receive]
+ [Shutdown the receive side of the socket. ]
+ ]
+
+ [
+ [shutdown_send]
+ [Shutdown the send side of the socket. ]
+ ]
+
+ [
+ [shutdown_both]
+ [Shutdown both send and receive on the socket. ]
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:sync basic_socket_streambuf::sync]
+
+[indexterm2 sync..basic_socket_streambuf]
+
+ int sync();
+
+
+
+[endsect]
+
+
+
+[section:time_type basic_socket_streambuf::time_type]
+
+[indexterm2 time_type..basic_socket_streambuf]
+The time type.
+
+
+ typedef TimeTraits::time_type time_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:timer_handler basic_socket_streambuf::timer_handler]
+
+[indexterm2 timer_handler..basic_socket_streambuf]
+
+ friend struct timer_handler();
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_socket_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:underflow basic_socket_streambuf::underflow]
+
+[indexterm2 underflow..basic_socket_streambuf]
+
+ int_type underflow();
+
+
+
+[endsect]
+
+
+
+[section:_basic_socket_streambuf basic_socket_streambuf::~basic_socket_streambuf]
+
+[indexterm2 ~basic_socket_streambuf..basic_socket_streambuf]
+Destructor flushes buffered data.
+
+
+ virtual ~basic_socket_streambuf();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:basic_stream_socket basic_stream_socket]
+
+
+Provides stream-oriented socket functionality.
+
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.StreamSocketService StreamSocketService]`` = stream_socket_service<Protocol>>
+ class basic_stream_socket :
+ public basic_socket< Protocol, StreamSocketService >
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
+ [Start an asynchronous receive. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
+ [Start an asynchronous send. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
+ [Construct a basic_stream_socket without opening it.
+
+ Construct and open a basic_stream_socket.
+
+ Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
+
+ Construct a basic_stream_socket on an existing native socket.
+
+ Move-construct a basic_stream_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_stream_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
+ [Read some data from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
+ [Receive some data on the socket.
+
+ Receive some data on a connected socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.send [*send]]]
+ [Send some data on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
+ [Write some data to the socket. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
+
+]
+
+The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+[section:assign basic_stream_socket::assign]
+
+[indexterm2 assign..basic_stream_socket]
+Assign an existing native socket to the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.assign.overload2 assign]``(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.assign.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::assign (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Assign an existing native socket to the socket.
+
+
+ void assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::assign (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Assign an existing native socket to the socket.
+
+
+ boost::system::error_code assign(
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:async_connect basic_stream_socket::async_connect]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 async_connect..basic_stream_socket]
+Start an asynchronous connect.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
+
+
+This function is used to asynchronously connect a socket to the specified remote endpoint. The function call always returns immediately.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
+
+[[handler][The handler to be called when the connection operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error // Result of operation
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Example]
+
+
+
+ void connect_handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Connect succeeded.
+ }
+ }
+
+ ...
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.async_connect(endpoint, connect_handler);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:async_read_some basic_stream_socket::async_read_some]
+
+[indexterm2 async_read_some..basic_stream_socket]
+Start an asynchronous read.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_some(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+
+
+This function is used to asynchronously read data from the stream socket. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes read.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
+
+
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.async_read_some(boost::asio::buffer(data, size), handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+[section:async_receive basic_stream_socket::async_receive]
+
+[indexterm2 async_receive..basic_stream_socket]
+Start an asynchronous receive.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_stream_socket.async_receive.overload1 async_receive]``(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_stream_socket.async_receive.overload2 async_receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ ReadHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_receive.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::async_receive (1 of 2 overloads)]
+
+
+Start an asynchronous receive.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+
+
+This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes received.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
+
+
+[heading Example]
+
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.async_receive(boost::asio::buffer(data, size), handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::async_receive (2 of 2 overloads)]
+
+
+Start an asynchronous receive.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ ReadHandler handler);
+
+
+This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[flags][Flags specifying how the receive call is to be made.]]
+
+[[handler][The handler to be called when the receive operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes received.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is received before the asynchronous operation completes.
+
+
+[heading Example]
+
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.async_receive(boost::asio::buffer(data, size), 0, handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:async_send basic_stream_socket::async_send]
+
+[indexterm2 async_send..basic_stream_socket]
+Start an asynchronous send.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.basic_stream_socket.async_send.overload1 async_send]``(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.basic_stream_socket.async_send.overload2 async_send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ WriteHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.async_send.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::async_send (1 of 2 overloads)]
+
+
+Start an asynchronous send.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
+
+
+This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes sent.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
+
+
+[heading Example]
+
+To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.async_send(boost::asio::buffer(data, size), handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::async_send (2 of 2 overloads)]
+
+
+Start an asynchronous send.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ WriteHandler handler);
+
+
+This function is used to asynchronously send data on the stream socket. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be sent on the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[flags][Flags specifying how the send call is to be made.]]
+
+[[handler][The handler to be called when the send operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes sent.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
+
+
+[heading Example]
+
+To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.async_send(boost::asio::buffer(data, size), 0, handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:async_write_some basic_stream_socket::async_write_some]
+
+[indexterm2 async_write_some..basic_stream_socket]
+Start an asynchronous write.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_some(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
+
+
+This function is used to asynchronously write data to the stream socket. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be written to the socket. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes written.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
+
+
+[heading Example]
+
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.async_write_some(boost::asio::buffer(data, size), handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+[section:at_mark basic_stream_socket::at_mark]
+
+[indexterm2 at_mark..basic_stream_socket]
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload1 at_mark]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload1 more...]]``
+
+ bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.at_mark.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::at_mark (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool at_mark() const;
+
+
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+
+
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::at_mark (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool at_mark(
+ boost::system::error_code & ec) const;
+
+
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:available basic_stream_socket::available]
+
+[indexterm2 available..basic_stream_socket]
+Determine the number of bytes available for reading.
+
+
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload1 available]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload1 more...]]``
+
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload2 available]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.available.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::available (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine the number of bytes available for reading.
+
+
+ std::size_t available() const;
+
+
+This function is used to determine the number of bytes that may be read without blocking.
+
+
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::available (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Determine the number of bytes available for reading.
+
+
+ std::size_t available(
+ boost::system::error_code & ec) const;
+
+
+This function is used to determine the number of bytes that may be read without blocking.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:basic_stream_socket basic_stream_socket::basic_stream_socket]
+
+[indexterm2 basic_stream_socket..basic_stream_socket]
+Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it.
+
+
+ explicit ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 basic_stream_socket]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 more...]]``
+
+
+Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`].
+
+
+ ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 basic_stream_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 more...]]``
+
+
+Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint.
+
+
+ ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 basic_stream_socket]``(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 more...]]``
+
+
+Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket.
+
+
+ ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 basic_stream_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload4 more...]]``
+
+
+Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another.
+
+
+ ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 basic_stream_socket]``(
+ basic_stream_socket && other);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload5 more...]]``
+
+
+[section:overload1 basic_stream_socket::basic_stream_socket (1 of 5 overloads)]
+
+
+Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] without opening it.
+
+
+ basic_stream_socket(
+ boost::asio::io_service & io_service);
+
+
+This constructor creates a stream socket without opening it. The socket needs to be opened and then connected or accepted before data can be sent or received on it.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::basic_stream_socket (2 of 5 overloads)]
+
+
+Construct and open a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`].
+
+
+ basic_stream_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+
+
+This constructor creates and opens a stream socket. The socket needs to be connected or accepted before data can be sent or received on it.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+
+[[protocol][An object specifying protocol parameters to be used.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_stream_socket::basic_stream_socket (3 of 5 overloads)]
+
+
+Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`], opening it and binding it to the given local endpoint.
+
+
+ basic_stream_socket(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
+
+
+This constructor creates a stream socket and automatically opens it bound to the specified endpoint on the local machine. The protocol used is the protocol associated with the given endpoint.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+
+[[endpoint][An endpoint on the local machine to which the stream socket will be bound.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload4 basic_stream_socket::basic_stream_socket (4 of 5 overloads)]
+
+
+Construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] on an existing native socket.
+
+
+ basic_stream_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket);
+
+
+This constructor creates a stream socket object to hold an existing native socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+
+[[protocol][An object specifying protocol parameters to be used.]]
+
+[[native_socket][The new underlying socket implementation.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload5 basic_stream_socket::basic_stream_socket (5 of 5 overloads)]
+
+
+Move-construct a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another.
+
+
+ basic_stream_socket(
+ basic_stream_socket && other);
+
+
+This constructor moves a stream socket from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:bind basic_stream_socket::bind]
+
+[indexterm2 bind..basic_stream_socket]
+Bind the socket to the given local endpoint.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.bind.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::bind (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Bind the socket to the given local endpoint.
+
+
+ void bind(
+ const endpoint_type & endpoint);
+
+
+This function binds the socket to the specified endpoint on the local machine.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::bind (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Bind the socket to the given local endpoint.
+
+
+ boost::system::error_code bind(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+
+
+This function binds the socket to the specified endpoint on the local machine.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+ boost::system::error_code ec;
+ socket.bind(boost::asio::ip::tcp::endpoint(
+ boost::asio::ip::tcp::v4(), 12345), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:broadcast basic_stream_socket::broadcast]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 broadcast..basic_stream_socket]
+Socket option to permit sending of broadcast messages.
+
+
+ typedef implementation_defined broadcast;
+
+
+
+Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:bytes_readable basic_stream_socket::bytes_readable]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 bytes_readable..basic_stream_socket]
+IO control command to get the amount of data that can be read without blocking.
+
+
+ typedef implementation_defined bytes_readable;
+
+
+
+Implements the FIONREAD IO control command.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::bytes_readable command(true);
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:cancel basic_stream_socket::cancel]
+
+[indexterm2 cancel..basic_stream_socket]
+Cancel all asynchronous operations associated with the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.cancel.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::cancel (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Cancel all asynchronous operations associated with the socket.
+
+
+ void cancel();
+
+
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
+
+
+* It will only cancel asynchronous operations that were initiated in the current thread.
+
+
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
+
+For portable cancellation, consider using one of the following alternatives:
+
+
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
+
+
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
+
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::cancel (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Cancel all asynchronous operations associated with the socket.
+
+
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
+
+
+This function causes all outstanding asynchronous connect, send and receive operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+Calls to `cancel()` will always fail with `boost::asio::error::operation_not_supported` when run on Windows XP, Windows Server 2003, and earlier versions of Windows, unless BOOST\_ASIO\_ENABLE\_CANCELIO is defined. However, the CancelIo function has two issues that should be considered before enabling its use:
+
+
+* It will only cancel asynchronous operations that were initiated in the current thread.
+
+
+* It can appear to complete without error, but the request to cancel the unfinished operations may be silently ignored by the operating system. Whether it works or not seems to depend on the drivers that are installed.
+
+For portable cancellation, consider using one of the following alternatives:
+
+
+* Disable asio's I/O completion port backend by defining BOOST\_ASIO\_DISABLE\_IOCP.
+
+
+* Use the `close()` function to simultaneously cancel the outstanding operations and close the socket.
+
+When running on Windows Vista, Windows Server 2008, and later, the CancelIoEx function is always used. This function does not have the problems described above.
+
+
+[endsect]
+
+
+[endsect]
+
+[section:close basic_stream_socket::close]
+
+[indexterm2 close..basic_stream_socket]
+Close the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.close.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::close (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Close the socket.
+
+
+ void close();
+
+
+This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
+
+]
+
+
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::close (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Close the socket.
+
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+This function is used to close the socket. Any asynchronous send, receive or connect operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.close(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call `shutdown()` before closing the socket.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:connect basic_stream_socket::connect]
+
+[indexterm2 connect..basic_stream_socket]
+Connect the socket to the specified endpoint.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.connect.overload1 connect]``(
+ const endpoint_type & peer_endpoint);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.connect.overload2 connect]``(
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.connect.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::connect (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Connect the socket to the specified endpoint.
+
+
+ void connect(
+ const endpoint_type & peer_endpoint);
+
+
+This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.connect(endpoint);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::connect (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Connect the socket to the specified endpoint.
+
+
+ boost::system::error_code connect(
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+
+
+This function is used to connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
+
+The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is not returned to the closed state.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ boost::system::error_code ec;
+ socket.connect(endpoint, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:debug basic_stream_socket::debug]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 debug..basic_stream_socket]
+Socket option to enable socket-level debugging.
+
+
+ typedef implementation_defined debug;
+
+
+
+Implements the SOL\_SOCKET/SO\_DEBUG socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:do_not_route basic_stream_socket::do_not_route]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 do_not_route..basic_stream_socket]
+Socket option to prevent routing, use local interfaces only.
+
+
+ typedef implementation_defined do_not_route;
+
+
+
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::do_not_route option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:enable_connection_aborted basic_stream_socket::enable_connection_aborted]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 enable_connection_aborted..basic_stream_socket]
+Socket option to report aborted connections on accept.
+
+
+ typedef implementation_defined enable_connection_aborted;
+
+
+
+Implements a custom socket option that determines whether or not an accept operation is permitted to fail with `boost::asio::error::connection_aborted`. By default the option is false.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option(true);
+ acceptor.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::enable_connection_aborted option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:endpoint_type basic_stream_socket::endpoint_type]
+
+[indexterm2 endpoint_type..basic_stream_socket]
+The endpoint type.
+
+
+ typedef Protocol::endpoint endpoint_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:get_implementation basic_stream_socket::get_implementation]
+
+[indexterm2 get_implementation..basic_stream_socket]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.basic_stream_socket.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.basic_stream_socket.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_implementation.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:get_io_service basic_stream_socket::get_io_service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 get_io_service..basic_stream_socket]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+
+
+ boost::asio::io_service & get_io_service();
+
+
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+
+
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+[section:get_option basic_stream_socket::get_option]
+
+[indexterm2 get_option..basic_stream_socket]
+Get an option from the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.get_option.overload1 get_option]``(
+ GettableSocketOption & option) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.get_option.overload2 get_option]``(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_option.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::get_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get an option from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void get_option(
+ GettableSocketOption & option) const;
+
+
+This function is used to get the current value of an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The option value to be obtained from the socket.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::get_option (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get an option from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
+
+
+This function is used to get the current value of an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The option value to be obtained from the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::keep_alive option;
+ boost::system::error_code ec;
+ socket.get_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ bool is_set = option.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:get_service basic_stream_socket::get_service]
+
+[indexterm2 get_service..basic_stream_socket]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.basic_stream_socket.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.basic_stream_socket.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.get_service.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::get_service (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ service_type & get_service();
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::get_service (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the service associated with the I/O object.
+
+
+ const service_type & get_service() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:implementation basic_stream_socket::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_stream_socket]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
+[section:implementation_type basic_stream_socket::implementation_type]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation_type..basic_stream_socket]
+The underlying implementation type of I/O object.
+
+
+ typedef service_type::implementation_type implementation_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:io_control basic_stream_socket::io_control]
+
+[indexterm2 io_control..basic_stream_socket]
+Perform an IO control command on the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.io_control.overload1 io_control]``(
+ IoControlCommand & command);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.io_control.overload2 io_control]``(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.io_control.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::io_control (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Perform an IO control command on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void io_control(
+ IoControlCommand & command);
+
+
+This function is used to execute an IO control command on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[command][The IO control command to be performed on the socket.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the number of bytes ready to read:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::io_control (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Perform an IO control command on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+
+
+This function is used to execute an IO control command on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[command][The IO control command to be performed on the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+
+[heading Example]
+
+Getting the number of bytes ready to read:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ boost::system::error_code ec;
+ socket.io_control(command, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ std::size_t bytes_readable = command.get();
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:is_open basic_stream_socket::is_open]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 is_open..basic_stream_socket]
+Determine whether the socket is open.
+
+
+ bool is_open() const;
+
+
+
+[endsect]
+
+
+
+[section:keep_alive basic_stream_socket::keep_alive]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 keep_alive..basic_stream_socket]
+Socket option to send keep-alives.
+
+
+ typedef implementation_defined keep_alive;
+
+
+
+Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:linger basic_stream_socket::linger]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 linger..basic_stream_socket]
+Socket option to specify whether the socket lingers on close if unsent data is present.
+
+
+ typedef implementation_defined linger;
+
+
+
+Implements the SOL\_SOCKET/SO\_LINGER socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option(true, 30);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::linger option;
+ socket.get_option(option);
+ bool is_set = option.enabled();
+ unsigned short timeout = option.timeout();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:local_endpoint basic_stream_socket::local_endpoint]
+
+[indexterm2 local_endpoint..basic_stream_socket]
+Get the local endpoint of the socket.
+
+
+ endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 local_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 more...]]``
+
+ endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 local_endpoint]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::local_endpoint (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the local endpoint of the socket.
+
+
+ endpoint_type local_endpoint() const;
+
+
+This function is used to obtain the locally bound endpoint of the socket.
+
+
+[heading Return Value]
+
+An object that represents the local endpoint of the socket.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::local_endpoint (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the local endpoint of the socket.
+
+
+ endpoint_type local_endpoint(
+ boost::system::error_code & ec) const;
+
+
+This function is used to obtain the locally bound endpoint of the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+An object that represents the local endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:lowest_layer basic_stream_socket::lowest_layer]
+
+[indexterm2 lowest_layer..basic_stream_socket]
+Get a reference to the lowest layer.
+
+
+ lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload1 more...]]``
+
+
+Get a const reference to the lowest layer.
+
+
+ const lowest_layer_type & ``[link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.lowest_layer.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::lowest_layer (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get a reference to the lowest layer.
+
+
+ lowest_layer_type & lowest_layer();
+
+
+This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::lowest_layer (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get a const reference to the lowest layer.
+
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.basic_socket `basic_socket`] cannot contain any further layers, it simply returns a reference to itself.
+
+
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:lowest_layer_type basic_stream_socket::lowest_layer_type]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 lowest_layer_type..basic_stream_socket]
+A [link boost_asio.reference.basic_socket `basic_socket`] is always the lowest layer.
+
+
+ typedef basic_socket< Protocol, StreamSocketService > lowest_layer_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
+ [Construct a basic_socket without opening it.
+
+ Construct and open a basic_socket.
+
+ Construct a basic_socket, opening it and binding it to the given local endpoint.
+
+ Construct a basic_socket on an existing native socket.
+
+ Move-construct a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
+
+]
+
+The [link boost_asio.reference.basic_socket `basic_socket`] class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:max_connections basic_stream_socket::max_connections]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 max_connections..basic_stream_socket]
+The maximum length of the queue of pending incoming connections.
+
+
+ static const int max_connections = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_do_not_route basic_stream_socket::message_do_not_route]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_do_not_route..basic_stream_socket]
+Specify that the data should not be subject to routing.
+
+
+ static const int message_do_not_route = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_end_of_record basic_stream_socket::message_end_of_record]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_end_of_record..basic_stream_socket]
+Specifies that the data marks the end of a record.
+
+
+ static const int message_end_of_record = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_flags basic_stream_socket::message_flags]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_flags..basic_stream_socket]
+Bitmask type for flags that can be passed to send and receive operations.
+
+
+ typedef int message_flags;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:message_out_of_band basic_stream_socket::message_out_of_band]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_out_of_band..basic_stream_socket]
+Process out-of-band data.
+
+
+ static const int message_out_of_band = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_peek basic_stream_socket::message_peek]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_peek..basic_stream_socket]
+Peek at incoming data without removing it from the input queue.
+
+
+ static const int message_peek = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:native basic_stream_socket::native]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 native..basic_stream_socket]
+(Deprecated: Use `native_handle()`.) Get the native socket representation.
+
+
+ native_type native();
+
+
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle basic_stream_socket::native_handle]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 native_handle..basic_stream_socket]
+Get the native socket representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the socket. This is intended to allow access to native socket functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type basic_stream_socket::native_handle_type]
+
+[indexterm2 native_handle_type..basic_stream_socket]
+The native representation of a socket.
+
+
+ typedef StreamSocketService::native_handle_type native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:native_non_blocking basic_stream_socket::native_non_blocking]
+
+[indexterm2 native_non_blocking..basic_stream_socket]
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.native_non_blocking.overload3 more...]]``
+
+
+[section:overload1 basic_stream_socket::native_non_blocking (1 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool native_non_blocking() const;
+
+
+This function is used to retrieve the non-blocking mode of the underlying native socket. This mode has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Return Value]
+
+`true` if the underlying socket is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
+
+
+[heading Remarks]
+
+The current non-blocking mode is cached by the socket object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native socket.
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::native_non_blocking (2 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ void native_non_blocking(
+ bool mode);
+
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
+
+]
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_stream_socket::native_non_blocking (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ boost::system::error_code native_non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+This function is used to modify the non-blocking mode of the underlying native socket. It has no effect on the behaviour of the socket object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the underlying socket is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense.]]
+
+]
+
+
+[heading Example]
+
+This function is intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The following example illustrates how Linux's `sendfile` system call might be encapsulated:
+
+ template <typename Handler>
+ struct sendfile_op
+ {
+ tcp::socket& sock_;
+ int fd_;
+ Handler handler_;
+ off_t offset_;
+ std::size_t total_bytes_transferred_;
+
+ // Function call operator meeting WriteHandler requirements.
+ // Used as the handler for the async_write_some operation.
+ void operator()(boost::system::error_code ec, std::size_t)
+ {
+ // Put the underlying socket into non-blocking mode.
+ if (!ec)
+ if (!sock_.native_non_blocking())
+ sock_.native_non_blocking(true, ec);
+
+ if (!ec)
+ {
+ for (;;)
+ {
+ // Try the system call.
+ errno = 0;
+ int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536);
+ ec = boost::system::error_code(n < 0 ? errno : 0,
+ boost::asio::error::get_system_category());
+ total_bytes_transferred_ += ec ? 0 : n;
+
+ // Retry operation immediately if interrupted by signal.
+ if (ec == boost::asio::error::interrupted)
+ continue;
+
+ // Check if we need to run the operation again.
+ if (ec == boost::asio::error::would_block
+ || ec == boost::asio::error::try_again)
+ {
+ // We have to wait for the socket to become ready again.
+ sock_.async_write_some(boost::asio::null_buffers(), *this);
+ return;
+ }
+
+ if (ec || n == 0)
+ {
+ // An error occurred, or we have reached the end of the file.
+ // Either way we must exit the loop so we can call the handler.
+ break;
+ }
+
+ // Loop around to try calling sendfile again.
+ }
+ }
+
+ // Pass result back to user's handler.
+ handler_(ec, total_bytes_transferred_);
+ }
+ };
+
+ template <typename Handler>
+ void async_sendfile(tcp::socket& sock, int fd, Handler h)
+ {
+ sendfile_op<Handler> op = { sock, fd, h, 0, 0 };
+ sock.async_write_some(boost::asio::null_buffers(), op);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:native_type basic_stream_socket::native_type]
+
+[indexterm2 native_type..basic_stream_socket]
+(Deprecated: Use native\_handle\_type.) The native representation of a socket.
+
+
+ typedef StreamSocketService::native_handle_type native_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:non_blocking basic_stream_socket::non_blocking]
+
+[indexterm2 non_blocking..basic_stream_socket]
+Gets the non-blocking mode of the socket.
+
+
+ bool ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.non_blocking.overload3 more...]]``
+
+
+[section:overload1 basic_stream_socket::non_blocking (1 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Gets the non-blocking mode of the socket.
+
+
+ bool non_blocking() const;
+
+
+
+[heading Return Value]
+
+`true` if the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::non_blocking (2 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ void non_blocking(
+ bool mode);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_stream_socket::non_blocking (3 of 3 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the socket's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:non_blocking_io basic_stream_socket::non_blocking_io]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 non_blocking_io..basic_stream_socket]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
+
+
+ typedef implementation_defined non_blocking_io;
+
+
+
+Implements the FIONBIO IO control command.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::non_blocking_io command(true);
+ socket.io_control(command);
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:open basic_stream_socket::open]
+
+[indexterm2 open..basic_stream_socket]
+Open the socket using the specified protocol.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.open.overload1 open]``(
+ const protocol_type & protocol = protocol_type());
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.open.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::open (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Open the socket using the specified protocol.
+
+
+ void open(
+ const protocol_type & protocol = protocol_type());
+
+
+This function opens the socket so that it will use the specified protocol.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[protocol][An object specifying protocol parameters to be used.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ socket.open(boost::asio::ip::tcp::v4());
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::open (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Open the socket using the specified protocol.
+
+
+ boost::system::error_code open(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+
+
+This function opens the socket so that it will use the specified protocol.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[protocol][An object specifying which protocol is to be used.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ boost::system::error_code ec;
+ socket.open(boost::asio::ip::tcp::v4(), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:operator_eq_ basic_stream_socket::operator=]
+
+[indexterm2 operator=..basic_stream_socket]
+Move-assign a [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] from another.
+
+
+ basic_stream_socket & operator=(
+ basic_stream_socket && other);
+
+
+This assignment operator moves a stream socket from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_socket(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
+
+[section:protocol_type basic_stream_socket::protocol_type]
+
+[indexterm2 protocol_type..basic_stream_socket]
+The protocol type.
+
+
+ typedef Protocol protocol_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:read_some basic_stream_socket::read_some]
+
+[indexterm2 read_some..basic_stream_socket]
+Read some data from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload1 read_some]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload2 read_some]``(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::read_some (1 of 2 overloads)]
+
+
+Read some data from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
+
+
+This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be read.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes read.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+
+]
+
+
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
+
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.read_some(boost::asio::buffer(data, size));
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::read_some (2 of 2 overloads)]
+
+
+Read some data from the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be read.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes read. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:receive basic_stream_socket::receive]
+
+[indexterm2 receive..basic_stream_socket]
+Receive some data on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload1 receive]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload2 receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload2 more...]]``
+
+
+Receive some data on a connected socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload3 receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload3 more...]]``
+
+
+[section:overload1 basic_stream_socket::receive (1 of 3 overloads)]
+
+
+Receive some data on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers);
+
+
+This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes received.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+
+]
+
+
+[heading Remarks]
+
+The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
+
+[heading Example]
+
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.receive(boost::asio::buffer(data, size));
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::receive (2 of 3 overloads)]
+
+
+Receive some data on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags);
+
+
+This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received.]]
+
+[[flags][Flags specifying how the receive call is to be made.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes received.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+
+]
+
+
+[heading Remarks]
+
+The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
+
+[heading Example]
+
+To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.receive(boost::asio::buffer(data, size), 0);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_stream_socket::receive (3 of 3 overloads)]
+
+
+Receive some data on a connected socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
+
+
+This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received.]]
+
+[[flags][Flags specifying how the receive call is to be made.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes received. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:receive_buffer_size basic_stream_socket::receive_buffer_size]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 receive_buffer_size..basic_stream_socket]
+Socket option for the receive buffer size of a socket.
+
+
+ typedef implementation_defined receive_buffer_size;
+
+
+
+Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_buffer_size option(8192);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:receive_low_watermark basic_stream_socket::receive_low_watermark]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 receive_low_watermark..basic_stream_socket]
+Socket option for the receive low watermark.
+
+
+ typedef implementation_defined receive_low_watermark;
+
+
+
+Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_low_watermark option(1024);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::receive_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:remote_endpoint basic_stream_socket::remote_endpoint]
+
+[indexterm2 remote_endpoint..basic_stream_socket]
+Get the remote endpoint of the socket.
+
+
+ endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 remote_endpoint]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 more...]]``
+
+ endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 remote_endpoint]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::remote_endpoint (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the remote endpoint of the socket.
+
+
+ endpoint_type remote_endpoint() const;
+
+
+This function is used to obtain the remote endpoint of the socket.
+
+
+[heading Return Value]
+
+An object that represents the remote endpoint of the socket.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::remote_endpoint (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Get the remote endpoint of the socket.
+
+
+ endpoint_type remote_endpoint(
+ boost::system::error_code & ec) const;
+
+
+This function is used to obtain the remote endpoint of the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+
+
+[heading Example]
+
+
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:reuse_address basic_stream_socket::reuse_address]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 reuse_address..basic_stream_socket]
+Socket option to allow the socket to be bound to an address that is already in use.
+
+
+ typedef implementation_defined reuse_address;
+
+
+
+Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option(true);
+ acceptor.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:send basic_stream_socket::send]
+
+[indexterm2 send..basic_stream_socket]
+Send some data on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload1 send]``(
+ const ConstBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload2 send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload2 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload3 send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload3 more...]]``
+
+
+[section:overload1 basic_stream_socket::send (1 of 3 overloads)]
+
+
+Send some data on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ const ConstBufferSequence & buffers);
+
+
+This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be sent on the socket.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes sent.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+
+
+[heading Example]
+
+To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.send(boost::asio::buffer(data, size));
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::send (2 of 3 overloads)]
+
+
+Send some data on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags);
+
+
+This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be sent on the socket.]]
+
+[[flags][Flags specifying how the send call is to be made.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes sent.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+
+
+[heading Example]
+
+To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.send(boost::asio::buffer(data, size), 0);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 basic_stream_socket::send (3 of 3 overloads)]
+
+
+Send some data on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
+
+
+This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be sent on the socket.]]
+
+[[flags][Flags specifying how the send call is to be made.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes sent. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:send_buffer_size basic_stream_socket::send_buffer_size]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 send_buffer_size..basic_stream_socket]
+Socket option for the send buffer size of a socket.
+
+
+ typedef implementation_defined send_buffer_size;
+
+
+
+Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option(8192);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:send_low_watermark basic_stream_socket::send_low_watermark]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 send_low_watermark..basic_stream_socket]
+Socket option for the send low watermark.
+
+
+ typedef implementation_defined send_low_watermark;
+
+
+
+Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
+
+
+[heading Examples]
+
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option(1024);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:service basic_stream_socket::service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_stream_socket]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
+
+
+ service_type & service;
+
+
+
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
+[endsect]
+
+
+
+[section:service_type basic_stream_socket::service_type]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service_type..basic_stream_socket]
+The type of the service that will be used to provide I/O operations.
+
+
+ typedef StreamSocketService service_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_stream_socket.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:set_option basic_stream_socket::set_option]
+
+[indexterm2 set_option..basic_stream_socket]
+Set an option on the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.set_option.overload1 set_option]``(
+ const SettableSocketOption & option);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::set_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Set an option on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void set_option(
+ const SettableSocketOption & option);
+
+
+This function is used to set an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The new option value to be set on the socket.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+
+[heading Example]
+
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ socket.set_option(option);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::set_option (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Set an option on the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+
+
+This function is used to set an option on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[option][The new option value to be set on the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+
+[heading Example]
+
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ boost::system::error_code ec;
+ socket.set_option(option, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:shutdown basic_stream_socket::shutdown]
+
+[indexterm2 shutdown..basic_stream_socket]
+Disable sends or receives on the socket.
+
+
+ void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload1 shutdown]``(
+ shutdown_type what);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.shutdown.overload2 shutdown]``(
+ shutdown_type what,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::shutdown (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Disable sends or receives on the socket.
+
+
+ void shutdown(
+ shutdown_type what);
+
+
+This function is used to disable send operations, receive operations, or both.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[what][Determines what types of operation will no longer be allowed.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Example]
+
+Shutting down the send side of the socket:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::shutdown (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+
+Disable sends or receives on the socket.
+
+
+ boost::system::error_code shutdown(
+ shutdown_type what,
+ boost::system::error_code & ec);
+
+
+This function is used to disable send operations, receive operations, or both.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[what][Determines what types of operation will no longer be allowed.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Example]
+
+Shutting down the send side of the socket:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:shutdown_type basic_stream_socket::shutdown_type]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 shutdown_type..basic_stream_socket]
+Different ways a socket may be shutdown.
+
+
+ enum shutdown_type
+
+[indexterm2 shutdown_receive..basic_stream_socket]
+[indexterm2 shutdown_send..basic_stream_socket]
+[indexterm2 shutdown_both..basic_stream_socket]
+
+[heading Values]
+[variablelist
+
+ [
+ [shutdown_receive]
+ [Shutdown the receive side of the socket. ]
+ ]
+
+ [
+ [shutdown_send]
+ [Shutdown the send side of the socket. ]
+ ]
+
+ [
+ [shutdown_both]
+ [Shutdown both send and receive on the socket. ]
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:write_some basic_stream_socket::write_some]
+
+[indexterm2 write_some..basic_stream_socket]
+Write some data to the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload2 write_some]``(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload2 more...]]``
+
+
+[section:overload1 basic_stream_socket::write_some (1 of 2 overloads)]
+
+
+Write some data to the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers);
+
+
+This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be written to the socket.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes written.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+
+]
+
+
+[heading Remarks]
+
+The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+
+
+[heading Example]
+
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ socket.write_some(boost::asio::buffer(data, size));
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_stream_socket::write_some (2 of 2 overloads)]
+
+
+Write some data to the socket.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be written to the socket.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes written. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[endsect]
+
+[section:basic_streambuf basic_streambuf]
+
+
+Automatically resizable buffer class based on std::streambuf.
+
+
+ template<
+ typename Allocator = std::allocator<char>>
+ class basic_streambuf :
+ noncopyable
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
+ [The type used to represent the input sequence as a list of buffers. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
+ [The type used to represent the output sequence as a list of buffers. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
+ [Construct a basic_streambuf object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
+ [Move characters from the output sequence to the input sequence. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
+ [Remove characters from the input sequence. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.data [*data]]]
+ [Get a list of buffers that represents the input sequence. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
+ [Get the maximum size of the basic_streambuf. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
+ [Get a list of buffers that represents the output sequence, with the given size. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.size [*size]]]
+ [Get the size of the input sequence. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
+ [Override std::streambuf behaviour. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
+ [Override std::streambuf behaviour. ]
+ ]
+
+]
+
+The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
+
+The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
+
+
+* A single contiguous character array, which is reallocated as necessary to accommodate changes in the size of the character sequence. This is the implementation approach currently used in Asio.
+
+
+* A sequence of one or more character arrays, where each array is of the same size. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
+
+
+* A sequence of one or more character arrays of varying sizes. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
+
+The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds:
+
+ size() <= max_size()
+
+
+Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
+
+The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
+
+
+[heading Examples]
+
+Writing directly from an streambuf to a socket:
+
+ boost::asio::streambuf b;
+ std::ostream os(&b);
+ os << "Hello, World!\n";
+
+ // try sending some data in input sequence
+ size_t n = sock.send(b.data());
+
+ b.consume(n); // sent data is removed from input sequence
+
+
+
+
+Reading from a socket directly into a streambuf:
+
+ boost::asio::streambuf b;
+
+ // reserve 512 bytes in output sequence
+ boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
+
+ size_t n = sock.receive(bufs);
+
+ // received data is "committed" from output sequence to input sequence
+ b.commit(n);
+
+ std::istream is(&b);
+ std::string s;
+ is >> s;
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:basic_streambuf basic_streambuf::basic_streambuf]
+
+[indexterm2 basic_streambuf..basic_streambuf]
+Construct a [link boost_asio.reference.basic_streambuf `basic_streambuf`] object.
+
+
+ basic_streambuf(
+ std::size_t maximum_size = (std::numeric_limits< std::size_t >::max)(),
+ const Allocator & allocator = Allocator());
+
+
+Constructs a streambuf with the specified maximum size. The initial size of the streambuf's input sequence is 0.
+
+
+[endsect]
+
+
+
+[section:commit basic_streambuf::commit]
+
+[indexterm2 commit..basic_streambuf]
+Move characters from the output sequence to the input sequence.
+
+
+ void commit(
+ std::size_t n);
+
+
+Appends `n` characters from the start of the output sequence to the input sequence. The beginning of the output sequence is advanced by `n` characters.
+
+Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[std::length_error][If `n` is greater than the size of the output sequence. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:const_buffers_type basic_streambuf::const_buffers_type]
+
+[indexterm2 const_buffers_type..basic_streambuf]
+The type used to represent the input sequence as a list of buffers.
+
+
+ typedef implementation_defined const_buffers_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:consume basic_streambuf::consume]
+
+[indexterm2 consume..basic_streambuf]
+Remove characters from the input sequence.
+
+
+ void consume(
+ std::size_t n);
+
+
+Removes `n` characters from the beginning of the input sequence.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[std::length_error][If `n > size()`. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:data basic_streambuf::data]
+
+[indexterm2 data..basic_streambuf]
+Get a list of buffers that represents the input sequence.
+
+
+ const_buffers_type data() const;
+
+
+
+[heading Return Value]
+
+An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing all character arrays in the input sequence.
+
+
+[heading Remarks]
+
+The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence.
+
+
+
+
+[endsect]
+
+
+
+[section:max_size basic_streambuf::max_size]
+
+[indexterm2 max_size..basic_streambuf]
+Get the maximum size of the [link boost_asio.reference.basic_streambuf `basic_streambuf`].
+
+
+ std::size_t max_size() const;
+
+
+
+[heading Return Value]
+
+The allowed maximum of the sum of the sizes of the input sequence and output sequence.
+
+
+
+
+[endsect]
+
+
+
+[section:mutable_buffers_type basic_streambuf::mutable_buffers_type]
+
+[indexterm2 mutable_buffers_type..basic_streambuf]
+The type used to represent the output sequence as a list of buffers.
+
+
+ typedef implementation_defined mutable_buffers_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/basic_streambuf.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:overflow basic_streambuf::overflow]
+
+[indexterm2 overflow..basic_streambuf]
+Override std::streambuf behaviour.
+
+
+ int_type overflow(
+ int_type c);
+
+
+Behaves according to the specification of `std::streambuf::overflow()`, with the specialisation that `std::length_error` is thrown if appending the character to the input sequence would require the condition `size() > max_size()` to be true.
+
+
+[endsect]
+
+
+
+[section:prepare basic_streambuf::prepare]
+
+[indexterm2 prepare..basic_streambuf]
+Get a list of buffers that represents the output sequence, with the given size.
+
+
+ mutable_buffers_type prepare(
+ std::size_t n);
+
+
+Ensures that the output sequence can accommodate `n` characters, reallocating character array objects as necessary.
+
+
+[heading Return Value]
+
+An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing character array objects at the start of the output sequence such that the sum of the buffer sizes is `n`.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[std::length_error][If `size() + n > max_size()`.]]
+
+]
+
+
+[heading Remarks]
+
+The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence.
+
+
+
+
+[endsect]
+
+
+
+[section:reserve basic_streambuf::reserve]
+
+[indexterm2 reserve..basic_streambuf]
+
+ void reserve(
+ std::size_t n);
+
+
+
+[endsect]
+
+
+
+[section:size basic_streambuf::size]
+
+[indexterm2 size..basic_streambuf]
+Get the size of the input sequence.
+
+
+ std::size_t size() const;
+
+
+
+[heading Return Value]
+
+The size of the input sequence. The value is equal to that calculated for `s` in the following code:
+
+ size_t s = 0;
+ const_buffers_type bufs = data();
+ const_buffers_type::const_iterator i = bufs.begin();
+ while (i != bufs.end())
+ {
+ const_buffer buf(*i++);
+ s += buffer_size(buf);
+ }
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:underflow basic_streambuf::underflow]
+
+[indexterm2 underflow..basic_streambuf]
+Override std::streambuf behaviour.
+
+
+ int_type underflow();
+
+
+Behaves according to the specification of `std::streambuf::underflow()`.
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:buffer buffer]
+
+[indexterm1 buffer]
+The `boost::asio::buffer` function is used to create a buffer object to represent raw memory, an array of POD elements, a vector of POD elements, or a std::string.
+
+
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload1 buffer]``(
+ const mutable_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload1 more...]]``
+
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload2 buffer]``(
+ const mutable_buffer & b,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload2 more...]]``
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload3 buffer]``(
+ const const_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload3 more...]]``
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload4 buffer]``(
+ const const_buffer & b,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload4 more...]]``
+
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload5 buffer]``(
+ void * data,
+ std::size_t size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload5 more...]]``
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload6 buffer]``(
+ const void * data,
+ std::size_t size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload6 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload7 buffer]``(
+ PodType (&data)[N]);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload7 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload8 buffer]``(
+ PodType (&data)[N],
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload8 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload9 buffer]``(
+ const PodType (&data)[N]);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload9 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload10 buffer]``(
+ const PodType (&data)[N],
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload10 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload11 buffer]``(
+ boost::array< PodType, N > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload11 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload12 buffer]``(
+ boost::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload12 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload13 buffer]``(
+ boost::array< const PodType, N > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload13 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload14 buffer]``(
+ boost::array< const PodType, N > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload14 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload15 buffer]``(
+ const boost::array< PodType, N > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload15 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload16 buffer]``(
+ const boost::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload16 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload17 buffer]``(
+ std::array< PodType, N > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload17 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload18 buffer]``(
+ std::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload18 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload19 buffer]``(
+ std::array< const PodType, N > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload19 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload20 buffer]``(
+ std::array< const PodType, N > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload20 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload21 buffer]``(
+ const std::array< PodType, N > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload21 more...]]``
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload22 buffer]``(
+ const std::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload22 more...]]``
+
+ template<
+ typename PodType,
+ typename Allocator>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload23 buffer]``(
+ std::vector< PodType, Allocator > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload23 more...]]``
+
+ template<
+ typename PodType,
+ typename Allocator>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload24 buffer]``(
+ std::vector< PodType, Allocator > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload24 more...]]``
+
+ template<
+ typename PodType,
+ typename Allocator>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload25 buffer]``(
+ const std::vector< PodType, Allocator > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload25 more...]]``
+
+ template<
+ typename PodType,
+ typename Allocator>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload26 buffer]``(
+ const std::vector< PodType, Allocator > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload26 more...]]``
+
+ template<
+ typename Elem,
+ typename Traits,
+ typename Allocator>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload27 buffer]``(
+ const std::basic_string< Elem, Traits, Allocator > & data);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload27 more...]]``
+
+ template<
+ typename Elem,
+ typename Traits,
+ typename Allocator>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload28 buffer]``(
+ const std::basic_string< Elem, Traits, Allocator > & data,
+ std::size_t max_size_in_bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer.overload28 more...]]``
+
+A buffer object represents a contiguous region of memory as a 2-tuple consisting of a pointer and size in bytes. A tuple of the form `{void*, size_t}` specifies a mutable (modifiable) region of memory. Similarly, a tuple of the form `{const void*, size_t}` specifies a const (non-modifiable) region of memory. These two forms correspond to the classes [link boost_asio.reference.mutable_buffer `mutable_buffer`] and [link boost_asio.reference.const_buffer `const_buffer`], respectively. To mirror C++'s conversion rules, a [link boost_asio.reference.mutable_buffer `mutable_buffer`] is implicitly convertible to a [link boost_asio.reference.const_buffer `const_buffer`], and the opposite conversion is not permitted.
+
+The simplest use case involves reading or writing a single buffer of a specified size:
+
+
+
+ sock.send(boost::asio::buffer(data, size));
+
+
+
+
+In the above example, the return value of `boost::asio::buffer` meets the requirements of the ConstBufferSequence concept so that it may be directly passed to the socket's write function. A buffer created for modifiable memory also meets the requirements of the MutableBufferSequence concept.
+
+An individual buffer may be created from a builtin array, std::vector, std::array or boost::array of POD elements. This helps prevent buffer overruns by automatically determining the size of the buffer:
+
+
+
+ char d1[128];
+ size_t bytes_transferred = sock.receive(boost::asio::buffer(d1));
+
+ std::vector<char> d2(128);
+ bytes_transferred = sock.receive(boost::asio::buffer(d2));
+
+ std::array<char, 128> d3;
+ bytes_transferred = sock.receive(boost::asio::buffer(d3));
+
+ boost::array<char, 128> d4;
+ bytes_transferred = sock.receive(boost::asio::buffer(d4));
+
+
+
+
+In all three cases above, the buffers created are exactly 128 bytes long. Note that a vector is [*never] automatically resized when creating or using a buffer. The buffer size is determined using the vector's `size()` member function, and not its capacity.
+
+
+[heading Accessing Buffer Contents]
+
+
+
+The contents of a buffer may be accessed using the [link boost_asio.reference.buffer_size `buffer_size`] and [link boost_asio.reference.buffer_cast `buffer_cast`] functions:
+
+
+
+ boost::asio::mutable_buffer b1 = ...;
+ std::size_t s1 = boost::asio::buffer_size(b1);
+ unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1);
+
+ boost::asio::const_buffer b2 = ...;
+ std::size_t s2 = boost::asio::buffer_size(b2);
+ const void* p2 = boost::asio::buffer_cast<const void*>(b2);
+
+
+
+
+The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
+
+For convenience, the [link boost_asio.reference.buffer_size `buffer_size`] function also works on buffer sequences (that is, types meeting the ConstBufferSequence or MutableBufferSequence type requirements). In this case, the function returns the total size of all buffers in the sequence.
+
+
+[heading Buffer Copying]
+
+
+
+The [link boost_asio.reference.buffer_copy `buffer_copy`] function may be used to copy raw bytes between individual buffers and buffer sequences.
+
+In particular, when used with the [link boost_asio.reference.buffer_size `buffer_size`] , the [link boost_asio.reference.buffer_copy `buffer_copy`] function can be used to linearise a sequence of buffers. For example:
+
+
+
+ vector<const_buffer> buffers = ...;
+
+ vector<unsigned char> data(boost::asio::buffer_size(buffers));
+ boost::asio::buffer_copy(boost::asio::buffer(data), buffers);
+
+
+
+
+
+[heading Buffer Invalidation]
+
+
+
+A buffer object does not have any ownership of the memory it refers to. It is the responsibility of the application to ensure the memory region remains valid until it is no longer required for an I/O operation. When the memory is no longer available, the buffer is said to have been invalidated.
+
+For the `boost::asio::buffer` overloads that accept an argument of type std::vector, the buffer objects returned are invalidated by any vector operation that also invalidates all references, pointers and iterators referring to the elements in the sequence (C++ Std, 23.2.4)
+
+For the `boost::asio::buffer` overloads that accept an argument of type std::basic\_string, the buffer objects returned are invalidated according to the rules defined for invalidation of references, pointers and iterators referring to elements of the sequence (C++ Std, 21.3).
+
+
+[heading Buffer Arithmetic]
+
+
+
+Buffer objects may be manipulated using simple arithmetic in a safe way which helps prevent buffer overruns. Consider an array initialised as follows:
+
+
+
+ boost::array<char, 6> a = { 'a', 'b', 'c', 'd', 'e' };
+
+
+
+
+A buffer object `b1` created using:
+
+
+
+ b1 = boost::asio::buffer(a);
+
+
+
+
+represents the entire array, `{ 'a', 'b', 'c', 'd', 'e' }`. An optional second argument to the `boost::asio::buffer` function may be used to limit the size, in bytes, of the buffer:
+
+
+
+ b2 = boost::asio::buffer(a, 3);
+
+
+
+
+such that `b2` represents the data `{ 'a', 'b', 'c' }`. Even if the size argument exceeds the actual size of the array, the size of the buffer object created will be limited to the array size.
+
+An offset may be applied to an existing buffer to create a new one:
+
+
+
+ b3 = b1 + 2;
+
+
+
+
+where `b3` will set to represent `{ 'c', 'd', 'e' }`. If the offset exceeds the size of the existing buffer, the newly created buffer will be empty.
+
+Both an offset and size may be specified to create a buffer that corresponds to a specific range of bytes within an existing buffer:
+
+
+
+ b4 = boost::asio::buffer(b1 + 1, 3);
+
+
+
+
+so that `b4` will refer to the bytes `{ 'b', 'c', 'd' }`.
+
+
+[heading Buffers and Scatter-Gather I/O]
+
+
+
+To read or write using multiple buffers (i.e. scatter-gather I/O), multiple buffer objects may be assigned into a container that supports the MutableBufferSequence (for read) or ConstBufferSequence (for write) concepts:
+
+
+
+ char d1[128];
+ std::vector<char> d2(128);
+ boost::array<char, 128> d3;
+
+ boost::array<mutable_buffer, 3> bufs1 = {
+ boost::asio::buffer(d1),
+ boost::asio::buffer(d2),
+ boost::asio::buffer(d3) };
+ bytes_transferred = sock.receive(bufs1);
+
+ std::vector<const_buffer> bufs2;
+ bufs2.push_back(boost::asio::buffer(d1));
+ bufs2.push_back(boost::asio::buffer(d2));
+ bufs2.push_back(boost::asio::buffer(d3));
+ bytes_transferred = sock.send(bufs2);
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffer.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:overload1 buffer (1 of 28 overloads)]
+
+
+Create a new modifiable buffer from an existing buffer.
+
+
+ mutable_buffers_1 buffer(
+ const mutable_buffer & b);
+
+
+
+[heading Return Value]
+
+`mutable_buffers_1(b)`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffer (2 of 28 overloads)]
+
+
+Create a new modifiable buffer from an existing buffer.
+
+
+ mutable_buffers_1 buffer(
+ const mutable_buffer & b,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ buffer_cast<void*>(b),
+ min(buffer_size(b), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 buffer (3 of 28 overloads)]
+
+
+Create a new non-modifiable buffer from an existing buffer.
+
+
+ const_buffers_1 buffer(
+ const const_buffer & b);
+
+
+
+[heading Return Value]
+
+`const_buffers_1(b)`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload4 buffer (4 of 28 overloads)]
+
+
+Create a new non-modifiable buffer from an existing buffer.
+
+
+ const_buffers_1 buffer(
+ const const_buffer & b,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ buffer_cast<const void*>(b),
+ min(buffer_size(b), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload5 buffer (5 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given memory range.
+
+
+ mutable_buffers_1 buffer(
+ void * data,
+ std::size_t size_in_bytes);
+
+
+
+[heading Return Value]
+
+`mutable_buffers_1(data, size_in_bytes)`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload6 buffer (6 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given memory range.
+
+
+ const_buffers_1 buffer(
+ const void * data,
+ std::size_t size_in_bytes);
+
+
+
+[heading Return Value]
+
+`const_buffers_1(data, size_in_bytes)`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload7 buffer (7 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 buffer(
+ PodType (&data)[N]);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ static_cast<void*>(data),
+ N * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload8 buffer (8 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 buffer(
+ PodType (&data)[N],
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ static_cast<void*>(data),
+ min(N * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload9 buffer (9 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ const PodType (&data)[N]);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ static_cast<const void*>(data),
+ N * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload10 buffer (10 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ const PodType (&data)[N],
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ static_cast<const void*>(data),
+ min(N * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload11 buffer (11 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 buffer(
+ boost::array< PodType, N > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload12 buffer (12 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 buffer(
+ boost::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ data.data(),
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload13 buffer (13 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ boost::array< const PodType, N > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload14 buffer (14 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ boost::array< const PodType, N > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload15 buffer (15 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ const boost::array< PodType, N > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload16 buffer (16 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ const boost::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload17 buffer (17 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 buffer(
+ std::array< PodType, N > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload18 buffer (18 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 buffer(
+ std::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ data.data(),
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload19 buffer (19 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ std::array< const PodType, N > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload20 buffer (20 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ std::array< const PodType, N > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload21 buffer (21 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ const std::array< PodType, N > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload22 buffer (22 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD array.
+
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 buffer(
+ const std::array< PodType, N > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload23 buffer (23 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD vector.
+
+
+ template<
+ typename PodType,
+ typename Allocator>
+ mutable_buffers_1 buffer(
+ std::vector< PodType, Allocator > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ data.size() ? &data[0] : 0,
+ data.size() * sizeof(PodType));
+
+
+
+
+
+[heading Remarks]
+
+The buffer is invalidated by any vector operation that would also invalidate iterators.
+
+
+
+
+[endsect]
+
+
+
+[section:overload24 buffer (24 of 28 overloads)]
+
+
+Create a new modifiable buffer that represents the given POD vector.
+
+
+ template<
+ typename PodType,
+ typename Allocator>
+ mutable_buffers_1 buffer(
+ std::vector< PodType, Allocator > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+
+ mutable_buffers_1(
+ data.size() ? &data[0] : 0,
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+[heading Remarks]
+
+The buffer is invalidated by any vector operation that would also invalidate iterators.
+
+
+
+
+[endsect]
+
+
+
+[section:overload25 buffer (25 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD vector.
+
+
+ template<
+ typename PodType,
+ typename Allocator>
+ const_buffers_1 buffer(
+ const std::vector< PodType, Allocator > & data);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.size() ? &data[0] : 0,
+ data.size() * sizeof(PodType));
+
+
+
+
+
+[heading Remarks]
+
+The buffer is invalidated by any vector operation that would also invalidate iterators.
+
+
+
+
+[endsect]
+
+
+
+[section:overload26 buffer (26 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given POD vector.
+
+
+ template<
+ typename PodType,
+ typename Allocator>
+ const_buffers_1 buffer(
+ const std::vector< PodType, Allocator > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.size() ? &data[0] : 0,
+ min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+
+
+
+
+[heading Remarks]
+
+The buffer is invalidated by any vector operation that would also invalidate iterators.
+
+
+
+
+[endsect]
+
+
+
+[section:overload27 buffer (27 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given string.
+
+
+ template<
+ typename Elem,
+ typename Traits,
+ typename Allocator>
+ const_buffers_1 buffer(
+ const std::basic_string< Elem, Traits, Allocator > & data);
+
+
+
+[heading Return Value]
+
+`const_buffers_1(data.data(), data.size() * sizeof(Elem))`.
+
+
+[heading Remarks]
+
+The buffer is invalidated by any non-const operation called on the given string object.
+
+
+
+
+[endsect]
+
+
+
+[section:overload28 buffer (28 of 28 overloads)]
+
+
+Create a new non-modifiable buffer that represents the given string.
+
+
+ template<
+ typename Elem,
+ typename Traits,
+ typename Allocator>
+ const_buffers_1 buffer(
+ const std::basic_string< Elem, Traits, Allocator > & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ min(data.size() * sizeof(Elem), max_size_in_bytes));
+
+
+
+
+
+[heading Remarks]
+
+The buffer is invalidated by any non-const operation called on the given string object.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:buffer_cast buffer_cast]
+
+[indexterm1 buffer_cast]
+The `boost::asio::buffer_cast` function is used to obtain a pointer to the underlying memory region associated with a buffer.
+
+
+ template<
+ typename PointerToPodType>
+ PointerToPodType ``[link boost_asio.reference.buffer_cast.overload1 buffer_cast]``(
+ const mutable_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_cast.overload1 more...]]``
+
+ template<
+ typename PointerToPodType>
+ PointerToPodType ``[link boost_asio.reference.buffer_cast.overload2 buffer_cast]``(
+ const const_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_cast.overload2 more...]]``
+
+
+[heading Examples:]
+
+
+
+To access the memory of a non-modifiable buffer, use:
+
+ boost::asio::const_buffer b1 = ...;
+ const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1);
+
+
+
+
+To access the memory of a modifiable buffer, use:
+
+ boost::asio::mutable_buffer b2 = ...;
+ unsigned char* p2 = boost::asio::buffer_cast<unsigned char*>(b2);
+
+
+
+
+The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffer.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:overload1 buffer_cast (1 of 2 overloads)]
+
+
+Cast a non-modifiable buffer to a specified pointer to POD type.
+
+
+ template<
+ typename PointerToPodType>
+ PointerToPodType buffer_cast(
+ const mutable_buffer & b);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffer_cast (2 of 2 overloads)]
+
+
+Cast a non-modifiable buffer to a specified pointer to POD type.
+
+
+ template<
+ typename PointerToPodType>
+ PointerToPodType buffer_cast(
+ const const_buffer & b);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:buffer_copy buffer_copy]
+
+[indexterm1 buffer_copy]
+The `boost::asio::buffer_copy` function is used to copy bytes from a source buffer (or buffer sequence) to a target buffer (or buffer sequence).
+
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload1 buffer_copy]``(
+ const mutable_buffer & target,
+ const const_buffer & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload1 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload2 buffer_copy]``(
+ const mutable_buffer & target,
+ const const_buffers_1 & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload2 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload3 buffer_copy]``(
+ const mutable_buffer & target,
+ const mutable_buffer & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload3 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload4 buffer_copy]``(
+ const mutable_buffer & target,
+ const mutable_buffers_1 & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload4 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload5 buffer_copy]``(
+ const mutable_buffer & target,
+ const ConstBufferSequence & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload5 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload6 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const const_buffer & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload6 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload7 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const const_buffers_1 & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload7 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload8 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const mutable_buffer & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload8 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload9 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const mutable_buffers_1 & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload9 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload10 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const ConstBufferSequence & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload10 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload11 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const const_buffer & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload11 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload12 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const const_buffers_1 & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload12 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload13 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const mutable_buffer & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload13 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload14 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const mutable_buffers_1 & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload14 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload15 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const ConstBufferSequence & source);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload15 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload16 buffer_copy]``(
+ const mutable_buffer & target,
+ const const_buffer & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload16 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload17 buffer_copy]``(
+ const mutable_buffer & target,
+ const const_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload17 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload18 buffer_copy]``(
+ const mutable_buffer & target,
+ const mutable_buffer & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload18 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload19 buffer_copy]``(
+ const mutable_buffer & target,
+ const mutable_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload19 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload20 buffer_copy]``(
+ const mutable_buffer & target,
+ const ConstBufferSequence & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload20 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload21 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const const_buffer & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload21 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload22 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const const_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload22 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload23 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const mutable_buffer & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload23 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload24 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const mutable_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload24 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload25 buffer_copy]``(
+ const mutable_buffers_1 & target,
+ const ConstBufferSequence & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload25 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload26 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const const_buffer & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload26 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload27 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const const_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload27 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload28 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const mutable_buffer & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload28 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload29 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const mutable_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload29 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffer_copy.overload30 buffer_copy]``(
+ const MutableBufferSequence & target,
+ const ConstBufferSequence & source,
+ std::size_t max_bytes_to_copy);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_copy.overload30 more...]]``
+
+The `buffer_copy` function is available in two forms:
+
+
+* A 2-argument form: `buffer_copy(target, source)`
+
+
+* A 3-argument form: `buffer_copy(target, source, max_bytes_to_copy)`
+
+Both forms return the number of bytes actually copied. The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `If` specified, `max_bytes_to_copy`.
+
+This prevents buffer overflow, regardless of the buffer sizes used in the copy operation.
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffer.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:overload1 buffer_copy (1 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const const_buffer & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffer_copy (2 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const const_buffers_1 & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 buffer_copy (3 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const mutable_buffer & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload4 buffer_copy (4 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const mutable_buffers_1 & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload5 buffer_copy (5 of 30 overloads)]
+
+
+Copies bytes from a source buffer sequence to a target buffer.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const ConstBufferSequence & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload6 buffer_copy (6 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const const_buffer & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload7 buffer_copy (7 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const const_buffers_1 & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload8 buffer_copy (8 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const mutable_buffer & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload9 buffer_copy (9 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const mutable_buffers_1 & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload10 buffer_copy (10 of 30 overloads)]
+
+
+Copies bytes from a source buffer sequence to a target buffer.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const ConstBufferSequence & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload11 buffer_copy (11 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const const_buffer & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload12 buffer_copy (12 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const const_buffers_1 & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload13 buffer_copy (13 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const mutable_buffer & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload14 buffer_copy (14 of 30 overloads)]
+
+
+Copies bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const mutable_buffers_1 & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload15 buffer_copy (15 of 30 overloads)]
+
+
+Copies bytes from a source buffer sequence to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const ConstBufferSequence & source);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+
+
+[endsect]
+
+
+
+[section:overload16 buffer_copy (16 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const const_buffer & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload17 buffer_copy (17 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const const_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload18 buffer_copy (18 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const mutable_buffer & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload19 buffer_copy (19 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const mutable_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload20 buffer_copy (20 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer sequence to a target buffer.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t buffer_copy(
+ const mutable_buffer & target,
+ const ConstBufferSequence & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload21 buffer_copy (21 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const const_buffer & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload22 buffer_copy (22 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const const_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload23 buffer_copy (23 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const mutable_buffer & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload24 buffer_copy (24 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer.
+
+
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const mutable_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload25 buffer_copy (25 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer sequence to a target buffer.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t buffer_copy(
+ const mutable_buffers_1 & target,
+ const ConstBufferSequence & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer representing the memory region to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload26 buffer_copy (26 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const const_buffer & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload27 buffer_copy (27 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const const_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer representing the memory region from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload28 buffer_copy (28 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const mutable_buffer & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload29 buffer_copy (29 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const mutable_buffers_1 & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A modifiable buffer representing the memory region from which the bytes will be copied. The contents of the source buffer will not be modified.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+
+[section:overload30 buffer_copy (30 of 30 overloads)]
+
+
+Copies a limited number of bytes from a source buffer sequence to a target buffer sequence.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t buffer_copy(
+ const MutableBufferSequence & target,
+ const ConstBufferSequence & source,
+ std::size_t max_bytes_to_copy);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[target][A modifiable buffer sequence representing the memory regions to which the bytes will be copied.]]
+
+[[source][A non-modifiable buffer sequence representing the memory regions from which the bytes will be copied.]]
+
+[[max_bytes_to_copy][The maximum number of bytes to be copied.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes copied.
+
+
+[heading Remarks]
+
+The number of bytes copied is the lesser of:
+
+
+* `buffer_size(target)`
+
+
+* `buffer_size(source)`
+
+
+* `max_bytes_to_copy`
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:buffer_size buffer_size]
+
+[indexterm1 buffer_size]
+The `boost::asio::buffer_size` function determines the total number of bytes in a buffer or buffer sequence.
+
+
+ std::size_t ``[link boost_asio.reference.buffer_size.overload1 buffer_size]``(
+ const mutable_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_size.overload1 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_size.overload2 buffer_size]``(
+ const mutable_buffers_1 & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_size.overload2 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_size.overload3 buffer_size]``(
+ const const_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_size.overload3 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffer_size.overload4 buffer_size]``(
+ const const_buffers_1 & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_size.overload4 more...]]``
+
+ template<
+ typename BufferSequence>
+ std::size_t ``[link boost_asio.reference.buffer_size.overload5 buffer_size]``(
+ const BufferSequence & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffer_size.overload5 more...]]``
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffer.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:overload1 buffer_size (1 of 5 overloads)]
+
+
+Get the number of bytes in a modifiable buffer.
+
+
+ std::size_t buffer_size(
+ const mutable_buffer & b);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffer_size (2 of 5 overloads)]
+
+
+Get the number of bytes in a modifiable buffer.
+
+
+ std::size_t buffer_size(
+ const mutable_buffers_1 & b);
+
+
+
+[endsect]
+
+
+
+[section:overload3 buffer_size (3 of 5 overloads)]
+
+
+Get the number of bytes in a non-modifiable buffer.
+
+
+ std::size_t buffer_size(
+ const const_buffer & b);
+
+
+
+[endsect]
+
+
+
+[section:overload4 buffer_size (4 of 5 overloads)]
+
+
+Get the number of bytes in a non-modifiable buffer.
+
+
+ std::size_t buffer_size(
+ const const_buffers_1 & b);
+
+
+
+[endsect]
+
+
+
+[section:overload5 buffer_size (5 of 5 overloads)]
+
+
+Get the total number of bytes in a buffer sequence.
+
+
+ template<
+ typename BufferSequence>
+ std::size_t buffer_size(
+ const BufferSequence & b);
+
+
+The `BufferSequence` template parameter may meet either of the `ConstBufferSequence` or `MutableBufferSequence` type requirements.
+
+
+[endsect]
+
+
+[endsect]
+
+[section:buffered_read_stream buffered_read_stream]
+
+
+Adds buffering to the read-related operations of a stream.
+
+
+ template<
+ typename Stream>
+ class buffered_read_stream :
+ noncopyable
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.buffered_read_stream.lowest_layer_type [*lowest_layer_type]]]
+ [The type of the lowest layer. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.buffered_read_stream.next_layer_type [*next_layer_type]]]
+ [The type of the next layer. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.async_fill [*async_fill]]]
+ [Start an asynchronous fill. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.buffered_read_stream [*buffered_read_stream]]]
+ [Construct, passing the specified argument to initialise the next layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.close [*close]]]
+ [Close the stream. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.fill [*fill]]]
+ [Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
+
+ Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.in_avail [*in_avail]]]
+ [Determine the amount of data that may be read without blocking. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.next_layer [*next_layer]]]
+ [Get a reference to the next layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.peek [*peek]]]
+ [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
+
+ Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.read_some [*read_some]]]
+ [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+
+ Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.write_some [*write_some]]]
+ [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+
+ Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
+ ]
+
 ]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
-[heading Example]
+ [
+ [[link boost_asio.reference.buffered_read_stream.default_buffer_size [*default_buffer_size]]]
+ [The default buffer size. ]
+ ]
+
+]
+
+The [link boost_asio.reference.buffered_read_stream `buffered_read_stream`] class template can be used to add buffering to the synchronous and asynchronous read operations of a stream.
+
+
+[heading Thread Safety]
   
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
- boost::asio::ip::tcp::socket socket(io_service);
- boost::system::error_code ec;
- socket.open(boost::asio::ip::tcp::v4(), ec);
- if (ec)
- {
- // An error occurred.
- }
 
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffered_read_stream.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:async_fill buffered_read_stream::async_fill]
+
+[indexterm2 async_fill..buffered_read_stream]
+Start an asynchronous fill.
+
+
+ template<
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_fill(
+ ReadHandler handler);
+
 
 
 [endsect]
 
 
-[section:protocol_type basic_stream_socket::protocol_type]
 
-[indexterm2 protocol_type..basic_stream_socket]
-The protocol type.
+[section:async_read_some buffered_read_stream::async_read_some]
 
+[indexterm2 async_read_some..buffered_read_stream]
+Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
 
- typedef Protocol protocol_type;
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_some(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+[endsect]
+
+
+
+[section:async_write_some buffered_read_stream::async_write_some]
+
+[indexterm2 async_write_some..buffered_read_stream]
+Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_some(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:read_some basic_stream_socket::read_some]
+[section:buffered_read_stream buffered_read_stream::buffered_read_stream]
 
-[indexterm2 read_some..basic_stream_socket]
-Read some data from the socket.
+[indexterm2 buffered_read_stream..buffered_read_stream]
+Construct, passing the specified argument to initialise the next layer.
 
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload1 read_some]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload1 more...]]``
+ typename Arg>
+ explicit ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 buffered_read_stream]``(
+ Arg & a);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 more...]]``
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.read_some.overload2 read_some]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.read_some.overload2 more...]]``
+ typename Arg>
+ ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 buffered_read_stream]``(
+ Arg & a,
+ std::size_t buffer_size);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::read_some (1 of 2 overloads)]
+[section:overload1 buffered_read_stream::buffered_read_stream (1 of 2 overloads)]
 
 
-Read some data from the socket.
+Construct, passing the specified argument to initialise the next layer.
 
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers);
+ typename Arg>
+ buffered_read_stream(
+ Arg & a);
 
 
-This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be read.]]
 
-]
+[section:overload2 buffered_read_stream::buffered_read_stream (2 of 2 overloads)]
 
 
-[heading Return Value]
-
-The number of bytes read.
+Construct, passing the specified argument to initialise the next layer.
 
 
-[heading Exceptions]
-
+ template<
+ typename Arg>
+ buffered_read_stream(
+ Arg & a,
+ std::size_t buffer_size);
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
 
-]
 
+[endsect]
 
-[heading Remarks]
-
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
+[endsect]
 
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+[section:close buffered_read_stream::close]
 
- socket.read_some(boost::asio::buffer(data, size));
+[indexterm2 close..buffered_read_stream]
+Close the stream.
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+ void ``[link boost_asio.reference.buffered_read_stream.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.buffered_read_stream.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload2 more...]]``
+
 
+[section:overload1 buffered_read_stream::close (1 of 2 overloads)]
+
+
+Close the stream.
+
+
+ void close();
 
 
 
@@ -28944,201 +46419,338 @@
 
 
 
-[section:overload2 basic_stream_socket::read_some (2 of 2 overloads)]
+[section:overload2 buffered_read_stream::close (2 of 2 overloads)]
 
 
-Read some data from the socket.
+Close the stream.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers,
+ boost::system::error_code close(
       boost::system::error_code & ec);
 
 
-This function is used to read data from the stream socket. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be read.]]
+[endsect]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[section:default_buffer_size buffered_read_stream::default_buffer_size]
 
+[indexterm2 default_buffer_size..buffered_read_stream]
+The default buffer size.
 
-[heading Return Value]
-
-The number of bytes read. Returns 0 if an error occurred.
 
+ static const std::size_t default_buffer_size = implementation_defined;
+
+
+
+[endsect]
+
+
+[section:fill buffered_read_stream::fill]
+
+[indexterm2 fill..buffered_read_stream]
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
+
+
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload1 fill]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload1 more...]]``
+
+
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
+
+
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload2 fill]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload2 more...]]``
+
+
+[section:overload1 buffered_read_stream::fill (1 of 2 overloads)]
+
+
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
 
-[heading Remarks]
-
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
+ std::size_t fill();
 
 
 
 [endsect]
 
 
+
+[section:overload2 buffered_read_stream::fill (2 of 2 overloads)]
+
+
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
+
+
+ std::size_t fill(
+ boost::system::error_code & ec);
+
+
+
 [endsect]
 
-[section:receive basic_stream_socket::receive]
 
-[indexterm2 receive..basic_stream_socket]
-Receive some data on the socket.
+[endsect]
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload1 receive]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload1 more...]]``
+[section:get_io_service buffered_read_stream::get_io_service]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload2 receive]``(
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload2 more...]]``
+[indexterm2 get_io_service..buffered_read_stream]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
-Receive some data on a connected socket.
+ boost::asio::io_service & get_io_service();
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.receive.overload3 receive]``(
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
+
+[endsect]
+
+
+[section:in_avail buffered_read_stream::in_avail]
+
+[indexterm2 in_avail..buffered_read_stream]
+Determine the amount of data that may be read without blocking.
+
+
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload1 in_avail]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload1 more...]]``
+
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload2 in_avail]``(
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.receive.overload3 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::receive (1 of 3 overloads)]
+[section:overload1 buffered_read_stream::in_avail (1 of 2 overloads)]
 
 
-Receive some data on the socket.
+Determine the amount of data that may be read without blocking.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
- const MutableBufferSequence & buffers);
+ std::size_t in_avail();
 
 
-This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be received.]]
 
-]
+[section:overload2 buffered_read_stream::in_avail (2 of 2 overloads)]
 
 
-[heading Return Value]
-
-The number of bytes received.
+Determine the amount of data that may be read without blocking.
 
 
-[heading Exceptions]
-
+ std::size_t in_avail(
+ boost::system::error_code & ec);
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
 
-]
 
+[endsect]
 
-[heading Remarks]
-
-The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
+[endsect]
 
-[heading Example]
-
-To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+[section:lowest_layer buffered_read_stream::lowest_layer]
 
- socket.receive(boost::asio::buffer(data, size));
+[indexterm2 lowest_layer..buffered_read_stream]
+Get a reference to the lowest layer.
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+ lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 more...]]``
+
+
+Get a const reference to the lowest layer.
+
+
+ const lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 more...]]``
+
+
+[section:overload1 buffered_read_stream::lowest_layer (1 of 2 overloads)]
+
+
+Get a reference to the lowest layer.
 
 
+ lowest_layer_type & lowest_layer();
+
 
 
 [endsect]
 
 
 
-[section:overload2 basic_stream_socket::receive (2 of 3 overloads)]
+[section:overload2 buffered_read_stream::lowest_layer (2 of 2 overloads)]
 
 
-Receive some data on the socket.
+Get a const reference to the lowest layer.
+
+
+ const lowest_layer_type & lowest_layer() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:lowest_layer_type buffered_read_stream::lowest_layer_type]
+
+[indexterm2 lowest_layer_type..buffered_read_stream]
+The type of the lowest layer.
+
+
+ typedef next_layer_type::lowest_layer_type lowest_layer_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffered_read_stream.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:next_layer buffered_read_stream::next_layer]
+
+[indexterm2 next_layer..buffered_read_stream]
+Get a reference to the next layer.
+
+
+ next_layer_type & next_layer();
+
+
+
+[endsect]
+
+
+
+[section:next_layer_type buffered_read_stream::next_layer_type]
+
+[indexterm2 next_layer_type..buffered_read_stream]
+The type of the next layer.
+
+
+ typedef boost::remove_reference< Stream >::type next_layer_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffered_read_stream.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:peek buffered_read_stream::peek]
+
+[indexterm2 peek..buffered_read_stream]
+Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload1 peek]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload1 more...]]``
+
+
+Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload2 peek]``(
       const MutableBufferSequence & buffers,
- socket_base::message_flags flags);
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload2 more...]]``
 
 
-This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
+[section:overload1 buffered_read_stream::peek (1 of 2 overloads)]
 
 
-[heading Parameters]
-
+Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be received.]]
 
-[[flags][Flags specifying how the receive call is to be made.]]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers);
 
-]
 
 
-[heading Return Value]
-
-The number of bytes received.
+[endsect]
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+[section:overload2 buffered_read_stream::peek (2 of 2 overloads)]
 
-]
 
+Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
-[heading Remarks]
-
-The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
-[heading Example]
-
-To receive into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- socket.receive(boost::asio::buffer(data, size), 0);
 
+[endsect]
+
+
+[endsect]
+
+[section:read_some buffered_read_stream::read_some]
+
+[indexterm2 read_some..buffered_read_stream]
+Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload1 read_some]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload1 more...]]``
+
+
+Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload2 read_some]``(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload2 more...]]``
+
+
+[section:overload1 buffered_read_stream::read_some (1 of 2 overloads)]
+
+
+Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on receiving into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
 
 
 
@@ -29146,1308 +46758,1336 @@
 
 
 
-[section:overload3 basic_stream_socket::receive (3 of 3 overloads)]
+[section:overload2 buffered_read_stream::read_some (2 of 2 overloads)]
 
 
-Receive some data on a connected socket.
+Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
+ std::size_t read_some(
       const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
       boost::system::error_code & ec);
 
 
-This function is used to receive data on the stream socket. The function call will block until one or more bytes of data has been received successfully, or until an error occurs.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be received.]]
+[endsect]
 
-[[flags][Flags specifying how the receive call is to be made.]]
+[section:write_some buffered_read_stream::write_some]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[indexterm2 write_some..buffered_read_stream]
+Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
-]
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload1 more...]]``
 
-[heading Return Value]
-
-The number of bytes received. Returns 0 if an error occurred.
 
+Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
 
-[heading Remarks]
-
-The receive operation may not receive all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload2 write_some]``(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload2 more...]]``
 
 
+[section:overload1 buffered_read_stream::write_some (1 of 2 overloads)]
 
-[endsect]
 
+Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers);
 
-[section:receive_buffer_size basic_stream_socket::receive_buffer_size]
 
 
-['Inherited from socket_base.]
+[endsect]
 
-[indexterm2 receive_buffer_size..basic_stream_socket]
-Socket option for the receive buffer size of a socket.
 
 
- typedef implementation_defined receive_buffer_size;
+[section:overload2 buffered_read_stream::write_some (2 of 2 overloads)]
 
 
+Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
 
-Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option(8192);
- socket.set_option(option);
 
+[endsect]
 
 
+[endsect]
 
 
-Getting the current option value:
+[endsect]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option;
- socket.get_option(option);
- int size = option.value();
+[section:buffered_stream buffered_stream]
 
 
+Adds buffering to the read- and write-related operations of a stream.
 
 
+ template<
+ typename Stream>
+ class buffered_stream :
+ noncopyable
 
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-[heading Requirements]
+ [
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+ [[link boost_asio.reference.buffered_stream.lowest_layer_type [*lowest_layer_type]]]
+ [The type of the lowest layer. ]
+
+ ]
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
 
+ [[link boost_asio.reference.buffered_stream.next_layer_type [*next_layer_type]]]
+ [The type of the next layer. ]
+
+ ]
 
-[endsect]
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.buffered_stream.async_fill [*async_fill]]]
+ [Start an asynchronous fill. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.async_flush [*async_flush]]]
+ [Start an asynchronous flush. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.buffered_stream [*buffered_stream]]]
+ [Construct, passing the specified argument to initialise the next layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.close [*close]]]
+ [Close the stream. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.fill [*fill]]]
+ [Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
 
-[section:receive_low_watermark basic_stream_socket::receive_low_watermark]
+ Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.flush [*flush]]]
+ [Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
+ Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.in_avail [*in_avail]]]
+ [Determine the amount of data that may be read without blocking. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
-['Inherited from socket_base.]
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.next_layer [*next_layer]]]
+ [Get a reference to the next layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.peek [*peek]]]
+ [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
-[indexterm2 receive_low_watermark..basic_stream_socket]
-Socket option for the receive low watermark.
+ Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.read_some [*read_some]]]
+ [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
+ Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.write_some [*write_some]]]
+ [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
- typedef implementation_defined receive_low_watermark;
+ Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
+ ]
+
+]
 
+The [link boost_asio.reference.buffered_stream `buffered_stream`] class template can be used to add buffering to the synchronous and asynchronous read and write operations of a stream.
 
 
-Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option(1024);
- socket.set_option(option);
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffered_stream.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option;
- socket.get_option(option);
- int size = option.value();
+[section:async_fill buffered_stream::async_fill]
 
+[indexterm2 async_fill..buffered_stream]
+Start an asynchronous fill.
 
 
+ template<
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_fill(
+ ReadHandler handler);
 
 
 
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[section:async_flush buffered_stream::async_flush]
 
+[indexterm2 async_flush..buffered_stream]
+Start an asynchronous flush.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_flush(
+ WriteHandler handler);
 
-[section:remote_endpoint basic_stream_socket::remote_endpoint]
 
-[indexterm2 remote_endpoint..basic_stream_socket]
-Get the remote endpoint of the socket.
 
+[endsect]
 
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 remote_endpoint]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 more...]]``
 
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 remote_endpoint]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 more...]]``
 
+[section:async_read_some buffered_stream::async_read_some]
 
-[section:overload1 basic_stream_socket::remote_endpoint (1 of 2 overloads)]
+[indexterm2 async_read_some..buffered_stream]
+Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
 
 
-['Inherited from basic_socket.]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_some(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
 
 
-Get the remote endpoint of the socket.
 
+[endsect]
 
- endpoint_type remote_endpoint() const;
 
 
-This function is used to obtain the remote endpoint of the socket.
+[section:async_write_some buffered_stream::async_write_some]
 
+[indexterm2 async_write_some..buffered_stream]
+Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
 
-[heading Return Value]
-
-An object that represents the remote endpoint of the socket.
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_some(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
+[endsect]
 
 
-[heading Example]
-
+[section:buffered_stream buffered_stream::buffered_stream]
 
+[indexterm2 buffered_stream..buffered_stream]
+Construct, passing the specified argument to initialise the next layer.
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
 
+ template<
+ typename Arg>
+ explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload1 buffered_stream]``(
+ Arg & a);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload1 more...]]``
 
+ template<
+ typename Arg>
+ explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload2 buffered_stream]``(
+ Arg & a,
+ std::size_t read_buffer_size,
+ std::size_t write_buffer_size);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload2 more...]]``
 
 
+[section:overload1 buffered_stream::buffered_stream (1 of 2 overloads)]
 
 
+Construct, passing the specified argument to initialise the next layer.
 
-[endsect]
 
+ template<
+ typename Arg>
+ buffered_stream(
+ Arg & a);
 
 
-[section:overload2 basic_stream_socket::remote_endpoint (2 of 2 overloads)]
 
+[endsect]
 
-['Inherited from basic_socket.]
 
 
-Get the remote endpoint of the socket.
+[section:overload2 buffered_stream::buffered_stream (2 of 2 overloads)]
 
 
- endpoint_type remote_endpoint(
- boost::system::error_code & ec) const;
+Construct, passing the specified argument to initialise the next layer.
 
 
-This function is used to obtain the remote endpoint of the socket.
+ template<
+ typename Arg>
+ buffered_stream(
+ Arg & a,
+ std::size_t read_buffer_size,
+ std::size_t write_buffer_size);
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+[endsect]
 
-]
 
+[endsect]
 
-[heading Return Value]
-
-An object that represents the remote endpoint of the socket. Returns a default-constructed endpoint object if an error occurred.
+[section:close buffered_stream::close]
 
+[indexterm2 close..buffered_stream]
+Close the stream.
 
-[heading Example]
-
 
+ void ``[link boost_asio.reference.buffered_stream.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload1 more...]]``
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
- if (ec)
- {
- // An error occurred.
- }
+ boost::system::error_code ``[link boost_asio.reference.buffered_stream.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload2 more...]]``
 
 
+[section:overload1 buffered_stream::close (1 of 2 overloads)]
 
 
+Close the stream.
 
 
+ void close();
 
-[endsect]
 
 
 [endsect]
 
 
-[section:reuse_address basic_stream_socket::reuse_address]
-
 
-['Inherited from socket_base.]
+[section:overload2 buffered_stream::close (2 of 2 overloads)]
 
-[indexterm2 reuse_address..basic_stream_socket]
-Socket option to allow the socket to be bound to an address that is already in use.
 
+Close the stream.
 
- typedef implementation_defined reuse_address;
 
+ boost::system::error_code close(
+ boost::system::error_code & ec);
 
 
-Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
 
+[endsect]
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option(true);
- acceptor.set_option(option);
+[endsect]
 
+[section:fill buffered_stream::fill]
 
+[indexterm2 fill..buffered_stream]
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
 
 
+ std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload1 fill]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload1 more...]]``
 
-Getting the current option value:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option;
- acceptor.get_option(option);
- bool is_set = option.value();
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
 
 
+ std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload2 fill]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload2 more...]]``
 
 
+[section:overload1 buffered_stream::fill (1 of 2 overloads)]
 
 
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+ std::size_t fill();
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:send basic_stream_socket::send]
 
-[indexterm2 send..basic_stream_socket]
-Send some data on the socket.
+[section:overload2 buffered_stream::fill (2 of 2 overloads)]
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload1 send]``(
- const ConstBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload1 more...]]``
+Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload2 send]``(
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload2 more...]]``
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.send.overload3 send]``(
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
+ std::size_t fill(
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.send.overload3 more...]]``
 
 
-[section:overload1 basic_stream_socket::send (1 of 3 overloads)]
 
+[endsect]
 
-Send some data on the socket.
 
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t send(
- const ConstBufferSequence & buffers);
+[section:flush buffered_stream::flush]
 
+[indexterm2 flush..buffered_stream]
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
-This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
 
+ std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload1 flush]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload1 more...]]``
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more data buffers to be sent on the socket.]]
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
 
-]
 
+ std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload2 flush]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload2 more...]]``
 
-[heading Return Value]
-
-The number of bytes sent.
 
+[section:overload1 buffered_stream::flush (1 of 2 overloads)]
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
-]
 
+ std::size_t flush();
 
-[heading Remarks]
-
-The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
 
-[heading Example]
-
-To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+[endsect]
 
- socket.send(boost::asio::buffer(data, size));
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+[section:overload2 buffered_stream::flush (2 of 2 overloads)]
+
+
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
+
 
+ std::size_t flush(
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload2 basic_stream_socket::send (2 of 3 overloads)]
 
+[section:get_io_service buffered_stream::get_io_service]
 
-Send some data on the socket.
+[indexterm2 get_io_service..buffered_stream]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t send(
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags);
+ boost::asio::io_service & get_io_service();
 
 
-This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more data buffers to be sent on the socket.]]
+[section:in_avail buffered_stream::in_avail]
 
-[[flags][Flags specifying how the send call is to be made.]]
+[indexterm2 in_avail..buffered_stream]
+Determine the amount of data that may be read without blocking.
 
-]
 
+ std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload1 in_avail]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload1 more...]]``
 
-[heading Return Value]
-
-The number of bytes sent.
+ std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload2 in_avail]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload2 more...]]``
 
 
-[heading Exceptions]
-
+[section:overload1 buffered_stream::in_avail (1 of 2 overloads)]
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
+Determine the amount of data that may be read without blocking.
 
 
-[heading Remarks]
-
-The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+ std::size_t in_avail();
 
 
-[heading Example]
-
-To send a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- socket.send(boost::asio::buffer(data, size), 0);
+[endsect]
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on sending multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
+[section:overload2 buffered_stream::in_avail (2 of 2 overloads)]
 
 
+Determine the amount of data that may be read without blocking.
 
-[endsect]
 
+ std::size_t in_avail(
+ boost::system::error_code & ec);
 
 
-[section:overload3 basic_stream_socket::send (3 of 3 overloads)]
 
+[endsect]
 
-Send some data on the socket.
 
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t send(
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
+[section:lowest_layer buffered_stream::lowest_layer]
 
+[indexterm2 lowest_layer..buffered_stream]
+Get a reference to the lowest layer.
 
-This function is used to send data on the stream socket. The function call will block until one or more bytes of the data has been sent successfully, or an until error occurs.
 
+ lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload1 more...]]``
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more data buffers to be sent on the socket.]]
+Get a const reference to the lowest layer.
 
-[[flags][Flags specifying how the send call is to be made.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+ const lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload2 more...]]``
 
-]
 
+[section:overload1 buffered_stream::lowest_layer (1 of 2 overloads)]
 
-[heading Return Value]
-
-The number of bytes sent. Returns 0 if an error occurred.
 
+Get a reference to the lowest layer.
 
-[heading Remarks]
-
-The send operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
+ lowest_layer_type & lowest_layer();
 
 
 
 [endsect]
 
 
-[endsect]
 
+[section:overload2 buffered_stream::lowest_layer (2 of 2 overloads)]
 
-[section:send_buffer_size basic_stream_socket::send_buffer_size]
 
+Get a const reference to the lowest layer.
 
-['Inherited from socket_base.]
 
-[indexterm2 send_buffer_size..basic_stream_socket]
-Socket option for the send buffer size of a socket.
+ const lowest_layer_type & lowest_layer() const;
 
 
- typedef implementation_defined send_buffer_size;
 
+[endsect]
 
 
-Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
+[endsect]
 
 
-[heading Examples]
-
-Setting the option:
+[section:lowest_layer_type buffered_stream::lowest_layer_type]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option(8192);
- socket.set_option(option);
+[indexterm2 lowest_layer_type..buffered_stream]
+The type of the lowest layer.
 
 
+ typedef next_layer_type::lowest_layer_type lowest_layer_type;
 
 
 
-Getting the current option value:
+[heading Requirements]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option;
- socket.get_option(option);
- int size = option.value();
+[*Header: ][^boost/asio/buffered_stream.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
 
+[section:next_layer buffered_stream::next_layer]
 
-[heading Requirements]
+[indexterm2 next_layer..buffered_stream]
+Get a reference to the next layer.
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ next_layer_type & next_layer();
+
 
 
 [endsect]
 
 
 
-[section:send_low_watermark basic_stream_socket::send_low_watermark]
+[section:next_layer_type buffered_stream::next_layer_type]
 
+[indexterm2 next_layer_type..buffered_stream]
+The type of the next layer.
 
-['Inherited from socket_base.]
 
-[indexterm2 send_low_watermark..basic_stream_socket]
-Socket option for the send low watermark.
+ typedef boost::remove_reference< Stream >::type next_layer_type;
 
 
- typedef implementation_defined send_low_watermark;
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffered_stream.hpp]
 
-Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Examples]
-
-Setting the option:
+[endsect]
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_low_watermark option(1024);
- socket.set_option(option);
 
+[section:peek buffered_stream::peek]
 
+[indexterm2 peek..buffered_stream]
+Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload1 peek]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload1 more...]]``
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_low_watermark option;
- socket.get_option(option);
- int size = option.value();
+Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload2 peek]``(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload2 more...]]``
 
 
+[section:overload1 buffered_stream::peek (1 of 2 overloads)]
 
 
+Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:service basic_stream_socket::service]
+[section:overload2 buffered_stream::peek (2 of 2 overloads)]
 
 
-['Inherited from basic_io_object.]
+Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
-[indexterm2 service..basic_stream_socket]
-The service associated with the I/O object.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
 
- service_type & service;
 
+[endsect]
 
 
 [endsect]
 
+[section:read_some buffered_stream::read_some]
+
+[indexterm2 read_some..buffered_stream]
+Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
 
-[section:service_type basic_stream_socket::service_type]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload1 read_some]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload1 more...]]``
 
 
-['Inherited from basic_io_object.]
+Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
 
-[indexterm2 service_type..basic_stream_socket]
-The type of the service that will be used to provide I/O operations.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload2 read_some]``(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload2 more...]]``
 
 
- typedef StreamSocketService service_type;
+[section:overload1 buffered_stream::read_some (1 of 2 overloads)]
 
 
+Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_stream_socket.hpp]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:set_option basic_stream_socket::set_option]
 
-[indexterm2 set_option..basic_stream_socket]
-Set an option on the socket.
+[section:overload2 buffered_stream::read_some (2 of 2 overloads)]
 
 
- void ``[link boost_asio.reference.basic_stream_socket.set_option.overload1 set_option]``(
- const SettableSocketOption & option);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload1 more...]]``
+Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.set_option.overload2 set_option]``(
- const SettableSocketOption & option,
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.set_option.overload2 more...]]``
 
 
-[section:overload1 basic_stream_socket::set_option (1 of 2 overloads)]
 
+[endsect]
 
-['Inherited from basic_socket.]
 
+[endsect]
 
-Set an option on the socket.
+[section:write_some buffered_stream::write_some]
+
+[indexterm2 write_some..buffered_stream]
+Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
 
   template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void set_option(
- const SettableSocketOption & option);
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload1 more...]]``
 
 
-This function is used to set an option on the socket.
+Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
 
 
-[heading Parameters]
-
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload2 write_some]``(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload2 more...]]``
 
-[variablelist
-
-[[option][The new option value to be set on the socket.]]
 
-]
+[section:overload1 buffered_stream::write_some (1 of 2 overloads)]
 
 
-[heading Exceptions]
-
+Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers);
 
 
 
-[heading Example]
-
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+[endsect]
+
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::no_delay option(true);
- socket.set_option(option);
+
+[section:overload2 buffered_stream::write_some (2 of 2 overloads)]
 
 
+Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
 
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload2 basic_stream_socket::set_option (2 of 2 overloads)]
 
+[endsect]
 
-['Inherited from basic_socket.]
+[section:buffered_write_stream buffered_write_stream]
 
 
-Set an option on the socket.
+Adds buffering to the write-related operations of a stream.
 
 
   template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code set_option(
- const SettableSocketOption & option,
- boost::system::error_code & ec);
-
+ typename Stream>
+ class buffered_write_stream :
+ noncopyable
 
-This function is used to set an option on the socket.
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-[heading Parameters]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.buffered_write_stream.lowest_layer_type [*lowest_layer_type]]]
+ [The type of the lowest layer. ]
   
-[[option][The new option value to be set on the socket.]]
+ ]
 
-[[ec][Set to indicate what error occurred, if any.]]
+ [
+
+ [[link boost_asio.reference.buffered_write_stream.next_layer_type [*next_layer_type]]]
+ [The type of the next layer. ]
+
+ ]
 
 ]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.buffered_write_stream.async_flush [*async_flush]]]
+ [Start an asynchronous flush. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.buffered_write_stream [*buffered_write_stream]]]
+ [Construct, passing the specified argument to initialise the next layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.close [*close]]]
+ [Close the stream. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.flush [*flush]]]
+ [Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
-[heading Example]
+ Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. ]
+ ]
   
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+ [
+ [[link boost_asio.reference.buffered_write_stream.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.in_avail [*in_avail]]]
+ [Determine the amount of data that may be read without blocking. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::no_delay option(true);
- boost::system::error_code ec;
- socket.set_option(option, ec);
- if (ec)
- {
- // An error occurred.
- }
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.next_layer [*next_layer]]]
+ [Get a reference to the next layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.peek [*peek]]]
+ [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
+ Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.read_some [*read_some]]]
+ [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
+ Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.write_some [*write_some]]]
+ [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
+ Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw. ]
+ ]
+
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.buffered_write_stream.default_buffer_size [*default_buffer_size]]]
+ [The default buffer size. ]
+ ]
 
+]
 
-[endsect]
+The [link boost_asio.reference.buffered_write_stream `buffered_write_stream`] class template can be used to add buffering to the synchronous and asynchronous write operations of a stream.
 
 
-[endsect]
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
-[section:shutdown basic_stream_socket::shutdown]
+[*Shared] [*objects:] Unsafe.
 
-[indexterm2 shutdown..basic_stream_socket]
-Disable sends or receives on the socket.
 
 
- void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload1 shutdown]``(
- shutdown_type what);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.shutdown.overload2 shutdown]``(
- shutdown_type what,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.shutdown.overload2 more...]]``
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffered_write_stream.hpp]
 
-[section:overload1 basic_stream_socket::shutdown (1 of 2 overloads)]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-['Inherited from basic_socket.]
+[section:async_flush buffered_write_stream::async_flush]
 
+[indexterm2 async_flush..buffered_write_stream]
+Start an asynchronous flush.
 
-Disable sends or receives on the socket.
 
+ template<
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_flush(
+ WriteHandler handler);
 
- void shutdown(
- shutdown_type what);
 
 
-This function is used to disable send operations, receive operations, or both.
+[endsect]
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[what][Determines what types of operation will no longer be allowed.]]
+[section:async_read_some buffered_write_stream::async_read_some]
 
-]
+[indexterm2 async_read_some..buffered_write_stream]
+Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
 
 
-[heading Exceptions]
-
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_some(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
 
+[endsect]
 
-[heading Example]
-
-Shutting down the send side of the socket:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
 
+[section:async_write_some buffered_write_stream::async_write_some]
 
+[indexterm2 async_write_some..buffered_write_stream]
+Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
 
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_some(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
 
 
 
 [endsect]
 
 
+[section:buffered_write_stream buffered_write_stream::buffered_write_stream]
 
-[section:overload2 basic_stream_socket::shutdown (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
-
-
-Disable sends or receives on the socket.
-
-
- boost::system::error_code shutdown(
- shutdown_type what,
- boost::system::error_code & ec);
+[indexterm2 buffered_write_stream..buffered_write_stream]
+Construct, passing the specified argument to initialise the next layer.
 
 
-This function is used to disable send operations, receive operations, or both.
+ template<
+ typename Arg>
+ explicit ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 buffered_write_stream]``(
+ Arg & a);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 more...]]``
 
+ template<
+ typename Arg>
+ ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 buffered_write_stream]``(
+ Arg & a,
+ std::size_t buffer_size);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 more...]]``
 
-[heading Parameters]
-
 
-[variablelist
-
-[[what][Determines what types of operation will no longer be allowed.]]
+[section:overload1 buffered_write_stream::buffered_write_stream (1 of 2 overloads)]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+Construct, passing the specified argument to initialise the next layer.
 
 
-[heading Example]
-
-Shutting down the send side of the socket:
+ template<
+ typename Arg>
+ buffered_write_stream(
+ Arg & a);
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::system::error_code ec;
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
- if (ec)
- {
- // An error occurred.
- }
 
 
+[endsect]
 
 
 
+[section:overload2 buffered_write_stream::buffered_write_stream (2 of 2 overloads)]
 
 
-[endsect]
+Construct, passing the specified argument to initialise the next layer.
+
+
+ template<
+ typename Arg>
+ buffered_write_stream(
+ Arg & a,
+ std::size_t buffer_size);
+
 
 
 [endsect]
 
 
-[section:shutdown_type basic_stream_socket::shutdown_type]
+[endsect]
 
+[section:close buffered_write_stream::close]
 
-['Inherited from socket_base.]
+[indexterm2 close..buffered_write_stream]
+Close the stream.
 
-[indexterm2 shutdown_type..basic_stream_socket]
-Different ways a socket may be shutdown.
 
+ void ``[link boost_asio.reference.buffered_write_stream.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload1 more...]]``
 
- enum shutdown_type
+ boost::system::error_code ``[link boost_asio.reference.buffered_write_stream.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload2 more...]]``
 
-[indexterm2 shutdown_receive..basic_stream_socket]
-[indexterm2 shutdown_send..basic_stream_socket]
-[indexterm2 shutdown_both..basic_stream_socket]
 
-[heading Values]
-[variablelist
+[section:overload1 buffered_write_stream::close (1 of 2 overloads)]
 
- [
- [shutdown_receive]
- [Shutdown the receive side of the socket. ]
- ]
 
- [
- [shutdown_send]
- [Shutdown the send side of the socket. ]
- ]
+Close the stream.
 
- [
- [shutdown_both]
- [Shutdown both send and receive on the socket. ]
- ]
 
-]
+ void close();
 
 
 
 [endsect]
 
 
-[section:write_some basic_stream_socket::write_some]
-
-[indexterm2 write_some..basic_stream_socket]
-Write some data to the socket.
 
+[section:overload2 buffered_write_stream::close (2 of 2 overloads)]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload1 write_some]``(
- const ConstBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.basic_stream_socket.write_some.overload2 write_some]``(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.basic_stream_socket.write_some.overload2 more...]]``
+Close the stream.
 
 
-[section:overload1 basic_stream_socket::write_some (1 of 2 overloads)]
+ boost::system::error_code close(
+ boost::system::error_code & ec);
 
 
-Write some data to the socket.
 
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers);
 
+[endsect]
 
-This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
 
+[section:default_buffer_size buffered_write_stream::default_buffer_size]
 
-[heading Parameters]
-
+[indexterm2 default_buffer_size..buffered_write_stream]
+The default buffer size.
 
-[variablelist
-
-[[buffers][One or more data buffers to be written to the socket.]]
 
-]
+ static const std::size_t default_buffer_size = implementation_defined;
 
 
-[heading Return Value]
-
-The number of bytes written.
 
+[endsect]
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+[section:flush buffered_write_stream::flush]
 
-]
+[indexterm2 flush..buffered_write_stream]
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
 
-[heading Remarks]
-
-The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload1 flush]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload1 more...]]``
 
 
-[heading Example]
-
-To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
 
- socket.write_some(boost::asio::buffer(data, size));
 
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload2 flush]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload2 more...]]``
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
+[section:overload1 buffered_write_stream::flush (1 of 2 overloads)]
 
 
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
-[endsect]
 
+ std::size_t flush();
 
 
-[section:overload2 basic_stream_socket::write_some (2 of 2 overloads)]
 
+[endsect]
 
-Write some data to the socket.
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
+[section:overload2 buffered_write_stream::flush (2 of 2 overloads)]
 
 
-This function is used to write data to the stream socket. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
+Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
 
 
-[heading Parameters]
-
+ std::size_t flush(
+ boost::system::error_code & ec);
 
-[variablelist
-
-[[buffers][One or more data buffers to be written to the socket.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[endsect]
 
 
-[heading Return Value]
-
-The number of bytes written. Returns 0 if an error occurred.
+[endsect]
 
 
-[heading Remarks]
-
-The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+[section:get_io_service buffered_write_stream::get_io_service]
 
+[indexterm2 get_io_service..buffered_write_stream]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
+ boost::asio::io_service & get_io_service();
 
-[endsect]
 
 
 [endsect]
 
 
-[endsect]
+[section:in_avail buffered_write_stream::in_avail]
 
-[section:basic_streambuf basic_streambuf]
+[indexterm2 in_avail..buffered_write_stream]
+Determine the amount of data that may be read without blocking.
 
 
-Automatically resizable buffer class based on std::streambuf.
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload1 in_avail]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload1 more...]]``
 
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload2 in_avail]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload2 more...]]``
 
- template<
- typename Allocator = std::allocator<char>>
- class basic_streambuf :
- noncopyable
 
+[section:overload1 buffered_write_stream::in_avail (1 of 2 overloads)]
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+Determine the amount of data that may be read without blocking.
 
- [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
- [The type used to represent the input sequence as a list of buffers. ]
-
- ]
 
- [
+ std::size_t in_avail();
 
- [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
- [The type used to represent the output sequence as a list of buffers. ]
-
- ]
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[endsect]
 
- [
- [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
- [Construct a basic_streambuf object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
- [Move characters from the output sequence to the input sequence. ]
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
- [Remove characters from the input sequence. ]
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.data [*data]]]
- [Get a list of buffers that represents the input sequence. ]
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
- [Get the maximum size of the basic_streambuf. ]
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
- [Get a list of buffers that represents the output sequence, with the given size. ]
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.size [*size]]]
- [Get the size of the input sequence. ]
- ]
-
-]
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
- [Override std::streambuf behaviour. ]
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
- []
- ]
-
- [
- [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
- [Override std::streambuf behaviour. ]
- ]
-
-]
+[section:overload2 buffered_write_stream::in_avail (2 of 2 overloads)]
 
-The `basic_streambuf` class is derived from `std::streambuf` to associate the streambuf's input and output sequences with one or more character arrays. These character arrays are internal to the `basic_streambuf` object, but direct access to the array elements is provided to permit them to be used efficiently with I/O operations. Characters written to the output sequence of a `basic_streambuf` object are appended to the input sequence of the same object.
 
-The `basic_streambuf` class's public interface is intended to permit the following implementation strategies:
+Determine the amount of data that may be read without blocking.
 
 
-* A single contiguous character array, which is reallocated as necessary to accommodate changes in the size of the character sequence. This is the implementation approach currently used in Asio.
+ std::size_t in_avail(
+ boost::system::error_code & ec);
 
 
-* A sequence of one or more character arrays, where each array is of the same size. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
 
+[endsect]
 
-* A sequence of one or more character arrays of varying sizes. Additional character array objects are appended to the sequence to accommodate changes in the size of the character sequence.
 
-The constructor for [link boost_asio.reference.basic_streambuf `basic_streambuf`] accepts a `size_t` argument specifying the maximum of the sum of the sizes of the input sequence and output sequence. During the lifetime of the `basic_streambuf` object, the following invariant holds:
+[endsect]
 
- size() <= max_size()
+[section:lowest_layer buffered_write_stream::lowest_layer]
 
+[indexterm2 lowest_layer..buffered_write_stream]
+Get a reference to the lowest layer.
 
-Any member function that would, if successful, cause the invariant to be violated shall throw an exception of class `std::length_error`.
 
-The constructor for `basic_streambuf` takes an Allocator argument. A copy of this argument is used for any memory allocation performed, by the constructor and by all member functions, during the lifetime of each `basic_streambuf` object.
+ lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 more...]]``
 
 
-[heading Examples]
-
-Writing directly from an streambuf to a socket:
+Get a const reference to the lowest layer.
 
- boost::asio::streambuf b;
- std::ostream os(&b);
- os << "Hello, World!\n";
 
- // try sending some data in input sequence
- size_t n = sock.send(b.data());
+ const lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 more...]]``
 
- b.consume(n); // sent data is removed from input sequence
 
+[section:overload1 buffered_write_stream::lowest_layer (1 of 2 overloads)]
 
 
+Get a reference to the lowest layer.
 
-Reading from a socket directly into a streambuf:
 
- boost::asio::streambuf b;
+ lowest_layer_type & lowest_layer();
 
- // reserve 512 bytes in output sequence
- boost::asio::streambuf::mutable_buffers_type bufs = b.prepare(512);
 
- size_t n = sock.receive(bufs);
 
- // received data is "committed" from output sequence to input sequence
- b.commit(n);
+[endsect]
 
- std::istream is(&b);
- std::string s;
- is >> s;
 
 
+[section:overload2 buffered_write_stream::lowest_layer (2 of 2 overloads)]
 
 
-[heading Requirements]
+Get a const reference to the lowest layer.
 
-[*Header: ][^boost/asio/basic_streambuf.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ const lowest_layer_type & lowest_layer() const;
 
 
-[section:basic_streambuf basic_streambuf::basic_streambuf]
 
-[indexterm2 basic_streambuf..basic_streambuf]
-Construct a [link boost_asio.reference.basic_streambuf `basic_streambuf`] object.
+[endsect]
 
 
- basic_streambuf(
- std::size_t max_size = (std::numeric_limits< std::size_t >::max)(),
- const Allocator & allocator = Allocator());
+[endsect]
 
 
-Constructs a streambuf with the specified maximum size. The initial size of the streambuf's input sequence is 0.
+[section:lowest_layer_type buffered_write_stream::lowest_layer_type]
 
+[indexterm2 lowest_layer_type..buffered_write_stream]
+The type of the lowest layer.
 
-[endsect]
 
+ typedef next_layer_type::lowest_layer_type lowest_layer_type;
 
 
-[section:commit basic_streambuf::commit]
 
-[indexterm2 commit..basic_streambuf]
-Move characters from the output sequence to the input sequence.
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffered_write_stream.hpp]
 
- void commit(
- std::size_t n);
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Appends `n` characters from the start of the output sequence to the input sequence. The beginning of the output sequence is advanced by `n` characters.
+[endsect]
 
-Requires a preceding call `prepare(x)` where `x >= n`, and no intervening operations that modify the input or output sequence.
 
 
-[heading Exceptions]
-
+[section:next_layer buffered_write_stream::next_layer]
 
-[variablelist
-
-[[std::length_error][If `n` is greater than the size of the output sequence. ]]
+[indexterm2 next_layer..buffered_write_stream]
+Get a reference to the next layer.
 
-]
 
+ next_layer_type & next_layer();
 
 
 
@@ -30455,19 +48095,19 @@
 
 
 
-[section:const_buffers_type basic_streambuf::const_buffers_type]
+[section:next_layer_type buffered_write_stream::next_layer_type]
 
-[indexterm2 const_buffers_type..basic_streambuf]
-The type used to represent the input sequence as a list of buffers.
+[indexterm2 next_layer_type..buffered_write_stream]
+The type of the next layer.
 
 
- typedef implementation_defined const_buffers_type;
+ typedef boost::remove_reference< Stream >::type next_layer_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/basic_streambuf.hpp]
+[*Header: ][^boost/asio/buffered_write_stream.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -30475,1069 +48115,1210 @@
 [endsect]
 
 
+[section:peek buffered_write_stream::peek]
 
-[section:consume basic_streambuf::consume]
-
-[indexterm2 consume..basic_streambuf]
-Remove characters from the input sequence.
+[indexterm2 peek..buffered_write_stream]
+Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
 
- void consume(
- std::size_t n);
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload1 peek]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload1 more...]]``
 
 
-Removes `n` characters from the beginning of the input sequence.
+Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
 
-[heading Exceptions]
-
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload2 peek]``(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload2 more...]]``
 
-[variablelist
-
-[[std::length_error][If `n > size()`. ]]
 
-]
+[section:overload1 buffered_write_stream::peek (1 of 2 overloads)]
 
 
+Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers);
 
 
 
-[section:data basic_streambuf::data]
+[endsect]
 
-[indexterm2 data..basic_streambuf]
-Get a list of buffers that represents the input sequence.
 
 
- const_buffers_type data() const;
+[section:overload2 buffered_write_stream::peek (2 of 2 overloads)]
 
 
+Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
-[heading Return Value]
-
-An object of type `const_buffers_type` that satisfies ConstBufferSequence requirements, representing all character arrays in the input sequence.
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
-[heading Remarks]
-
-The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence.
 
 
+[endsect]
 
 
 [endsect]
 
+[section:read_some buffered_write_stream::read_some]
 
+[indexterm2 read_some..buffered_write_stream]
+Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
-[section:max_size basic_streambuf::max_size]
 
-[indexterm2 max_size..basic_streambuf]
-Get the maximum size of the [link boost_asio.reference.basic_streambuf `basic_streambuf`].
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload1 read_some]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload1 more...]]``
 
 
- std::size_t max_size() const;
+Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
+
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload2 read_some]``(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload2 more...]]``
 
 
-[heading Return Value]
-
-The allowed maximum of the sum of the sizes of the input sequence and output sequence.
+[section:overload1 buffered_write_stream::read_some (1 of 2 overloads)]
 
 
+Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
 
 
 
-[section:mutable_buffers_type basic_streambuf::mutable_buffers_type]
+[endsect]
 
-[indexterm2 mutable_buffers_type..basic_streambuf]
-The type used to represent the output sequence as a list of buffers.
 
 
- typedef implementation_defined mutable_buffers_type;
+[section:overload2 buffered_write_stream::read_some (2 of 2 overloads)]
 
 
+Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/basic_streambuf.hpp]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overflow basic_streambuf::overflow]
-
-[indexterm2 overflow..basic_streambuf]
-Override std::streambuf behaviour.
+[section:write_some buffered_write_stream::write_some]
 
+[indexterm2 write_some..buffered_write_stream]
+Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
- int_type overflow(
- int_type c);
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload1 more...]]``
 
-Behaves according to the specification of `std::streambuf::overflow()`, with the specialisation that `std::length_error` is thrown if appending the character to the input sequence would require the condition `size() > max_size()` to be true.
 
+Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload2 write_some]``(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload2 more...]]``
 
 
-[section:prepare basic_streambuf::prepare]
+[section:overload1 buffered_write_stream::write_some (1 of 2 overloads)]
 
-[indexterm2 prepare..basic_streambuf]
-Get a list of buffers that represents the output sequence, with the given size.
 
+Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
- mutable_buffers_type prepare(
- std::size_t n);
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers);
 
-Ensures that the output sequence can accommodate `n` characters, reallocating character array objects as necessary.
 
 
-[heading Return Value]
-
-An object of type `mutable_buffers_type` that satisfies MutableBufferSequence requirements, representing character array objects at the start of the output sequence such that the sum of the buffer sizes is `n`.
+[endsect]
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[std::length_error][If `size() + n > max_size()`.]]
+[section:overload2 buffered_write_stream::write_some (2 of 2 overloads)]
 
-]
 
+Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw.
 
-[heading Remarks]
-
-The returned object is invalidated by any `basic_streambuf` member function that modifies the input sequence or output sequence.
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:reserve basic_streambuf::reserve]
 
-[indexterm2 reserve..basic_streambuf]
+[endsect]
 
- void reserve(
- std::size_t n);
 
+[section:buffers_begin buffers_begin]
+
+[indexterm1 buffers_begin]
+Construct an iterator representing the beginning of the buffers' data.
 
 
-[endsect]
+ template<
+ typename BufferSequence>
+ buffers_iterator< BufferSequence > buffers_begin(
+ const BufferSequence & buffers);
 
 
+[heading Requirements]
 
-[section:size basic_streambuf::size]
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-[indexterm2 size..basic_streambuf]
-Get the size of the input sequence.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- std::size_t size() const;
+[endsect]
 
 
 
-[heading Return Value]
-
-The size of the input sequence. The value is equal to that calculated for `s` in the following code:
+[section:buffers_end buffers_end]
 
- size_t s = 0;
- const_buffers_type bufs = data();
- const_buffers_type::const_iterator i = bufs.begin();
- while (i != bufs.end())
- {
- const_buffer buf(*i++);
- s += buffer_size(buf);
- }
+[indexterm1 buffers_end]
+Construct an iterator representing the end of the buffers' data.
 
 
+ template<
+ typename BufferSequence>
+ buffers_iterator< BufferSequence > buffers_end(
+ const BufferSequence & buffers);
 
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:buffers_iterator buffers_iterator]
 
-[section:underflow basic_streambuf::underflow]
 
-[indexterm2 underflow..basic_streambuf]
-Override std::streambuf behaviour.
+A random access iterator over the bytes in a buffer sequence.
 
 
- int_type underflow();
+ template<
+ typename BufferSequence,
+ typename ByteType = char>
+ class buffers_iterator
 
 
-Behaves according to the specification of `std::streambuf::underflow()`.
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.buffers_iterator.difference_type [*difference_type]]]
+ [The type used for the distance between two iterators. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.buffers_iterator.iterator_category [*iterator_category]]]
+ [The iterator category. ]
+
+ ]
 
-[endsect]
+ [
 
-[section:buffer buffer]
+ [[link boost_asio.reference.buffers_iterator.pointer [*pointer]]]
+ [The type of the result of applying operator->() to the iterator. ]
+
+ ]
 
-[indexterm1 buffer]
-The `boost::asio::buffer` function is used to create a buffer object to represent raw memory, an array of POD elements, a vector of POD elements, or a std::string.
+ [
 
-
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload1 buffer]``(
- const mutable_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload1 more...]]``
+ [[link boost_asio.reference.buffers_iterator.reference [*reference]]]
+ [The type of the result of applying operator*() to the iterator. ]
+
+ ]
 
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload2 buffer]``(
- const mutable_buffer & b,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload2 more...]]``
+ [
 
- const_buffers_1 ``[link boost_asio.reference.buffer.overload3 buffer]``(
- const const_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload3 more...]]``
+ [[link boost_asio.reference.buffers_iterator.value_type [*value_type]]]
+ [The type of the value pointed to by the iterator. ]
+
+ ]
 
- const_buffers_1 ``[link boost_asio.reference.buffer.overload4 buffer]``(
- const const_buffer & b,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload4 more...]]``
+]
 
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload5 buffer]``(
- void * data,
- std::size_t size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload5 more...]]``
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
- const_buffers_1 ``[link boost_asio.reference.buffer.overload6 buffer]``(
- const void * data,
- std::size_t size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload6 more...]]``
+ [
+ [[link boost_asio.reference.buffers_iterator.begin [*begin]]]
+ [Construct an iterator representing the beginning of the buffers' data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.buffers_iterator [*buffers_iterator]]]
+ [Default constructor. Creates an iterator in an undefined state. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.end [*end]]]
+ [Construct an iterator representing the end of the buffers' data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator__star_ [*operator *]]]
+ [Dereference an iterator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_plus__plus_ [*operator++]]]
+ [Increment operator (prefix).
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload7 buffer]``(
- PodType (&data)[N]);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload7 more...]]``
+ Increment operator (postfix). ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_plus__eq_ [*operator+=]]]
+ [Addition operator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_minus__minus_ [*operator--]]]
+ [Decrement operator (prefix).
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload8 buffer]``(
- PodType (&data)[N],
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload8 more...]]``
+ Decrement operator (postfix). ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_minus__eq_ [*operator-=]]]
+ [Subtraction operator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_arrow_ [*operator->]]]
+ [Dereference an iterator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_lb__rb_ [*operator\[\]]]]
+ [Access an individual element. ]
+ ]
+
+]
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload9 buffer]``(
- const PodType (&data)[N]);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload9 more...]]``
+[heading Friends]
+[table
+ [[Name][Description]]
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload10 buffer]``(
- const PodType (&data)[N],
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload10 more...]]``
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_not__eq_ [*operator!=]]]
+ [Test two iterators for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_plus_ [*operator+]]]
+ [Addition operator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_minus_ [*operator-]]]
+ [Subtraction operator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_lt_ [*operator<]]]
+ [Compare two iterators. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_lt__eq_ [*operator<=]]]
+ [Compare two iterators. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_eq__eq_ [*operator==]]]
+ [Test two iterators for equality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_gt_ [*operator>]]]
+ [Compare two iterators. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffers_iterator.operator_gt__eq_ [*operator>=]]]
+ [Compare two iterators. ]
+ ]
+
+]
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload11 buffer]``(
- boost::array< PodType, N > & data);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload11 more...]]``
+[heading Requirements]
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload12 buffer]``(
- boost::array< PodType, N > & data,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload12 more...]]``
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload13 buffer]``(
- boost::array< const PodType, N > & data);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload13 more...]]``
+[*Convenience header: ][^boost/asio.hpp]
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload14 buffer]``(
- boost::array< const PodType, N > & data,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload14 more...]]``
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload15 buffer]``(
- const boost::array< PodType, N > & data);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload15 more...]]``
+[section:begin buffers_iterator::begin]
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload16 buffer]``(
- const boost::array< PodType, N > & data,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload16 more...]]``
+[indexterm2 begin..buffers_iterator]
+Construct an iterator representing the beginning of the buffers' data.
 
- template<
- typename PodType,
- typename Allocator>
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload17 buffer]``(
- std::vector< PodType, Allocator > & data);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload17 more...]]``
 
- template<
- typename PodType,
- typename Allocator>
- mutable_buffers_1 ``[link boost_asio.reference.buffer.overload18 buffer]``(
- std::vector< PodType, Allocator > & data,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload18 more...]]``
+ static buffers_iterator begin(
+ const BufferSequence & buffers);
 
- template<
- typename PodType,
- typename Allocator>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload19 buffer]``(
- const std::vector< PodType, Allocator > & data);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload19 more...]]``
 
- template<
- typename PodType,
- typename Allocator>
- const_buffers_1 ``[link boost_asio.reference.buffer.overload20 buffer]``(
- const std::vector< PodType, Allocator > & data,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload20 more...]]``
 
- const_buffers_1 ``[link boost_asio.reference.buffer.overload21 buffer]``(
- const std::string & data);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload21 more...]]``
+[endsect]
 
- const_buffers_1 ``[link boost_asio.reference.buffer.overload22 buffer]``(
- const std::string & data,
- std::size_t max_size_in_bytes);
- `` [''''&raquo;''' [link boost_asio.reference.buffer.overload22 more...]]``
 
-A buffer object represents a contiguous region of memory as a 2-tuple consisting of a pointer and size in bytes. A tuple of the form `{void*, size_t}` specifies a mutable (modifiable) region of memory. Similarly, a tuple of the form `{const void*, size_t}` specifies a const (non-modifiable) region of memory. These two forms correspond to the classes [link boost_asio.reference.mutable_buffer `mutable_buffer`] and [link boost_asio.reference.const_buffer `const_buffer`], respectively. To mirror C++'s conversion rules, a [link boost_asio.reference.mutable_buffer `mutable_buffer`] is implicitly convertible to a [link boost_asio.reference.const_buffer `const_buffer`], and the opposite conversion is not permitted.
 
-The simplest use case involves reading or writing a single buffer of a specified size:
+[section:buffers_iterator buffers_iterator::buffers_iterator]
 
+[indexterm2 buffers_iterator..buffers_iterator]
+Default constructor. Creates an iterator in an undefined state.
 
 
- sock.send(boost::asio::buffer(data, size));
+ buffers_iterator();
 
 
 
+[endsect]
 
-In the above example, the return value of `boost::asio::buffer` meets the requirements of the ConstBufferSequence concept so that it may be directly passed to the socket's write function. A buffer created for modifiable memory also meets the requirements of the MutableBufferSequence concept.
 
-An individual buffer may be created from a builtin array, std::vector or boost::array of POD elements. This helps prevent buffer overruns by automatically determining the size of the buffer:
 
+[section:difference_type buffers_iterator::difference_type]
 
+[indexterm2 difference_type..buffers_iterator]
+The type used for the distance between two iterators.
 
- char d1[128];
- size_t bytes_transferred = sock.receive(boost::asio::buffer(d1));
 
- std::vector<char> d2(128);
- bytes_transferred = sock.receive(boost::asio::buffer(d2));
+ typedef std::ptrdiff_t difference_type;
 
- boost::array<char, 128> d3;
- bytes_transferred = sock.receive(boost::asio::buffer(d3));
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-In all three cases above, the buffers created are exactly 128 bytes long. Note that a vector is [*never] automatically resized when creating or using a buffer. The buffer size is determined using the vector's `size()` member function, and not its capacity.
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Accessing Buffer Contents]
-
+[endsect]
 
 
-The contents of a buffer may be accessed using the boost::asio::buffer\_size and boost::asio::buffer\_cast functions:
 
+[section:end buffers_iterator::end]
 
+[indexterm2 end..buffers_iterator]
+Construct an iterator representing the end of the buffers' data.
 
- boost::asio::mutable_buffer b1 = ...;
- std::size_t s1 = boost::asio::buffer_size(b1);
- unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1);
 
- boost::asio::const_buffer b2 = ...;
- std::size_t s2 = boost::asio::buffer_size(b2);
- const void* p2 = boost::asio::buffer_cast<const void*>(b2);
+ static buffers_iterator end(
+ const BufferSequence & buffers);
 
 
 
+[endsect]
 
-The boost::asio::buffer\_cast function permits violations of type safety, so uses of it in application code should be carefully considered.
 
 
-[heading Buffer Invalidation]
-
+[section:iterator_category buffers_iterator::iterator_category]
 
+[indexterm2 iterator_category..buffers_iterator]
+The iterator category.
 
-A buffer object does not have any ownership of the memory it refers to. It is the responsibility of the application to ensure the memory region remains valid until it is no longer required for an I/O operation. When the memory is no longer available, the buffer is said to have been invalidated.
 
-For the `boost::asio::buffer` overloads that accept an argument of type std::vector, the buffer objects returned are invalidated by any vector operation that also invalidates all references, pointers and iterators referring to the elements in the sequence (C++ Std, 23.2.4)
+ typedef std::random_access_iterator_tag iterator_category;
 
-For the `boost::asio::buffer` overloads that accept an argument of type std::string, the buffer objects returned are invalidated according to the rules defined for invalidation of references, pointers and iterators referring to elements of the sequence (C++ Std, 21.3).
 
 
-[heading Buffer Arithmetic]
-
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-Buffer objects may be manipulated using simple arithmetic in a safe way which helps prevent buffer overruns. Consider an array initialised as follows:
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
- boost::array<char, 6> a = { 'a', 'b', 'c', 'd', 'e' };
 
 
+[section:operator__star_ buffers_iterator::operator *]
 
+[indexterm2 operator *..buffers_iterator]
+Dereference an iterator.
 
-A buffer object `b1` created using:
 
+ reference operator *() const;
 
 
- b1 = boost::asio::buffer(a);
 
+[endsect]
 
 
 
-represents the entire array, `{ 'a', 'b', 'c', 'd', 'e' }`. An optional second argument to the `boost::asio::buffer` function may be used to limit the size, in bytes, of the buffer:
+[section:operator_not__eq_ buffers_iterator::operator!=]
 
+[indexterm2 operator!=..buffers_iterator]
+Test two iterators for inequality.
 
 
- b2 = boost::asio::buffer(a, 3);
+ friend bool operator!=(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-such that `b2` represents the data `{ 'a', 'b', 'c' }`. Even if the size argument exceeds the actual size of the array, the size of the buffer object created will be limited to the array size.
+[*Convenience header: ][^boost/asio.hpp]
 
-An offset may be applied to an existing buffer to create a new one:
 
+[endsect]
 
 
- b3 = b1 + 2;
+[section:operator_plus_ buffers_iterator::operator+]
 
+[indexterm2 operator+..buffers_iterator]
+Addition operator.
 
 
+ friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload1 operator+]``(
+ const buffers_iterator & iter,
+ std::ptrdiff_t difference);
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload1 more...]]``
 
-where `b3` will set to represent `{ 'c', 'd', 'e' }`. If the offset exceeds the size of the existing buffer, the newly created buffer will be empty.
+ friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload2 operator+]``(
+ std::ptrdiff_t difference,
+ const buffers_iterator & iter);
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload2 more...]]``
 
-Both an offset and size may be specified to create a buffer that corresponds to a specific range of bytes within an existing buffer:
 
+[section:overload1 buffers_iterator::operator+ (1 of 2 overloads)]
 
 
- b4 = boost::asio::buffer(b1 + 1, 3);
+Addition operator.
 
 
+ friend buffers_iterator operator+(
+ const buffers_iterator & iter,
+ std::ptrdiff_t difference);
 
 
-so that `b4` will refer to the bytes `{ 'b', 'c', 'd' }`.
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-[heading Buffers and Scatter-Gather I/O]
-
+[*Convenience header: ][^boost/asio.hpp]
 
 
-To read or write using multiple buffers (i.e. scatter-gather I/O), multiple buffer objects may be assigned into a container that supports the MutableBufferSequence (for read) or ConstBufferSequence (for write) concepts:
+[endsect]
 
 
 
- char d1[128];
- std::vector<char> d2(128);
- boost::array<char, 128> d3;
+[section:overload2 buffers_iterator::operator+ (2 of 2 overloads)]
 
- boost::array<mutable_buffer, 3> bufs1 = {
- boost::asio::buffer(d1),
- boost::asio::buffer(d2),
- boost::asio::buffer(d3) };
- bytes_transferred = sock.receive(bufs1);
 
- std::vector<const_buffer> bufs2;
- bufs2.push_back(boost::asio::buffer(d1));
- bufs2.push_back(boost::asio::buffer(d2));
- bufs2.push_back(boost::asio::buffer(d3));
- bytes_transferred = sock.send(bufs2);
+Addition operator.
 
 
+ friend buffers_iterator operator+(
+ std::ptrdiff_t difference,
+ const buffers_iterator & iter);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffer.hpp]
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:overload1 buffer (1 of 22 overloads)]
+[endsect]
 
 
-Create a new modifiable buffer from an existing buffer.
+[endsect]
 
+[section:operator_plus__plus_ buffers_iterator::operator++]
 
- mutable_buffers_1 buffer(
- const mutable_buffer & b);
+[indexterm2 operator++..buffers_iterator]
+Increment operator (prefix).
 
 
+ buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 operator++]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 more...]]``
 
-[heading Return Value]
-
-`mutable_buffers_1(b)`.
 
+Increment operator (postfix).
 
 
+ buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 operator++]``(
+ int );
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 more...]]``
 
-[endsect]
 
+[section:overload1 buffers_iterator::operator++ (1 of 2 overloads)]
 
 
-[section:overload2 buffer (2 of 22 overloads)]
+Increment operator (prefix).
 
 
-Create a new modifiable buffer from an existing buffer.
+ buffers_iterator & operator++();
 
 
- mutable_buffers_1 buffer(
- const mutable_buffer & b,
- std::size_t max_size_in_bytes);
 
+[endsect]
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
 
- mutable_buffers_1(
- buffer_cast<void*>(b),
- min(buffer_size(b), max_size_in_bytes));
+[section:overload2 buffers_iterator::operator++ (2 of 2 overloads)]
 
 
+Increment operator (postfix).
 
 
+ buffers_iterator operator++(
+ int );
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload3 buffer (3 of 22 overloads)]
-
-
-Create a new non-modifiable buffer from an existing buffer.
-
-
- const_buffers_1 buffer(
- const const_buffer & b);
 
+[section:operator_plus__eq_ buffers_iterator::operator+=]
 
+[indexterm2 operator+=..buffers_iterator]
+Addition operator.
 
-[heading Return Value]
-
-`const_buffers_1(b)`.
 
+ buffers_iterator & operator+=(
+ std::ptrdiff_t difference);
 
 
 
 [endsect]
 
 
+[section:operator_minus_ buffers_iterator::operator-]
 
-[section:overload4 buffer (4 of 22 overloads)]
+[indexterm2 operator-..buffers_iterator]
+Subtraction operator.
 
 
-Create a new non-modifiable buffer from an existing buffer.
+ friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload1 operator-]``(
+ const buffers_iterator & iter,
+ std::ptrdiff_t difference);
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload1 more...]]``
 
+ friend std::ptrdiff_t ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload2 operator-]``(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload2 more...]]``
 
- const_buffers_1 buffer(
- const const_buffer & b,
- std::size_t max_size_in_bytes);
 
+[section:overload1 buffers_iterator::operator- (1 of 2 overloads)]
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+Subtraction operator.
 
- const_buffers_1(
- buffer_cast<const void*>(b),
- min(buffer_size(b), max_size_in_bytes));
 
+ friend buffers_iterator operator-(
+ const buffers_iterator & iter,
+ std::ptrdiff_t difference);
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload5 buffer (5 of 22 overloads)]
+[section:overload2 buffers_iterator::operator- (2 of 2 overloads)]
 
 
-Create a new modifiable buffer that represents the given memory range.
+Subtraction operator.
 
 
- mutable_buffers_1 buffer(
- void * data,
- std::size_t size_in_bytes);
+ friend std::ptrdiff_t operator-(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
 
 
+[heading Requirements]
 
-[heading Return Value]
-
-`mutable_buffers_1(data, size_in_bytes)`.
+[*Header: ][^boost/asio/buffers_iterator.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
 [endsect]
 
+[section:operator_minus__minus_ buffers_iterator::operator--]
 
+[indexterm2 operator--..buffers_iterator]
+Decrement operator (prefix).
 
-[section:overload6 buffer (6 of 22 overloads)]
 
+ buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 operator--]``();
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 more...]]``
 
-Create a new non-modifiable buffer that represents the given memory range.
 
+Decrement operator (postfix).
 
- const_buffers_1 buffer(
- const void * data,
- std::size_t size_in_bytes);
+
+ buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 operator--]``(
+ int );
+ `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 more...]]``
 
 
+[section:overload1 buffers_iterator::operator-- (1 of 2 overloads)]
 
-[heading Return Value]
-
-`const_buffers_1(data, size_in_bytes)`.
 
+Decrement operator (prefix).
 
 
+ buffers_iterator & operator--();
 
-[endsect]
 
 
+[endsect]
 
-[section:overload7 buffer (7 of 22 overloads)]
 
 
-Create a new modifiable buffer that represents the given POD array.
+[section:overload2 buffers_iterator::operator-- (2 of 2 overloads)]
 
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 buffer(
- PodType (&data)[N]);
+Decrement operator (postfix).
 
 
+ buffers_iterator operator--(
+ int );
 
-[heading Return Value]
-
-A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
 
- mutable_buffers_1(
- static_cast<void*>(data),
- N * sizeof(PodType));
 
+[endsect]
 
 
+[endsect]
 
 
+[section:operator_minus__eq_ buffers_iterator::operator-=]
 
+[indexterm2 operator-=..buffers_iterator]
+Subtraction operator.
 
-[endsect]
 
+ buffers_iterator & operator-=(
+ std::ptrdiff_t difference);
 
 
-[section:overload8 buffer (8 of 22 overloads)]
 
+[endsect]
 
-Create a new modifiable buffer that represents the given POD array.
 
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 buffer(
- PodType (&data)[N],
- std::size_t max_size_in_bytes);
+[section:operator_arrow_ buffers_iterator::operator->]
 
+[indexterm2 operator->..buffers_iterator]
+Dereference an iterator.
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+ pointer operator->() const;
 
- mutable_buffers_1(
- static_cast<void*>(data),
- min(N * sizeof(PodType), max_size_in_bytes));
 
 
+[endsect]
 
 
 
+[section:operator_lt_ buffers_iterator::operator<]
 
+[indexterm2 operator<..buffers_iterator]
+Compare two iterators.
 
-[endsect]
 
+ friend bool operator<(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
 
 
-[section:overload9 buffer (9 of 22 overloads)]
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-Create a new non-modifiable buffer that represents the given POD array.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 buffer(
- const PodType (&data)[N]);
+[endsect]
 
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+[section:operator_lt__eq_ buffers_iterator::operator<=]
 
- const_buffers_1(
- static_cast<const void*>(data),
- N * sizeof(PodType));
+[indexterm2 operator<=..buffers_iterator]
+Compare two iterators.
 
 
+ friend bool operator<=(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
+
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload10 buffer (10 of 22 overloads)]
+[section:operator_eq__eq_ buffers_iterator::operator==]
 
+[indexterm2 operator==..buffers_iterator]
+Test two iterators for equality.
 
-Create a new non-modifiable buffer that represents the given POD array.
 
+ friend bool operator==(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 buffer(
- const PodType (&data)[N],
- std::size_t max_size_in_bytes);
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+[*Convenience header: ][^boost/asio.hpp]
 
- const_buffers_1(
- static_cast<const void*>(data),
- min(N * sizeof(PodType), max_size_in_bytes));
 
+[endsect]
 
 
 
+[section:operator_gt_ buffers_iterator::operator>]
 
+[indexterm2 operator>..buffers_iterator]
+Compare two iterators.
 
 
-[endsect]
+ friend bool operator>(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
 
 
+[heading Requirements]
 
-[section:overload11 buffer (11 of 22 overloads)]
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Create a new modifiable buffer that represents the given POD array.
 
+[endsect]
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 buffer(
- boost::array< PodType, N > & data);
 
 
+[section:operator_gt__eq_ buffers_iterator::operator>=]
 
-[heading Return Value]
-
-A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+[indexterm2 operator>=..buffers_iterator]
+Compare two iterators.
 
- mutable_buffers_1(
- data.data(),
- data.size() * sizeof(PodType));
 
+ friend bool operator>=(
+ const buffers_iterator & a,
+ const buffers_iterator & b);
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload12 buffer (12 of 22 overloads)]
-
+[section:operator_lb__rb_ buffers_iterator::operator\[\]]
 
-Create a new modifiable buffer that represents the given POD array.
+[indexterm2 operator\[\]..buffers_iterator]
+Access an individual element.
 
 
- template<
- typename PodType,
- std::size_t N>
- mutable_buffers_1 buffer(
- boost::array< PodType, N > & data,
- std::size_t max_size_in_bytes);
+ reference operator[](
+ std::ptrdiff_t difference) const;
 
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+[endsect]
 
- mutable_buffers_1(
- data.data(),
- min(data.size() * sizeof(PodType), max_size_in_bytes));
 
 
+[section:pointer buffers_iterator::pointer]
 
+[indexterm2 pointer..buffers_iterator]
+The type of the result of applying `operator->()` to the iterator.
 
 
+ typedef const_or_non_const_ByteType * pointer;
 
 
-[endsect]
 
+If the buffer sequence stores buffer objects that are convertible to [link boost_asio.reference.mutable_buffer `mutable_buffer`], this is a pointer to a non-const ByteType. Otherwise, a pointer to a const ByteType.
 
+[heading Requirements]
 
-[section:overload13 buffer (13 of 22 overloads)]
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Create a new non-modifiable buffer that represents the given POD array.
 
+[endsect]
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 buffer(
- boost::array< const PodType, N > & data);
 
 
+[section:reference buffers_iterator::reference]
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+[indexterm2 reference..buffers_iterator]
+The type of the result of applying `operator*()` to the iterator.
 
- const_buffers_1(
- data.data(),
- data.size() * sizeof(PodType));
 
+ typedef const_or_non_const_ByteType & reference;
 
 
 
+If the buffer sequence stores buffer objects that are convertible to [link boost_asio.reference.mutable_buffer `mutable_buffer`], this is a reference to a non-const ByteType. Otherwise, a reference to a const ByteType.
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
-[section:overload14 buffer (14 of 22 overloads)]
 
 
-Create a new non-modifiable buffer that represents the given POD array.
+[section:value_type buffers_iterator::value_type]
 
+[indexterm2 value_type..buffers_iterator]
+The type of the value pointed to by the iterator.
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 buffer(
- boost::array< const PodType, N > & data,
- std::size_t max_size_in_bytes);
 
+ typedef ByteType value_type;
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
 
- const_buffers_1(
- data.data(),
- min(data.size() * sizeof(PodType), max_size_in_bytes));
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffers_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
 
 [endsect]
 
+[section:connect connect]
 
+[indexterm1 connect]
+Establishes a socket connection by trying each endpoint in a sequence.
 
-[section:overload15 buffer (15 of 22 overloads)]
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator ``[link boost_asio.reference.connect.overload1 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload1 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator ``[link boost_asio.reference.connect.overload2 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload2 more...]]``
 
-Create a new non-modifiable buffer that represents the given POD array.
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator ``[link boost_asio.reference.connect.overload3 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload3 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator ``[link boost_asio.reference.connect.overload4 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload4 more...]]``
 
   template<
- typename PodType,
- std::size_t N>
- const_buffers_1 buffer(
- const boost::array< PodType, N > & data);
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator ``[link boost_asio.reference.connect.overload5 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ConnectCondition connect_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload5 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator ``[link boost_asio.reference.connect.overload6 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ConnectCondition connect_condition,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload6 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator ``[link boost_asio.reference.connect.overload7 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ConnectCondition connect_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload7 more...]]``
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator ``[link boost_asio.reference.connect.overload8 connect]``(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ConnectCondition connect_condition,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.connect.overload8 more...]]``
 
- const_buffers_1(
- data.data(),
- data.size() * sizeof(PodType));
+[heading Requirements]
 
+[*Header: ][^boost/asio/connect.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[section:overload1 connect (1 of 8 overloads)]
 
 
+Establishes a socket connection by trying each endpoint in a sequence.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin);
 
 
-[section:overload16 buffer (16 of 22 overloads)]
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
 
-Create a new non-modifiable buffer that represents the given POD array.
+[heading Parameters]
+
 
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
- template<
- typename PodType,
- std::size_t N>
- const_buffers_1 buffer(
- const boost::array< PodType, N > & data,
- std::size_t max_size_in_bytes);
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
+]
 
 
 [heading Return Value]
       
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
-
- const_buffers_1(
- data.data(),
- min(data.size() * sizeof(PodType), max_size_in_bytes));
-
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
+]
 
 
-[endsect]
+[heading Remarks]
+
+This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
 
 
+[heading Example]
+
 
-[section:overload17 buffer (17 of 22 overloads)]
 
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+ boost::asio::connect(s, r.resolve(q));
 
-Create a new modifiable buffer that represents the given POD vector.
 
 
- template<
- typename PodType,
- typename Allocator>
- mutable_buffers_1 buffer(
- std::vector< PodType, Allocator > & data);
 
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
 
- mutable_buffers_1(
- data.size() ? &data[0] : 0,
- data.size() * sizeof(PodType));
+[endsect]
 
 
 
+[section:overload2 connect (2 of 8 overloads)]
 
 
-[heading Remarks]
-
-The buffer is invalidated by any vector operation that would also invalidate iterators.
+Establishes a socket connection by trying each endpoint in a sequence.
 
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ boost::system::error_code & ec);
 
 
-[endsect]
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
 
+[heading Parameters]
+
 
-[section:overload18 buffer (18 of 22 overloads)]
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
-Create a new modifiable buffer that represents the given POD vector.
+[[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
+]
 
- template<
- typename PodType,
- typename Allocator>
- mutable_buffers_1 buffer(
- std::vector< PodType, Allocator > & data,
- std::size_t max_size_in_bytes);
 
+[heading Return Value]
+
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
-[heading Return Value]
+[heading Remarks]
       
-A [link boost_asio.reference.mutable_buffers_1 `mutable_buffers_1`] value equivalent to:
+This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
 
- mutable_buffers_1(
- data.size() ? &data[0] : 0,
- min(data.size() * sizeof(PodType), max_size_in_bytes));
+
+[heading Example]
+
 
 
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+ boost::system::error_code ec;
+ boost::asio::connect(s, r.resolve(q), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
 
 
-[heading Remarks]
-
-The buffer is invalidated by any vector operation that would also invalidate iterators.
 
 
 
@@ -31546,321 +49327,328 @@
 
 
 
-[section:overload19 buffer (19 of 22 overloads)]
+[section:overload3 connect (3 of 8 overloads)]
 
 
-Create a new non-modifiable buffer that represents the given POD vector.
+Establishes a socket connection by trying each endpoint in a sequence.
 
 
   template<
- typename PodType,
- typename Allocator>
- const_buffers_1 buffer(
- const std::vector< PodType, Allocator > & data);
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end);
 
 
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
 
- const_buffers_1(
- data.size() ? &data[0] : 0,
- data.size() * sizeof(PodType));
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
+[[end][An iterator pointing to the end of a sequence of endpoints.]]
 
+]
 
 
-[heading Remarks]
+[heading Return Value]
       
-The buffer is invalidated by any vector operation that would also invalidate iterators.
-
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
+[heading Exceptions]
+
 
-[endsect]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
+]
 
 
-[section:overload20 buffer (20 of 22 overloads)]
+[heading Example]
+
 
 
-Create a new non-modifiable buffer that represents the given POD vector.
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::resolver::iterator i = r.resolve(q), end;
+ tcp::socket s(io_service);
+ boost::asio::connect(s, i, end);
 
 
- template<
- typename PodType,
- typename Allocator>
- const_buffers_1 buffer(
- const std::vector< PodType, Allocator > & data,
- std::size_t max_size_in_bytes);
 
 
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
 
- const_buffers_1(
- data.size() ? &data[0] : 0,
- min(data.size() * sizeof(PodType), max_size_in_bytes));
 
+[endsect]
 
 
 
+[section:overload4 connect (4 of 8 overloads)]
 
-[heading Remarks]
-
-The buffer is invalidated by any vector operation that would also invalidate iterators.
 
+Establishes a socket connection by trying each endpoint in a sequence.
 
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ boost::system::error_code & ec);
 
-[endsect]
 
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
 
-[section:overload21 buffer (21 of 22 overloads)]
+[heading Parameters]
+
 
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
-Create a new non-modifiable buffer that represents the given string.
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
+[[end][An iterator pointing to the end of a sequence of endpoints.]]
 
- const_buffers_1 buffer(
- const std::string & data);
+[[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
+]
 
 
 [heading Return Value]
       
-`const_buffers_1(data.data(), data.size())`.
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
-[heading Remarks]
-
-The buffer is invalidated by any non-const operation called on the given string object.
-
+[heading Example]
+
 
 
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::resolver::iterator i = r.resolve(q), end;
+ tcp::socket s(io_service);
+ boost::system::error_code ec;
+ boost::asio::connect(s, i, end, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
 
-[endsect]
 
 
 
-[section:overload22 buffer (22 of 22 overloads)]
 
 
-Create a new non-modifiable buffer that represents the given string.
 
+[endsect]
 
- const_buffers_1 buffer(
- const std::string & data,
- std::size_t max_size_in_bytes);
 
 
+[section:overload5 connect (5 of 8 overloads)]
 
-[heading Return Value]
-
-A [link boost_asio.reference.const_buffers_1 `const_buffers_1`] value equivalent to:
 
- const_buffers_1(
- data.data(),
- min(data.size(), max_size_in_bytes));
+Establishes a socket connection by trying each endpoint in a sequence.
 
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ConnectCondition connect_condition);
 
 
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
-[heading Remarks]
-
-The buffer is invalidated by any non-const operation called on the given string object.
 
+[heading Parameters]
+
 
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
-[endsect]
+[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
+``
+ Iterator connect_condition(
+ const boost::system::error_code& ec,
+ Iterator next);
+``
+The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is an iterator pointing to the next endpoint to be tried. The function object should return the next iterator, but is permitted to return a different iterator so that endpoints may be skipped. The implementation guarantees that the function object will never be called with the end iterator.]]
 
+]
 
-[endsect]
 
-[section:buffered_read_stream buffered_read_stream]
+[heading Return Value]
+
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
-Adds buffering to the read-related operations of a stream.
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
- template<
- typename Stream>
- class buffered_read_stream :
- noncopyable
+]
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[heading Remarks]
+
+This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
 
- [
 
- [[link boost_asio.reference.buffered_read_stream.lowest_layer_type [*lowest_layer_type]]]
- [The type of the lowest layer. ]
+[heading Example]
   
- ]
+The following connect condition function object can be used to output information about the individual connection attempts:
 
- [
+ struct my_connect_condition
+ {
+ template <typename Iterator>
+ Iterator operator()(
+ const boost::system::error_code& ec,
+ Iterator next)
+ {
+ if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ std::cout << "Trying: " << next->endpoint() << std::endl;
+ return next;
+ }
+ };
+
+
+It would be used with the `boost::asio::connect` function as follows:
+
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+ tcp::resolver::iterator i = boost::asio::connect(
+ s, r.resolve(q), my_connect_condition());
+ std::cout << "Connected to: " << i->endpoint() << std::endl;
 
- [[link boost_asio.reference.buffered_read_stream.next_layer_type [*next_layer_type]]]
- [The type of the next layer. ]
-
- ]
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.buffered_read_stream.async_fill [*async_fill]]]
- [Start an asynchronous fill. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.async_read_some [*async_read_some]]]
- [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.async_write_some [*async_write_some]]]
- [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.buffered_read_stream [*buffered_read_stream]]]
- [Construct, passing the specified argument to initialise the next layer. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.close [*close]]]
- [Close the stream. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.fill [*fill]]]
- [Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
 
- Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.in_avail [*in_avail]]]
- [Determine the amount of data that may be read without blocking. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.next_layer [*next_layer]]]
- [Get a reference to the next layer. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.peek [*peek]]]
- [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
- Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.read_some [*read_some]]]
- [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+[endsect]
 
- Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_read_stream.write_some [*write_some]]]
- [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
 
- Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
- ]
-
-]
 
-[heading Data Members]
-[table
- [[Name][Description]]
+[section:overload6 connect (6 of 8 overloads)]
 
- [
- [[link boost_asio.reference.buffered_read_stream.default_buffer_size [*default_buffer_size]]]
- [The default buffer size. ]
- ]
 
-]
+Establishes a socket connection by trying each endpoint in a sequence.
 
-The [link boost_asio.reference.buffered_read_stream `buffered_read_stream`] class template can be used to add buffering to the synchronous and asynchronous read operations of a stream.
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ ConnectCondition connect_condition,
+ boost::system::error_code & ec);
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
 
+[heading Parameters]
+
 
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
-[heading Requirements]
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
-[*Header: ][^boost/asio/buffered_read_stream.hpp]
+[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
+``
+ Iterator connect_condition(
+ const boost::system::error_code& ec,
+ Iterator next);
+``
+The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is an iterator pointing to the next endpoint to be tried. The function object should return the next iterator, but is permitted to return a different iterator so that endpoints may be skipped. The implementation guarantees that the function object will never be called with the end iterator.]]
 
-[*Convenience header: ][^boost/asio.hpp]
+[[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
+]
 
-[section:async_fill buffered_read_stream::async_fill]
 
-[indexterm2 async_fill..buffered_read_stream]
-Start an asynchronous fill.
+[heading Return Value]
+
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
- template<
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_fill(
- ReadHandler handler);
+[heading Remarks]
+
+This overload assumes that a default constructed object of type `Iterator` represents the end of the sequence. This is a valid assumption for iterator types such as `boost::asio::ip::tcp::resolver::iterator`.
 
 
+[heading Example]
+
+The following connect condition function object can be used to output information about the individual connection attempts:
 
-[endsect]
+ struct my_connect_condition
+ {
+ template <typename Iterator>
+ Iterator operator()(
+ const boost::system::error_code& ec,
+ Iterator next)
+ {
+ if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ std::cout << "Trying: " << next->endpoint() << std::endl;
+ return next;
+ }
+ };
 
 
+It would be used with the `boost::asio::connect` function as follows:
+
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::socket s(io_service);
+ boost::system::error_code ec;
+ tcp::resolver::iterator i = boost::asio::connect(
+ s, r.resolve(q), my_connect_condition(), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ else
+ {
+ std::cout << "Connected to: " << i->endpoint() << std::endl;
+ }
 
-[section:async_read_some buffered_read_stream::async_read_some]
 
-[indexterm2 async_read_some..buffered_read_stream]
-Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_read_some(
- const MutableBufferSequence & buffers,
- ReadHandler handler);
 
 
 
@@ -31868,221 +49656,309 @@
 
 
 
-[section:async_write_some buffered_read_stream::async_write_some]
+[section:overload7 connect (7 of 8 overloads)]
 
-[indexterm2 async_write_some..buffered_read_stream]
-Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
+
+Establishes a socket connection by trying each endpoint in a sequence.
 
 
   template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ConnectCondition connect_condition);
 
 
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
-[endsect]
 
+[heading Parameters]
+
 
-[section:buffered_read_stream buffered_read_stream::buffered_read_stream]
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
-[indexterm2 buffered_read_stream..buffered_read_stream]
-Construct, passing the specified argument to initialise the next layer.
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
+[[end][An iterator pointing to the end of a sequence of endpoints.]]
 
- template<
- typename Arg>
- explicit ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 buffered_read_stream]``(
- Arg & a);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 more...]]``
+[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
+``
+ Iterator connect_condition(
+ const boost::system::error_code& ec,
+ Iterator next);
+``
+The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is an iterator pointing to the next endpoint to be tried. The function object should return the next iterator, but is permitted to return a different iterator so that endpoints may be skipped. The implementation guarantees that the function object will never be called with the end iterator.]]
 
- template<
- typename Arg>
- ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 buffered_read_stream]``(
- Arg & a,
- std::size_t buffer_size);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 more...]]``
+]
 
 
-[section:overload1 buffered_read_stream::buffered_read_stream (1 of 2 overloads)]
+[heading Return Value]
+
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
-Construct, passing the specified argument to initialise the next layer.
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. If the sequence is empty, the associated `error_code` is `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
- template<
- typename Arg>
- buffered_read_stream(
- Arg & a);
+]
 
 
+[heading Example]
+
+The following connect condition function object can be used to output information about the individual connection attempts:
 
-[endsect]
+ struct my_connect_condition
+ {
+ template <typename Iterator>
+ Iterator operator()(
+ const boost::system::error_code& ec,
+ Iterator next)
+ {
+ if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ std::cout << "Trying: " << next->endpoint() << std::endl;
+ return next;
+ }
+ };
 
 
+It would be used with the `boost::asio::connect` function as follows:
 
-[section:overload2 buffered_read_stream::buffered_read_stream (2 of 2 overloads)]
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::resolver::iterator i = r.resolve(q), end;
+ tcp::socket s(io_service);
+ i = boost::asio::connect(s, i, end, my_connect_condition());
+ std::cout << "Connected to: " << i->endpoint() << std::endl;
 
 
-Construct, passing the specified argument to initialise the next layer.
 
 
- template<
- typename Arg>
- buffered_read_stream(
- Arg & a,
- std::size_t buffer_size);
 
 
 
 [endsect]
 
 
-[endsect]
 
-[section:close buffered_read_stream::close]
+[section:overload8 connect (8 of 8 overloads)]
 
-[indexterm2 close..buffered_read_stream]
-Close the stream.
 
+Establishes a socket connection by trying each endpoint in a sequence.
 
- void ``[link boost_asio.reference.buffered_read_stream.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.buffered_read_stream.close.overload2 close]``(
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService]``,
+ typename Iterator,
+ typename ConnectCondition>
+ Iterator connect(
+ basic_socket< Protocol, SocketService > & s,
+ Iterator begin,
+ Iterator end,
+ ConnectCondition connect_condition,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.close.overload2 more...]]``
 
 
-[section:overload1 buffered_read_stream::close (1 of 2 overloads)]
+This function attempts to connect a socket to one of a sequence of endpoints. It does this by repeated calls to the socket's `connect` member function, once for each endpoint in the sequence, until a connection is successfully established.
 
 
-Close the stream.
+[heading Parameters]
+
 
+[variablelist
+
+[[s][The socket to be connected. If the socket is already open, it will be closed.]]
 
- void close();
+[[begin][An iterator pointing to the start of a sequence of endpoints.]]
 
+[[end][An iterator pointing to the end of a sequence of endpoints.]]
 
+[[connect_condition][A function object that is called prior to each connection attempt. The signature of the function object must be:
+``
+ Iterator connect_condition(
+ const boost::system::error_code& ec,
+ Iterator next);
+``
+The `ec` parameter contains the result from the most recent connect operation. Before the first connection attempt, `ec` is always set to indicate success. The `next` parameter is an iterator pointing to the next endpoint to be tried. The function object should return the next iterator, but is permitted to return a different iterator so that endpoints may be skipped. The implementation guarantees that the function object will never be called with the end iterator.]]
 
-[endsect]
+[[ec][Set to indicate what error occurred, if any. If the sequence is empty, set to `boost::asio::error::not_found`. Otherwise, contains the error from the last connection attempt.]]
 
+]
 
 
-[section:overload2 buffered_read_stream::close (2 of 2 overloads)]
+[heading Return Value]
+
+On success, an iterator denoting the successfully connected endpoint. Otherwise, the end iterator.
 
 
-Close the stream.
+[heading Example]
+
+The following connect condition function object can be used to output information about the individual connection attempts:
 
+ struct my_connect_condition
+ {
+ template <typename Iterator>
+ Iterator operator()(
+ const boost::system::error_code& ec,
+ Iterator next)
+ {
+ if (ec) std::cout << "Error: " << ec.message() << std::endl;
+ std::cout << "Trying: " << next->endpoint() << std::endl;
+ return next;
+ }
+ };
 
- boost::system::error_code close(
- boost::system::error_code & ec);
 
+It would be used with the `boost::asio::connect` function as follows:
 
+ tcp::resolver r(io_service);
+ tcp::resolver::query q("host", "service");
+ tcp::resolver::iterator i = r.resolve(q), end;
+ tcp::socket s(io_service);
+ boost::system::error_code ec;
+ i = boost::asio::connect(s, i, end, my_connect_condition(), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ else
+ {
+ std::cout << "Connected to: " << i->endpoint() << std::endl;
+ }
 
-[endsect]
 
 
-[endsect]
 
 
-[section:default_buffer_size buffered_read_stream::default_buffer_size]
 
-[indexterm2 default_buffer_size..buffered_read_stream]
-The default buffer size.
 
+[endsect]
 
- static const std::size_t default_buffer_size = implementation_defined;
 
+[endsect]
 
+[section:const_buffer const_buffer]
 
-[endsect]
 
+Holds a buffer that cannot be modified.
 
-[section:fill buffered_read_stream::fill]
 
-[indexterm2 fill..buffered_read_stream]
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
+ class const_buffer
 
 
- std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload1 fill]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload1 more...]]``
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
+ [Construct an empty buffer.
 
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
+ Construct a buffer to represent a given memory range.
 
+ Construct a non-modifiable buffer from a modifiable one. ]
+ ]
+
+]
 
- std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload2 fill]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.fill.overload2 more...]]``
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
+ [Create a new non-modifiable buffer that is offset from the start of another. ]
+ ]
+
+]
 
-[section:overload1 buffered_read_stream::fill (1 of 2 overloads)]
+The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
 
 
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
+[heading Accessing Buffer Contents]
+
 
 
- std::size_t fill();
+The contents of a buffer may be accessed using the [link boost_asio.reference.buffer_size `buffer_size`] and [link boost_asio.reference.buffer_cast `buffer_cast`] functions:
 
 
 
-[endsect]
+ boost::asio::const_buffer b1 = ...;
+ std::size_t s1 = boost::asio::buffer_size(b1);
+ const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1);
 
 
 
-[section:overload2 buffered_read_stream::fill (2 of 2 overloads)]
 
+The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
 
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffer.hpp]
 
- std::size_t fill(
- boost::system::error_code & ec);
+[*Convenience header: ][^boost/asio.hpp]
 
+[section:const_buffer const_buffer::const_buffer]
 
+[indexterm2 const_buffer..const_buffer]
+Construct an empty buffer.
 
-[endsect]
 
+ ``[link boost_asio.reference.const_buffer.const_buffer.overload1 const_buffer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload1 more...]]``
 
-[endsect]
 
+Construct a buffer to represent a given memory range.
 
-[section:get_io_service buffered_read_stream::get_io_service]
 
-[indexterm2 get_io_service..buffered_read_stream]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+ ``[link boost_asio.reference.const_buffer.const_buffer.overload2 const_buffer]``(
+ const void * data,
+ std::size_t size);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload2 more...]]``
 
 
- boost::asio::io_service & get_io_service();
+Construct a non-modifiable buffer from a modifiable one.
 
 
+ ``[link boost_asio.reference.const_buffer.const_buffer.overload3 const_buffer]``(
+ const mutable_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload3 more...]]``
 
-[endsect]
 
+[section:overload1 const_buffer::const_buffer (1 of 3 overloads)]
 
-[section:in_avail buffered_read_stream::in_avail]
 
-[indexterm2 in_avail..buffered_read_stream]
-Determine the amount of data that may be read without blocking.
+Construct an empty buffer.
 
 
- std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload1 in_avail]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload1 more...]]``
+ const_buffer();
 
- std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload2 in_avail]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.in_avail.overload2 more...]]``
 
 
-[section:overload1 buffered_read_stream::in_avail (1 of 2 overloads)]
+[endsect]
 
 
-Determine the amount of data that may be read without blocking.
 
+[section:overload2 const_buffer::const_buffer (2 of 3 overloads)]
 
- std::size_t in_avail();
+
+Construct a buffer to represent a given memory range.
+
+
+ const_buffer(
+ const void * data,
+ std::size_t size);
 
 
 
@@ -32090,14 +49966,14 @@
 
 
 
-[section:overload2 buffered_read_stream::in_avail (2 of 2 overloads)]
+[section:overload3 const_buffer::const_buffer (3 of 3 overloads)]
 
 
-Determine the amount of data that may be read without blocking.
+Construct a non-modifiable buffer from a modifiable one.
 
 
- std::size_t in_avail(
- boost::system::error_code & ec);
+ const_buffer(
+ const mutable_buffer & b);
 
 
 
@@ -32106,216 +49982,259 @@
 
 [endsect]
 
+[section:operator_plus_ const_buffer::operator+]
 
-[section:io_service buffered_read_stream::io_service]
+[indexterm2 operator+..const_buffer]
+Create a new non-modifiable buffer that is offset from the start of another.
 
-[indexterm2 io_service..buffered_read_stream]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
+ const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload1 operator+]``(
+ const const_buffer & b,
+ std::size_t start);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload1 more...]]``
 
- boost::asio::io_service & io_service();
+ const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload2 operator+]``(
+ std::size_t start,
+ const const_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload2 more...]]``
 
 
+[section:overload1 const_buffer::operator+ (1 of 2 overloads)]
 
-[endsect]
 
+Create a new non-modifiable buffer that is offset from the start of another.
 
-[section:lowest_layer buffered_read_stream::lowest_layer]
 
-[indexterm2 lowest_layer..buffered_read_stream]
-Get a reference to the lowest layer.
+ const_buffer operator+(
+ const const_buffer & b,
+ std::size_t start);
 
 
- lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload1 more...]]``
 
+[endsect]
 
-Get a const reference to the lowest layer.
 
 
- const lowest_layer_type & ``[link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.lowest_layer.overload2 more...]]``
+[section:overload2 const_buffer::operator+ (2 of 2 overloads)]
 
 
-[section:overload1 buffered_read_stream::lowest_layer (1 of 2 overloads)]
+Create a new non-modifiable buffer that is offset from the start of another.
 
 
-Get a reference to the lowest layer.
+ const_buffer operator+(
+ std::size_t start,
+ const const_buffer & b);
 
 
- lowest_layer_type & lowest_layer();
 
+[endsect]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload2 buffered_read_stream::lowest_layer (2 of 2 overloads)]
+[section:const_buffers_1 const_buffers_1]
 
 
-Get a const reference to the lowest layer.
+Adapts a single non-modifiable buffer so that it meets the requirements of the ConstBufferSequence concept.
 
 
- const lowest_layer_type & lowest_layer() const;
+ class const_buffers_1 :
+ public const_buffer
 
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.const_buffers_1.const_iterator [*const_iterator]]]
+ [A random-access iterator type that may be used to read elements. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.const_buffers_1.value_type [*value_type]]]
+ [The type for each element in the list of buffers. ]
+
+ ]
 
-[section:lowest_layer_type buffered_read_stream::lowest_layer_type]
+]
 
-[indexterm2 lowest_layer_type..buffered_read_stream]
-The type of the lowest layer.
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.const_buffers_1.begin [*begin]]]
+ [Get a random-access iterator to the first element. ]
+ ]
+
+ [
+ [[link boost_asio.reference.const_buffers_1.const_buffers_1 [*const_buffers_1]]]
+ [Construct to represent a given memory range.
 
- typedef next_layer_type::lowest_layer_type lowest_layer_type;
+ Construct to represent a single non-modifiable buffer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.const_buffers_1.end [*end]]]
+ [Get a random-access iterator for one past the last element. ]
+ ]
+
+]
 
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.const_buffers_1.operator_plus_ [*operator+]]]
+ [Create a new non-modifiable buffer that is offset from the start of another. ]
+ ]
+
+]
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffered_read_stream.hpp]
+[*Header: ][^boost/asio/buffer.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:begin const_buffers_1::begin]
+
+[indexterm2 begin..const_buffers_1]
+Get a random-access iterator to the first element.
 
 
+ const_iterator begin() const;
 
-[section:next_layer buffered_read_stream::next_layer]
 
-[indexterm2 next_layer..buffered_read_stream]
-Get a reference to the next layer.
 
+[endsect]
 
- next_layer_type & next_layer();
 
+[section:const_buffers_1 const_buffers_1::const_buffers_1]
 
+[indexterm2 const_buffers_1..const_buffers_1]
+Construct to represent a given memory range.
 
-[endsect]
 
+ ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 const_buffers_1]``(
+ const void * data,
+ std::size_t size);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 more...]]``
 
 
-[section:next_layer_type buffered_read_stream::next_layer_type]
+Construct to represent a single non-modifiable buffer.
 
-[indexterm2 next_layer_type..buffered_read_stream]
-The type of the next layer.
 
+ explicit ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 const_buffers_1]``(
+ const const_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 more...]]``
 
- typedef boost::remove_reference< Stream >::type next_layer_type;
 
+[section:overload1 const_buffers_1::const_buffers_1 (1 of 2 overloads)]
 
 
-[heading Requirements]
+Construct to represent a given memory range.
 
-[*Header: ][^boost/asio/buffered_read_stream.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ const_buffers_1(
+ const void * data,
+ std::size_t size);
+
 
 
 [endsect]
 
 
-[section:peek buffered_read_stream::peek]
 
-[indexterm2 peek..buffered_read_stream]
-Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
+[section:overload2 const_buffers_1::const_buffers_1 (2 of 2 overloads)]
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload1 peek]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload1 more...]]``
+Construct to represent a single non-modifiable buffer.
 
 
-Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
+ const_buffers_1(
+ const const_buffer & b);
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_read_stream.peek.overload2 peek]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.peek.overload2 more...]]``
 
+[endsect]
 
-[section:overload1 buffered_read_stream::peek (1 of 2 overloads)]
 
+[endsect]
 
-Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
+[section:const_iterator const_buffers_1::const_iterator]
+
+[indexterm2 const_iterator..const_buffers_1]
+A random-access iterator type that may be used to read elements.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
- const MutableBufferSequence & buffers);
 
+ typedef const const_buffer * const_iterator;
 
 
-[endsect]
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffer.hpp]
 
-[section:overload2 buffered_read_stream::peek (2 of 2 overloads)]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
+[endsect]
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
+
+[section:end const_buffers_1::end]
+
+[indexterm2 end..const_buffers_1]
+Get a random-access iterator for one past the last element.
 
 
+ const_iterator end() const;
 
-[endsect]
 
 
 [endsect]
 
-[section:read_some buffered_read_stream::read_some]
 
-[indexterm2 read_some..buffered_read_stream]
-Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+[section:operator_plus_ const_buffers_1::operator+]
 
+[indexterm2 operator+..const_buffers_1]
+Create a new non-modifiable buffer that is offset from the start of another.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload1 read_some]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload1 more...]]``
 
+ const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload1 operator+]``(
+ const const_buffer & b,
+ std::size_t start);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload1 more...]]``
 
-Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
+ const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload2 operator+]``(
+ std::size_t start,
+ const const_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload2 more...]]``
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_read_stream.read_some.overload2 read_some]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.read_some.overload2 more...]]``
+[section:overload1 const_buffers_1::operator+ (1 of 2 overloads)]
 
 
-[section:overload1 buffered_read_stream::read_some (1 of 2 overloads)]
+['Inherited from const_buffer.]
 
 
-Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+Create a new non-modifiable buffer that is offset from the start of another.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers);
+ const_buffer operator+(
+ const const_buffer & b,
+ std::size_t start);
 
 
 
@@ -32323,17 +50242,18 @@
 
 
 
-[section:overload2 buffered_read_stream::read_some (2 of 2 overloads)]
+[section:overload2 const_buffers_1::operator+ (2 of 2 overloads)]
 
 
-Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
+['Inherited from const_buffer.]
+
+
+Create a new non-modifiable buffer that is offset from the start of another.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
+ const_buffer operator+(
+ std::size_t start,
+ const const_buffer & b);
 
 
 
@@ -32342,79 +50262,86 @@
 
 [endsect]
 
-[section:write_some buffered_read_stream::write_some]
 
-[indexterm2 write_some..buffered_read_stream]
-Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+[section:value_type const_buffers_1::value_type]
 
+[indexterm2 value_type..const_buffers_1]
+The type for each element in the list of buffers.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload1 write_some]``(
- const ConstBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload1 more...]]``
 
+ typedef const_buffer value_type;
 
-Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_read_stream.write_some.overload2 write_some]``(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_read_stream.write_some.overload2 more...]]``
+ [
+ [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
+ [Construct an empty buffer.
 
+ Construct a buffer to represent a given memory range.
 
-[section:overload1 buffered_read_stream::write_some (1 of 2 overloads)]
+ Construct a non-modifiable buffer from a modifiable one. ]
+ ]
+
+]
 
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
-Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+ [
+ [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
+ [Create a new non-modifiable buffer that is offset from the start of another. ]
+ ]
+
+]
 
+The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers);
 
+[heading Accessing Buffer Contents]
+
 
 
-[endsect]
+The contents of a buffer may be accessed using the [link boost_asio.reference.buffer_size `buffer_size`] and [link boost_asio.reference.buffer_cast `buffer_cast`] functions:
 
 
 
-[section:overload2 buffered_read_stream::write_some (2 of 2 overloads)]
+ boost::asio::const_buffer b1 = ...;
+ std::size_t s1 = boost::asio::buffer_size(b1);
+ const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1);
 
 
-Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
+The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
 
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/buffer.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+
 [endsect]
 
-[section:buffered_stream buffered_stream]
+[section:datagram_socket_service datagram_socket_service]
 
 
-Adds buffering to the read- and write-related operations of a stream.
+Default service implementation for a datagram socket.
 
 
   template<
- typename Stream>
- class buffered_stream :
- noncopyable
+ typename ``[link boost_asio.reference.Protocol Protocol]``>
+ class datagram_socket_service :
+ public io_service::service
 
 
 [heading Types]
@@ -32423,15 +50350,36 @@
 
   [
 
- [[link boost_asio.reference.buffered_stream.lowest_layer_type [*lowest_layer_type]]]
- [The type of the lowest layer. ]
+ [[link boost_asio.reference.datagram_socket_service.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.buffered_stream.next_layer_type [*next_layer_type]]]
- [The type of the next layer. ]
+ [[link boost_asio.reference.datagram_socket_service.implementation_type [*implementation_type]]]
+ [The type of a datagram socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.datagram_socket_service.native_handle_type [*native_handle_type]]]
+ [The native socket type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.datagram_socket_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native socket type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.datagram_socket_service.protocol_type [*protocol_type]]]
+ [The protocol type. ]
   
   ]
 
@@ -32442,128 +50390,229 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.buffered_stream.async_fill [*async_fill]]]
- [Start an asynchronous fill. ]
+ [[link boost_asio.reference.datagram_socket_service.assign [*assign]]]
+ [Assign an existing native socket to a datagram socket. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.async_flush [*async_flush]]]
- [Start an asynchronous flush. ]
+ [[link boost_asio.reference.datagram_socket_service.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.async_read_some [*async_read_some]]]
- [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
+ [[link boost_asio.reference.datagram_socket_service.async_receive [*async_receive]]]
+ [Start an asynchronous receive. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.async_write_some [*async_write_some]]]
- [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
+ [[link boost_asio.reference.datagram_socket_service.async_receive_from [*async_receive_from]]]
+ [Start an asynchronous receive that will get the endpoint of the sender. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.buffered_stream [*buffered_stream]]]
- [Construct, passing the specified argument to initialise the next layer. ]
+ [[link boost_asio.reference.datagram_socket_service.async_send [*async_send]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.close [*close]]]
- [Close the stream. ]
+ [[link boost_asio.reference.datagram_socket_service.async_send_to [*async_send_to]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.fill [*fill]]]
- [Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
-
- Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred. ]
+ [[link boost_asio.reference.datagram_socket_service.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.flush [*flush]]]
- [Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
-
- Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. ]
+ [[link boost_asio.reference.datagram_socket_service.available [*available]]]
+ [Determine the number of bytes available for reading. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.datagram_socket_service.bind [*bind]]]
+ []
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.in_avail [*in_avail]]]
- [Determine the amount of data that may be read without blocking. ]
+ [[link boost_asio.reference.datagram_socket_service.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.datagram_socket_service.close [*close]]]
+ [Close a datagram socket implementation. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
-
- Get a const reference to the lowest layer. ]
+ [[link boost_asio.reference.datagram_socket_service.connect [*connect]]]
+ [Connect the datagram socket to the specified endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.next_layer [*next_layer]]]
- [Get a reference to the next layer. ]
+ [[link boost_asio.reference.datagram_socket_service.construct [*construct]]]
+ [Construct a new datagram socket implementation. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.peek [*peek]]]
- [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
-
- Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
+ [[link boost_asio.reference.datagram_socket_service.datagram_socket_service [*datagram_socket_service]]]
+ [Construct a new datagram socket service for the specified io_service. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.read_some [*read_some]]]
- [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+ [[link boost_asio.reference.datagram_socket_service.destroy [*destroy]]]
+ [Destroy a datagram socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.get_option [*get_option]]]
+ [Get a socket option. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.move_assign [*move_assign]]]
+ [Move-assign from another datagram socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.move_construct [*move_construct]]]
+ [Move-construct a new datagram socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.native_handle [*native_handle]]]
+ [Get the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
 
- Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
+ Sets the non-blocking mode of the native socket implementation. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_stream.write_some [*write_some]]]
- [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+ [[link boost_asio.reference.datagram_socket_service.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
- Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred. ]
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.open [*open]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.receive [*receive]]]
+ [Receive some data from the peer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.receive_from [*receive_from]]]
+ [Receive a datagram with the endpoint of the sender. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.send [*send]]]
+ [Send the given data to the peer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.send_to [*send_to]]]
+ [Send a datagram to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.set_option [*set_option]]]
+ [Set a socket option. ]
+ ]
+
+ [
+ [[link boost_asio.reference.datagram_socket_service.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
   ]
   
 ]
 
-The [link boost_asio.reference.buffered_stream `buffered_stream`] class template can be used to add buffering to the synchronous and asynchronous read and write operations of a stream.
+[heading Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.datagram_socket_service.id [*id]]]
+ [The unique service identifier. ]
+ ]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+]
 
-[*Shared] [*objects:] Unsafe.
+[heading Requirements]
 
+[*Header: ][^boost/asio/datagram_socket_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Requirements]
+[section:assign datagram_socket_service::assign]
 
-[*Header: ][^boost/asio/buffered_stream.hpp]
+[indexterm2 assign..datagram_socket_service]
+Assign an existing native socket to a datagram socket.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ boost::system::error_code assign(
+ implementation_type & impl,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
 
-[section:async_fill buffered_stream::async_fill]
 
-[indexterm2 async_fill..buffered_stream]
-Start an asynchronous fill.
+
+[endsect]
+
+
+
+[section:async_connect datagram_socket_service::async_connect]
+
+[indexterm2 async_connect..datagram_socket_service]
+Start an asynchronous connect.
 
 
   template<
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_fill(
- ReadHandler handler);
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ implementation_type & impl,
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
 
 
 
@@ -32571,16 +50620,20 @@
 
 
 
-[section:async_flush buffered_stream::async_flush]
+[section:async_receive datagram_socket_service::async_receive]
 
-[indexterm2 async_flush..buffered_stream]
-Start an asynchronous flush.
+[indexterm2 async_receive..datagram_socket_service]
+Start an asynchronous receive.
 
 
   template<
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_flush(
- WriteHandler handler);
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ ReadHandler handler);
 
 
 
@@ -32588,17 +50641,20 @@
 
 
 
-[section:async_read_some buffered_stream::async_read_some]
+[section:async_receive_from datagram_socket_service::async_receive_from]
 
-[indexterm2 async_read_some..buffered_stream]
-Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
+[indexterm2 async_receive_from..datagram_socket_service]
+Start an asynchronous receive that will get the endpoint of the sender.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
       typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_read_some(
+ void async_receive_from(
+ implementation_type & impl,
       const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
       ReadHandler handler);
 
 
@@ -32607,17 +50663,19 @@
 
 
 
-[section:async_write_some buffered_stream::async_write_some]
+[section:async_send datagram_socket_service::async_send]
 
-[indexterm2 async_write_some..buffered_stream]
-Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
+[indexterm2 async_send..datagram_socket_service]
+Start an asynchronous send.
 
 
   template<
       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
+ void async_send(
+ implementation_type & impl,
       const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
       WriteHandler handler);
 
 
@@ -32625,37 +50683,38 @@
 [endsect]
 
 
-[section:buffered_stream buffered_stream::buffered_stream]
 
-[indexterm2 buffered_stream..buffered_stream]
-Construct, passing the specified argument to initialise the next layer.
+[section:async_send_to datagram_socket_service::async_send_to]
 
+[indexterm2 async_send_to..datagram_socket_service]
+Start an asynchronous send.
 
- template<
- typename Arg>
- explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload1 buffered_stream]``(
- Arg & a);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload1 more...]]``
 
   template<
- typename Arg>
- explicit ``[link boost_asio.reference.buffered_stream.buffered_stream.overload2 buffered_stream]``(
- Arg & a,
- std::size_t read_buffer_size,
- std::size_t write_buffer_size);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.buffered_stream.overload2 more...]]``
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send_to(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
+ WriteHandler handler);
 
 
-[section:overload1 buffered_stream::buffered_stream (1 of 2 overloads)]
 
+[endsect]
 
-Construct, passing the specified argument to initialise the next layer.
 
 
- template<
- typename Arg>
- buffered_stream(
- Arg & a);
+[section:at_mark datagram_socket_service::at_mark]
+
+[indexterm2 at_mark..datagram_socket_service]
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool at_mark(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
 
 
@@ -32663,95 +50722,195 @@
 
 
 
-[section:overload2 buffered_stream::buffered_stream (2 of 2 overloads)]
+[section:available datagram_socket_service::available]
+
+[indexterm2 available..datagram_socket_service]
+Determine the number of bytes available for reading.
 
 
-Construct, passing the specified argument to initialise the next layer.
+ std::size_t available(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
 
- template<
- typename Arg>
- buffered_stream(
- Arg & a,
- std::size_t read_buffer_size,
- std::size_t write_buffer_size);
+
+[endsect]
+
+
+
+[section:bind datagram_socket_service::bind]
+
+[indexterm2 bind..datagram_socket_service]
+
+ boost::system::error_code bind(
+ implementation_type & impl,
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
+
+[section:cancel datagram_socket_service::cancel]
+
+[indexterm2 cancel..datagram_socket_service]
+Cancel all asynchronous operations associated with the socket.
+
+
+ boost::system::error_code cancel(
+ implementation_type & impl,
+ boost::system::error_code & ec);
+
+
+
 [endsect]
 
-[section:close buffered_stream::close]
 
-[indexterm2 close..buffered_stream]
-Close the stream.
 
+[section:close datagram_socket_service::close]
 
- void ``[link boost_asio.reference.buffered_stream.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload1 more...]]``
+[indexterm2 close..datagram_socket_service]
+Close a datagram socket implementation.
 
- boost::system::error_code ``[link boost_asio.reference.buffered_stream.close.overload2 close]``(
+
+ boost::system::error_code close(
+ implementation_type & impl,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.close.overload2 more...]]``
 
 
-[section:overload1 buffered_stream::close (1 of 2 overloads)]
+
+[endsect]
+
+
+
+[section:connect datagram_socket_service::connect]
+
+[indexterm2 connect..datagram_socket_service]
+Connect the datagram socket to the specified endpoint.
+
+
+ boost::system::error_code connect(
+ implementation_type & impl,
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:construct datagram_socket_service::construct]
+
+[indexterm2 construct..datagram_socket_service]
+Construct a new datagram socket implementation.
+
+
+ void construct(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:datagram_socket_service datagram_socket_service::datagram_socket_service]
+
+[indexterm2 datagram_socket_service..datagram_socket_service]
+Construct a new datagram socket service for the specified [link boost_asio.reference.io_service `io_service`].
+
+
+ datagram_socket_service(
+ boost::asio::io_service & io_service);
+
+
+
+[endsect]
+
+
+
+[section:destroy datagram_socket_service::destroy]
+
+[indexterm2 destroy..datagram_socket_service]
+Destroy a datagram socket implementation.
+
+
+ void destroy(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:endpoint_type datagram_socket_service::endpoint_type]
+
+[indexterm2 endpoint_type..datagram_socket_service]
+The endpoint type.
+
+
+ typedef Protocol::endpoint endpoint_type;
 
 
-Close the stream.
 
+[heading Requirements]
 
- void close();
+[*Header: ][^boost/asio/datagram_socket_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 buffered_stream::close (2 of 2 overloads)]
-
+[section:get_io_service datagram_socket_service::get_io_service]
 
-Close the stream.
 
+['Inherited from io_service.]
 
- boost::system::error_code close(
- boost::system::error_code & ec);
+[indexterm2 get_io_service..datagram_socket_service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
 
+ boost::asio::io_service & get_io_service();
 
-[endsect]
 
 
 [endsect]
 
-[section:fill buffered_stream::fill]
 
-[indexterm2 fill..buffered_stream]
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
 
+[section:get_option datagram_socket_service::get_option]
 
- std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload1 fill]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload1 more...]]``
+[indexterm2 get_option..datagram_socket_service]
+Get a socket option.
 
 
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ const implementation_type & impl,
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
 
 
- std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload2 fill]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.fill.overload2 more...]]``
+
+[endsect]
 
 
-[section:overload1 buffered_stream::fill (1 of 2 overloads)]
 
+[section:id datagram_socket_service::id]
 
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation. Throws an exception on failure.
+[indexterm2 id..datagram_socket_service]
+The unique service identifier.
 
 
- std::size_t fill();
+ static boost::asio::io_service::id id;
 
 
 
@@ -32759,166 +50918,189 @@
 
 
 
-[section:overload2 buffered_stream::fill (2 of 2 overloads)]
-
+[section:implementation_type datagram_socket_service::implementation_type]
 
-Fill the buffer with some data. Returns the number of bytes placed in the buffer as a result of the operation, or 0 if an error occurred.
+[indexterm2 implementation_type..datagram_socket_service]
+The type of a datagram socket.
 
 
- std::size_t fill(
- boost::system::error_code & ec);
+ typedef implementation_defined implementation_type;
 
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/datagram_socket_service.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:flush buffered_stream::flush]
 
-[indexterm2 flush..buffered_stream]
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
+[endsect]
 
 
- std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload1 flush]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload1 more...]]``
 
+[section:io_control datagram_socket_service::io_control]
 
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
+[indexterm2 io_control..datagram_socket_service]
+Perform an IO control command on the socket.
 
 
- std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload2 flush]``(
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ implementation_type & impl,
+ IoControlCommand & command,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.flush.overload2 more...]]``
 
 
-[section:overload1 buffered_stream::flush (1 of 2 overloads)]
 
+[endsect]
 
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
 
- std::size_t flush();
+[section:is_open datagram_socket_service::is_open]
 
+[indexterm2 is_open..datagram_socket_service]
+Determine whether the socket is open.
 
 
-[endsect]
+ bool is_open(
+ const implementation_type & impl) const;
 
 
 
-[section:overload2 buffered_stream::flush (2 of 2 overloads)]
+[endsect]
 
 
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
 
+[section:local_endpoint datagram_socket_service::local_endpoint]
 
- std::size_t flush(
- boost::system::error_code & ec);
+[indexterm2 local_endpoint..datagram_socket_service]
+Get the local endpoint.
 
 
+ endpoint_type local_endpoint(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
-[endsect]
 
 
 [endsect]
 
 
-[section:get_io_service buffered_stream::get_io_service]
 
-[indexterm2 get_io_service..buffered_stream]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+[section:move_assign datagram_socket_service::move_assign]
 
+[indexterm2 move_assign..datagram_socket_service]
+Move-assign from another datagram socket implementation.
 
- boost::asio::io_service & get_io_service();
+
+ void move_assign(
+ implementation_type & impl,
+ datagram_socket_service & other_service,
+ implementation_type & other_impl);
 
 
 
 [endsect]
 
 
-[section:in_avail buffered_stream::in_avail]
 
-[indexterm2 in_avail..buffered_stream]
-Determine the amount of data that may be read without blocking.
+[section:move_construct datagram_socket_service::move_construct]
 
+[indexterm2 move_construct..datagram_socket_service]
+Move-construct a new datagram socket implementation.
 
- std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload1 in_avail]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload1 more...]]``
 
- std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload2 in_avail]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.in_avail.overload2 more...]]``
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
 
 
-[section:overload1 buffered_stream::in_avail (1 of 2 overloads)]
 
+[endsect]
 
-Determine the amount of data that may be read without blocking.
 
 
- std::size_t in_avail();
+[section:native datagram_socket_service::native]
 
+[indexterm2 native..datagram_socket_service]
+(Deprecated: Use `native_handle()`.) Get the native socket implementation.
 
 
-[endsect]
+ native_type native(
+ implementation_type & impl);
 
 
 
-[section:overload2 buffered_stream::in_avail (2 of 2 overloads)]
+[endsect]
 
 
-Determine the amount of data that may be read without blocking.
 
+[section:native_handle datagram_socket_service::native_handle]
+
+[indexterm2 native_handle..datagram_socket_service]
+Get the native socket implementation.
 
- std::size_t in_avail(
- boost::system::error_code & ec);
+
+ native_handle_type native_handle(
+ implementation_type & impl);
 
 
 
 [endsect]
 
 
-[endsect]
+
+[section:native_handle_type datagram_socket_service::native_handle_type]
+
+[indexterm2 native_handle_type..datagram_socket_service]
+The native socket type.
 
 
-[section:io_service buffered_stream::io_service]
+ typedef implementation_defined native_handle_type;
 
-[indexterm2 io_service..buffered_stream]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
 
- boost::asio::io_service & io_service();
+[heading Requirements]
+
+[*Header: ][^boost/asio/datagram_socket_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:lowest_layer buffered_stream::lowest_layer]
+[section:native_non_blocking datagram_socket_service::native_non_blocking]
 
-[indexterm2 lowest_layer..buffered_stream]
-Get a reference to the lowest layer.
+[indexterm2 native_non_blocking..datagram_socket_service]
+Gets the non-blocking mode of the native socket implementation.
 
 
- lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload1 more...]]``
+ bool ``[link boost_asio.reference.datagram_socket_service.native_non_blocking.overload1 native_non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.datagram_socket_service.native_non_blocking.overload1 more...]]``
 
 
-Get a const reference to the lowest layer.
+Sets the non-blocking mode of the native socket implementation.
 
 
- const lowest_layer_type & ``[link boost_asio.reference.buffered_stream.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.lowest_layer.overload2 more...]]``
+ boost::system::error_code ``[link boost_asio.reference.datagram_socket_service.native_non_blocking.overload2 native_non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.datagram_socket_service.native_non_blocking.overload2 more...]]``
 
 
-[section:overload1 buffered_stream::lowest_layer (1 of 2 overloads)]
+[section:overload1 datagram_socket_service::native_non_blocking (1 of 2 overloads)]
 
 
-Get a reference to the lowest layer.
+Gets the non-blocking mode of the native socket implementation.
 
 
- lowest_layer_type & lowest_layer();
+ bool native_non_blocking(
+ const implementation_type & impl) const;
 
 
 
@@ -32926,13 +51108,16 @@
 
 
 
-[section:overload2 buffered_stream::lowest_layer (2 of 2 overloads)]
+[section:overload2 datagram_socket_service::native_non_blocking (2 of 2 overloads)]
 
 
-Get a const reference to the lowest layer.
+Sets the non-blocking mode of the native socket implementation.
 
 
- const lowest_layer_type & lowest_layer() const;
+ boost::system::error_code native_non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
 
 
@@ -32942,19 +51127,19 @@
 [endsect]
 
 
-[section:lowest_layer_type buffered_stream::lowest_layer_type]
+[section:native_type datagram_socket_service::native_type]
 
-[indexterm2 lowest_layer_type..buffered_stream]
-The type of the lowest layer.
+[indexterm2 native_type..datagram_socket_service]
+(Deprecated: Use native\_handle\_type.) The native socket type.
 
 
- typedef next_layer_type::lowest_layer_type lowest_layer_type;
+ typedef implementation_defined native_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffered_stream.hpp]
+[*Header: ][^boost/asio/datagram_socket_service.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -32962,135 +51147,131 @@
 [endsect]
 
 
+[section:non_blocking datagram_socket_service::non_blocking]
 
-[section:next_layer buffered_stream::next_layer]
+[indexterm2 non_blocking..datagram_socket_service]
+Gets the non-blocking mode of the socket.
 
-[indexterm2 next_layer..buffered_stream]
-Get a reference to the next layer.
 
+ bool ``[link boost_asio.reference.datagram_socket_service.non_blocking.overload1 non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.datagram_socket_service.non_blocking.overload1 more...]]``
 
- next_layer_type & next_layer();
 
+Sets the non-blocking mode of the socket.
 
 
-[endsect]
+ boost::system::error_code ``[link boost_asio.reference.datagram_socket_service.non_blocking.overload2 non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.datagram_socket_service.non_blocking.overload2 more...]]``
 
 
+[section:overload1 datagram_socket_service::non_blocking (1 of 2 overloads)]
 
-[section:next_layer_type buffered_stream::next_layer_type]
 
-[indexterm2 next_layer_type..buffered_stream]
-The type of the next layer.
+Gets the non-blocking mode of the socket.
 
 
- typedef boost::remove_reference< Stream >::type next_layer_type;
+ bool non_blocking(
+ const implementation_type & impl) const;
 
 
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/buffered_stream.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[section:overload2 datagram_socket_service::non_blocking (2 of 2 overloads)]
 
-[endsect]
 
+Sets the non-blocking mode of the socket.
 
-[section:peek buffered_stream::peek]
 
-[indexterm2 peek..buffered_stream]
-Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
+ boost::system::error_code non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload1 peek]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload1 more...]]``
 
+[endsect]
 
-Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_stream.peek.overload2 peek]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.peek.overload2 more...]]``
 
+[section:open datagram_socket_service::open]
 
-[section:overload1 buffered_stream::peek (1 of 2 overloads)]
+[indexterm2 open..datagram_socket_service]
 
+ boost::system::error_code open(
+ implementation_type & impl,
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
 
-Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
- const MutableBufferSequence & buffers);
+[endsect]
 
 
 
-[endsect]
+[section:protocol_type datagram_socket_service::protocol_type]
 
+[indexterm2 protocol_type..datagram_socket_service]
+The protocol type.
 
 
-[section:overload2 buffered_stream::peek (2 of 2 overloads)]
+ typedef Protocol protocol_type;
 
 
-Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
+[heading Requirements]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
+[*Header: ][^boost/asio/datagram_socket_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[endsect]
 
-[section:read_some buffered_stream::read_some]
+[section:receive datagram_socket_service::receive]
 
-[indexterm2 read_some..buffered_stream]
-Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+[indexterm2 receive..datagram_socket_service]
+Receive some data from the peer.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload1 read_some]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload1 more...]]``
-
+ std::size_t receive(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
-Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_stream.read_some.overload2 read_some]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.read_some.overload2 more...]]``
+[endsect]
 
 
-[section:overload1 buffered_stream::read_some (1 of 2 overloads)]
 
+[section:receive_from datagram_socket_service::receive_from]
 
-Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+[indexterm2 receive_from..datagram_socket_service]
+Receive a datagram with the endpoint of the sender.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers);
+ std::size_t receive_from(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
 
 
@@ -33098,59 +51279,75 @@
 
 
 
-[section:overload2 buffered_stream::read_some (2 of 2 overloads)]
-
+[section:remote_endpoint datagram_socket_service::remote_endpoint]
 
-Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
+[indexterm2 remote_endpoint..datagram_socket_service]
+Get the remote endpoint.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
+ endpoint_type remote_endpoint(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
 
 
 [endsect]
 
 
-[endsect]
 
-[section:write_some buffered_stream::write_some]
+[section:send datagram_socket_service::send]
 
-[indexterm2 write_some..buffered_stream]
-Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+[indexterm2 send..datagram_socket_service]
+Send the given data to the peer.
 
 
   template<
       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload1 write_some]``(
- const ConstBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload1 more...]]``
+ std::size_t send(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
 
-Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
+
+[endsect]
+
+
+
+[section:send_to datagram_socket_service::send_to]
+
+[indexterm2 send_to..datagram_socket_service]
+Send a datagram to the specified endpoint.
 
 
   template<
       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload2 write_some]``(
+ std::size_t send_to(
+ implementation_type & impl,
       const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_stream.write_some.overload2 more...]]``
 
 
-[section:overload1 buffered_stream::write_some (1 of 2 overloads)]
+
+[endsect]
 
 
-Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+
+[section:set_option datagram_socket_service::set_option]
+
+[indexterm2 set_option..datagram_socket_service]
+Set a socket option.
 
 
   template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers);
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ implementation_type & impl,
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
 
 
 
@@ -33158,16 +51355,15 @@
 
 
 
-[section:overload2 buffered_stream::write_some (2 of 2 overloads)]
-
+[section:shutdown datagram_socket_service::shutdown]
 
-Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred.
+[indexterm2 shutdown..datagram_socket_service]
+Disable sends or receives on the socket.
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers,
+ boost::system::error_code shutdown(
+ implementation_type & impl,
+ socket_base::shutdown_type what,
       boost::system::error_code & ec);
 
 
@@ -33175,21 +51371,17 @@
 [endsect]
 
 
-[endsect]
-
 
 [endsect]
 
-[section:buffered_write_stream buffered_write_stream]
 
+[section:deadline_timer deadline_timer]
 
-Adds buffering to the write-related operations of a stream.
+[indexterm1 deadline_timer]
+Typedef for the typical usage of timer. Uses a UTC clock.
 
 
- template<
- typename Stream>
- class buffered_write_stream :
- noncopyable
+ typedef basic_deadline_timer< boost::posix_time::ptime > deadline_timer;
 
 
 [heading Types]
@@ -33198,329 +51390,366 @@
 
   [
 
- [[link boost_asio.reference.buffered_write_stream.lowest_layer_type [*lowest_layer_type]]]
- [The type of the lowest layer. ]
+ [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
+ [The duration type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.buffered_write_stream.next_layer_type [*next_layer_type]]]
- [The type of the next layer. ]
+ [[link boost_asio.reference.basic_deadline_timer.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
   ]
 
-]
-
-[heading Member Functions]
-[table
- [[Name][Description]]
-
- [
- [[link boost_asio.reference.buffered_write_stream.async_flush [*async_flush]]]
- [Start an asynchronous flush. ]
- ]
-
   [
- [[link boost_asio.reference.buffered_write_stream.async_read_some [*async_read_some]]]
- [Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation. ]
- ]
+
+ [[link boost_asio.reference.basic_deadline_timer.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
   
- [
- [[link boost_asio.reference.buffered_write_stream.async_write_some [*async_write_some]]]
- [Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffered_write_stream.buffered_write_stream [*buffered_write_stream]]]
- [Construct, passing the specified argument to initialise the next layer. ]
- ]
+
+ [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
+ [The time type. ]
   
- [
- [[link boost_asio.reference.buffered_write_stream.close [*close]]]
- [Close the stream. ]
   ]
-
- [
- [[link boost_asio.reference.buffered_write_stream.flush [*flush]]]
- [Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
 
- Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred. ]
- ]
-
   [
- [[link boost_asio.reference.buffered_write_stream.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
+
+ [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
+ [The time traits type. ]
   
- [
- [[link boost_asio.reference.buffered_write_stream.in_avail [*in_avail]]]
- [Determine the amount of data that may be read without blocking. ]
   ]
-
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.buffered_write_stream.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
+ [Start an asynchronous wait on the timer. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_write_stream.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
+ [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
+ [Constructor.
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.buffered_write_stream.next_layer [*next_layer]]]
- [Get a reference to the next layer. ]
+ Constructor to set a particular expiry time as an absolute time.
+
+ Constructor to set a particular expiry time relative to now. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_write_stream.peek [*peek]]]
- [Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
-
- Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred. ]
+ [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
+ [Cancel any asynchronous operations that are waiting on the timer. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_write_stream.read_some [*read_some]]]
- [Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
-
- Read some data from the stream. Returns the number of bytes read or 0 if an error occurred. ]
+ [[link boost_asio.reference.basic_deadline_timer.cancel_one [*cancel_one]]]
+ [Cancels one asynchronous operation that is waiting on the timer. ]
   ]
   
   [
- [[link boost_asio.reference.buffered_write_stream.write_some [*write_some]]]
- [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+ [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
+ [Get the timer's expiry time as an absolute time.
 
- Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw. ]
+ Set the timer's expiry time as an absolute time. ]
   ]
   
-]
-
-[heading Data Members]
-[table
- [[Name][Description]]
-
   [
- [[link boost_asio.reference.buffered_write_stream.default_buffer_size [*default_buffer_size]]]
- [The default buffer size. ]
- ]
-
-]
-
-The [link boost_asio.reference.buffered_write_stream `buffered_write_stream`] class template can be used to add buffering to the synchronous and asynchronous write operations of a stream.
-
-
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
-
-[*Shared] [*objects:] Unsafe.
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/buffered_write_stream.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[section:async_flush buffered_write_stream::async_flush]
-
-[indexterm2 async_flush..buffered_write_stream]
-Start an asynchronous flush.
-
-
- template<
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_flush(
- WriteHandler handler);
-
-
-
-[endsect]
-
-
-
-[section:async_read_some buffered_write_stream::async_read_some]
-
-[indexterm2 async_read_some..buffered_write_stream]
-Start an asynchronous read. The buffer into which the data will be read must be valid for the lifetime of the asynchronous operation.
-
-
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_read_some(
- const MutableBufferSequence & buffers,
- ReadHandler handler);
+ [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
+ [Get the timer's expiry time relative to now.
 
+ Set the timer's expiry time relative to now. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_deadline_timer.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
+ [Perform a blocking wait on the timer. ]
+ ]
+
+]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.basic_deadline_timer.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_deadline_timer.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
 
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_deadline_timer.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
-[section:async_write_some buffered_write_stream::async_write_some]
+ [
+ [[link boost_asio.reference.basic_deadline_timer.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
-[indexterm2 async_write_some..buffered_write_stream]
-Start an asynchronous write. The data being written must be valid for the lifetime of the asynchronous operation.
+]
 
+The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
+A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
 
+Most applications will use the [link boost_asio.reference.deadline_timer `deadline_timer`] typedef.
 
 
-[endsect]
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
-[section:buffered_write_stream buffered_write_stream::buffered_write_stream]
 
-[indexterm2 buffered_write_stream..buffered_write_stream]
-Construct, passing the specified argument to initialise the next layer.
+[heading Examples]
+
+Performing a blocking wait:
 
+ // Construct a timer without setting an expiry time.
+ boost::asio::deadline_timer timer(io_service);
 
- template<
- typename Arg>
- explicit ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 buffered_write_stream]``(
- Arg & a);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 more...]]``
+ // Set an expiry time relative to now.
+ timer.expires_from_now(boost::posix_time::seconds(5));
 
- template<
- typename Arg>
- ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 buffered_write_stream]``(
- Arg & a,
- std::size_t buffer_size);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 more...]]``
+ // Wait for the timer to expire.
+ timer.wait();
 
 
-[section:overload1 buffered_write_stream::buffered_write_stream (1 of 2 overloads)]
 
 
-Construct, passing the specified argument to initialise the next layer.
 
+Performing an asynchronous wait:
 
- template<
- typename Arg>
- buffered_write_stream(
- Arg & a);
+ void handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Timer expired.
+ }
+ }
 
+ ...
 
+ // Construct a timer with an absolute expiry time.
+ boost::asio::deadline_timer timer(io_service,
+ boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
 
-[endsect]
+ // Start an asynchronous wait.
+ timer.async_wait(handler);
 
 
 
-[section:overload2 buffered_write_stream::buffered_write_stream (2 of 2 overloads)]
 
 
-Construct, passing the specified argument to initialise the next layer.
+[heading Changing an active deadline_timer's expiry time]
+
 
 
- template<
- typename Arg>
- buffered_write_stream(
- Arg & a,
- std::size_t buffer_size);
+Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
 
 
 
-[endsect]
+ void on_some_event()
+ {
+ if (my_timer.expires_from_now(seconds(5)) > 0)
+ {
+ // We managed to cancel the timer. Start new asynchronous wait.
+ my_timer.async_wait(on_timeout);
+ }
+ else
+ {
+ // Too late, timer has already expired!
+ }
+ }
 
+ void on_timeout(const boost::system::error_code& e)
+ {
+ if (e != boost::asio::error::operation_aborted)
+ {
+ // Timer was not cancelled, take necessary action.
+ }
+ }
 
-[endsect]
 
-[section:close buffered_write_stream::close]
 
-[indexterm2 close..buffered_write_stream]
-Close the stream.
 
 
- void ``[link boost_asio.reference.buffered_write_stream.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload1 more...]]``
+* The `boost::asio::basic_deadline_timer::expires_from_now()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
 
- boost::system::error_code ``[link boost_asio.reference.buffered_write_stream.close.overload2 close]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.close.overload2 more...]]``
 
+* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
 
-[section:overload1 buffered_write_stream::close (1 of 2 overloads)]
 
 
-Close the stream.
 
+[heading Requirements]
 
- void close();
+[*Header: ][^boost/asio/deadline_timer.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:deadline_timer_service deadline_timer_service]
 
-[section:overload2 buffered_write_stream::close (2 of 2 overloads)]
-
-
-Close the stream.
-
-
- boost::system::error_code close(
- boost::system::error_code & ec);
 
+Default service implementation for a timer.
 
 
-[endsect]
+ template<
+ typename TimeType,
+ typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits<TimeType>>
+ class deadline_timer_service :
+ public io_service::service
 
 
-[endsect]
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-[section:default_buffer_size buffered_write_stream::default_buffer_size]
+ [[link boost_asio.reference.deadline_timer_service.duration_type [*duration_type]]]
+ [The duration type. ]
+
+ ]
 
-[indexterm2 default_buffer_size..buffered_write_stream]
-The default buffer size.
+ [
 
+ [[link boost_asio.reference.deadline_timer_service.implementation_type [*implementation_type]]]
+ [The implementation type of the deadline timer. ]
+
+ ]
 
- static const std::size_t default_buffer_size = implementation_defined;
+ [
 
+ [[link boost_asio.reference.deadline_timer_service.time_type [*time_type]]]
+ [The time type. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.deadline_timer_service.traits_type [*traits_type]]]
+ [The time traits type. ]
+
+ ]
 
+]
 
-[section:flush buffered_write_stream::flush]
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[indexterm2 flush..buffered_write_stream]
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
+ [
+ [[link boost_asio.reference.deadline_timer_service.async_wait [*async_wait]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.cancel [*cancel]]]
+ [Cancel any asynchronous wait operations associated with the timer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.cancel_one [*cancel_one]]]
+ [Cancels one asynchronous wait operation associated with the timer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.construct [*construct]]]
+ [Construct a new timer implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.deadline_timer_service [*deadline_timer_service]]]
+ [Construct a new timer service for the specified io_service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.destroy [*destroy]]]
+ [Destroy a timer implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.expires_at [*expires_at]]]
+ [Get the expiry time for the timer as an absolute time.
 
+ Set the expiry time for the timer as an absolute time. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.expires_from_now [*expires_from_now]]]
+ [Get the expiry time for the timer relative to now.
 
- std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload1 flush]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload1 more...]]``
+ Set the expiry time for the timer relative to now. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.deadline_timer_service.wait [*wait]]]
+ []
+ ]
+
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
+ [
+ [[link boost_asio.reference.deadline_timer_service.id [*id]]]
+ [The unique service identifier. ]
+ ]
 
+]
 
- std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload2 flush]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.flush.overload2 more...]]``
+[heading Requirements]
 
+[*Header: ][^boost/asio/deadline_timer_service.hpp]
 
-[section:overload1 buffered_write_stream::flush (1 of 2 overloads)]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation. Throws an exception on failure.
+[section:async_wait deadline_timer_service::async_wait]
 
+[indexterm2 async_wait..deadline_timer_service]
 
- std::size_t flush();
+ template<
+ typename ``[link boost_asio.reference.WaitHandler WaitHandler]``>
+ void async_wait(
+ implementation_type & impl,
+ WaitHandler handler);
 
 
 
@@ -33528,13 +51757,14 @@
 
 
 
-[section:overload2 buffered_write_stream::flush (2 of 2 overloads)]
-
+[section:cancel deadline_timer_service::cancel]
 
-Flush all data from the buffer to the next layer. Returns the number of bytes written to the next layer on the last write operation, or 0 if an error occurred.
+[indexterm2 cancel..deadline_timer_service]
+Cancel any asynchronous wait operations associated with the timer.
 
 
- std::size_t flush(
+ std::size_t cancel(
+ implementation_type & impl,
       boost::system::error_code & ec);
 
 
@@ -33542,43 +51772,31 @@
 [endsect]
 
 
-[endsect]
-
 
-[section:get_io_service buffered_write_stream::get_io_service]
+[section:cancel_one deadline_timer_service::cancel_one]
 
-[indexterm2 get_io_service..buffered_write_stream]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+[indexterm2 cancel_one..deadline_timer_service]
+Cancels one asynchronous wait operation associated with the timer.
 
 
- boost::asio::io_service & get_io_service();
+ std::size_t cancel_one(
+ implementation_type & impl,
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
-[section:in_avail buffered_write_stream::in_avail]
-
-[indexterm2 in_avail..buffered_write_stream]
-Determine the amount of data that may be read without blocking.
-
-
- std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload1 in_avail]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload1 more...]]``
-
- std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload2 in_avail]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.in_avail.overload2 more...]]``
-
-
-[section:overload1 buffered_write_stream::in_avail (1 of 2 overloads)]
 
+[section:construct deadline_timer_service::construct]
 
-Determine the amount of data that may be read without blocking.
+[indexterm2 construct..deadline_timer_service]
+Construct a new timer implementation.
 
 
- std::size_t in_avail();
+ void construct(
+ implementation_type & impl);
 
 
 
@@ -33586,309 +51804,265 @@
 
 
 
-[section:overload2 buffered_write_stream::in_avail (2 of 2 overloads)]
-
+[section:deadline_timer_service deadline_timer_service::deadline_timer_service]
 
-Determine the amount of data that may be read without blocking.
+[indexterm2 deadline_timer_service..deadline_timer_service]
+Construct a new timer service for the specified [link boost_asio.reference.io_service `io_service`].
 
 
- std::size_t in_avail(
- boost::system::error_code & ec);
+ deadline_timer_service(
+ boost::asio::io_service & io_service);
 
 
 
 [endsect]
 
 
-[endsect]
-
 
-[section:io_service buffered_write_stream::io_service]
+[section:destroy deadline_timer_service::destroy]
 
-[indexterm2 io_service..buffered_write_stream]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+[indexterm2 destroy..deadline_timer_service]
+Destroy a timer implementation.
 
 
- boost::asio::io_service & io_service();
+ void destroy(
+ implementation_type & impl);
 
 
 
 [endsect]
 
 
-[section:lowest_layer buffered_write_stream::lowest_layer]
-
-[indexterm2 lowest_layer..buffered_write_stream]
-Get a reference to the lowest layer.
 
+[section:duration_type deadline_timer_service::duration_type]
 
- lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload1 more...]]``
+[indexterm2 duration_type..deadline_timer_service]
+The duration type.
 
 
-Get a const reference to the lowest layer.
+ typedef traits_type::duration_type duration_type;
 
 
- const lowest_layer_type & ``[link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.lowest_layer.overload2 more...]]``
 
+[heading Requirements]
 
-[section:overload1 buffered_write_stream::lowest_layer (1 of 2 overloads)]
+[*Header: ][^boost/asio/deadline_timer_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Get a reference to the lowest layer.
 
+[endsect]
 
- lowest_layer_type & lowest_layer();
 
+[section:expires_at deadline_timer_service::expires_at]
 
+[indexterm2 expires_at..deadline_timer_service]
+Get the expiry time for the timer as an absolute time.
 
-[endsect]
 
+ time_type ``[link boost_asio.reference.deadline_timer_service.expires_at.overload1 expires_at]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_at.overload1 more...]]``
 
 
-[section:overload2 buffered_write_stream::lowest_layer (2 of 2 overloads)]
+Set the expiry time for the timer as an absolute time.
 
 
-Get a const reference to the lowest layer.
+ std::size_t ``[link boost_asio.reference.deadline_timer_service.expires_at.overload2 expires_at]``(
+ implementation_type & impl,
+ const time_type & expiry_time,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_at.overload2 more...]]``
 
 
- const lowest_layer_type & lowest_layer() const;
+[section:overload1 deadline_timer_service::expires_at (1 of 2 overloads)]
 
 
+Get the expiry time for the timer as an absolute time.
 
-[endsect]
 
+ time_type expires_at(
+ const implementation_type & impl) const;
 
-[endsect]
 
 
-[section:lowest_layer_type buffered_write_stream::lowest_layer_type]
+[endsect]
 
-[indexterm2 lowest_layer_type..buffered_write_stream]
-The type of the lowest layer.
 
 
- typedef next_layer_type::lowest_layer_type lowest_layer_type;
+[section:overload2 deadline_timer_service::expires_at (2 of 2 overloads)]
 
 
+Set the expiry time for the timer as an absolute time.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/buffered_write_stream.hpp]
+ std::size_t expires_at(
+ implementation_type & impl,
+ const time_type & expiry_time,
+ boost::system::error_code & ec);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:next_layer buffered_write_stream::next_layer]
-
-[indexterm2 next_layer..buffered_write_stream]
-Get a reference to the next layer.
-
-
- next_layer_type & next_layer();
+[section:expires_from_now deadline_timer_service::expires_from_now]
 
+[indexterm2 expires_from_now..deadline_timer_service]
+Get the expiry time for the timer relative to now.
 
 
-[endsect]
+ duration_type ``[link boost_asio.reference.deadline_timer_service.expires_from_now.overload1 expires_from_now]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_from_now.overload1 more...]]``
 
 
+Set the expiry time for the timer relative to now.
 
-[section:next_layer_type buffered_write_stream::next_layer_type]
 
-[indexterm2 next_layer_type..buffered_write_stream]
-The type of the next layer.
+ std::size_t ``[link boost_asio.reference.deadline_timer_service.expires_from_now.overload2 expires_from_now]``(
+ implementation_type & impl,
+ const duration_type & expiry_time,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_from_now.overload2 more...]]``
 
 
- typedef boost::remove_reference< Stream >::type next_layer_type;
+[section:overload1 deadline_timer_service::expires_from_now (1 of 2 overloads)]
 
 
+Get the expiry time for the timer relative to now.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/buffered_write_stream.hpp]
+ duration_type expires_from_now(
+ const implementation_type & impl) const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:peek buffered_write_stream::peek]
-
-[indexterm2 peek..buffered_write_stream]
-Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
 
-
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload1 peek]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload1 more...]]``
+[section:overload2 deadline_timer_service::expires_from_now (2 of 2 overloads)]
 
 
-Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
+Set the expiry time for the timer relative to now.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_write_stream.peek.overload2 peek]``(
- const MutableBufferSequence & buffers,
+ std::size_t expires_from_now(
+ implementation_type & impl,
+ const duration_type & expiry_time,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.peek.overload2 more...]]``
-
-
-[section:overload1 buffered_write_stream::peek (1 of 2 overloads)]
-
-
-Peek at the incoming data on the stream. Returns the number of bytes read. Throws an exception on failure.
-
-
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
- const MutableBufferSequence & buffers);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload2 buffered_write_stream::peek (2 of 2 overloads)]
 
+[section:get_io_service deadline_timer_service::get_io_service]
 
-Peek at the incoming data on the stream. Returns the number of bytes read, or 0 if an error occurred.
 
+['Inherited from io_service.]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
+[indexterm2 get_io_service..deadline_timer_service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
 
+ boost::asio::io_service & get_io_service();
 
-[endsect]
 
 
 [endsect]
 
-[section:read_some buffered_write_stream::read_some]
 
-[indexterm2 read_some..buffered_write_stream]
-Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
 
+[section:id deadline_timer_service::id]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload1 read_some]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload1 more...]]``
+[indexterm2 id..deadline_timer_service]
+The unique service identifier.
 
 
-Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
+ static boost::asio::io_service::id id;
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_write_stream.read_some.overload2 read_some]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.read_some.overload2 more...]]``
 
+[endsect]
 
-[section:overload1 buffered_write_stream::read_some (1 of 2 overloads)]
 
 
-Read some data from the stream. Returns the number of bytes read. Throws an exception on failure.
+[section:implementation_type deadline_timer_service::implementation_type]
 
+[indexterm2 implementation_type..deadline_timer_service]
+The implementation type of the deadline timer.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers);
 
+ typedef implementation_defined implementation_type;
 
 
-[endsect]
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/deadline_timer_service.hpp]
 
-[section:overload2 buffered_write_stream::read_some (2 of 2 overloads)]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Read some data from the stream. Returns the number of bytes read or 0 if an error occurred.
+[endsect]
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
 
+[section:time_type deadline_timer_service::time_type]
 
+[indexterm2 time_type..deadline_timer_service]
+The time type.
 
-[endsect]
 
+ typedef traits_type::time_type time_type;
 
-[endsect]
 
-[section:write_some buffered_write_stream::write_some]
 
-[indexterm2 write_some..buffered_write_stream]
-Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+[heading Requirements]
 
+[*Header: ][^boost/asio/deadline_timer_service.hpp]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload1 write_some]``(
- const ConstBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload1 more...]]``
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw.
+[endsect]
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.buffered_write_stream.write_some.overload2 write_some]``(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.buffered_write_stream.write_some.overload2 more...]]``
 
+[section:traits_type deadline_timer_service::traits_type]
 
-[section:overload1 buffered_write_stream::write_some (1 of 2 overloads)]
+[indexterm2 traits_type..deadline_timer_service]
+The time traits type.
 
 
-Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure.
+ typedef TimeTraits traits_type;
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers);
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/deadline_timer_service.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
-[section:overload2 buffered_write_stream::write_some (2 of 2 overloads)]
 
 
-Write the given data to the stream. Returns the number of bytes written, or 0 if an error occurred and the error handler did not throw.
+[section:wait deadline_timer_service::wait]
 
+[indexterm2 wait..deadline_timer_service]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers,
+ void wait(
+ implementation_type & impl,
       boost::system::error_code & ec);
 
 
@@ -33896,27 +52070,20 @@
 [endsect]
 
 
-[endsect]
-
 
 [endsect]
 
 
-[section:buffers_begin buffers_begin]
-
-[indexterm1 buffers_begin]
-Construct an iterator representing the beginning of the buffers' data.
+[section:error__addrinfo_category error::addrinfo_category]
 
+[indexterm1 error::addrinfo_category]
 
- template<
- typename BufferSequence>
- buffers_iterator< BufferSequence > buffers_begin(
- const BufferSequence & buffers);
+ static const boost::system::error_category & addrinfo_category = boost::asio::error::get_addrinfo_category();
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -33925,21 +52092,34 @@
 
 
 
-[section:buffers_end buffers_end]
+[section:error__addrinfo_errors error::addrinfo_errors]
 
-[indexterm1 buffers_end]
-Construct an iterator representing the end of the buffers' data.
+[indexterm1 error::addrinfo_errors]
+
+ enum addrinfo_errors
 
+[indexterm2 service_not_found..error::addrinfo_errors]
+[indexterm2 socket_type_not_supported..error::addrinfo_errors]
 
- template<
- typename BufferSequence>
- buffers_iterator< BufferSequence > buffers_end(
- const BufferSequence & buffers);
+[heading Values]
+[variablelist
+
+ [
+ [service_not_found]
+ [The service is not supported for the given socket type. ]
+ ]
+
+ [
+ [socket_type_not_supported]
+ [The socket type is not supported. ]
+ ]
+
+]
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -33947,203 +52127,239 @@
 [endsect]
 
 
-[section:buffers_iterator buffers_iterator]
-
 
-A random access iterator over the bytes in a buffer sequence.
+[section:error__basic_errors error::basic_errors]
 
+[indexterm1 error::basic_errors]
 
- template<
- typename BufferSequence,
- typename ByteType = char>
- class buffers_iterator
+ enum basic_errors
 
+[indexterm2 access_denied..error::basic_errors]
+[indexterm2 address_family_not_supported..error::basic_errors]
+[indexterm2 address_in_use..error::basic_errors]
+[indexterm2 already_connected..error::basic_errors]
+[indexterm2 already_started..error::basic_errors]
+[indexterm2 broken_pipe..error::basic_errors]
+[indexterm2 connection_aborted..error::basic_errors]
+[indexterm2 connection_refused..error::basic_errors]
+[indexterm2 connection_reset..error::basic_errors]
+[indexterm2 bad_descriptor..error::basic_errors]
+[indexterm2 fault..error::basic_errors]
+[indexterm2 host_unreachable..error::basic_errors]
+[indexterm2 in_progress..error::basic_errors]
+[indexterm2 interrupted..error::basic_errors]
+[indexterm2 invalid_argument..error::basic_errors]
+[indexterm2 message_size..error::basic_errors]
+[indexterm2 name_too_long..error::basic_errors]
+[indexterm2 network_down..error::basic_errors]
+[indexterm2 network_reset..error::basic_errors]
+[indexterm2 network_unreachable..error::basic_errors]
+[indexterm2 no_descriptors..error::basic_errors]
+[indexterm2 no_buffer_space..error::basic_errors]
+[indexterm2 no_memory..error::basic_errors]
+[indexterm2 no_permission..error::basic_errors]
+[indexterm2 no_protocol_option..error::basic_errors]
+[indexterm2 not_connected..error::basic_errors]
+[indexterm2 not_socket..error::basic_errors]
+[indexterm2 operation_aborted..error::basic_errors]
+[indexterm2 operation_not_supported..error::basic_errors]
+[indexterm2 shut_down..error::basic_errors]
+[indexterm2 timed_out..error::basic_errors]
+[indexterm2 try_again..error::basic_errors]
+[indexterm2 would_block..error::basic_errors]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[heading Values]
+[variablelist
 
   [
- [[link boost_asio.reference.buffers_iterator.begin [*begin]]]
- [Construct an iterator representing the beginning of the buffers' data. ]
+ [access_denied]
+ [Permission denied. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.buffers_iterator [*buffers_iterator]]]
- [Default constructor. Creates an iterator in an undefined state. ]
+ [address_family_not_supported]
+ [Address family not supported by protocol. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.end [*end]]]
- [Construct an iterator representing the end of the buffers' data. ]
+ [address_in_use]
+ [Address already in use. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator__star_ [*operator *]]]
- [Dereference an iterator. ]
+ [already_connected]
+ [Transport endpoint is already connected. ]
   ]
-
- [
- [[link boost_asio.reference.buffers_iterator.operator_plus__plus_ [*operator++]]]
- [Increment operator (prefix).
 
- Increment operator (postfix). ]
- ]
-
   [
- [[link boost_asio.reference.buffers_iterator.operator_plus__eq_ [*operator+=]]]
- [Addition operator. ]
+ [already_started]
+ [Operation already in progress. ]
   ]
-
- [
- [[link boost_asio.reference.buffers_iterator.operator_minus__minus_ [*operator--]]]
- [Decrement operator (prefix).
 
- Decrement operator (postfix). ]
- ]
-
   [
- [[link boost_asio.reference.buffers_iterator.operator_minus__eq_ [*operator-=]]]
- [Subtraction operator. ]
+ [broken_pipe]
+ [Broken pipe. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_arrow_ [*operator->]]]
- [Dereference an iterator. ]
+ [connection_aborted]
+ [A connection has been aborted. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_lb__rb_ [*operator\[\]]]]
- [Access an individual element. ]
+ [connection_refused]
+ [Connection refused. ]
   ]
-
-]
-
-[heading Friends]
-[table
- [[Name][Description]]
 
   [
- [[link boost_asio.reference.buffers_iterator.operator_not__eq_ [*operator!=]]]
- [Test two iterators for inequality. ]
+ [connection_reset]
+ [Connection reset by peer. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_plus_ [*operator+]]]
- [Addition operator. ]
+ [bad_descriptor]
+ [Bad file descriptor. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_minus_ [*operator-]]]
- [Subtraction operator. ]
+ [fault]
+ [Bad address. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_lt_ [*operator<]]]
- [Compare two iterators. ]
+ [host_unreachable]
+ [No route to host. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_lt__eq_ [*operator<=]]]
- [Compare two iterators. ]
+ [in_progress]
+ [Operation now in progress. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_eq__eq_ [*operator==]]]
- [Test two iterators for equality. ]
+ [interrupted]
+ [Interrupted system call. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_gt_ [*operator>]]]
- [Compare two iterators. ]
+ [invalid_argument]
+ [Invalid argument. ]
   ]
-
+
   [
- [[link boost_asio.reference.buffers_iterator.operator_gt__eq_ [*operator>=]]]
- [Compare two iterators. ]
+ [message_size]
+ [Message too long. ]
   ]
-
-]
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/buffers_iterator.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[section:begin buffers_iterator::begin]
-
-[indexterm2 begin..buffers_iterator]
-Construct an iterator representing the beginning of the buffers' data.
-
-
- static buffers_iterator begin(
- const BufferSequence & buffers);
-
-
-
-[endsect]
-
-
-
-[section:buffers_iterator buffers_iterator::buffers_iterator]
 
-[indexterm2 buffers_iterator..buffers_iterator]
-Default constructor. Creates an iterator in an undefined state.
+ [
+ [name_too_long]
+ [The name was too long. ]
+ ]
 
+ [
+ [network_down]
+ [Network is down. ]
+ ]
 
- buffers_iterator();
+ [
+ [network_reset]
+ [Network dropped connection on reset. ]
+ ]
 
+ [
+ [network_unreachable]
+ [Network is unreachable. ]
+ ]
 
+ [
+ [no_descriptors]
+ [Too many open files. ]
+ ]
 
-[endsect]
+ [
+ [no_buffer_space]
+ [No buffer space available. ]
+ ]
 
+ [
+ [no_memory]
+ [Cannot allocate memory. ]
+ ]
 
+ [
+ [no_permission]
+ [Operation not permitted. ]
+ ]
 
-[section:end buffers_iterator::end]
+ [
+ [no_protocol_option]
+ [Protocol not available. ]
+ ]
 
-[indexterm2 end..buffers_iterator]
-Construct an iterator representing the end of the buffers' data.
+ [
+ [not_connected]
+ [Transport endpoint is not connected. ]
+ ]
 
+ [
+ [not_socket]
+ [Socket operation on non-socket. ]
+ ]
 
- static buffers_iterator end(
- const BufferSequence & buffers);
+ [
+ [operation_aborted]
+ [Operation cancelled. ]
+ ]
 
+ [
+ [operation_not_supported]
+ [Operation not supported. ]
+ ]
 
+ [
+ [shut_down]
+ [Cannot send after transport endpoint shutdown. ]
+ ]
 
-[endsect]
+ [
+ [timed_out]
+ [Connection timed out. ]
+ ]
 
+ [
+ [try_again]
+ [Resource temporarily unavailable. ]
+ ]
 
+ [
+ [would_block]
+ [The socket is marked non-blocking and the requested operation would block. ]
+ ]
 
-[section:operator__star_ buffers_iterator::operator *]
+]
 
-[indexterm2 operator *..buffers_iterator]
-Dereference an iterator.
 
+[heading Requirements]
 
- byte_type & operator *() const;
+[*Header: ][^boost/asio/error.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_not__eq_ buffers_iterator::operator!=]
-
-[indexterm2 operator!=..buffers_iterator]
-Test two iterators for inequality.
+[section:error__get_addrinfo_category error::get_addrinfo_category]
 
+[indexterm1 error::get_addrinfo_category]
 
- friend bool operator!=(
- const buffers_iterator & a,
- const buffers_iterator & b);
+ const boost::system::error_category & get_addrinfo_category();
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -34151,37 +52367,17 @@
 [endsect]
 
 
-[section:operator_plus_ buffers_iterator::operator+]
-
-[indexterm2 operator+..buffers_iterator]
-Addition operator.
-
-
- friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload1 operator+]``(
- const buffers_iterator & iter,
- std::ptrdiff_t difference);
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload1 more...]]``
-
- friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus_.overload2 operator+]``(
- std::ptrdiff_t difference,
- const buffers_iterator & iter);
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus_.overload2 more...]]``
-
-
-[section:overload1 buffers_iterator::operator+ (1 of 2 overloads)]
-
 
-Addition operator.
+[section:error__get_misc_category error::get_misc_category]
 
+[indexterm1 error::get_misc_category]
 
- friend buffers_iterator operator+(
- const buffers_iterator & iter,
- std::ptrdiff_t difference);
+ const boost::system::error_category & get_misc_category();
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -34190,20 +52386,16 @@
 
 
 
-[section:overload2 buffers_iterator::operator+ (2 of 2 overloads)]
-
-
-Addition operator.
+[section:error__get_netdb_category error::get_netdb_category]
 
+[indexterm1 error::get_netdb_category]
 
- friend buffers_iterator operator+(
- std::ptrdiff_t difference,
- const buffers_iterator & iter);
+ const boost::system::error_category & get_netdb_category();
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -34211,158 +52403,118 @@
 [endsect]
 
 
-[endsect]
-
-[section:operator_plus__plus_ buffers_iterator::operator++]
-
-[indexterm2 operator++..buffers_iterator]
-Increment operator (prefix).
-
-
- buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 operator++]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload1 more...]]``
-
-
-Increment operator (postfix).
-
-
- buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 operator++]``(
- int );
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_plus__plus_.overload2 more...]]``
 
+[section:error__get_ssl_category error::get_ssl_category]
 
-[section:overload1 buffers_iterator::operator++ (1 of 2 overloads)]
+[indexterm1 error::get_ssl_category]
 
+ const boost::system::error_category & get_ssl_category();
 
-Increment operator (prefix).
 
+[heading Requirements]
 
- buffers_iterator & operator++();
+[*Header: ][^boost/asio/ssl/error.hpp]
 
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 buffers_iterator::operator++ (2 of 2 overloads)]
-
-
-Increment operator (postfix).
-
-
- buffers_iterator operator++(
- int );
-
-
-
-[endsect]
-
-
-[endsect]
+[section:error__get_system_category error::get_system_category]
 
+[indexterm1 error::get_system_category]
 
-[section:operator_plus__eq_ buffers_iterator::operator+=]
+ const boost::system::error_category & get_system_category();
 
-[indexterm2 operator+=..buffers_iterator]
-Addition operator.
 
+[heading Requirements]
 
- buffers_iterator & operator+=(
- std::ptrdiff_t difference);
+[*Header: ][^boost/asio/error.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:operator_minus_ buffers_iterator::operator-]
-
-[indexterm2 operator-..buffers_iterator]
-Subtraction operator.
-
-
- friend buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload1 operator-]``(
- const buffers_iterator & iter,
- std::ptrdiff_t difference);
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload1 more...]]``
-
- friend std::ptrdiff_t ``[link boost_asio.reference.buffers_iterator.operator_minus_.overload2 operator-]``(
- const buffers_iterator & a,
- const buffers_iterator & b);
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus_.overload2 more...]]``
-
-
-[section:overload1 buffers_iterator::operator- (1 of 2 overloads)]
+[section:error__make_error_code error::make_error_code]
 
+[indexterm1 error::make_error_code]
+
+ boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload1 make_error_code]``(
+ basic_errors e);
+ `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload1 more...]]``
 
-Subtraction operator.
+ boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload2 make_error_code]``(
+ netdb_errors e);
+ `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload2 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload3 make_error_code]``(
+ addrinfo_errors e);
+ `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload3 more...]]``
 
- friend buffers_iterator operator-(
- const buffers_iterator & iter,
- std::ptrdiff_t difference);
+ boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload4 make_error_code]``(
+ misc_errors e);
+ `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload4 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload5 make_error_code]``(
+ ssl_errors e);
+ `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload5 more...]]``
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:overload1 error::make_error_code (1 of 5 overloads)]
 
 
 
-[section:overload2 buffers_iterator::operator- (2 of 2 overloads)]
+ boost::system::error_code make_error_code(
+ basic_errors e);
 
 
-Subtraction operator.
 
+[endsect]
 
- friend std::ptrdiff_t operator-(
- const buffers_iterator & a,
- const buffers_iterator & b);
 
 
-[heading Requirements]
+[section:overload2 error::make_error_code (2 of 5 overloads)]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ boost::system::error_code make_error_code(
+ netdb_errors e);
 
-[endsect]
 
 
 [endsect]
 
-[section:operator_minus__minus_ buffers_iterator::operator--]
 
-[indexterm2 operator--..buffers_iterator]
-Decrement operator (prefix).
 
+[section:overload3 error::make_error_code (3 of 5 overloads)]
 
- buffers_iterator & ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 operator--]``();
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload1 more...]]``
 
 
-Decrement operator (postfix).
+ boost::system::error_code make_error_code(
+ addrinfo_errors e);
 
 
- buffers_iterator ``[link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 operator--]``(
- int );
- `` [''''&raquo;''' [link boost_asio.reference.buffers_iterator.operator_minus__minus_.overload2 more...]]``
 
+[endsect]
 
-[section:overload1 buffers_iterator::operator-- (1 of 2 overloads)]
 
 
-Decrement operator (prefix).
+[section:overload4 error::make_error_code (4 of 5 overloads)]
 
 
- buffers_iterator & operator--();
+
+ boost::system::error_code make_error_code(
+ misc_errors e);
 
 
 
@@ -34370,14 +52522,12 @@
 
 
 
-[section:overload2 buffers_iterator::operator-- (2 of 2 overloads)]
-
+[section:overload5 error::make_error_code (5 of 5 overloads)]
 
-Decrement operator (postfix).
 
 
- buffers_iterator operator--(
- int );
+ boost::system::error_code make_error_code(
+ ssl_errors e);
 
 
 
@@ -34387,49 +52537,64 @@
 [endsect]
 
 
-[section:operator_minus__eq_ buffers_iterator::operator-=]
-
-[indexterm2 operator-=..buffers_iterator]
-Subtraction operator.
+[section:error__misc_category error::misc_category]
 
+[indexterm1 error::misc_category]
 
- buffers_iterator & operator-=(
- std::ptrdiff_t difference);
+ static const boost::system::error_category & misc_category = boost::asio::error::get_misc_category();
 
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/error.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[section:operator_arrow_ buffers_iterator::operator->]
+[endsect]
 
-[indexterm2 operator->..buffers_iterator]
-Dereference an iterator.
 
 
- byte_type * operator->() const;
+[section:error__misc_errors error::misc_errors]
 
+[indexterm1 error::misc_errors]
 
+ enum misc_errors
 
-[endsect]
+[indexterm2 already_open..error::misc_errors]
+[indexterm2 eof..error::misc_errors]
+[indexterm2 not_found..error::misc_errors]
+[indexterm2 fd_set_failure..error::misc_errors]
 
+[heading Values]
+[variablelist
 
+ [
+ [already_open]
+ [Already open. ]
+ ]
 
-[section:operator_lt_ buffers_iterator::operator<]
+ [
+ [eof]
+ [End of file or stream. ]
+ ]
 
-[indexterm2 operator<..buffers_iterator]
-Compare two iterators.
+ [
+ [not_found]
+ [Element not found. ]
+ ]
 
+ [
+ [fd_set_failure]
+ [The descriptor cannot fit into the select system call's fd_set. ]
+ ]
 
- friend bool operator<(
- const buffers_iterator & a,
- const buffers_iterator & b);
+]
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -34438,20 +52603,16 @@
 
 
 
-[section:operator_lt__eq_ buffers_iterator::operator<=]
-
-[indexterm2 operator<=..buffers_iterator]
-Compare two iterators.
+[section:error__netdb_category error::netdb_category]
 
+[indexterm1 error::netdb_category]
 
- friend bool operator<=(
- const buffers_iterator & a,
- const buffers_iterator & b);
+ static const boost::system::error_category & netdb_category = boost::asio::error::get_netdb_category();
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -34460,20 +52621,46 @@
 
 
 
-[section:operator_eq__eq_ buffers_iterator::operator==]
+[section:error__netdb_errors error::netdb_errors]
 
-[indexterm2 operator==..buffers_iterator]
-Test two iterators for equality.
+[indexterm1 error::netdb_errors]
 
+ enum netdb_errors
 
- friend bool operator==(
- const buffers_iterator & a,
- const buffers_iterator & b);
+[indexterm2 host_not_found..error::netdb_errors]
+[indexterm2 host_not_found_try_again..error::netdb_errors]
+[indexterm2 no_data..error::netdb_errors]
+[indexterm2 no_recovery..error::netdb_errors]
+
+[heading Values]
+[variablelist
+
+ [
+ [host_not_found]
+ [Host not found (authoritative). ]
+ ]
+
+ [
+ [host_not_found_try_again]
+ [Host not found (non-authoritative). ]
+ ]
+
+ [
+ [no_data]
+ [The query is valid but does not have associated address data. ]
+ ]
+
+ [
+ [no_recovery]
+ [A non-recoverable error occurred. ]
+ ]
+
+]
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/error.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -34482,545 +52669,632 @@
 
 
 
-[section:operator_gt_ buffers_iterator::operator>]
-
-[indexterm2 operator>..buffers_iterator]
-Compare two iterators.
+[section:error__ssl_category error::ssl_category]
 
+[indexterm1 error::ssl_category]
 
- friend bool operator>(
- const buffers_iterator & a,
- const buffers_iterator & b);
+ static const boost::system::error_category & ssl_category = boost::asio::error::get_ssl_category();
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/ssl/error.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_gt__eq_ buffers_iterator::operator>=]
-
-[indexterm2 operator>=..buffers_iterator]
-Compare two iterators.
+[section:error__ssl_errors error::ssl_errors]
 
+[indexterm1 error::ssl_errors]
 
- friend bool operator>=(
- const buffers_iterator & a,
- const buffers_iterator & b);
+ enum ssl_errors
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffers_iterator.hpp]
+[*Header: ][^boost/asio/ssl/error.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_lb__rb_ buffers_iterator::operator\[\]]
-
-[indexterm2 operator\[\]..buffers_iterator]
-Access an individual element.
+[section:error__system_category error::system_category]
 
+[indexterm1 error::system_category]
 
- byte_type & operator[](
- std::ptrdiff_t difference) const;
+ static const boost::system::error_category & system_category = boost::asio::error::get_system_category();
 
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/error.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
-[section:const_buffer const_buffer]
 
 
-Holds a buffer that cannot be modified.
+[section:has_service has_service]
 
+[indexterm1 has_service]
 
- class const_buffer
+ template<
+ typename ``[link boost_asio.reference.Service Service]``>
+ bool has_service(
+ io_service & ios);
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+This function is used to determine whether the [link boost_asio.reference.io_service `io_service`] contains a service object corresponding to the given service type.
 
- [
- [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
- [Construct an empty buffer.
 
- Construct a buffer to represent a given memory range.
+[heading Parameters]
+
 
- Construct a non-modifiable buffer from a modifiable one. ]
- ]
+[variablelist
   
-]
-
-[heading Related Functions]
-[table
- [[Name][Description]]
+[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
- [
- [[link boost_asio.reference.const_buffer.buffer_cast [*buffer_cast]]]
- [Cast a non-modifiable buffer to a specified pointer to POD type. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffer.buffer_size [*buffer_size]]]
- [Get the number of bytes in a non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
- [Create a new non-modifiable buffer that is offset from the start of another. ]
- ]
-
 ]
 
-The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/buffer.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
 
+[heading Return Value]
+
+A boolean indicating whether the [link boost_asio.reference.io_service `io_service`] contains the service.
 
-[section:buffer_cast const_buffer::buffer_cast]
 
-[indexterm2 buffer_cast..const_buffer]
-Cast a non-modifiable buffer to a specified pointer to POD type.
 
+[heading Requirements]
 
- template<
- typename PointerToPodType>
- PointerToPodType buffer_cast(
- const const_buffer & b);
+[*Header: ][^boost/asio/io_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:invalid_service_owner invalid_service_owner]
 
-[section:buffer_size const_buffer::buffer_size]
 
-[indexterm2 buffer_size..const_buffer]
-Get the number of bytes in a non-modifiable buffer.
+Exception thrown when trying to add a service object to an [link boost_asio.reference.io_service `io_service`] where the service has a different owner.
 
 
- std::size_t buffer_size(
- const const_buffer & b);
+ class invalid_service_owner
 
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.invalid_service_owner.invalid_service_owner [*invalid_service_owner]]]
+ []
+ ]
+
+]
 
+[heading Requirements]
 
-[section:const_buffer const_buffer::const_buffer]
+[*Header: ][^boost/asio/io_service.hpp]
 
-[indexterm2 const_buffer..const_buffer]
-Construct an empty buffer.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- ``[link boost_asio.reference.const_buffer.const_buffer.overload1 const_buffer]``();
- `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload1 more...]]``
+[section:invalid_service_owner invalid_service_owner::invalid_service_owner]
 
+[indexterm2 invalid_service_owner..invalid_service_owner]
 
-Construct a buffer to represent a given memory range.
+ invalid_service_owner();
 
 
- ``[link boost_asio.reference.const_buffer.const_buffer.overload2 const_buffer]``(
- const void * data,
- std::size_t size);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload2 more...]]``
 
+[endsect]
 
-Construct a non-modifiable buffer from a modifiable one.
 
 
- ``[link boost_asio.reference.const_buffer.const_buffer.overload3 const_buffer]``(
- const mutable_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffer.const_buffer.overload3 more...]]``
+[endsect]
 
+[section:io_service io_service]
 
-[section:overload1 const_buffer::const_buffer (1 of 3 overloads)]
 
+Provides core I/O functionality.
 
-Construct an empty buffer.
 
+ class io_service :
+ noncopyable
 
- const_buffer();
 
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.io_service__id [*id]]]
+ [Class used to uniquely identify a service. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.io_service__service [*service]]]
+ [Base class for all io_service services. ]
+
+ ]
 
-[section:overload2 const_buffer::const_buffer (2 of 3 overloads)]
+ [
 
+ [[link boost_asio.reference.io_service__strand [*strand]]]
+ [Provides serialised handler execution. ]
+
+ ]
 
-Construct a buffer to represent a given memory range.
+ [
 
+ [[link boost_asio.reference.io_service__work [*work]]]
+ [Class to inform the io_service when it has work to do. ]
+
+ ]
 
- const_buffer(
- const void * data,
- std::size_t size);
+ [
 
+ [[link boost_asio.reference.io_service.fork_event [*fork_event]]]
+ [Fork-related event notifications. ]
+
+ ]
 
+]
 
-[endsect]
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.io_service.dispatch [*dispatch]]]
+ [Request the io_service to invoke the given handler. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.io_service [*io_service]]]
+ [Constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.notify_fork [*notify_fork]]]
+ [Notify the io_service of a fork-related event. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.poll [*poll]]]
+ [Run the io_service object's event processing loop to execute ready handlers. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.poll_one [*poll_one]]]
+ [Run the io_service object's event processing loop to execute one ready handler. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.post [*post]]]
+ [Request the io_service to invoke the given handler and return immediately. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.reset [*reset]]]
+ [Reset the io_service in preparation for a subsequent run() invocation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.run [*run]]]
+ [Run the io_service object's event processing loop. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.run_one [*run_one]]]
+ [Run the io_service object's event processing loop to execute at most one handler. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.stop [*stop]]]
+ [Stop the io_service object's event processing loop. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.stopped [*stopped]]]
+ [Determine whether the io_service object has been stopped. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.wrap [*wrap]]]
+ [Create a new handler that automatically dispatches the wrapped handler on the io_service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service._io_service [*~io_service]]]
+ [Destructor. ]
+ ]
+
+]
 
+[heading Friends]
+[table
+ [[Name][Description]]
 
-[section:overload3 const_buffer::const_buffer (3 of 3 overloads)]
+ [
+ [[link boost_asio.reference.io_service.add_service [*add_service]]]
+ [Add a service object to the io_service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.has_service [*has_service]]]
+ [Determine if an io_service contains a specified service type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service.use_service [*use_service]]]
+ [Obtain the service object corresponding to the given type. ]
+ ]
+
+]
 
+The [link boost_asio.reference.io_service `io_service`] class provides the core I/O functionality for users of the asynchronous I/O objects, including:
 
-Construct a non-modifiable buffer from a modifiable one.
 
+* `boost::asio::ip::tcp::socket`
 
- const_buffer(
- const mutable_buffer & b);
+* `boost::asio::ip::tcp::acceptor`
 
+* `boost::asio::ip::udp::socket`
 
+* [link boost_asio.reference.deadline_timer `deadline_timer`].
 
-[endsect]
+The [link boost_asio.reference.io_service `io_service`] class also includes facilities intended for developers of custom asynchronous services.
 
 
-[endsect]
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
-[section:operator_plus_ const_buffer::operator+]
+[*Shared] [*objects:] Safe, with the specific exceptions of the `reset()` and `notify_fork()` functions. Calling `reset()` while there are unfinished `run()`, `run_one()`, `poll()` or `poll_one()` calls results in undefined behaviour. The `notify_fork()` function should not be called while any [link boost_asio.reference.io_service `io_service`] function, or any function on an I/O object that is associated with the [link boost_asio.reference.io_service `io_service`], is being called in another thread.
 
-[indexterm2 operator+..const_buffer]
-Create a new non-modifiable buffer that is offset from the start of another.
 
 
- const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload1 operator+]``(
- const const_buffer & b,
- std::size_t start);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload1 more...]]``
+[heading Synchronous and asynchronous operations]
+
 
- const_buffer ``[link boost_asio.reference.const_buffer.operator_plus_.overload2 operator+]``(
- std::size_t start,
- const const_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffer.operator_plus_.overload2 more...]]``
 
+Synchronous operations on I/O objects implicitly run the [link boost_asio.reference.io_service `io_service`] object for an individual operation. The [link boost_asio.reference.io_service `io_service`] functions `run()`, `run_one()`, `poll()` or `poll_one()` must be called for the [link boost_asio.reference.io_service `io_service`] to perform asynchronous operations on behalf of a C++ program. Notification that an asynchronous operation has completed is delivered by invocation of the associated handler. Handlers are invoked only by a thread that is currently calling any overload of `run()`, `run_one()`, `poll()` or `poll_one()` for the [link boost_asio.reference.io_service `io_service`].
 
-[section:overload1 const_buffer::operator+ (1 of 2 overloads)]
 
+[heading Effect of exceptions thrown from handlers]
+
 
-Create a new non-modifiable buffer that is offset from the start of another.
 
+If an exception is thrown from a handler, the exception is allowed to propagate through the throwing thread's invocation of `run()`, `run_one()`, `poll()` or `poll_one()`. No other threads that are calling any of these functions are affected. It is then the responsibility of the application to catch the exception.
 
- const_buffer operator+(
- const const_buffer & b,
- std::size_t start);
+After the exception has been caught, the `run()`, `run_one()`, `poll()` or `poll_one()` call may be restarted [*without] the need for an intervening call to `reset()`. This allows the thread to rejoin the [link boost_asio.reference.io_service `io_service`] object's thread pool without impacting any other threads in the pool.
 
+For example:
 
 
-[endsect]
 
+ boost::asio::io_service io_service;
+ ...
+ for (;;)
+ {
+ try
+ {
+ io_service.run();
+ break; // run() exited normally
+ }
+ catch (my_exception& e)
+ {
+ // Deal with exception as appropriate.
+ }
+ }
 
 
-[section:overload2 const_buffer::operator+ (2 of 2 overloads)]
 
 
-Create a new non-modifiable buffer that is offset from the start of another.
 
+[heading Stopping the io_service from running out of work]
+
 
- const_buffer operator+(
- std::size_t start,
- const const_buffer & b);
 
+Some applications may need to prevent an [link boost_asio.reference.io_service `io_service`] object's `run()` call from returning when there is no more work to do. For example, the [link boost_asio.reference.io_service `io_service`] may be being run in a background thread that is launched prior to the application's asynchronous operations. The `run()` call may be kept running by creating an object of type [link boost_asio.reference.io_service__work `io_service::work`]:
 
 
-[endsect]
 
+ boost::asio::io_service io_service;
+ boost::asio::io_service::work work(io_service);
+ ...
 
-[endsect]
 
 
-[endsect]
 
-[section:const_buffers_1 const_buffers_1]
+To effect a shutdown, the application will then need to call the [link boost_asio.reference.io_service `io_service`] object's `stop()` member function. This will cause the [link boost_asio.reference.io_service `io_service`] `run()` call to return as soon as possible, abandoning unfinished operations and without permitting ready handlers to be dispatched.
+
+Alternatively, if the application requires that all operations and handlers be allowed to finish normally, the work object may be explicitly destroyed.
 
 
-Adapts a single non-modifiable buffer so that it meets the requirements of the ConstBufferSequence concept.
 
+ boost::asio::io_service io_service;
+ auto_ptr<boost::asio::io_service::work> work(
+ new boost::asio::io_service::work(io_service));
+ ...
+ work.reset(); // Allow run() to exit.
 
- class const_buffers_1 :
- public const_buffer
 
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
 
- [[link boost_asio.reference.const_buffers_1.const_iterator [*const_iterator]]]
- [A random-access iterator type that may be used to read elements. ]
+[heading The io_service class and I/O services]
   
- ]
 
- [
 
- [[link boost_asio.reference.const_buffers_1.value_type [*value_type]]]
- [The type for each element in the list of buffers. ]
-
- ]
+Class [link boost_asio.reference.io_service `io_service`] implements an extensible, type-safe, polymorphic set of I/O services, indexed by service type. An object of class [link boost_asio.reference.io_service `io_service`] must be initialised before I/O objects such as sockets, resolvers and timers can be used. These I/O objects are distinguished by having constructors that accept an `io_service&` parameter.
 
-]
+I/O services exist to manage the logical interface to the operating system on behalf of the I/O objects. In particular, there are resources that are shared across a class of I/O objects. For example, timers may be implemented in terms of a single timer queue. The I/O services manage these shared resources.
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+Access to the services of an [link boost_asio.reference.io_service `io_service`] is via three function templates, `use_service()`, `add_service()` and `has_service()`.
 
- [
- [[link boost_asio.reference.const_buffers_1.begin [*begin]]]
- [Get a random-access iterator to the first element. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffers_1.const_buffers_1 [*const_buffers_1]]]
- [Construct to represent a given memory range.
+In a call to `use_service<Service>()`, the type argument chooses a service, making available all members of the named type. If `Service` is not present in an [link boost_asio.reference.io_service `io_service`], an object of type `Service` is created and added to the [link boost_asio.reference.io_service `io_service`]. A C++ program can check if an [link boost_asio.reference.io_service `io_service`] implements a particular service with the function template `has_service<Service>()`.
 
- Construct to represent a single non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffers_1.end [*end]]]
- [Get a random-access iterator for one past the last element. ]
- ]
-
-]
+Service objects may be explicitly added to an [link boost_asio.reference.io_service `io_service`] using the function template `add_service<Service>()`. If the `Service` is already present, the [link boost_asio.reference.service_already_exists `service_already_exists`] exception is thrown. If the owner of the service is not the same object as the [link boost_asio.reference.io_service `io_service`] parameter, the [link boost_asio.reference.invalid_service_owner `invalid_service_owner`] exception is thrown.
 
-[heading Related Functions]
-[table
- [[Name][Description]]
+Once a service reference is obtained from an [link boost_asio.reference.io_service `io_service`] object by calling `use_service()`, that reference remains usable as long as the owning [link boost_asio.reference.io_service `io_service`] object exists.
 
- [
- [[link boost_asio.reference.const_buffers_1.buffer_cast [*buffer_cast]]]
- [Cast a non-modifiable buffer to a specified pointer to POD type. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffers_1.buffer_size [*buffer_size]]]
- [Get the number of bytes in a non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffers_1.operator_plus_ [*operator+]]]
- [Create a new non-modifiable buffer that is offset from the start of another. ]
- ]
-
-]
+All I/O service implementations have [link boost_asio.reference.io_service__service `io_service::service`] as a public base class. Custom I/O services may be implemented by deriving from this class and then added to an [link boost_asio.reference.io_service `io_service`] using the facilities described above.
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/buffer.hpp]
+[*Header: ][^boost/asio/io_service.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:begin const_buffers_1::begin]
+[section:add_service io_service::add_service]
 
-[indexterm2 begin..const_buffers_1]
-Get a random-access iterator to the first element.
+[indexterm2 add_service..io_service]
+Add a service object to the [link boost_asio.reference.io_service `io_service`].
 
 
- const_iterator begin() const;
+ template<
+ typename ``[link boost_asio.reference.Service Service]``>
+ friend void add_service(
+ io_service & ios,
+ Service * svc);
 
 
+This function is used to add a service to the [link boost_asio.reference.io_service `io_service`].
 
-[endsect]
 
+[heading Parameters]
+
 
+[variablelist
+
+[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
-[section:buffer_cast const_buffers_1::buffer_cast]
+[[svc][The service object. On success, ownership of the service object is transferred to the [link boost_asio.reference.io_service `io_service`]. When the [link boost_asio.reference.io_service `io_service`] object is destroyed, it will destroy the service object by performing:
+``
+ delete static_cast<io_service::service*>(svc)
+``
+]]
 
+]
 
-['Inherited from const_buffer.]
 
-[indexterm2 buffer_cast..const_buffers_1]
-Cast a non-modifiable buffer to a specified pointer to POD type.
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.io_service `io_service`].]]
 
- template<
- typename PointerToPodType>
- PointerToPodType buffer_cast(
- const const_buffer & b);
+[[boost::asio::invalid_service_owner][Thrown if the service's owning [link boost_asio.reference.io_service `io_service`] is not the [link boost_asio.reference.io_service `io_service`] object specified by the ios parameter. ]]
 
+]
 
 
-[endsect]
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/io_service.hpp]
 
-[section:buffer_size const_buffers_1::buffer_size]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-['Inherited from const_buffer.]
+[endsect]
 
-[indexterm2 buffer_size..const_buffers_1]
-Get the number of bytes in a non-modifiable buffer.
 
 
- std::size_t buffer_size(
- const const_buffer & b);
+[section:dispatch io_service::dispatch]
 
+[indexterm2 dispatch..io_service]
+Request the [link boost_asio.reference.io_service `io_service`] to invoke the given handler.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.CompletionHandler CompletionHandler]``>
+ void dispatch(
+ CompletionHandler handler);
 
 
-[section:const_buffers_1 const_buffers_1::const_buffers_1]
+This function is used to ask the [link boost_asio.reference.io_service `io_service`] to execute the given handler.
 
-[indexterm2 const_buffers_1..const_buffers_1]
-Construct to represent a given memory range.
+The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked. The handler may be executed inside this function if the guarantee can be met.
 
 
- ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 const_buffers_1]``(
- const void * data,
- std::size_t size);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload1 more...]]``
+[heading Parameters]
+
 
+[variablelist
+
+[[handler][The handler to be called. The [link boost_asio.reference.io_service `io_service`] will make a copy of the handler object as required. The function signature of the handler must be:
+``
+ void handler();
+``
+]]
 
-Construct to represent a single non-modifiable buffer.
+]
 
 
- explicit ``[link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 const_buffers_1]``(
- const const_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.const_buffers_1.overload2 more...]]``
+[heading Remarks]
+
+This function throws an exception only if:
 
 
-[section:overload1 const_buffers_1::const_buffers_1 (1 of 2 overloads)]
+* the handler's `asio_handler_allocate` function; or
 
 
-Construct to represent a given memory range.
+* the handler's copy constructor
 
+throws an exception.
 
- const_buffers_1(
- const void * data,
- std::size_t size);
 
+[endsect]
 
 
-[endsect]
 
+[section:fork_event io_service::fork_event]
 
+[indexterm2 fork_event..io_service]
+Fork-related event notifications.
 
-[section:overload2 const_buffers_1::const_buffers_1 (2 of 2 overloads)]
 
+ enum fork_event
 
-Construct to represent a single non-modifiable buffer.
+[indexterm2 fork_prepare..io_service]
+[indexterm2 fork_parent..io_service]
+[indexterm2 fork_child..io_service]
 
+[heading Values]
+[variablelist
 
- const_buffers_1(
- const const_buffer & b);
+ [
+ [fork_prepare]
+ [Notify the io_service that the process is about to fork. ]
+ ]
+
+ [
+ [fork_parent]
+ [Notify the io_service that the process has forked and is the parent. ]
+ ]
 
+ [
+ [fork_child]
+ [Notify the io_service that the process has forked and is the child. ]
+ ]
 
+]
 
-[endsect]
 
 
 [endsect]
 
 
-[section:const_iterator const_buffers_1::const_iterator]
 
-[indexterm2 const_iterator..const_buffers_1]
-A random-access iterator type that may be used to read elements.
+[section:has_service io_service::has_service]
 
+[indexterm2 has_service..io_service]
+Determine if an [link boost_asio.reference.io_service `io_service`] contains a specified service type.
 
- typedef const const_buffer * const_iterator;
 
+ template<
+ typename ``[link boost_asio.reference.Service Service]``>
+ friend bool has_service(
+ io_service & ios);
 
 
-[heading Requirements]
+This function is used to determine whether the [link boost_asio.reference.io_service `io_service`] contains a service object corresponding to the given service type.
 
-[*Header: ][^boost/asio/buffer.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Parameters]
+
 
+[variablelist
+
+[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
-[endsect]
+]
 
 
+[heading Return Value]
+
+A boolean indicating whether the [link boost_asio.reference.io_service `io_service`] contains the service.
 
-[section:end const_buffers_1::end]
 
-[indexterm2 end..const_buffers_1]
-Get a random-access iterator for one past the last element.
 
+[heading Requirements]
 
- const_iterator end() const;
+[*Header: ][^boost/asio/io_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:operator_plus_ const_buffers_1::operator+]
+[section:io_service io_service::io_service]
 
-[indexterm2 operator+..const_buffers_1]
-Create a new non-modifiable buffer that is offset from the start of another.
+[indexterm2 io_service..io_service]
+Constructor.
 
 
- const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload1 operator+]``(
- const const_buffer & b,
- std::size_t start);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload1 more...]]``
+ ``[link boost_asio.reference.io_service.io_service.overload1 io_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.io_service.overload1 more...]]``
 
- const_buffer ``[link boost_asio.reference.const_buffers_1.operator_plus_.overload2 operator+]``(
- std::size_t start,
- const const_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.const_buffers_1.operator_plus_.overload2 more...]]``
+ explicit ``[link boost_asio.reference.io_service.io_service.overload2 io_service]``(
+ std::size_t concurrency_hint);
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.io_service.overload2 more...]]``
 
 
-[section:overload1 const_buffers_1::operator+ (1 of 2 overloads)]
+[section:overload1 io_service::io_service (1 of 2 overloads)]
 
 
-['Inherited from const_buffer.]
+Constructor.
 
 
-Create a new non-modifiable buffer that is offset from the start of another.
+ io_service();
 
 
- const_buffer operator+(
- const const_buffer & b,
- std::size_t start);
 
+[endsect]
 
 
-[endsect]
 
+[section:overload2 io_service::io_service (2 of 2 overloads)]
 
 
-[section:overload2 const_buffers_1::operator+ (2 of 2 overloads)]
+Constructor.
 
 
-['Inherited from const_buffer.]
+ io_service(
+ std::size_t concurrency_hint);
 
 
-Create a new non-modifiable buffer that is offset from the start of another.
+Construct with a hint about the required level of concurrency.
 
 
- const_buffer operator+(
- std::size_t start,
- const const_buffer & b);
+[heading Parameters]
+
+
+[variablelist
+
+[[concurrency_hint][A suggestion to the implementation on how many threads it should allow to run simultaneously. ]]
+
+]
+
 
 
 
@@ -35030,343 +53304,193 @@
 [endsect]
 
 
-[section:value_type const_buffers_1::value_type]
+[section:notify_fork io_service::notify_fork]
 
-[indexterm2 value_type..const_buffers_1]
-The type for each element in the list of buffers.
+[indexterm2 notify_fork..io_service]
+Notify the [link boost_asio.reference.io_service `io_service`] of a fork-related event.
 
 
- typedef const_buffer value_type;
+ void notify_fork(
+ boost::asio::io_service::fork_event event);
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+This function is used to inform the [link boost_asio.reference.io_service `io_service`] that the process is about to fork, or has just forked. This allows the [link boost_asio.reference.io_service `io_service`], and the services it contains, to perform any necessary housekeeping to ensure correct operation following a fork.
 
- [
- [[link boost_asio.reference.const_buffer.const_buffer [*const_buffer]]]
- [Construct an empty buffer.
+This function must not be called while any other [link boost_asio.reference.io_service `io_service`] function, or any function on an I/O object associated with the [link boost_asio.reference.io_service `io_service`], is being called in another thread. It is, however, safe to call this function from within a completion handler, provided no other thread is accessing the [link boost_asio.reference.io_service `io_service`].
 
- Construct a buffer to represent a given memory range.
 
- Construct a non-modifiable buffer from a modifiable one. ]
- ]
+[heading Parameters]
+
+
+[variablelist
   
+[[event][A fork-related event.]]
+
 ]
 
-[heading Related Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.const_buffer.buffer_cast [*buffer_cast]]]
- [Cast a non-modifiable buffer to a specified pointer to POD type. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffer.buffer_size [*buffer_size]]]
- [Get the number of bytes in a non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.const_buffer.operator_plus_ [*operator+]]]
- [Create a new non-modifiable buffer that is offset from the start of another. ]
- ]
+[heading Exceptions]
+
+
+[variablelist
   
+[[boost::system::system_error][Thrown on failure. If the notification fails the [link boost_asio.reference.io_service `io_service`] object should no longer be used and should be destroyed.]]
+
 ]
 
-The [link boost_asio.reference.const_buffer `const_buffer`] class provides a safe representation of a buffer that cannot be modified. It does not own the underlying data, and so is cheap to copy or assign.
 
+[heading Example]
+
+The following code illustrates how to incorporate the `notify_fork()` function:
 
-[heading Requirements]
+ my_io_service.notify_fork(boost::asio::io_service::fork_prepare);
+ if (fork() == 0)
+ {
+ // This is the child process.
+ my_io_service.notify_fork(boost::asio::io_service::fork_child);
+ }
+ else
+ {
+ // This is the parent process.
+ my_io_service.notify_fork(boost::asio::io_service::fork_parent);
+ }
 
-[*Header: ][^boost/asio/buffer.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+
+[heading Remarks]
+
+For each service object `svc` in the [link boost_asio.reference.io_service `io_service`] set, performs `svc->fork_service();`. When processing the fork\_prepare event, services are visited in reverse order of the beginning of service object lifetime. Otherwise, services are visited in order of the beginning of service object lifetime.
+
 
 
 
 [endsect]
 
-[section:datagram_socket_service datagram_socket_service]
 
+[section:poll io_service::poll]
 
-Default service implementation for a datagram socket.
+[indexterm2 poll..io_service]
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute ready handlers.
 
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``>
- class datagram_socket_service :
- public io_service::service
+ std::size_t ``[link boost_asio.reference.io_service.poll.overload1 poll]``();
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.poll.overload1 more...]]``
 
+ std::size_t ``[link boost_asio.reference.io_service.poll.overload2 poll]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.poll.overload2 more...]]``
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+[section:overload1 io_service::poll (1 of 2 overloads)]
 
- [[link boost_asio.reference.datagram_socket_service.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
 
- [
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute ready handlers.
 
- [[link boost_asio.reference.datagram_socket_service.implementation_type [*implementation_type]]]
- [The type of a datagram socket. ]
-
- ]
 
- [
+ std::size_t poll();
 
- [[link boost_asio.reference.datagram_socket_service.native_type [*native_type]]]
- [The native socket type. ]
-
- ]
 
- [
+The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_service `io_service`] has been stopped or there are no more ready handlers.
 
- [[link boost_asio.reference.datagram_socket_service.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
 
-]
+[heading Return Value]
+
+The number of handlers that were executed.
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.datagram_socket_service.assign [*assign]]]
- [Assign an existing native socket to a datagram socket. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.async_receive [*async_receive]]]
- [Start an asynchronous receive. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.async_receive_from [*async_receive_from]]]
- [Start an asynchronous receive that will get the endpoint of the sender. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.async_send [*async_send]]]
- [Start an asynchronous send. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.async_send_to [*async_send_to]]]
- [Start an asynchronous send. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.bind [*bind]]]
- []
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.close [*close]]]
- [Close a datagram socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.connect [*connect]]]
- [Connect the datagram socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.construct [*construct]]]
- [Construct a new datagram socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.datagram_socket_service [*datagram_socket_service]]]
- [Construct a new datagram socket service for the specified io_service. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.destroy [*destroy]]]
- [Destroy a datagram socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.get_option [*get_option]]]
- [Get a socket option. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.local_endpoint [*local_endpoint]]]
- [Get the local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.native [*native]]]
- [Get the native socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.open [*open]]]
- []
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.receive [*receive]]]
- [Receive some data from the peer. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.receive_from [*receive_from]]]
- [Receive a datagram with the endpoint of the sender. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.send [*send]]]
- [Send the given data to the peer. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.send_to [*send_to]]]
- [Send a datagram to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.set_option [*set_option]]]
- [Set a socket option. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.datagram_socket_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
+[heading Exceptions]
+
+
+[variablelist
   
+[[boost::system::system_error][Thrown on failure. ]]
+
 ]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.datagram_socket_service.id [*id]]]
- [The unique service identifier. ]
- ]
 
-]
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/datagram_socket_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[section:overload2 io_service::poll (2 of 2 overloads)]
 
-[section:assign datagram_socket_service::assign]
 
-[indexterm2 assign..datagram_socket_service]
-Assign an existing native socket to a datagram socket.
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute ready handlers.
 
 
- boost::system::error_code assign(
- implementation_type & impl,
- const protocol_type & protocol,
- const native_type & native_socket,
+ std::size_t poll(
       boost::system::error_code & ec);
 
 
+The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_service `io_service`] has been stopped or there are no more ready handlers.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of handlers that were executed.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:poll_one io_service::poll_one]
+
+[indexterm2 poll_one..io_service]
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute one ready handler.
+
+
+ std::size_t ``[link boost_asio.reference.io_service.poll_one.overload1 poll_one]``();
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.poll_one.overload1 more...]]``
 
-[endsect]
+ std::size_t ``[link boost_asio.reference.io_service.poll_one.overload2 poll_one]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.poll_one.overload2 more...]]``
 
 
+[section:overload1 io_service::poll_one (1 of 2 overloads)]
 
-[section:async_connect datagram_socket_service::async_connect]
 
-[indexterm2 async_connect..datagram_socket_service]
-Start an asynchronous connect.
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute one ready handler.
 
 
- template<
- typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
- void async_connect(
- implementation_type & impl,
- const endpoint_type & peer_endpoint,
- ConnectHandler handler);
+ std::size_t poll_one();
 
 
+The `poll_one()` function runs at most one handler that is ready to run, without blocking.
 
-[endsect]
 
+[heading Return Value]
+
+The number of handlers that were executed.
 
 
-[section:async_receive datagram_socket_service::async_receive]
+[heading Exceptions]
+
 
-[indexterm2 async_receive..datagram_socket_service]
-Start an asynchronous receive.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_receive(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
- ReadHandler handler);
 
 
 
@@ -35374,553 +53498,601 @@
 
 
 
-[section:async_receive_from datagram_socket_service::async_receive_from]
+[section:overload2 io_service::poll_one (2 of 2 overloads)]
 
-[indexterm2 async_receive_from..datagram_socket_service]
-Start an asynchronous receive that will get the endpoint of the sender.
 
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute one ready handler.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_receive_from(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- endpoint_type & sender_endpoint,
- socket_base::message_flags flags,
- ReadHandler handler);
 
+ std::size_t poll_one(
+ boost::system::error_code & ec);
 
 
-[endsect]
+The `poll_one()` function runs at most one handler that is ready to run, without blocking.
 
 
+[heading Parameters]
+
 
-[section:async_send datagram_socket_service::async_send]
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
 
-[indexterm2 async_send..datagram_socket_service]
-Start an asynchronous send.
+]
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_send(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
- WriteHandler handler);
+[heading Return Value]
+
+The number of handlers that were executed.
 
 
 
-[endsect]
 
+[endsect]
 
 
-[section:async_send_to datagram_socket_service::async_send_to]
+[endsect]
 
-[indexterm2 async_send_to..datagram_socket_service]
-Start an asynchronous send.
 
+[section:post io_service::post]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_send_to(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- const endpoint_type & destination,
- socket_base::message_flags flags,
- WriteHandler handler);
+[indexterm2 post..io_service]
+Request the [link boost_asio.reference.io_service `io_service`] to invoke the given handler and return immediately.
 
 
+ template<
+ typename ``[link boost_asio.reference.CompletionHandler CompletionHandler]``>
+ void post(
+ CompletionHandler handler);
 
-[endsect]
 
+This function is used to ask the [link boost_asio.reference.io_service `io_service`] to execute the given handler, but without allowing the [link boost_asio.reference.io_service `io_service`] to call the handler from inside this function.
 
+The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked.
 
-[section:at_mark datagram_socket_service::at_mark]
 
-[indexterm2 at_mark..datagram_socket_service]
-Determine whether the socket is at the out-of-band data mark.
+[heading Parameters]
+
 
+[variablelist
+
+[[handler][The handler to be called. The [link boost_asio.reference.io_service `io_service`] will make a copy of the handler object as required. The function signature of the handler must be:
+``
+ void handler();
+``
+]]
 
- bool at_mark(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
+]
 
 
+[heading Remarks]
+
+This function throws an exception only if:
 
-[endsect]
 
+* the handler's `asio_handler_allocate` function; or
 
 
-[section:available datagram_socket_service::available]
+* the handler's copy constructor
 
-[indexterm2 available..datagram_socket_service]
-Determine the number of bytes available for reading.
+throws an exception.
 
 
- std::size_t available(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
+[endsect]
 
 
 
-[endsect]
+[section:reset io_service::reset]
 
+[indexterm2 reset..io_service]
+Reset the [link boost_asio.reference.io_service `io_service`] in preparation for a subsequent `run()` invocation.
 
 
-[section:bind datagram_socket_service::bind]
+ void reset();
 
-[indexterm2 bind..datagram_socket_service]
 
- boost::system::error_code bind(
- implementation_type & impl,
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+This function must be called prior to any second or later set of invocations of the `run()`, `run_one()`, `poll()` or `poll_one()` functions when a previous invocation of these functions returned due to the [link boost_asio.reference.io_service `io_service`] being stopped or running out of work. After a call to `reset()`, the [link boost_asio.reference.io_service `io_service`] object's `stopped()` function will return `false`.
 
+This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions.
 
 
 [endsect]
 
 
+[section:run io_service::run]
 
-[section:cancel datagram_socket_service::cancel]
+[indexterm2 run..io_service]
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
 
-[indexterm2 cancel..datagram_socket_service]
-Cancel all asynchronous operations associated with the socket.
 
+ std::size_t ``[link boost_asio.reference.io_service.run.overload1 run]``();
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.run.overload1 more...]]``
 
- boost::system::error_code cancel(
- implementation_type & impl,
+ std::size_t ``[link boost_asio.reference.io_service.run.overload2 run]``(
       boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.run.overload2 more...]]``
 
 
+[section:overload1 io_service::run (1 of 2 overloads)]
 
-[endsect]
 
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
 
 
-[section:close datagram_socket_service::close]
+ std::size_t run();
 
-[indexterm2 close..datagram_socket_service]
-Close a datagram socket implementation.
 
+The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
 
- boost::system::error_code close(
- implementation_type & impl,
- boost::system::error_code & ec);
+Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_service `io_service`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_service `io_service`] may choose any one of them to invoke a handler.
 
+A normal exit from the `run()` function implies that the [link boost_asio.reference.io_service `io_service`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `reset()`.
 
 
-[endsect]
+[heading Return Value]
+
+The number of handlers that were executed.
 
 
+[heading Exceptions]
+
 
-[section:connect datagram_socket_service::connect]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[indexterm2 connect..datagram_socket_service]
-Connect the datagram socket to the specified endpoint.
+]
 
 
- boost::system::error_code connect(
- implementation_type & impl,
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
+[heading Remarks]
+
+The `run()` function must not be called from a thread that is currently calling one of `run()`, `run_one()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_service `io_service`] object.
 
+The `poll()` function may also be used to dispatch ready handlers, but without blocking.
 
 
 [endsect]
 
 
 
-[section:construct datagram_socket_service::construct]
+[section:overload2 io_service::run (2 of 2 overloads)]
 
-[indexterm2 construct..datagram_socket_service]
-Construct a new datagram socket implementation.
 
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
 
- void construct(
- implementation_type & impl);
 
+ std::size_t run(
+ boost::system::error_code & ec);
 
 
-[endsect]
+The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
 
+Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_service `io_service`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_service `io_service`] may choose any one of them to invoke a handler.
 
+A normal exit from the `run()` function implies that the [link boost_asio.reference.io_service `io_service`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `reset()`.
 
-[section:datagram_socket_service datagram_socket_service::datagram_socket_service]
 
-[indexterm2 datagram_socket_service..datagram_socket_service]
-Construct a new datagram socket service for the specified [link boost_asio.reference.io_service `io_service`].
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
- datagram_socket_service(
- boost::asio::io_service & io_service);
 
+[heading Return Value]
+
+The number of handlers that were executed.
+
+
+[heading Remarks]
+
+The `run()` function must not be called from a thread that is currently calling one of `run()`, `run_one()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_service `io_service`] object.
+
+The `poll()` function may also be used to dispatch ready handlers, but without blocking.
 
 
 [endsect]
 
 
+[endsect]
 
-[section:destroy datagram_socket_service::destroy]
+[section:run_one io_service::run_one]
 
-[indexterm2 destroy..datagram_socket_service]
-Destroy a datagram socket implementation.
+[indexterm2 run_one..io_service]
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute at most one handler.
 
 
- void destroy(
- implementation_type & impl);
+ std::size_t ``[link boost_asio.reference.io_service.run_one.overload1 run_one]``();
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.run_one.overload1 more...]]``
 
+ std::size_t ``[link boost_asio.reference.io_service.run_one.overload2 run_one]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.io_service.run_one.overload2 more...]]``
 
 
-[endsect]
+[section:overload1 io_service::run_one (1 of 2 overloads)]
 
 
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute at most one handler.
 
-[section:endpoint_type datagram_socket_service::endpoint_type]
 
-[indexterm2 endpoint_type..datagram_socket_service]
-The endpoint type.
+ std::size_t run_one();
 
 
- typedef Protocol::endpoint endpoint_type;
+The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
 
 
+[heading Return Value]
+
+The number of handlers that were executed. A zero return value implies that the [link boost_asio.reference.io_service `io_service`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `reset()`.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/datagram_socket_service.hpp]
+[heading Exceptions]
+
 
-[*Convenience header: ][^boost/asio.hpp]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
-[endsect]
 
 
 
-[section:get_io_service datagram_socket_service::get_io_service]
+[endsect]
 
 
-['Inherited from io_service.]
 
-[indexterm2 get_io_service..datagram_socket_service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+[section:overload2 io_service::run_one (2 of 2 overloads)]
 
 
- boost::asio::io_service & get_io_service();
+Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute at most one handler.
 
 
+ std::size_t run_one(
+ boost::system::error_code & ec);
 
-[endsect]
 
+The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
 
 
-[section:get_option datagram_socket_service::get_option]
+[heading Return Value]
+
+The number of handlers that were executed. A zero return value implies that the [link boost_asio.reference.io_service `io_service`] object is stopped (the `stopped()` function returns `true`). Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately unless there is a prior call to `reset()`.
+
+The number of handlers that were executed.
 
-[indexterm2 get_option..datagram_socket_service]
-Get a socket option.
 
 
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code get_option(
- const implementation_type & impl,
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
 
+[endsect]
 
 
 [endsect]
 
 
+[section:stop io_service::stop]
 
-[section:id datagram_socket_service::id]
+[indexterm2 stop..io_service]
+Stop the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
 
-[indexterm2 id..datagram_socket_service]
-The unique service identifier.
 
+ void stop();
 
- static boost::asio::io_service::id id;
 
+This function does not block, but instead simply signals the [link boost_asio.reference.io_service `io_service`] to stop. All invocations of its `run()` or `run_one()` member functions should return as soon as possible. Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately until `reset()` is called.
 
 
 [endsect]
 
 
 
-[section:implementation_type datagram_socket_service::implementation_type]
+[section:stopped io_service::stopped]
 
-[indexterm2 implementation_type..datagram_socket_service]
-The type of a datagram socket.
+[indexterm2 stopped..io_service]
+Determine whether the [link boost_asio.reference.io_service `io_service`] object has been stopped.
 
 
- typedef implementation_defined implementation_type;
+ bool stopped() const;
 
 
+This function is used to determine whether an [link boost_asio.reference.io_service `io_service`] object has been stopped, either through an explicit call to `stop()`, or due to running out of work. When an [link boost_asio.reference.io_service `io_service`] object is stopped, calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately without invoking any handlers.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/datagram_socket_service.hpp]
+[heading Return Value]
+
+`true` if the [link boost_asio.reference.io_service `io_service`] object is stopped, otherwise `false`.
+
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:io_control datagram_socket_service::io_control]
+[section:use_service io_service::use_service]
 
-[indexterm2 io_control..datagram_socket_service]
-Perform an IO control command on the socket.
+[indexterm2 use_service..io_service]
+Obtain the service object corresponding to the given type.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- implementation_type & impl,
- IoControlCommand & command,
- boost::system::error_code & ec);
+ typename ``[link boost_asio.reference.Service Service]``>
+ friend Service & use_service(
+ io_service & ios);
 
 
+This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_service `io_service`] will create a new instance of the service.
 
-[endsect]
 
+[heading Parameters]
+
+
+[variablelist
+
+[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
+]
 
-[section:io_service datagram_socket_service::io_service]
 
+[heading Return Value]
+
+The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..datagram_socket_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
+[heading Requirements]
 
- boost::asio::io_service & io_service();
+[*Header: ][^boost/asio/io_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:is_open datagram_socket_service::is_open]
+[section:wrap io_service::wrap]
 
-[indexterm2 is_open..datagram_socket_service]
-Determine whether the socket is open.
+[indexterm2 wrap..io_service]
+Create a new handler that automatically dispatches the wrapped handler on the [link boost_asio.reference.io_service `io_service`].
 
 
- bool is_open(
- const implementation_type & impl) const;
+ template<
+ typename ``[link boost_asio.reference.Handler Handler]``>
+ unspecified wrap(
+ Handler handler);
 
 
+This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the [link boost_asio.reference.io_service `io_service`] object's dispatch function.
 
-[endsect]
 
+[heading Parameters]
+
 
+[variablelist
+
+[[handler][The handler to be wrapped. The [link boost_asio.reference.io_service `io_service`] will make a copy of the handler object as required. The function signature of the handler must be:
+``
+ void handler(A1 a1, ... An an);
+``
+]]
 
-[section:local_endpoint datagram_socket_service::local_endpoint]
+]
 
-[indexterm2 local_endpoint..datagram_socket_service]
-Get the local endpoint.
 
+[heading Return Value]
+
+A function object that, when invoked, passes the wrapped handler to the [link boost_asio.reference.io_service `io_service`] object's dispatch function. Given a function object with the signature:
 
- endpoint_type local_endpoint(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
+ R f(A1 a1, ... An an);
 
 
+If this function object is passed to the wrap function like so:
 
-[endsect]
+ io_service.wrap(f);
 
 
+then the return value is a function object with the signature
 
-[section:native datagram_socket_service::native]
+ void g(A1 a1, ... An an);
 
-[indexterm2 native..datagram_socket_service]
-Get the native socket implementation.
 
+that, when invoked, executes code equivalent to:
 
- native_type native(
- implementation_type & impl);
+ io_service.dispatch(boost::bind(f, a1, ... an));
 
 
 
-[endsect]
 
 
 
-[section:native_type datagram_socket_service::native_type]
 
-[indexterm2 native_type..datagram_socket_service]
-The native socket type.
+[endsect]
 
 
- typedef implementation_defined native_type;
 
+[section:_io_service io_service::~io_service]
 
+[indexterm2 ~io_service..io_service]
+Destructor.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/datagram_socket_service.hpp]
+ ~io_service();
 
-[*Convenience header: ][^boost/asio.hpp]
 
+On destruction, the [link boost_asio.reference.io_service `io_service`] performs the following sequence of operations:
 
-[endsect]
 
+* For each service object `svc` in the [link boost_asio.reference.io_service `io_service`] set, in reverse order of the beginning of service object lifetime, performs `svc->shutdown_service()`.
 
 
-[section:open datagram_socket_service::open]
+* Uninvoked handler objects that were scheduled for deferred invocation on the [link boost_asio.reference.io_service `io_service`], or any associated strand, are destroyed.
 
-[indexterm2 open..datagram_socket_service]
 
- boost::system::error_code open(
- implementation_type & impl,
- const protocol_type & protocol,
- boost::system::error_code & ec);
+* For each service object `svc` in the [link boost_asio.reference.io_service `io_service`] set, in reverse order of the beginning of service object lifetime, performs `delete static_cast<io_service::service*>(svc)`.
 
 
+[heading Remarks]
+
+The destruction sequence described above permits programs to simplify their resource management by using `shared_ptr<>`. Where an object's lifetime is tied to the lifetime of a connection (or some other sequence of asynchronous operations), a `shared_ptr` to the object would be bound into the handlers for all asynchronous operations associated with it. This works as follows:
 
-[endsect]
 
+* When a single connection ends, all associated asynchronous operations complete. The corresponding handler objects are destroyed, and all `shared_ptr` references to the objects are destroyed.
 
 
-[section:protocol_type datagram_socket_service::protocol_type]
+* To shut down the whole program, the [link boost_asio.reference.io_service `io_service`] function `stop()` is called to terminate any `run()` calls as soon as possible. The [link boost_asio.reference.io_service `io_service`] destructor defined above destroys all handlers, causing all `shared_ptr` references to all connection objects to be destroyed.
 
-[indexterm2 protocol_type..datagram_socket_service]
-The protocol type.
 
 
- typedef Protocol protocol_type;
 
+[endsect]
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/datagram_socket_service.hpp]
+[endsect]
 
-[*Convenience header: ][^boost/asio.hpp]
+[section:io_service__id io_service::id]
 
 
-[endsect]
+Class used to uniquely identify a service.
 
 
+ class id :
+ noncopyable
 
-[section:receive datagram_socket_service::receive]
 
-[indexterm2 receive..datagram_socket_service]
-Receive some data from the peer.
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.io_service__id.id [*id]]]
+ [Constructor. ]
+ ]
+
+]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
+[heading Requirements]
+
+[*Header: ][^boost/asio/io_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:id io_service::id::id]
 
+[indexterm2 id..io_service::id]
+Constructor.
 
 
-[section:receive_from datagram_socket_service::receive_from]
+ id();
 
-[indexterm2 receive_from..datagram_socket_service]
-Receive a datagram with the endpoint of the sender.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive_from(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- endpoint_type & sender_endpoint,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
+[endsect]
 
 
 
 [endsect]
 
+[section:io_service__service io_service::service]
 
 
-[section:remote_endpoint datagram_socket_service::remote_endpoint]
+Base class for all [link boost_asio.reference.io_service `io_service`] services.
 
-[indexterm2 remote_endpoint..datagram_socket_service]
-Get the remote endpoint.
+
+ class service :
+ noncopyable
 
 
- endpoint_type remote_endpoint(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.io_service__service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
+ ]
+
+]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.io_service__service.service [*service]]]
+ [Constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service__service._service [*~service]]]
+ [Destructor. ]
+ ]
+
+]
+
+[heading Private Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.io_service__service.fork_service [*fork_service]]]
+ [Handle notification of a fork-related event to perform any necessary housekeeping. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service__service.shutdown_service [*shutdown_service]]]
+ [Destroy all user-defined handler objects owned by the service. ]
+ ]
+
+]
 
+[heading Requirements]
 
-[section:send datagram_socket_service::send]
+[*Header: ][^boost/asio/io_service.hpp]
 
-[indexterm2 send..datagram_socket_service]
-Send the given data to the peer.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t send(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
+[section:get_io_service io_service::service::get_io_service]
 
+[indexterm2 get_io_service..io_service::service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
 
-[endsect]
+ boost::asio::io_service & get_io_service();
 
 
 
-[section:send_to datagram_socket_service::send_to]
+[endsect]
 
-[indexterm2 send_to..datagram_socket_service]
-Send a datagram to the specified endpoint.
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t send_to(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- const endpoint_type & destination,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
+[section:service io_service::service::service]
 
+[indexterm2 service..io_service::service]
+Constructor.
 
 
-[endsect]
+ service(
+ boost::asio::io_service & owner);
 
 
 
-[section:set_option datagram_socket_service::set_option]
+[heading Parameters]
+
 
-[indexterm2 set_option..datagram_socket_service]
-Set a socket option.
+[variablelist
+
+[[owner][The [link boost_asio.reference.io_service `io_service`] object that owns the service. ]]
 
+]
 
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code set_option(
- implementation_type & impl,
- const SettableSocketOption & option,
- boost::system::error_code & ec);
 
 
 
@@ -35928,16 +54100,13 @@
 
 
 
-[section:shutdown datagram_socket_service::shutdown]
+[section:_service io_service::service::~service]
 
-[indexterm2 shutdown..datagram_socket_service]
-Disable sends or receives on the socket.
+[indexterm2 ~service..io_service::service]
+Destructor.
 
 
- boost::system::error_code shutdown(
- implementation_type & impl,
- socket_base::shutdown_type what,
- boost::system::error_code & ec);
+ virtual ~service();
 
 
 
@@ -35945,403 +54114,268 @@
 
 
 
-[section:shutdown_service datagram_socket_service::shutdown_service]
-
-[indexterm2 shutdown_service..datagram_socket_service]
-Destroy all user-defined handler objects owned by the service.
-
+[section:fork_service io_service::service::fork_service]
 
- virtual void shutdown_service();
+[indexterm2 fork_service..io_service::service]
+Handle notification of a fork-related event to perform any necessary housekeeping.
 
 
+ virtual void fork_service(
+ boost::asio::io_service::fork_event event);
 
-[endsect]
 
+This function is not a pure virtual so that services only have to implement it if necessary. The default implementation does nothing.
 
 
 [endsect]
 
 
-[section:deadline_timer deadline_timer]
 
-[indexterm1 deadline_timer]
-Typedef for the typical usage of timer. Uses a UTC clock.
+[section:shutdown_service io_service::service::shutdown_service]
 
+[indexterm2 shutdown_service..io_service::service]
+Destroy all user-defined handler objects owned by the service.
 
- typedef basic_deadline_timer< boost::posix_time::ptime > deadline_timer;
 
+ void shutdown_service();
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
 
- [[link boost_asio.reference.basic_deadline_timer.duration_type [*duration_type]]]
- [The duration type. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_deadline_timer.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_deadline_timer.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
+[section:io_service__strand io_service::strand]
 
- [
 
- [[link boost_asio.reference.basic_deadline_timer.time_type [*time_type]]]
- [The time type. ]
-
- ]
+Provides serialised handler execution.
 
- [
 
- [[link boost_asio.reference.basic_deadline_timer.traits_type [*traits_type]]]
- [The time traits type. ]
-
- ]
+ class strand
 
-]
 
 [heading Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_deadline_timer.async_wait [*async_wait]]]
- [Start an asynchronous wait on the timer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer [*basic_deadline_timer]]]
- [Constructor.
-
- Constructor to set a particular expiry time as an absolute time.
-
- Constructor to set a particular expiry time relative to now. ]
- ]
-
- [
- [[link boost_asio.reference.basic_deadline_timer.cancel [*cancel]]]
- [Cancel any asynchronous operations that are waiting on the timer. ]
+ [[link boost_asio.reference.io_service__strand.dispatch [*dispatch]]]
+ [Request the strand to invoke the given handler. ]
   ]
   
   [
- [[link boost_asio.reference.basic_deadline_timer.expires_at [*expires_at]]]
- [Get the timer's expiry time as an absolute time.
-
- Set the timer's expiry time as an absolute time. ]
+ [[link boost_asio.reference.io_service__strand.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the strand. ]
   ]
   
   [
- [[link boost_asio.reference.basic_deadline_timer.expires_from_now [*expires_from_now]]]
- [Get the timer's expiry time relative to now.
-
- Set the timer's expiry time relative to now. ]
+ [[link boost_asio.reference.io_service__strand.post [*post]]]
+ [Request the strand to invoke the given handler and return immediately. ]
   ]
   
   [
- [[link boost_asio.reference.basic_deadline_timer.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.io_service__strand.strand [*strand]]]
+ [Constructor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_deadline_timer.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.io_service__strand.wrap [*wrap]]]
+ [Create a new handler that automatically dispatches the wrapped handler on the strand. ]
   ]
   
   [
- [[link boost_asio.reference.basic_deadline_timer.wait [*wait]]]
- [Perform a blocking wait on the timer. ]
+ [[link boost_asio.reference.io_service__strand._strand [*~strand]]]
+ [Destructor. ]
   ]
   
 ]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
+The [link boost_asio.reference.io_service__strand `io_service::strand`] class provides the ability to post and dispatch handlers with the guarantee that none of those handlers will execute concurrently.
 
- [
- [[link boost_asio.reference.basic_deadline_timer.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
 
- [
- [[link boost_asio.reference.basic_deadline_timer.service [*service]]]
- [The service associated with the I/O object. ]
- ]
+[heading Order of handler invocation]
+
+Given:
 
-]
 
-The [link boost_asio.reference.basic_deadline_timer `basic_deadline_timer`] class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
+* a strand object `s`
 
-A deadline timer is always in one of two states: "expired" or "not expired". If the `wait()` or `async_wait()` function is called on an expired timer, the wait operation will complete immediately.
 
-Most applications will use the `boost::asio::deadline_timer` typedef.
+* an object `a` meeting completion handler requirements
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+* an object `a1` which is an arbitrary copy of `a` made by the implementation
 
-[*Shared] [*objects:] Unsafe.
 
+* an object `b` meeting completion handler requirements
 
-[heading Examples]
-
-Performing a blocking wait:
 
- // Construct a timer without setting an expiry time.
- boost::asio::deadline_timer timer(io_service);
+* an object `b1` which is an arbitrary copy of `b` made by the implementation
 
- // Set an expiry time relative to now.
- timer.expires_from_now(boost::posix_time::seconds(5));
+if any of the following conditions are true:
 
- // Wait for the timer to expire.
- timer.wait();
 
+* `s.post(a)` happens-before `s.post(b)`
 
 
+* `s.post(a)` happens-before `s.dispatch(b)`, where the latter is performed outside the strand
 
 
-Performing an asynchronous wait:
+* `s.dispatch(a)` happens-before `s.post(b)`, where the former is performed outside the strand
 
- void handler(const boost::system::error_code& error)
- {
- if (!error)
- {
- // Timer expired.
- }
- }
 
- ...
+* `s.dispatch(a)` happens-before `s.dispatch(b)`, where both are performed outside the strand
 
- // Construct a timer with an absolute expiry time.
- boost::asio::deadline_timer timer(io_service,
- boost::posix_time::time_from_string("2005-12-07 23:59:59.000"));
+then `asio_handler_invoke(a1, &a1)` happens-before `asio_handler_invoke(b1, &b1)`.
 
- // Start an asynchronous wait.
- timer.async_wait(handler);
+Note that in the following case:
 
+ async_op_1(..., s.wrap(a));
+ async_op_2(..., s.wrap(b));
 
 
+the completion of the first async operation will perform `s.dispatch(a)`, and the second will perform `s.dispatch(b)`, but the order in which those are performed is unspecified. That is, you cannot state whether one happens-before the other. Therefore none of the above conditions are met and no ordering guarantee is made.
 
 
-[heading Changing an active deadline_timer's expiry time]
+[heading Thread Safety]
   
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Safe.
 
-Changing the expiry time of a timer while there are pending asynchronous waits causes those wait operations to be cancelled. To ensure that the action associated with the timer is performed only once, use something like this: used:
 
 
 
- void on_some_event()
- {
- if (my_timer.expires_from_now(seconds(5)) > 0)
- {
- // We managed to cancel the timer. Start new asynchronous wait.
- my_timer.async_wait(on_timeout);
- }
- else
- {
- // Too late, timer has already expired!
- }
- }
+[heading Requirements]
 
- void on_timeout(const boost::system::error_code& e)
- {
- if (e != boost::asio::error::operation_aborted)
- {
- // Timer was not cancelled, take necessary action.
- }
- }
+[*Header: ][^boost/asio/strand.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[section:dispatch io_service::strand::dispatch]
 
+[indexterm2 dispatch..io_service::strand]
+Request the strand to invoke the given handler.
 
 
-* The `boost::asio::basic_deadline_timer::expires_from_now()` function cancels any pending asynchronous waits, and returns the number of asynchronous waits that were cancelled. If it returns 0 then you were too late and the wait handler has already been executed, or will soon be executed. If it returns 1 then the wait handler was successfully cancelled.
+ template<
+ typename ``[link boost_asio.reference.CompletionHandler CompletionHandler]``>
+ void dispatch(
+ CompletionHandler handler);
 
 
-* If a wait handler is cancelled, the boost::system::error\_code passed to it contains the value `boost::asio::error::operation_aborted`.
+This function is used to ask the strand to execute the given handler.
 
+The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The handler may be executed inside this function if the guarantee can be met. If this function is called from within a handler that was posted or dispatched through the same strand, then the new handler will be executed immediately.
 
+The strand's guarantee is in addition to the guarantee provided by the underlying [link boost_asio.reference.io_service `io_service`]. The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the io\_service's run member function is currently being invoked.
 
 
-[heading Requirements]
+[heading Parameters]
+
+
+[variablelist
+
+[[handler][The handler to be called. The strand will make a copy of the handler object as required. The function signature of the handler must be:
+``
+ void handler();
+``
+]]
+
+]
 
-[*Header: ][^boost/asio/deadline_timer.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:deadline_timer_service deadline_timer_service]
 
+[section:get_io_service io_service::strand::get_io_service]
 
-Default service implementation for a timer.
+[indexterm2 get_io_service..io_service::strand]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the strand.
 
 
- template<
- typename TimeType,
- typename ``[link boost_asio.reference.TimeTraits TimeTraits]`` = boost::asio::time_traits<TimeType>>
- class deadline_timer_service :
- public io_service::service
+ boost::asio::io_service & get_io_service();
 
 
-[heading Types]
-[table
- [[Name][Description]]
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the strand uses to dispatch handlers for asynchronous operations.
 
- [
 
- [[link boost_asio.reference.deadline_timer_service.duration_type [*duration_type]]]
- [The duration type. ]
-
- ]
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the strand will use to dispatch handlers. Ownership is not transferred to the caller.
 
- [
 
- [[link boost_asio.reference.deadline_timer_service.implementation_type [*implementation_type]]]
- [The implementation type of the deadline timer. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.deadline_timer_service.time_type [*time_type]]]
- [The time type. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.deadline_timer_service.traits_type [*traits_type]]]
- [The time traits type. ]
-
- ]
 
-]
+[section:post io_service::strand::post]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[indexterm2 post..io_service::strand]
+Request the strand to invoke the given handler and return immediately.
 
- [
- [[link boost_asio.reference.deadline_timer_service.async_wait [*async_wait]]]
- []
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.cancel [*cancel]]]
- [Cancel any asynchronous wait operations associated with the timer. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.construct [*construct]]]
- [Construct a new timer implementation. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.deadline_timer_service [*deadline_timer_service]]]
- [Construct a new timer service for the specified io_service. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.destroy [*destroy]]]
- [Destroy a timer implementation. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.expires_at [*expires_at]]]
- [Get the expiry time for the timer as an absolute time.
 
- Set the expiry time for the timer as an absolute time. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.expires_from_now [*expires_from_now]]]
- [Get the expiry time for the timer relative to now.
+ template<
+ typename ``[link boost_asio.reference.CompletionHandler CompletionHandler]``>
+ void post(
+ CompletionHandler handler);
 
- Set the expiry time for the timer relative to now. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
-
- [
- [[link boost_asio.reference.deadline_timer_service.wait [*wait]]]
- []
- ]
-
-]
 
-[heading Data Members]
-[table
- [[Name][Description]]
+This function is used to ask the strand to execute the given handler, but without allowing the strand to call the handler from inside this function.
 
- [
- [[link boost_asio.reference.deadline_timer_service.id [*id]]]
- [The unique service identifier. ]
- ]
+The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The strand's guarantee is in addition to the guarantee provided by the underlying [link boost_asio.reference.io_service `io_service`]. The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the io\_service's run member function is currently being invoked.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[handler][The handler to be called. The strand will make a copy of the handler object as required. The function signature of the handler must be:
+``
+ void handler();
+``
+]]
 
 ]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/deadline_timer_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[endsect]
 
-[section:async_wait deadline_timer_service::async_wait]
 
-[indexterm2 async_wait..deadline_timer_service]
 
- template<
- typename ``[link boost_asio.reference.WaitHandler WaitHandler]``>
- void async_wait(
- implementation_type & impl,
- WaitHandler handler);
+[section:strand io_service::strand::strand]
 
+[indexterm2 strand..io_service::strand]
+Constructor.
 
 
-[endsect]
+ strand(
+ boost::asio::io_service & io_service);
 
 
+Constructs the strand.
 
-[section:cancel deadline_timer_service::cancel]
 
-[indexterm2 cancel..deadline_timer_service]
-Cancel any asynchronous wait operations associated with the timer.
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the strand will use to dispatch handlers that are ready to be run. ]]
 
+]
 
- std::size_t cancel(
- implementation_type & impl,
- boost::system::error_code & ec);
 
 
 
@@ -36349,44 +54383,59 @@
 
 
 
-[section:construct deadline_timer_service::construct]
+[section:wrap io_service::strand::wrap]
 
-[indexterm2 construct..deadline_timer_service]
-Construct a new timer implementation.
+[indexterm2 wrap..io_service::strand]
+Create a new handler that automatically dispatches the wrapped handler on the strand.
 
 
- void construct(
- implementation_type & impl);
+ template<
+ typename ``[link boost_asio.reference.Handler Handler]``>
+ unspecified wrap(
+ Handler handler);
 
 
+This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the strand's dispatch function.
 
-[endsect]
 
+[heading Parameters]
+
 
+[variablelist
+
+[[handler][The handler to be wrapped. The strand will make a copy of the handler object as required. The function signature of the handler must be:
+``
+ void handler(A1 a1, ... An an);
+``
+]]
 
-[section:deadline_timer_service deadline_timer_service::deadline_timer_service]
+]
 
-[indexterm2 deadline_timer_service..deadline_timer_service]
-Construct a new timer service for the specified [link boost_asio.reference.io_service `io_service`].
 
+[heading Return Value]
+
+A function object that, when invoked, passes the wrapped handler to the strand's dispatch function. Given a function object with the signature:
 
- deadline_timer_service(
- boost::asio::io_service & io_service);
+ R f(A1 a1, ... An an);
 
 
+If this function object is passed to the wrap function like so:
 
-[endsect]
+ strand.wrap(f);
 
 
+then the return value is a function object with the signature
+
+ void g(A1 a1, ... An an);
+
+
+that, when invoked, executes code equivalent to:
+
+ strand.dispatch(boost::bind(f, a1, ... an));
 
-[section:destroy deadline_timer_service::destroy]
 
-[indexterm2 destroy..deadline_timer_service]
-Destroy a timer implementation.
 
 
- void destroy(
- implementation_type & impl);
 
 
 
@@ -36394,581 +54443,566 @@
 
 
 
-[section:duration_type deadline_timer_service::duration_type]
+[section:_strand io_service::strand::~strand]
 
-[indexterm2 duration_type..deadline_timer_service]
-The duration type.
+[indexterm2 ~strand..io_service::strand]
+Destructor.
 
 
- typedef traits_type::duration_type duration_type;
+ ~strand();
 
 
+Destroys a strand.
 
-[heading Requirements]
+Handlers posted through the strand that have not yet been invoked will still be dispatched in a way that meets the guarantee of non-concurrency.
 
-[*Header: ][^boost/asio/deadline_timer_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
+
 
 
 [endsect]
 
+[section:io_service__work io_service::work]
+
 
-[section:expires_at deadline_timer_service::expires_at]
+Class to inform the [link boost_asio.reference.io_service `io_service`] when it has work to do.
 
-[indexterm2 expires_at..deadline_timer_service]
-Get the expiry time for the timer as an absolute time.
 
+ class work
 
- time_type ``[link boost_asio.reference.deadline_timer_service.expires_at.overload1 expires_at]``(
- const implementation_type & impl) const;
- `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_at.overload1 more...]]``
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.io_service__work.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the work. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service__work.work [*work]]]
+ [Constructor notifies the io_service that work is starting.
+
+ Copy constructor notifies the io_service that work is starting. ]
+ ]
+
+ [
+ [[link boost_asio.reference.io_service__work._work [*~work]]]
+ [Destructor notifies the io_service that the work is complete. ]
+ ]
+
+]
+
+The work class is used to inform the [link boost_asio.reference.io_service `io_service`] when work starts and finishes. This ensures that the [link boost_asio.reference.io_service `io_service`] object's `run()` function will not exit while work is underway, and that it does exit when there is no unfinished work remaining.
 
-Set the expiry time for the timer as an absolute time.
+The work class is copy-constructible so that it may be used as a data member in a handler class. It is not assignable.
 
+[heading Requirements]
 
- std::size_t ``[link boost_asio.reference.deadline_timer_service.expires_at.overload2 expires_at]``(
- implementation_type & impl,
- const time_type & expiry_time,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_at.overload2 more...]]``
+[*Header: ][^boost/asio/io_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:overload1 deadline_timer_service::expires_at (1 of 2 overloads)]
 
+[section:get_io_service io_service::work::get_io_service]
 
-Get the expiry time for the timer as an absolute time.
+[indexterm2 get_io_service..io_service::work]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the work.
 
 
- time_type expires_at(
- const implementation_type & impl) const;
+ boost::asio::io_service & get_io_service();
 
 
 
 [endsect]
 
 
+[section:work io_service::work::work]
 
-[section:overload2 deadline_timer_service::expires_at (2 of 2 overloads)]
+[indexterm2 work..io_service::work]
+Constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
 
 
-Set the expiry time for the timer as an absolute time.
+ explicit ``[link boost_asio.reference.io_service__work.work.overload1 work]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.io_service__work.work.overload1 more...]]``
 
 
- std::size_t expires_at(
- implementation_type & impl,
- const time_type & expiry_time,
- boost::system::error_code & ec);
+Copy constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
 
 
+ ``[link boost_asio.reference.io_service__work.work.overload2 work]``(
+ const work & other);
+ `` [''''&raquo;''' [link boost_asio.reference.io_service__work.work.overload2 more...]]``
 
-[endsect]
 
+[section:overload1 io_service::work::work (1 of 2 overloads)]
 
-[endsect]
 
-[section:expires_from_now deadline_timer_service::expires_from_now]
+Constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
 
-[indexterm2 expires_from_now..deadline_timer_service]
-Get the expiry time for the timer relative to now.
+
+ work(
+ boost::asio::io_service & io_service);
 
 
- duration_type ``[link boost_asio.reference.deadline_timer_service.expires_from_now.overload1 expires_from_now]``(
- const implementation_type & impl) const;
- `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_from_now.overload1 more...]]``
+The constructor is used to inform the [link boost_asio.reference.io_service `io_service`] that some work has begun. This ensures that the [link boost_asio.reference.io_service `io_service`] object's `run()` function will not exit while the work is underway.
 
 
-Set the expiry time for the timer relative to now.
+[endsect]
 
 
- std::size_t ``[link boost_asio.reference.deadline_timer_service.expires_from_now.overload2 expires_from_now]``(
- implementation_type & impl,
- const duration_type & expiry_time,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.deadline_timer_service.expires_from_now.overload2 more...]]``
 
+[section:overload2 io_service::work::work (2 of 2 overloads)]
 
-[section:overload1 deadline_timer_service::expires_from_now (1 of 2 overloads)]
 
+Copy constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
 
-Get the expiry time for the timer relative to now.
 
+ work(
+ const work & other);
 
- duration_type expires_from_now(
- const implementation_type & impl) const;
 
+The constructor is used to inform the [link boost_asio.reference.io_service `io_service`] that some work has begun. This ensures that the [link boost_asio.reference.io_service `io_service`] object's `run()` function will not exit while the work is underway.
 
 
 [endsect]
 
 
-
-[section:overload2 deadline_timer_service::expires_from_now (2 of 2 overloads)]
+[endsect]
 
 
-Set the expiry time for the timer relative to now.
+[section:_work io_service::work::~work]
 
+[indexterm2 ~work..io_service::work]
+Destructor notifies the [link boost_asio.reference.io_service `io_service`] that the work is complete.
 
- std::size_t expires_from_now(
- implementation_type & impl,
- const duration_type & expiry_time,
- boost::system::error_code & ec);
 
+ ~work();
 
 
-[endsect]
+The destructor is used to inform the [link boost_asio.reference.io_service `io_service`] that some work has finished. Once the count of unfinished work reaches zero, the [link boost_asio.reference.io_service `io_service`] object's `run()` function is permitted to exit.
 
 
 [endsect]
 
 
-[section:get_io_service deadline_timer_service::get_io_service]
-
 
-['Inherited from io_service.]
+[endsect]
 
-[indexterm2 get_io_service..deadline_timer_service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+[section:ip__address ip::address]
 
 
- boost::asio::io_service & get_io_service();
+Implements version-independent IP addresses.
 
 
+ class address
 
-[endsect]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__address.address [*address]]]
+ [Default constructor.
 
-[section:id deadline_timer_service::id]
+ Construct an address from an IPv4 address.
 
-[indexterm2 id..deadline_timer_service]
-The unique service identifier.
+ Construct an address from an IPv6 address.
 
+ Copy constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.from_string [*from_string]]]
+ [Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.is_loopback [*is_loopback]]]
+ [Determine whether the address is a loopback address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.is_multicast [*is_multicast]]]
+ [Determine whether the address is a multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.is_unspecified [*is_unspecified]]]
+ [Determine whether the address is unspecified. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.is_v4 [*is_v4]]]
+ [Get whether the address is an IP version 4 address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.is_v6 [*is_v6]]]
+ [Get whether the address is an IP version 6 address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.operator_eq_ [*operator=]]]
+ [Assign from another address.
 
- static boost::asio::io_service::id id;
+ Assign from an IPv4 address.
 
+ Assign from an IPv6 address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.to_string [*to_string]]]
+ [Get the address as a string in dotted decimal format. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.to_v4 [*to_v4]]]
+ [Get the address as an IP version 4 address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.to_v6 [*to_v6]]]
+ [Get the address as an IP version 6 address. ]
+ ]
+
+]
 
+[heading Friends]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__address.operator_not__eq_ [*operator!=]]]
+ [Compare two addresses for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.operator_lt_ [*operator<]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.operator_lt__eq_ [*operator<=]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.operator_eq__eq_ [*operator==]]]
+ [Compare two addresses for equality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.operator_gt_ [*operator>]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address.operator_gt__eq_ [*operator>=]]]
+ [Compare addresses for ordering. ]
+ ]
+
+]
 
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__address.operator_lt__lt_ [*operator<<]]]
+ [Output an address as a string. ]
+ ]
+
+]
 
-[section:implementation_type deadline_timer_service::implementation_type]
+The [link boost_asio.reference.ip__address `ip::address`] class provides the ability to use either IP version 4 or version 6 addresses.
 
-[indexterm2 implementation_type..deadline_timer_service]
-The implementation type of the deadline timer.
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
- typedef implementation_defined implementation_type;
+[*Shared] [*objects:] Unsafe.
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/deadline_timer_service.hpp]
+[*Header: ][^boost/asio/ip/address.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
+[section:address ip::address::address]
 
-[endsect]
+[indexterm2 address..ip::address]
+Default constructor.
 
 
+ ``[link boost_asio.reference.ip__address.address.overload1 address]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload1 more...]]``
 
-[section:io_service deadline_timer_service::io_service]
 
+Construct an address from an IPv4 address.
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..deadline_timer_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+ ``[link boost_asio.reference.ip__address.address.overload2 address]``(
+ const boost::asio::ip::address_v4 & ipv4_address);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload2 more...]]``
 
 
- boost::asio::io_service & io_service();
+Construct an address from an IPv6 address.
 
 
+ ``[link boost_asio.reference.ip__address.address.overload3 address]``(
+ const boost::asio::ip::address_v6 & ipv6_address);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload3 more...]]``
 
-[endsect]
 
+Copy constructor.
 
 
-[section:shutdown_service deadline_timer_service::shutdown_service]
+ ``[link boost_asio.reference.ip__address.address.overload4 address]``(
+ const address & other);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload4 more...]]``
 
-[indexterm2 shutdown_service..deadline_timer_service]
-Destroy all user-defined handler objects owned by the service.
 
+[section:overload1 ip::address::address (1 of 4 overloads)]
 
- virtual void shutdown_service();
 
+Default constructor.
 
 
-[endsect]
+ address();
 
 
 
-[section:time_type deadline_timer_service::time_type]
+[endsect]
 
-[indexterm2 time_type..deadline_timer_service]
-The time type.
 
 
- typedef traits_type::time_type time_type;
+[section:overload2 ip::address::address (2 of 4 overloads)]
 
 
+Construct an address from an IPv4 address.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/deadline_timer_service.hpp]
+ address(
+ const boost::asio::ip::address_v4 & ipv4_address);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:traits_type deadline_timer_service::traits_type]
+[section:overload3 ip::address::address (3 of 4 overloads)]
 
-[indexterm2 traits_type..deadline_timer_service]
-The time traits type.
 
+Construct an address from an IPv6 address.
 
- typedef TimeTraits traits_type;
 
+ address(
+ const boost::asio::ip::address_v6 & ipv6_address);
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/deadline_timer_service.hpp]
+[endsect]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:overload4 ip::address::address (4 of 4 overloads)]
 
 
+Copy constructor.
 
-[section:wait deadline_timer_service::wait]
 
-[indexterm2 wait..deadline_timer_service]
+ address(
+ const address & other);
+
 
- void wait(
- implementation_type & impl,
- boost::system::error_code & ec);
 
+[endsect]
 
 
 [endsect]
 
+[section:from_string ip::address::from_string]
 
+[indexterm2 from_string..ip::address]
+Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
-[endsect]
 
+ static address ``[link boost_asio.reference.ip__address.from_string.overload1 from_string]``(
+ const char * str);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload1 more...]]``
 
-[section:error__addrinfo_category error::addrinfo_category]
+ static address ``[link boost_asio.reference.ip__address.from_string.overload2 from_string]``(
+ const char * str,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload2 more...]]``
 
-[indexterm1 error::addrinfo_category]
+ static address ``[link boost_asio.reference.ip__address.from_string.overload3 from_string]``(
+ const std::string & str);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload3 more...]]``
 
- static const boost::system::error_category & addrinfo_category = boost::asio::error::get_addrinfo_category();
+ static address ``[link boost_asio.reference.ip__address.from_string.overload4 from_string]``(
+ const std::string & str,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload4 more...]]``
 
 
-[heading Requirements]
+[section:overload1 ip::address::from_string (1 of 4 overloads)]
 
-[*Header: ][^boost/asio/error.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
+
+
+ static address from_string(
+ const char * str);
+
 
 
 [endsect]
 
 
 
-[section:error__addrinfo_errors error::addrinfo_errors]
+[section:overload2 ip::address::from_string (2 of 4 overloads)]
 
-[indexterm1 error::addrinfo_errors]
 
- enum addrinfo_errors
+Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
-[indexterm2 service_not_found..error::addrinfo_errors]
-[indexterm2 socket_type_not_supported..error::addrinfo_errors]
 
-[heading Values]
-[variablelist
+ static address from_string(
+ const char * str,
+ boost::system::error_code & ec);
 
- [
- [service_not_found]
- [The service is not supported for the given socket type. ]
- ]
 
- [
- [socket_type_not_supported]
- [The socket type is not supported. ]
- ]
 
-]
+[endsect]
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[section:overload3 ip::address::from_string (3 of 4 overloads)]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
-[endsect]
 
+ static address from_string(
+ const std::string & str);
 
 
-[section:error__basic_errors error::basic_errors]
 
-[indexterm1 error::basic_errors]
+[endsect]
 
- enum basic_errors
 
-[indexterm2 access_denied..error::basic_errors]
-[indexterm2 address_family_not_supported..error::basic_errors]
-[indexterm2 address_in_use..error::basic_errors]
-[indexterm2 already_connected..error::basic_errors]
-[indexterm2 already_started..error::basic_errors]
-[indexterm2 broken_pipe..error::basic_errors]
-[indexterm2 connection_aborted..error::basic_errors]
-[indexterm2 connection_refused..error::basic_errors]
-[indexterm2 connection_reset..error::basic_errors]
-[indexterm2 bad_descriptor..error::basic_errors]
-[indexterm2 fault..error::basic_errors]
-[indexterm2 host_unreachable..error::basic_errors]
-[indexterm2 in_progress..error::basic_errors]
-[indexterm2 interrupted..error::basic_errors]
-[indexterm2 invalid_argument..error::basic_errors]
-[indexterm2 message_size..error::basic_errors]
-[indexterm2 name_too_long..error::basic_errors]
-[indexterm2 network_down..error::basic_errors]
-[indexterm2 network_reset..error::basic_errors]
-[indexterm2 network_unreachable..error::basic_errors]
-[indexterm2 no_descriptors..error::basic_errors]
-[indexterm2 no_buffer_space..error::basic_errors]
-[indexterm2 no_memory..error::basic_errors]
-[indexterm2 no_permission..error::basic_errors]
-[indexterm2 no_protocol_option..error::basic_errors]
-[indexterm2 not_connected..error::basic_errors]
-[indexterm2 not_socket..error::basic_errors]
-[indexterm2 operation_aborted..error::basic_errors]
-[indexterm2 operation_not_supported..error::basic_errors]
-[indexterm2 shut_down..error::basic_errors]
-[indexterm2 timed_out..error::basic_errors]
-[indexterm2 try_again..error::basic_errors]
-[indexterm2 would_block..error::basic_errors]
 
-[heading Values]
-[variablelist
+[section:overload4 ip::address::from_string (4 of 4 overloads)]
 
- [
- [access_denied]
- [Permission denied. ]
- ]
 
- [
- [address_family_not_supported]
- [Address family not supported by protocol. ]
- ]
+Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
- [
- [address_in_use]
- [Address already in use. ]
- ]
 
- [
- [already_connected]
- [Transport endpoint is already connected. ]
- ]
+ static address from_string(
+ const std::string & str,
+ boost::system::error_code & ec);
 
- [
- [already_started]
- [Operation already in progress. ]
- ]
 
- [
- [broken_pipe]
- [Broken pipe. ]
- ]
 
- [
- [connection_aborted]
- [A connection has been aborted. ]
- ]
+[endsect]
 
- [
- [connection_refused]
- [Connection refused. ]
- ]
 
- [
- [connection_reset]
- [Connection reset by peer. ]
- ]
+[endsect]
 
- [
- [bad_descriptor]
- [Bad file descriptor. ]
- ]
 
- [
- [fault]
- [Bad address. ]
- ]
+[section:is_loopback ip::address::is_loopback]
 
- [
- [host_unreachable]
- [No route to host. ]
- ]
+[indexterm2 is_loopback..ip::address]
+Determine whether the address is a loopback address.
 
- [
- [in_progress]
- [Operation now in progress. ]
- ]
 
- [
- [interrupted]
- [Interrupted system call. ]
- ]
+ bool is_loopback() const;
 
- [
- [invalid_argument]
- [Invalid argument. ]
- ]
 
- [
- [message_size]
- [Message too long. ]
- ]
 
- [
- [name_too_long]
- [The name was too long. ]
- ]
+[endsect]
 
- [
- [network_down]
- [Network is down. ]
- ]
 
- [
- [network_reset]
- [Network dropped connection on reset. ]
- ]
 
- [
- [network_unreachable]
- [Network is unreachable. ]
- ]
+[section:is_multicast ip::address::is_multicast]
 
- [
- [no_descriptors]
- [Too many open files. ]
- ]
+[indexterm2 is_multicast..ip::address]
+Determine whether the address is a multicast address.
 
- [
- [no_buffer_space]
- [No buffer space available. ]
- ]
 
- [
- [no_memory]
- [Cannot allocate memory. ]
- ]
+ bool is_multicast() const;
 
- [
- [no_permission]
- [Operation not permitted. ]
- ]
 
- [
- [no_protocol_option]
- [Protocol not available. ]
- ]
 
- [
- [not_connected]
- [Transport endpoint is not connected. ]
- ]
+[endsect]
 
- [
- [not_socket]
- [Socket operation on non-socket. ]
- ]
 
- [
- [operation_aborted]
- [Operation cancelled. ]
- ]
 
- [
- [operation_not_supported]
- [Operation not supported. ]
- ]
+[section:is_unspecified ip::address::is_unspecified]
 
- [
- [shut_down]
- [Cannot send after transport endpoint shutdown. ]
- ]
+[indexterm2 is_unspecified..ip::address]
+Determine whether the address is unspecified.
+
+
+ bool is_unspecified() const;
 
- [
- [timed_out]
- [Connection timed out. ]
- ]
 
- [
- [try_again]
- [Resource temporarily unavailable. ]
- ]
 
- [
- [would_block]
- [The socket is marked non-blocking and the requested operation would block. ]
- ]
+[endsect]
 
-]
 
 
-[heading Requirements]
+[section:is_v4 ip::address::is_v4]
 
-[*Header: ][^boost/asio/error.hpp]
+[indexterm2 is_v4..ip::address]
+Get whether the address is an IP version 4 address.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ bool is_v4() const;
 
-[endsect]
 
 
+[endsect]
 
-[section:error__get_addrinfo_category error::get_addrinfo_category]
 
-[indexterm1 error::get_addrinfo_category]
 
- const boost::system::error_category & get_addrinfo_category();
+[section:is_v6 ip::address::is_v6]
 
+[indexterm2 is_v6..ip::address]
+Get whether the address is an IP version 6 address.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+ bool is_v6() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:error__get_misc_category error::get_misc_category]
+[section:operator_not__eq_ ip::address::operator!=]
 
-[indexterm1 error::get_misc_category]
+[indexterm2 operator!=..ip::address]
+Compare two addresses for inequality.
 
- const boost::system::error_category & get_misc_category();
+
+ friend bool operator!=(
+ const address & a1,
+ const address & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[*Header: ][^boost/asio/ip/address.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -36977,16 +55011,20 @@
 
 
 
-[section:error__get_netdb_category error::get_netdb_category]
+[section:operator_lt_ ip::address::operator<]
 
-[indexterm1 error::get_netdb_category]
+[indexterm2 operator<..ip::address]
+Compare addresses for ordering.
 
- const boost::system::error_category & get_netdb_category();
+
+ friend bool operator<(
+ const address & a1,
+ const address & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[*Header: ][^boost/asio/ip/address.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -36995,34 +55033,60 @@
 
 
 
-[section:error__get_ssl_category error::get_ssl_category]
+[section:operator_lt__lt_ ip::address::operator<<]
 
-[indexterm1 error::get_ssl_category]
+[indexterm2 operator<<..ip::address]
+Output an address as a string.
 
- const boost::system::error_category & get_ssl_category();
+
+ template<
+ typename Elem,
+ typename Traits>
+ std::basic_ostream< Elem, Traits > & operator<<(
+ std::basic_ostream< Elem, Traits > & os,
+ const address & addr);
 
 
-[heading Requirements]
+Used to output a human-readable string for a specified address.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[os][The output stream to which the string will be written.]]
+
+[[addr][The address to be written.]]
+
+]
+
+
+[heading Return Value]
+
+The output stream.
 
-[*Header: ][^boost/asio/error.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:error__get_system_category error::get_system_category]
+[section:operator_lt__eq_ ip::address::operator<=]
 
-[indexterm1 error::get_system_category]
+[indexterm2 operator<=..ip::address]
+Compare addresses for ordering.
 
- const boost::system::error_category & get_system_category();
+
+ friend bool operator<=(
+ const address & a1,
+ const address & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[*Header: ][^boost/asio/ip/address.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -37030,43 +55094,41 @@
 [endsect]
 
 
-[section:error__make_error_code error::make_error_code]
+[section:operator_eq_ ip::address::operator=]
 
-[indexterm1 error::make_error_code]
-
- boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload1 make_error_code]``(
- basic_errors e);
- `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload1 more...]]``
+[indexterm2 operator=..ip::address]
+Assign from another address.
 
- boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload2 make_error_code]``(
- netdb_errors e);
- `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload2 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload3 make_error_code]``(
- addrinfo_errors e);
- `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload3 more...]]``
+ address & ``[link boost_asio.reference.ip__address.operator_eq_.overload1 operator=]``(
+ const address & other);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload4 make_error_code]``(
- misc_errors e);
- `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload4 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.error__make_error_code.overload5 make_error_code]``(
- ssl_errors e);
- `` [''''&raquo;''' [link boost_asio.reference.error__make_error_code.overload5 more...]]``
+Assign from an IPv4 address.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+ address & ``[link boost_asio.reference.ip__address.operator_eq_.overload2 operator=]``(
+ const boost::asio::ip::address_v4 & ipv4_address);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload2 more...]]``
 
-[*Convenience header: ][^boost/asio.hpp]
 
+Assign from an IPv6 address.
 
-[section:overload1 error::make_error_code (1 of 5 overloads)]
 
+ address & ``[link boost_asio.reference.ip__address.operator_eq_.overload3 operator=]``(
+ const boost::asio::ip::address_v6 & ipv6_address);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload3 more...]]``
 
 
- boost::system::error_code make_error_code(
- basic_errors e);
+[section:overload1 ip::address::operator= (1 of 3 overloads)]
+
+
+Assign from another address.
+
+
+ address & operator=(
+ const address & other);
 
 
 
@@ -37074,12 +55136,14 @@
 
 
 
-[section:overload2 error::make_error_code (2 of 5 overloads)]
+[section:overload2 ip::address::operator= (2 of 3 overloads)]
+
 
+Assign from an IPv4 address.
 
 
- boost::system::error_code make_error_code(
- netdb_errors e);
+ address & operator=(
+ const boost::asio::ip::address_v4 & ipv4_address);
 
 
 
@@ -37087,57 +55151,81 @@
 
 
 
-[section:overload3 error::make_error_code (3 of 5 overloads)]
+[section:overload3 ip::address::operator= (3 of 3 overloads)]
+
 
+Assign from an IPv6 address.
 
 
- boost::system::error_code make_error_code(
- addrinfo_errors e);
+ address & operator=(
+ const boost::asio::ip::address_v6 & ipv6_address);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload4 error::make_error_code (4 of 5 overloads)]
 
+[section:operator_eq__eq_ ip::address::operator==]
 
+[indexterm2 operator==..ip::address]
+Compare two addresses for equality.
 
- boost::system::error_code make_error_code(
- misc_errors e);
 
+ friend bool operator==(
+ const address & a1,
+ const address & a2);
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/address.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload5 error::make_error_code (5 of 5 overloads)]
+[section:operator_gt_ ip::address::operator>]
 
+[indexterm2 operator>..ip::address]
+Compare addresses for ordering.
 
 
- boost::system::error_code make_error_code(
- ssl_errors e);
+ friend bool operator>(
+ const address & a1,
+ const address & a2);
+
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:error__misc_category error::misc_category]
 
-[indexterm1 error::misc_category]
+[section:operator_gt__eq_ ip::address::operator>=]
 
- static const boost::system::error_category & misc_category = boost::asio::error::get_misc_category();
+[indexterm2 operator>=..ip::address]
+Compare addresses for ordering.
+
+
+ friend bool operator>=(
+ const address & a1,
+ const address & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[*Header: ][^boost/asio/ip/address.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -37145,663 +55233,613 @@
 [endsect]
 
 
+[section:to_string ip::address::to_string]
 
-[section:error__misc_errors error::misc_errors]
+[indexterm2 to_string..ip::address]
+Get the address as a string in dotted decimal format.
 
-[indexterm1 error::misc_errors]
 
- enum misc_errors
+ std::string ``[link boost_asio.reference.ip__address.to_string.overload1 to_string]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload1 more...]]``
 
-[indexterm2 already_open..error::misc_errors]
-[indexterm2 eof..error::misc_errors]
-[indexterm2 not_found..error::misc_errors]
-[indexterm2 fd_set_failure..error::misc_errors]
+ std::string ``[link boost_asio.reference.ip__address.to_string.overload2 to_string]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload2 more...]]``
 
-[heading Values]
-[variablelist
 
- [
- [already_open]
- [Already open. ]
- ]
+[section:overload1 ip::address::to_string (1 of 2 overloads)]
 
- [
- [eof]
- [End of file or stream. ]
- ]
 
- [
- [not_found]
- [Element not found. ]
- ]
+Get the address as a string in dotted decimal format.
 
- [
- [fd_set_failure]
- [The descriptor cannot fit into the select system call's fd_set. ]
- ]
 
-]
+ std::string to_string() const;
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[endsect]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:overload2 ip::address::to_string (2 of 2 overloads)]
 
 
+Get the address as a string in dotted decimal format.
 
-[section:error__netdb_category error::netdb_category]
 
-[indexterm1 error::netdb_category]
+ std::string to_string(
+ boost::system::error_code & ec) const;
 
- static const boost::system::error_category & netdb_category = boost::asio::error::get_netdb_category();
 
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/error.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
-[endsect]
+[section:to_v4 ip::address::to_v4]
 
+[indexterm2 to_v4..ip::address]
+Get the address as an IP version 4 address.
 
 
-[section:error__netdb_errors error::netdb_errors]
+ boost::asio::ip::address_v4 to_v4() const;
 
-[indexterm1 error::netdb_errors]
 
- enum netdb_errors
 
-[indexterm2 host_not_found..error::netdb_errors]
-[indexterm2 host_not_found_try_again..error::netdb_errors]
-[indexterm2 no_data..error::netdb_errors]
-[indexterm2 no_recovery..error::netdb_errors]
+[endsect]
 
-[heading Values]
-[variablelist
 
- [
- [host_not_found]
- [Host not found (authoritative). ]
- ]
 
- [
- [host_not_found_try_again]
- [Host not found (non-authoritative). ]
- ]
+[section:to_v6 ip::address::to_v6]
 
- [
- [no_data]
- [The query is valid but does not have associated address data. ]
- ]
+[indexterm2 to_v6..ip::address]
+Get the address as an IP version 6 address.
 
- [
- [no_recovery]
- [A non-recoverable error occurred. ]
- ]
 
-]
+ boost::asio::ip::address_v6 to_v6() const;
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[endsect]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
+[section:ip__address_v4 ip::address_v4]
 
 
-[section:error__ssl_category error::ssl_category]
+Implements IP version 4 style addresses.
 
-[indexterm1 error::ssl_category]
 
- static const boost::system::error_category & ssl_category = boost::asio::error::get_ssl_category();
+ class address_v4
 
 
-[heading Requirements]
+[heading Types]
+[table
+ [[Name][Description]]
 
-[*Header: ][^boost/asio/error.hpp]
+ [
 
-[*Convenience header: ][^boost/asio.hpp]
+ [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
+ [The type used to represent an address as an array of bytes. ]
+
+ ]
 
+]
 
-[endsect]
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
+ [Default constructor.
 
+ Construct an address from raw bytes.
 
-[section:error__ssl_errors error::ssl_errors]
+ Construct an address from a unsigned long in host byte order.
 
-[indexterm1 error::ssl_errors]
+ Copy constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.any [*any]]]
+ [Obtain an address object that represents any address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
+ [Obtain an address object that represents the broadcast address.
+
+ Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
+ [Create an address from an IP address string in dotted decimal form. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
+ [Determine whether the address is a class A address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
+ [Determine whether the address is a class B address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
+ [Determine whether the address is a class C address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.is_loopback [*is_loopback]]]
+ [Determine whether the address is a loopback address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
+ [Determine whether the address is a multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.is_unspecified [*is_unspecified]]]
+ [Determine whether the address is unspecified. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
+ [Obtain an address object that represents the loopback address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
+ [Obtain the netmask that corresponds to the address, based on its address class. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
+ [Assign from another address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
+ [Get the address in bytes, in network byte order. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
+ [Get the address as a string in dotted decimal format. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
+ [Get the address as an unsigned long in host byte order. ]
+ ]
+
+]
+
+[heading Friends]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
+ [Compare two addresses for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
+ [Compare two addresses for equality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
+ [Compare addresses for ordering. ]
+ ]
+
+]
+
+[heading Related Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
+ [Output an address as a string. ]
+ ]
+
+]
+
+The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
 
- enum ssl_errors
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
+[section:address_v4 ip::address_v4::address_v4]
 
-[endsect]
+[indexterm2 address_v4..ip::address_v4]
+Default constructor.
 
 
+ ``[link boost_asio.reference.ip__address_v4.address_v4.overload1 address_v4]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload1 more...]]``
 
-[section:error__system_category error::system_category]
 
-[indexterm1 error::system_category]
+Construct an address from raw bytes.
 
- static const boost::system::error_category & system_category = boost::asio::error::get_system_category();
 
+ explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload2 address_v4]``(
+ const bytes_type & bytes);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload2 more...]]``
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+Construct an address from a unsigned long in host byte order.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload3 address_v4]``(
+ unsigned long addr);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload3 more...]]``
 
-[endsect]
 
+Copy constructor.
 
 
-[section:has_service has_service]
+ ``[link boost_asio.reference.ip__address_v4.address_v4.overload4 address_v4]``(
+ const address_v4 & other);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload4 more...]]``
 
-[indexterm1 has_service]
 
- template<
- typename ``[link boost_asio.reference.Service Service]``>
- bool has_service(
- io_service & ios);
+[section:overload1 ip::address_v4::address_v4 (1 of 4 overloads)]
 
 
-This function is used to determine whether the [link boost_asio.reference.io_service `io_service`] contains a service object corresponding to the given service type.
+Default constructor.
 
 
-[heading Parameters]
-
+ address_v4();
 
-[variablelist
-
-[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
-]
+
+[endsect]
 
 
-[heading Return Value]
-
-A boolean indicating whether the [link boost_asio.reference.io_service `io_service`] contains the service.
 
+[section:overload2 ip::address_v4::address_v4 (2 of 4 overloads)]
 
 
-[heading Requirements]
+Construct an address from raw bytes.
 
-[*Header: ][^boost/asio/io_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ address_v4(
+ const bytes_type & bytes);
+
 
 
 [endsect]
 
 
-[section:invalid_service_owner invalid_service_owner]
 
+[section:overload3 ip::address_v4::address_v4 (3 of 4 overloads)]
 
-Exception thrown when trying to add a service object to an [link boost_asio.reference.io_service `io_service`] where the service has a different owner.
 
+Construct an address from a unsigned long in host byte order.
 
- class invalid_service_owner
 
+ address_v4(
+ unsigned long addr);
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.invalid_service_owner.invalid_service_owner [*invalid_service_owner]]]
- []
- ]
-
-]
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/io_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[section:overload4 ip::address_v4::address_v4 (4 of 4 overloads)]
 
-[section:invalid_service_owner invalid_service_owner::invalid_service_owner]
 
-[indexterm2 invalid_service_owner..invalid_service_owner]
+Copy constructor.
 
- invalid_service_owner();
 
+ address_v4(
+ const address_v4 & other);
 
 
-[endsect]
 
+[endsect]
 
 
 [endsect]
 
-[section:io_service io_service]
-
 
-Provides core I/O functionality.
+[section:any ip::address_v4::any]
 
+[indexterm2 any..ip::address_v4]
+Obtain an address object that represents any address.
 
- class io_service :
- noncopyable
 
+ static address_v4 any();
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
 
- [[link boost_asio.reference.io_service__id [*id]]]
- [Class used to uniquely identify a service. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.io_service__service [*service]]]
- [Base class for all io_service services. ]
-
- ]
+[section:broadcast ip::address_v4::broadcast]
 
- [
+[indexterm2 broadcast..ip::address_v4]
+Obtain an address object that represents the broadcast address.
 
- [[link boost_asio.reference.io_service__strand [*strand]]]
- [Provides serialised handler execution. ]
-
- ]
 
- [
+ static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload1 broadcast]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload1 more...]]``
 
- [[link boost_asio.reference.io_service__work [*work]]]
- [Class to inform the io_service when it has work to do. ]
-
- ]
 
-]
+Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask.
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.io_service.dispatch [*dispatch]]]
- [Request the io_service to invoke the given handler. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.io_service [*io_service]]]
- [Constructor. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.poll [*poll]]]
- [Run the io_service object's event processing loop to execute ready handlers. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.poll_one [*poll_one]]]
- [Run the io_service object's event processing loop to execute one ready handler. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.post [*post]]]
- [Request the io_service to invoke the given handler and return immediately. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.reset [*reset]]]
- [Reset the io_service in preparation for a subsequent run() invocation. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.run [*run]]]
- [Run the io_service object's event processing loop. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.run_one [*run_one]]]
- [Run the io_service object's event processing loop to execute at most one handler. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.stop [*stop]]]
- [Stop the io_service object's event processing loop. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.wrap [*wrap]]]
- [Create a new handler that automatically dispatches the wrapped handler on the io_service. ]
- ]
-
- [
- [[link boost_asio.reference.io_service._io_service [*~io_service]]]
- [Destructor. ]
- ]
-
-]
+ static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload2 broadcast]``(
+ const address_v4 & addr,
+ const address_v4 & mask);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload2 more...]]``
 
-[heading Friends]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.io_service.add_service [*add_service]]]
- [Add a service object to the io_service. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.has_service [*has_service]]]
- [Determine if an io_service contains a specified service type. ]
- ]
-
- [
- [[link boost_asio.reference.io_service.use_service [*use_service]]]
- [Obtain the service object corresponding to the given type. ]
- ]
-
-]
+[section:overload1 ip::address_v4::broadcast (1 of 2 overloads)]
 
-The [link boost_asio.reference.io_service `io_service`] class provides the core I/O functionality for users of the asynchronous I/O objects, including:
 
+Obtain an address object that represents the broadcast address.
 
-* `boost::asio::ip::tcp::socket`
 
-* `boost::asio::ip::tcp::acceptor`
+ static address_v4 broadcast();
 
-* `boost::asio::ip::udp::socket`
 
-* `boost::asio::deadline_timer`.
 
-The [link boost_asio.reference.io_service `io_service`] class also includes facilities intended for developers of custom asynchronous services.
+[endsect]
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Safe, with the exception that calling `reset()` while there are unfinished `run()`, `run_one()`, `poll()` or `poll_one()` calls results in undefined behaviour.
+[section:overload2 ip::address_v4::broadcast (2 of 2 overloads)]
 
 
+Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask.
 
-[heading Synchronous and asynchronous operations]
-
 
+ static address_v4 broadcast(
+ const address_v4 & addr,
+ const address_v4 & mask);
 
-Synchronous operations on I/O objects implicitly run the [link boost_asio.reference.io_service `io_service`] object for an individual operation. The [link boost_asio.reference.io_service `io_service`] functions `run()`, `run_one()`, `poll()` or `poll_one()` must be called for the [link boost_asio.reference.io_service `io_service`] to perform asynchronous operations on behalf of a C++ program. Notification that an asynchronous operation has completed is delivered by invocation of the associated handler. Handlers are invoked only by a thread that is currently calling any overload of `run()`, `run_one()`, `poll()` or `poll_one()` for the [link boost_asio.reference.io_service `io_service`].
 
 
-[heading Effect of exceptions thrown from handlers]
-
+[endsect]
 
 
-If an exception is thrown from a handler, the exception is allowed to propagate through the throwing thread's invocation of `run()`, `run_one()`, `poll()` or `poll_one()`. No other threads that are calling any of these functions are affected. It is then the responsibility of the application to catch the exception.
+[endsect]
 
-After the exception has been caught, the `run()`, `run_one()`, `poll()` or `poll_one()` call may be restarted [*without] the need for an intervening call to `reset()`. This allows the thread to rejoin the [link boost_asio.reference.io_service `io_service`] object's thread pool without impacting any other threads in the pool.
 
-For example:
+[section:bytes_type ip::address_v4::bytes_type]
 
+[indexterm2 bytes_type..ip::address_v4]
+The type used to represent an address as an array of bytes.
 
 
- boost::asio::io_service io_service;
- ...
- for (;;)
- {
- try
- {
- io_service.run();
- break; // run() exited normally
- }
- catch (my_exception& e)
- {
- // Deal with exception as appropriate.
- }
- }
+ typedef array< unsigned char, 4 > bytes_type;
 
 
 
 
+[heading Remarks]
+
+This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`.
 
-[heading Stopping the io_service from running out of work]
-
 
 
-Some applications may need to prevent an [link boost_asio.reference.io_service `io_service`] object's `run()` call from returning when there is no more work to do. For example, the [link boost_asio.reference.io_service `io_service`] may be being run in a background thread that is launched prior to the application's asynchronous operations. The `run()` call may be kept running by creating an object of type [link boost_asio.reference.io_service__work `io_service::work`]:
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
- boost::asio::io_service io_service;
- boost::asio::io_service::work work(io_service);
- ...
 
+[endsect]
 
 
+[section:from_string ip::address_v4::from_string]
 
-To effect a shutdown, the application will then need to call the [link boost_asio.reference.io_service `io_service`] object's `stop()` member function. This will cause the [link boost_asio.reference.io_service `io_service`] `run()` call to return as soon as possible, abandoning unfinished operations and without permitting ready handlers to be dispatched.
+[indexterm2 from_string..ip::address_v4]
+Create an address from an IP address string in dotted decimal form.
 
-Alternatively, if the application requires that all operations and handlers be allowed to finish normally, the work object may be explicitly destroyed.
 
+ static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload1 from_string]``(
+ const char * str);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload1 more...]]``
 
+ static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload2 from_string]``(
+ const char * str,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload2 more...]]``
 
- boost::asio::io_service io_service;
- auto_ptr<boost::asio::io_service::work> work(
- new boost::asio::io_service::work(io_service));
- ...
- work.reset(); // Allow run() to exit.
+ static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload3 from_string]``(
+ const std::string & str);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload3 more...]]``
 
+ static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload4 from_string]``(
+ const std::string & str,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload4 more...]]``
 
 
+[section:overload1 ip::address_v4::from_string (1 of 4 overloads)]
 
 
-[heading The io_service class and I/O services]
-
+Create an address from an IP address string in dotted decimal form.
 
 
-Class [link boost_asio.reference.io_service `io_service`] implements an extensible, type-safe, polymorphic set of I/O services, indexed by service type. An object of class [link boost_asio.reference.io_service `io_service`] must be initialised before I/O objects such as sockets, resolvers and timers can be used. These I/O objects are distinguished by having constructors that accept an `io_service&` parameter.
+ static address_v4 from_string(
+ const char * str);
 
-I/O services exist to manage the logical interface to the operating system on behalf of the I/O objects. In particular, there are resources that are shared across a class of I/O objects. For example, timers may be implemented in terms of a single timer queue. The I/O services manage these shared resources.
 
-Access to the services of an [link boost_asio.reference.io_service `io_service`] is via three function templates, `use_service()`, `add_service()` and `has_service()`.
 
-In a call to `use_service<Service>()`, the type argument chooses a service, making available all members of the named type. If `Service` is not present in an [link boost_asio.reference.io_service `io_service`], an object of type `Service` is created and added to the [link boost_asio.reference.io_service `io_service`]. A C++ program can check if an [link boost_asio.reference.io_service `io_service`] implements a particular service with the function template `has_service<Service>()`.
+[endsect]
 
-Service objects may be explicitly added to an [link boost_asio.reference.io_service `io_service`] using the function template `add_service<Service>()`. If the `Service` is already present, the [link boost_asio.reference.service_already_exists `service_already_exists`] exception is thrown. If the owner of the service is not the same object as the [link boost_asio.reference.io_service `io_service`] parameter, the [link boost_asio.reference.invalid_service_owner `invalid_service_owner`] exception is thrown.
 
-Once a service reference is obtained from an [link boost_asio.reference.io_service `io_service`] object by calling `use_service()`, that reference remains usable as long as the owning [link boost_asio.reference.io_service `io_service`] object exists.
 
-All I/O service implementations have [link boost_asio.reference.io_service__service `io_service::service`] as a public base class. Custom I/O services may be implemented by deriving from this class and then added to an [link boost_asio.reference.io_service `io_service`] using the facilities described above.
+[section:overload2 ip::address_v4::from_string (2 of 4 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/io_service.hpp]
+Create an address from an IP address string in dotted decimal form.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ static address_v4 from_string(
+ const char * str,
+ boost::system::error_code & ec);
 
-[section:add_service io_service::add_service]
 
-[indexterm2 add_service..io_service]
-Add a service object to the [link boost_asio.reference.io_service `io_service`].
 
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.Service Service]``>
- friend void add_service(
- io_service & ios,
- Service * svc);
 
 
-This function is used to add a service to the [link boost_asio.reference.io_service `io_service`].
+[section:overload3 ip::address_v4::from_string (3 of 4 overloads)]
 
 
-[heading Parameters]
-
+Create an address from an IP address string in dotted decimal form.
 
-[variablelist
-
-[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
-[[svc][The service object. On success, ownership of the service object is transferred to the [link boost_asio.reference.io_service `io_service`]. When the [link boost_asio.reference.io_service `io_service`] object is destroyed, it will destroy the service object by performing:
-``
- delete static_cast<io_service::service*>(svc)
-``
-]]
+ static address_v4 from_string(
+ const std::string & str);
 
-]
 
 
-[heading Exceptions]
-
+[endsect]
 
-[variablelist
-
-[[boost::asio::service_already_exists][Thrown if a service of the given type is already present in the [link boost_asio.reference.io_service `io_service`].]]
 
-[[boost::asio::invalid_service_owner][Thrown if the service's owning [link boost_asio.reference.io_service `io_service`] is not the [link boost_asio.reference.io_service `io_service`] object specified by the ios parameter. ]]
 
-]
+[section:overload4 ip::address_v4::from_string (4 of 4 overloads)]
 
 
+Create an address from an IP address string in dotted decimal form.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/io_service.hpp]
+ static address_v4 from_string(
+ const std::string & str,
+ boost::system::error_code & ec);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:dispatch io_service::dispatch]
-
-[indexterm2 dispatch..io_service]
-Request the [link boost_asio.reference.io_service `io_service`] to invoke the given handler.
-
-
- template<
- typename ``[link boost_asio.reference.CompletionHandler CompletionHandler]``>
- void dispatch(
- CompletionHandler handler);
 
+[section:is_class_a ip::address_v4::is_class_a]
 
-This function is used to ask the [link boost_asio.reference.io_service `io_service`] to execute the given handler.
+[indexterm2 is_class_a..ip::address_v4]
+Determine whether the address is a class A address.
 
-The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked. The handler may be executed inside this function if the guarantee can be met.
 
+ bool is_class_a() const;
 
-[heading Parameters]
-
 
-[variablelist
-
-[[handler][The handler to be called. The [link boost_asio.reference.io_service `io_service`] will make a copy of the handler object as required. The function signature of the handler must be:
-``
- void handler();
-``
-]]
 
-]
+[endsect]
 
 
-[heading Remarks]
-
-This function throws an exception only if:
 
+[section:is_class_b ip::address_v4::is_class_b]
 
-* the handler's `asio_handler_allocate` function; or
+[indexterm2 is_class_b..ip::address_v4]
+Determine whether the address is a class B address.
 
 
-* the handler's copy constructor
+ bool is_class_b() const;
 
-throws an exception.
 
 
 [endsect]
 
 
 
-[section:has_service io_service::has_service]
+[section:is_class_c ip::address_v4::is_class_c]
 
-[indexterm2 has_service..io_service]
-Determine if an [link boost_asio.reference.io_service `io_service`] contains a specified service type.
+[indexterm2 is_class_c..ip::address_v4]
+Determine whether the address is a class C address.
 
 
- template<
- typename ``[link boost_asio.reference.Service Service]``>
- friend bool has_service(
- io_service & ios);
+ bool is_class_c() const;
 
 
-This function is used to determine whether the [link boost_asio.reference.io_service `io_service`] contains a service object corresponding to the given service type.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
-]
+[section:is_loopback ip::address_v4::is_loopback]
 
+[indexterm2 is_loopback..ip::address_v4]
+Determine whether the address is a loopback address.
 
-[heading Return Value]
-
-A boolean indicating whether the [link boost_asio.reference.io_service `io_service`] contains the service.
 
+ bool is_loopback() const;
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/io_service.hpp]
+[endsect]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:is_multicast ip::address_v4::is_multicast]
 
+[indexterm2 is_multicast..ip::address_v4]
+Determine whether the address is a multicast address.
 
-[section:io_service io_service::io_service]
 
-[indexterm2 io_service..io_service]
-Constructor.
+ bool is_multicast() const;
 
 
- ``[link boost_asio.reference.io_service.io_service.overload1 io_service]``();
- `` [''''&raquo;''' [link boost_asio.reference.io_service.io_service.overload1 more...]]``
 
- explicit ``[link boost_asio.reference.io_service.io_service.overload2 io_service]``(
- std::size_t concurrency_hint);
- `` [''''&raquo;''' [link boost_asio.reference.io_service.io_service.overload2 more...]]``
+[endsect]
 
 
-[section:overload1 io_service::io_service (1 of 2 overloads)]
 
+[section:is_unspecified ip::address_v4::is_unspecified]
 
-Constructor.
+[indexterm2 is_unspecified..ip::address_v4]
+Determine whether the address is unspecified.
 
 
- io_service();
+ bool is_unspecified() const;
 
 
 
@@ -37809,94 +55847,94 @@
 
 
 
-[section:overload2 io_service::io_service (2 of 2 overloads)]
-
+[section:loopback ip::address_v4::loopback]
 
-Constructor.
+[indexterm2 loopback..ip::address_v4]
+Obtain an address object that represents the loopback address.
 
 
- io_service(
- std::size_t concurrency_hint);
+ static address_v4 loopback();
 
 
-Construct with a hint about the required level of concurrency.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[concurrency_hint][A suggestion to the implementation on how many threads it should allow to run simultaneously. ]]
 
-]
+[section:netmask ip::address_v4::netmask]
 
+[indexterm2 netmask..ip::address_v4]
+Obtain the netmask that corresponds to the address, based on its address class.
 
 
+ static address_v4 netmask(
+ const address_v4 & addr);
 
-[endsect]
 
 
 [endsect]
 
-[section:poll io_service::poll]
 
-[indexterm2 poll..io_service]
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute ready handlers.
 
+[section:operator_not__eq_ ip::address_v4::operator!=]
 
- std::size_t ``[link boost_asio.reference.io_service.poll.overload1 poll]``();
- `` [''''&raquo;''' [link boost_asio.reference.io_service.poll.overload1 more...]]``
+[indexterm2 operator!=..ip::address_v4]
+Compare two addresses for inequality.
 
- std::size_t ``[link boost_asio.reference.io_service.poll.overload2 poll]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.io_service.poll.overload2 more...]]``
 
+ friend bool operator!=(
+ const address_v4 & a1,
+ const address_v4 & a2);
 
-[section:overload1 io_service::poll (1 of 2 overloads)]
 
+[heading Requirements]
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute ready handlers.
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
- std::size_t poll();
 
+[endsect]
 
-The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_service `io_service`] has been stopped or there are no more ready handlers.
 
 
-[heading Return Value]
-
-The number of handlers that were executed.
+[section:operator_lt_ ip::address_v4::operator<]
 
+[indexterm2 operator<..ip::address_v4]
+Compare addresses for ordering.
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+ friend bool operator<(
+ const address_v4 & a1,
+ const address_v4 & a2);
 
-]
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 io_service::poll (2 of 2 overloads)]
-
+[section:operator_lt__lt_ ip::address_v4::operator<<]
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute ready handlers.
+[indexterm2 operator<<..ip::address_v4]
+Output an address as a string.
 
 
- std::size_t poll(
- boost::system::error_code & ec);
+ template<
+ typename Elem,
+ typename Traits>
+ std::basic_ostream< Elem, Traits > & operator<<(
+ std::basic_ostream< Elem, Traits > & os,
+ const address_v4 & addr);
 
 
-The `poll()` function runs handlers that are ready to run, without blocking, until the [link boost_asio.reference.io_service `io_service`] has been stopped or there are no more ready handlers.
+Used to output a human-readable string for a specified address.
 
 
 [heading Parameters]
@@ -37904,14 +55942,16 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any.]]
+[[os][The output stream to which the string will be written.]]
+
+[[addr][The address to be written.]]
 
 ]
 
 
 [heading Return Value]
       
-The number of handlers that were executed.
+The output stream.
 
 
 
@@ -37919,296 +55959,429 @@
 [endsect]
 
 
-[endsect]
-
-[section:poll_one io_service::poll_one]
 
-[indexterm2 poll_one..io_service]
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute one ready handler.
+[section:operator_lt__eq_ ip::address_v4::operator<=]
 
+[indexterm2 operator<=..ip::address_v4]
+Compare addresses for ordering.
 
- std::size_t ``[link boost_asio.reference.io_service.poll_one.overload1 poll_one]``();
- `` [''''&raquo;''' [link boost_asio.reference.io_service.poll_one.overload1 more...]]``
 
- std::size_t ``[link boost_asio.reference.io_service.poll_one.overload2 poll_one]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.io_service.poll_one.overload2 more...]]``
+ friend bool operator<=(
+ const address_v4 & a1,
+ const address_v4 & a2);
 
 
-[section:overload1 io_service::poll_one (1 of 2 overloads)]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute one ready handler.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- std::size_t poll_one();
+[endsect]
 
 
-The `poll_one()` function runs at most one handler that is ready to run, without blocking.
 
+[section:operator_eq_ ip::address_v4::operator=]
 
-[heading Return Value]
-
-The number of handlers that were executed.
+[indexterm2 operator=..ip::address_v4]
+Assign from another address.
 
 
-[heading Exceptions]
-
+ address_v4 & operator=(
+ const address_v4 & other);
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
 
+[endsect]
 
 
 
-[endsect]
+[section:operator_eq__eq_ ip::address_v4::operator==]
 
+[indexterm2 operator==..ip::address_v4]
+Compare two addresses for equality.
 
 
-[section:overload2 io_service::poll_one (2 of 2 overloads)]
+ friend bool operator==(
+ const address_v4 & a1,
+ const address_v4 & a2);
 
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute one ready handler.
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
- std::size_t poll_one(
- boost::system::error_code & ec);
+[*Convenience header: ][^boost/asio.hpp]
 
 
-The `poll_one()` function runs at most one handler that is ready to run, without blocking.
+[endsect]
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+[section:operator_gt_ ip::address_v4::operator>]
 
-]
+[indexterm2 operator>..ip::address_v4]
+Compare addresses for ordering.
 
 
-[heading Return Value]
-
-The number of handlers that were executed.
+ friend bool operator>(
+ const address_v4 & a1,
+ const address_v4 & a2);
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:post io_service::post]
 
-[indexterm2 post..io_service]
-Request the [link boost_asio.reference.io_service `io_service`] to invoke the given handler and return immediately.
+[section:operator_gt__eq_ ip::address_v4::operator>=]
 
+[indexterm2 operator>=..ip::address_v4]
+Compare addresses for ordering.
 
- template<
- typename ``[link boost_asio.reference.CompletionHandler CompletionHandler]``>
- void post(
- CompletionHandler handler);
 
+ friend bool operator>=(
+ const address_v4 & a1,
+ const address_v4 & a2);
 
-This function is used to ask the [link boost_asio.reference.io_service `io_service`] to execute the given handler, but without allowing the [link boost_asio.reference.io_service `io_service`] to call the handler from inside this function.
 
-The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the `run()`, `run_one()`, `poll()` or `poll_one()` member functions is currently being invoked.
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v4.hpp]
 
-[heading Parameters]
-
+[*Convenience header: ][^boost/asio.hpp]
 
-[variablelist
-
-[[handler][The handler to be called. The [link boost_asio.reference.io_service `io_service`] will make a copy of the handler object as required. The function signature of the handler must be:
-``
- void handler();
-``
-]]
 
-]
+[endsect]
 
 
-[heading Remarks]
-
-This function throws an exception only if:
 
+[section:to_bytes ip::address_v4::to_bytes]
 
-* the handler's `asio_handler_allocate` function; or
+[indexterm2 to_bytes..ip::address_v4]
+Get the address in bytes, in network byte order.
 
 
-* the handler's copy constructor
+ bytes_type to_bytes() const;
 
-throws an exception.
 
 
 [endsect]
 
 
+[section:to_string ip::address_v4::to_string]
 
-[section:reset io_service::reset]
+[indexterm2 to_string..ip::address_v4]
+Get the address as a string in dotted decimal format.
 
-[indexterm2 reset..io_service]
-Reset the [link boost_asio.reference.io_service `io_service`] in preparation for a subsequent `run()` invocation.
 
+ std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload1 to_string]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload1 more...]]``
 
- void reset();
+ std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload2 to_string]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload2 more...]]``
 
 
-This function must be called prior to any second or later set of invocations of the `run()`, `run_one()`, `poll()` or `poll_one()` functions when a previous invocation of these functions returned due to the [link boost_asio.reference.io_service `io_service`] being stopped or running out of work. This function allows the [link boost_asio.reference.io_service `io_service`] to reset any internal state, such as a "stopped" flag.
+[section:overload1 ip::address_v4::to_string (1 of 2 overloads)]
 
-This function must not be called while there are any unfinished calls to the `run()`, `run_one()`, `poll()` or `poll_one()` functions.
 
+Get the address as a string in dotted decimal format.
 
-[endsect]
 
+ std::string to_string() const;
 
-[section:run io_service::run]
 
-[indexterm2 run..io_service]
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
 
+[endsect]
 
- std::size_t ``[link boost_asio.reference.io_service.run.overload1 run]``();
- `` [''''&raquo;''' [link boost_asio.reference.io_service.run.overload1 more...]]``
 
- std::size_t ``[link boost_asio.reference.io_service.run.overload2 run]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.io_service.run.overload2 more...]]``
 
+[section:overload2 ip::address_v4::to_string (2 of 2 overloads)]
 
-[section:overload1 io_service::run (1 of 2 overloads)]
 
+Get the address as a string in dotted decimal format.
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
 
+ std::string to_string(
+ boost::system::error_code & ec) const;
 
- std::size_t run();
 
 
-The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
+[endsect]
 
-Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_service `io_service`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_service `io_service`] may choose any one of them to invoke a handler.
 
-The `run()` function may be safely called again once it has completed only after a call to `reset()`.
+[endsect]
 
 
-[heading Return Value]
-
-The number of handlers that were executed.
+[section:to_ulong ip::address_v4::to_ulong]
 
+[indexterm2 to_ulong..ip::address_v4]
+Get the address as an unsigned long in host byte order.
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+ unsigned long to_ulong() const;
 
-]
 
 
-[heading Remarks]
-
-The `run()` function must not be called from a thread that is currently calling one of `run()`, `run_one()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_service `io_service`] object.
+[endsect]
 
-The `poll()` function may also be used to dispatch ready handlers, but without blocking.
 
 
 [endsect]
 
+[section:ip__address_v6 ip::address_v6]
 
 
-[section:overload2 io_service::run (2 of 2 overloads)]
+Implements IP version 6 style addresses.
 
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
+ class address_v6
 
 
- std::size_t run(
- boost::system::error_code & ec);
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-The `run()` function blocks until all work has finished and there are no more handlers to be dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
+ [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
+ [The type used to represent an address as an array of bytes. ]
+
+ ]
 
-Multiple threads may call the `run()` function to set up a pool of threads from which the [link boost_asio.reference.io_service `io_service`] may execute handlers. All threads that are waiting in the pool are equivalent and the [link boost_asio.reference.io_service `io_service`] may choose any one of them to invoke a handler.
+]
 
-The `run()` function may be safely called again once it has completed only after a call to `reset()`.
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
+ [Default constructor.
 
-[heading Parameters]
-
+ Construct an address from raw bytes and scope ID.
 
-[variablelist
+ Copy constructor. ]
+ ]
   
-[[ec][Set to indicate what error occurred, if any.]]
+ [
+ [[link boost_asio.reference.ip__address_v6.any [*any]]]
+ [Obtain an address object that represents any address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
+ [Create an address from an IP address string. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
+ [Determine whether the address is link local. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
+ [Determine whether the address is a loopback address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
+ [Determine whether the address is a multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
+ [Determine whether the address is a global multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
+ [Determine whether the address is a link-local multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
+ [Determine whether the address is a node-local multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
+ [Determine whether the address is a org-local multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
+ [Determine whether the address is a site-local multicast address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
+ [Determine whether the address is site local. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
+ [Determine whether the address is unspecified. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
+ [Determine whether the address is an IPv4-compatible address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
+ [Determine whether the address is a mapped IPv4 address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
+ [Obtain an address object that represents the loopback address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
+ [Assign from another address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
+ [The scope ID of the address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
+ [Get the address in bytes, in network byte order. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
+ [Get the address as a string. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
+ [Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
+ [Create an IPv4-compatible IPv6 address. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
+ [Create an IPv4-mapped IPv6 address. ]
+ ]
+
+]
+
+[heading Friends]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
+ [Compare two addresses for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
+ [Compare two addresses for equality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
+ [Compare addresses for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
+ [Compare addresses for ordering. ]
+ ]
+
 ]
 
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
-[heading Return Value]
-
-The number of handlers that were executed.
+ [
+ [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
+ [Output an address as a string. ]
+ ]
+
+]
 
+The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
 
-[heading Remarks]
-
-The `run()` function must not be called from a thread that is currently calling one of `run()`, `run_one()`, `poll()` or `poll_one()` on the same [link boost_asio.reference.io_service `io_service`] object.
 
-The `poll()` function may also be used to dispatch ready handlers, but without blocking.
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
-[endsect]
 
 
-[endsect]
+[heading Requirements]
 
-[section:run_one io_service::run_one]
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
-[indexterm2 run_one..io_service]
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute at most one handler.
+[*Convenience header: ][^boost/asio.hpp]
 
+[section:address_v6 ip::address_v6::address_v6]
 
- std::size_t ``[link boost_asio.reference.io_service.run_one.overload1 run_one]``();
- `` [''''&raquo;''' [link boost_asio.reference.io_service.run_one.overload1 more...]]``
+[indexterm2 address_v6..ip::address_v6]
+Default constructor.
 
- std::size_t ``[link boost_asio.reference.io_service.run_one.overload2 run_one]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.io_service.run_one.overload2 more...]]``
 
+ ``[link boost_asio.reference.ip__address_v6.address_v6.overload1 address_v6]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload1 more...]]``
 
-[section:overload1 io_service::run_one (1 of 2 overloads)]
 
+Construct an address from raw bytes and scope ID.
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute at most one handler.
 
+ explicit ``[link boost_asio.reference.ip__address_v6.address_v6.overload2 address_v6]``(
+ const bytes_type & bytes,
+ unsigned long scope_id = 0);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload2 more...]]``
 
- std::size_t run_one();
 
+Copy constructor.
 
-The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
 
+ ``[link boost_asio.reference.ip__address_v6.address_v6.overload3 address_v6]``(
+ const address_v6 & other);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload3 more...]]``
 
-[heading Return Value]
-
-The number of handlers that were executed.
 
+[section:overload1 ip::address_v6::address_v6 (1 of 3 overloads)]
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+Default constructor.
 
-]
 
+ address_v6();
 
 
 
@@ -38216,33 +56389,30 @@
 
 
 
-[section:overload2 io_service::run_one (2 of 2 overloads)]
+[section:overload2 ip::address_v6::address_v6 (2 of 3 overloads)]
 
 
-Run the [link boost_asio.reference.io_service `io_service`] object's event processing loop to execute at most one handler.
+Construct an address from raw bytes and scope ID.
 
 
- std::size_t run_one(
- boost::system::error_code & ec);
+ address_v6(
+ const bytes_type & bytes,
+ unsigned long scope_id = 0);
 
 
-The `run_one()` function blocks until one handler has been dispatched, or until the [link boost_asio.reference.io_service `io_service`] has been stopped.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[section:overload3 ip::address_v6::address_v6 (3 of 3 overloads)]
 
 
-[heading Return Value]
-
-The number of handlers that were executed.
+Copy constructor.
+
 
+ address_v6(
+ const address_v6 & other);
 
 
 
@@ -38252,56 +56422,40 @@
 [endsect]
 
 
-[section:stop io_service::stop]
-
-[indexterm2 stop..io_service]
-Stop the [link boost_asio.reference.io_service `io_service`] object's event processing loop.
+[section:any ip::address_v6::any]
 
+[indexterm2 any..ip::address_v6]
+Obtain an address object that represents any address.
 
- void stop();
 
+ static address_v6 any();
 
-This function does not block, but instead simply signals the [link boost_asio.reference.io_service `io_service`] to stop. All invocations of its `run()` or `run_one()` member functions should return as soon as possible. Subsequent calls to `run()`, `run_one()`, `poll()` or `poll_one()` will return immediately until `reset()` is called.
 
 
 [endsect]
 
 
 
-[section:use_service io_service::use_service]
-
-[indexterm2 use_service..io_service]
-Obtain the service object corresponding to the given type.
-
-
- template<
- typename ``[link boost_asio.reference.Service Service]``>
- friend Service & use_service(
- io_service & ios);
-
+[section:bytes_type ip::address_v6::bytes_type]
 
-This function is used to locate a service object that corresponds to the given service type. If there is no existing implementation of the service, then the [link boost_asio.reference.io_service `io_service`] will create a new instance of the service.
+[indexterm2 bytes_type..ip::address_v6]
+The type used to represent an address as an array of bytes.
 
 
-[heading Parameters]
-
+ typedef array< unsigned char, 16 > bytes_type;
 
-[variablelist
-
-[[ios][The [link boost_asio.reference.io_service `io_service`] object that owns the service.]]
 
-]
 
 
-[heading Return Value]
+[heading Remarks]
       
-The service interface implementing the specified service type. Ownership of the service interface is not transferred to the caller.
+This type is defined in terms of the C++0x template `std::array` when it is available. Otherwise, it uses `boost:array`.
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/io_service.hpp]
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -38309,60 +56463,55 @@
 [endsect]
 
 
+[section:from_string ip::address_v6::from_string]
 
-[section:wrap io_service::wrap]
-
-[indexterm2 wrap..io_service]
-Create a new handler that automatically dispatches the wrapped handler on the [link boost_asio.reference.io_service `io_service`].
-
-
- template<
- typename ``[link boost_asio.reference.Handler Handler]``>
- unspecified wrap(
- Handler handler);
-
+[indexterm2 from_string..ip::address_v6]
+Create an address from an IP address string.
 
-This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the [link boost_asio.reference.io_service `io_service`] object's dispatch function.
 
+ static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload1 from_string]``(
+ const char * str);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload1 more...]]``
 
-[heading Parameters]
-
+ static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload2 from_string]``(
+ const char * str,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload2 more...]]``
 
-[variablelist
-
-[[handler][The handler to be wrapped. The [link boost_asio.reference.io_service `io_service`] will make a copy of the handler object as required. The function signature of the handler must be:
-``
- void handler(A1 a1, ... An an);
-``
-]]
+ static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload3 from_string]``(
+ const std::string & str);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload3 more...]]``
 
-]
+ static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload4 from_string]``(
+ const std::string & str,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload4 more...]]``
 
 
-[heading Return Value]
-
-A function object that, when invoked, passes the wrapped handler to the [link boost_asio.reference.io_service `io_service`] object's dispatch function. Given a function object with the signature:
+[section:overload1 ip::address_v6::from_string (1 of 4 overloads)]
 
- R f(A1 a1, ... An an);
 
+Create an address from an IP address string.
 
-If this function object is passed to the wrap function like so:
 
- io_service.wrap(f);
+ static address_v6 from_string(
+ const char * str);
 
 
-then the return value is a function object with the signature
 
- void g(A1 a1, ... An an);
+[endsect]
 
 
-that, when invoked, executes code equivalent to:
 
- io_service.dispatch(boost::bind(f, a1, ... an));
+[section:overload2 ip::address_v6::from_string (2 of 4 overloads)]
 
 
+Create an address from an IP address string.
 
 
+ static address_v6 from_string(
+ const char * str,
+ boost::system::error_code & ec);
 
 
 
@@ -38370,146 +56519,102 @@
 
 
 
-[section:_io_service io_service::~io_service]
-
-[indexterm2 ~io_service..io_service]
-Destructor.
-
-
- ~io_service();
-
+[section:overload3 ip::address_v6::from_string (3 of 4 overloads)]
 
-On destruction, the [link boost_asio.reference.io_service `io_service`] performs the following sequence of operations:
 
+Create an address from an IP address string.
 
-* For each service object `svc` in the [link boost_asio.reference.io_service `io_service`] set, in reverse order of the beginning of service object lifetime, performs `svc->shutdown_service()`.
 
+ static address_v6 from_string(
+ const std::string & str);
 
-* Uninvoked handler objects that were scheduled for deferred invocation on the [link boost_asio.reference.io_service `io_service`], or any associated strand, are destroyed.
 
 
-* For each service object `svc` in the [link boost_asio.reference.io_service `io_service`] set, in reverse order of the beginning of service object lifetime, performs `delete static_cast<io_service::service*>(svc)`.
+[endsect]
 
 
-[heading Remarks]
-
-The destruction sequence described above permits programs to simplify their resource management by using `shared_ptr<>`. Where an object's lifetime is tied to the lifetime of a connection (or some other sequence of asynchronous operations), a `shared_ptr` to the object would be bound into the handlers for all asynchronous operations associated with it. This works as follows:
 
+[section:overload4 ip::address_v6::from_string (4 of 4 overloads)]
 
-* When a single connection ends, all associated asynchronous operations complete. The corresponding handler objects are destroyed, and all `shared_ptr` references to the objects are destroyed.
 
+Create an address from an IP address string.
 
-* To shut down the whole program, the [link boost_asio.reference.io_service `io_service`] function `stop()` is called to terminate any `run()` calls as soon as possible. The [link boost_asio.reference.io_service `io_service`] destructor defined above destroys all handlers, causing all `shared_ptr` references to all connection objects to be destroyed.
 
+ static address_v6 from_string(
+ const std::string & str,
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
-
 [endsect]
 
-[section:io_service__id io_service::id]
 
+[section:is_link_local ip::address_v6::is_link_local]
 
-Class used to uniquely identify a service.
+[indexterm2 is_link_local..ip::address_v6]
+Determine whether the address is link local.
 
 
- class id :
- noncopyable
+ bool is_link_local() const;
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.io_service__id.id [*id]]]
- [Constructor. ]
- ]
-
-]
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/io_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[section:is_loopback ip::address_v6::is_loopback]
 
+[indexterm2 is_loopback..ip::address_v6]
+Determine whether the address is a loopback address.
 
-[section:id io_service::id::id]
 
-[indexterm2 id..io_service::id]
-Constructor.
+ bool is_loopback() const;
 
 
- id();
 
+[endsect]
 
 
-[endsect]
 
+[section:is_multicast ip::address_v6::is_multicast]
 
+[indexterm2 is_multicast..ip::address_v6]
+Determine whether the address is a multicast address.
 
-[endsect]
 
-[section:io_service__service io_service::service]
+ bool is_multicast() const;
 
 
-Base class for all [link boost_asio.reference.io_service `io_service`] services.
 
+[endsect]
 
- class service :
- noncopyable
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[section:is_multicast_global ip::address_v6::is_multicast_global]
 
- [
- [[link boost_asio.reference.io_service__service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
-]
+[indexterm2 is_multicast_global..ip::address_v6]
+Determine whether the address is a global multicast address.
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.io_service__service.service [*service]]]
- [Constructor. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__service._service [*~service]]]
- [Destructor. ]
- ]
-
-]
+ bool is_multicast_global() const;
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/io_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
-[section:get_io_service io_service::service::get_io_service]
 
-[indexterm2 get_io_service..io_service::service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+[section:is_multicast_link_local ip::address_v6::is_multicast_link_local]
 
+[indexterm2 is_multicast_link_local..ip::address_v6]
+Determine whether the address is a link-local multicast address.
 
- boost::asio::io_service & get_io_service();
+
+ bool is_multicast_link_local() const;
 
 
 
@@ -38517,13 +56622,13 @@
 
 
 
-[section:io_service io_service::service::io_service]
+[section:is_multicast_node_local ip::address_v6::is_multicast_node_local]
 
-[indexterm2 io_service..io_service::service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+[indexterm2 is_multicast_node_local..ip::address_v6]
+Determine whether the address is a node-local multicast address.
 
 
- boost::asio::io_service & io_service();
+ bool is_multicast_node_local() const;
 
 
 
@@ -38531,216 +56636,180 @@
 
 
 
-[section:service io_service::service::service]
+[section:is_multicast_org_local ip::address_v6::is_multicast_org_local]
 
-[indexterm2 service..io_service::service]
-Constructor.
+[indexterm2 is_multicast_org_local..ip::address_v6]
+Determine whether the address is a org-local multicast address.
 
 
- service(
- boost::asio::io_service & owner);
+ bool is_multicast_org_local() const;
 
 
 
-[heading Parameters]
-
+[endsect]
 
-[variablelist
-
-[[owner][The [link boost_asio.reference.io_service `io_service`] object that owns the service. ]]
 
-]
 
+[section:is_multicast_site_local ip::address_v6::is_multicast_site_local]
 
+[indexterm2 is_multicast_site_local..ip::address_v6]
+Determine whether the address is a site-local multicast address.
 
 
-[endsect]
+ bool is_multicast_site_local() const;
 
 
 
-[section:_service io_service::service::~service]
+[endsect]
 
-[indexterm2 ~service..io_service::service]
-Destructor.
 
 
- virtual ~service();
+[section:is_site_local ip::address_v6::is_site_local]
 
+[indexterm2 is_site_local..ip::address_v6]
+Determine whether the address is site local.
 
 
-[endsect]
+ bool is_site_local() const;
 
 
 
 [endsect]
 
-[section:io_service__strand io_service::strand]
 
 
-Provides serialised handler execution.
+[section:is_unspecified ip::address_v6::is_unspecified]
+
+[indexterm2 is_unspecified..ip::address_v6]
+Determine whether the address is unspecified.
 
 
- class strand
+ bool is_unspecified() const;
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.io_service__strand.dispatch [*dispatch]]]
- [Request the strand to invoke the given handler. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__strand.get_io_service [*get_io_service]]]
- [Get the io_service associated with the strand. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__strand.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the strand. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__strand.post [*post]]]
- [Request the strand to invoke the given handler and return immediately. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__strand.strand [*strand]]]
- [Constructor. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__strand.wrap [*wrap]]]
- [Create a new handler that automatically dispatches the wrapped handler on the strand. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__strand._strand [*~strand]]]
- [Destructor. ]
- ]
-
-]
+[endsect]
 
-The [link boost_asio.reference.io_service__strand `io_service::strand`] class provides the ability to post and dispatch handlers with the guarantee that none of those handlers will execute concurrently.
 
 
-[heading Order of handler invocation]
-
-Given:
+[section:is_v4_compatible ip::address_v6::is_v4_compatible]
 
+[indexterm2 is_v4_compatible..ip::address_v6]
+Determine whether the address is an IPv4-compatible address.
 
-* a strand object `s`
 
+ bool is_v4_compatible() const;
 
-* an object `a` meeting completion handler requirements
 
 
-* an object `a1` which is an arbitrary copy of `a` made by the implementation
+[endsect]
 
 
-* an object `b` meeting completion handler requirements
 
+[section:is_v4_mapped ip::address_v6::is_v4_mapped]
 
-* an object `b1` which is an arbitrary copy of `b` made by the implementation
+[indexterm2 is_v4_mapped..ip::address_v6]
+Determine whether the address is a mapped IPv4 address.
 
-if any of the following conditions are true:
 
+ bool is_v4_mapped() const;
 
-* `s.post(a)` happens-before `s.post(b)`
 
 
-* `s.post(a)` happens-before `s.dispatch(b)`, where the latter is performed outside the strand
+[endsect]
 
 
-* `s.dispatch(a)` happens-before `s.post(b)`, where the former is performed outside the strand
 
+[section:loopback ip::address_v6::loopback]
 
-* `s.dispatch(a)` happens-before `s.dispatch(b)`, where both are performed outside the strand
+[indexterm2 loopback..ip::address_v6]
+Obtain an address object that represents the loopback address.
 
-then `asio_handler_invoke(a1, &a1)` happens-before `asio_handler_invoke(b1, &b1)`.
 
-Note that in the following case:
+ static address_v6 loopback();
 
- async_op_1(..., s.wrap(a));
- async_op_2(..., s.wrap(b));
 
 
-the completion of the first async operation will perform `s.dispatch(a)`, and the second will perform `s.dispatch(b)`, but the order in which those are performed is unspecified. That is, you cannot state whether one happens-before the other. Therefore none of the above conditions are met and no ordering guarantee is made.
+[endsect]
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Safe.
+[section:operator_not__eq_ ip::address_v6::operator!=]
+
+[indexterm2 operator!=..ip::address_v6]
+Compare two addresses for inequality.
 
 
+ friend bool operator!=(
+ const address_v6 & a1,
+ const address_v6 & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/strand.hpp]
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:dispatch io_service::strand::dispatch]
+[endsect]
 
-[indexterm2 dispatch..io_service::strand]
-Request the strand to invoke the given handler.
 
 
- template<
- typename ``[link boost_asio.reference.Handler Handler]``>
- void dispatch(
- Handler handler);
+[section:operator_lt_ ip::address_v6::operator<]
 
+[indexterm2 operator<..ip::address_v6]
+Compare addresses for ordering.
 
-This function is used to ask the strand to execute the given handler.
 
-The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The handler may be executed inside this function if the guarantee can be met. If this function is called from within a handler that was posted or dispatched through the same strand, then the new handler will be executed immediately.
+ friend bool operator<(
+ const address_v6 & a1,
+ const address_v6 & a2);
 
-The strand's guarantee is in addition to the guarantee provided by the underlying [link boost_asio.reference.io_service `io_service`]. The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the io\_service's run member function is currently being invoked.
 
+[heading Requirements]
 
-[heading Parameters]
-
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
-[variablelist
-
-[[handler][The handler to be called. The strand will make a copy of the handler object as required. The function signature of the handler must be:
-``
- void handler();
-``
-]]
+[*Convenience header: ][^boost/asio.hpp]
 
-]
 
+[endsect]
 
 
 
-[endsect]
+[section:operator_lt__lt_ ip::address_v6::operator<<]
 
+[indexterm2 operator<<..ip::address_v6]
+Output an address as a string.
 
 
-[section:get_io_service io_service::strand::get_io_service]
+ template<
+ typename Elem,
+ typename Traits>
+ std::basic_ostream< Elem, Traits > & operator<<(
+ std::basic_ostream< Elem, Traits > & os,
+ const address_v6 & addr);
 
-[indexterm2 get_io_service..io_service::strand]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the strand.
+
+Used to output a human-readable string for a specified address.
 
 
- boost::asio::io_service & get_io_service();
+[heading Parameters]
+
+
+[variablelist
+
+[[os][The output stream to which the string will be written.]]
 
+[[addr][The address to be written.]]
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the strand uses to dispatch handlers for asynchronous operations.
+]
 
 
 [heading Return Value]
       
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the strand will use to dispatch handlers. Ownership is not transferred to the caller.
+The output stream.
 
 
 
@@ -38749,230 +56818,191 @@
 
 
 
-[section:io_service io_service::strand::io_service]
-
-[indexterm2 io_service..io_service::strand]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the strand.
-
+[section:operator_lt__eq_ ip::address_v6::operator<=]
 
- boost::asio::io_service & io_service();
+[indexterm2 operator<=..ip::address_v6]
+Compare addresses for ordering.
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the strand uses to dispatch handlers for asynchronous operations.
+ friend bool operator<=(
+ const address_v6 & a1,
+ const address_v6 & a2);
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the strand will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:post io_service::strand::post]
+[section:operator_eq_ ip::address_v6::operator=]
 
-[indexterm2 post..io_service::strand]
-Request the strand to invoke the given handler and return immediately.
+[indexterm2 operator=..ip::address_v6]
+Assign from another address.
 
 
- template<
- typename ``[link boost_asio.reference.Handler Handler]``>
- void post(
- Handler handler);
+ address_v6 & operator=(
+ const address_v6 & other);
 
 
-This function is used to ask the strand to execute the given handler, but without allowing the strand to call the handler from inside this function.
 
-The strand object guarantees that handlers posted or dispatched through the strand will not be executed concurrently. The strand's guarantee is in addition to the guarantee provided by the underlying [link boost_asio.reference.io_service `io_service`]. The [link boost_asio.reference.io_service `io_service`] guarantees that the handler will only be called in a thread in which the io\_service's run member function is currently being invoked.
+[endsect]
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[handler][The handler to be called. The strand will make a copy of the handler object as required. The function signature of the handler must be:
-``
- void handler();
-``
-]]
+[section:operator_eq__eq_ ip::address_v6::operator==]
 
-]
+[indexterm2 operator==..ip::address_v6]
+Compare two addresses for equality.
 
 
+ friend bool operator==(
+ const address_v6 & a1,
+ const address_v6 & a2);
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:strand io_service::strand::strand]
 
-[indexterm2 strand..io_service::strand]
-Constructor.
+[endsect]
 
 
- strand(
- boost::asio::io_service & io_service);
 
+[section:operator_gt_ ip::address_v6::operator>]
 
-Constructs the strand.
+[indexterm2 operator>..ip::address_v6]
+Compare addresses for ordering.
 
 
-[heading Parameters]
-
+ friend bool operator>(
+ const address_v6 & a1,
+ const address_v6 & a2);
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the strand will use to dispatch handlers that are ready to be run. ]]
 
-]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:wrap io_service::strand::wrap]
-
-[indexterm2 wrap..io_service::strand]
-Create a new handler that automatically dispatches the wrapped handler on the strand.
-
-
- template<
- typename ``[link boost_asio.reference.Handler Handler]``>
- unspecified wrap(
- Handler handler);
+[section:operator_gt__eq_ ip::address_v6::operator>=]
 
+[indexterm2 operator>=..ip::address_v6]
+Compare addresses for ordering.
 
-This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the strand's dispatch function.
 
+ friend bool operator>=(
+ const address_v6 & a1,
+ const address_v6 & a2);
 
-[heading Parameters]
-
 
-[variablelist
-
-[[handler][The handler to be wrapped. The strand will make a copy of the handler object as required. The function signature of the handler must be:
-``
- void handler(A1 a1, ... An an);
-``
-]]
+[heading Requirements]
 
-]
+[*Header: ][^boost/asio/ip/address_v6.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[heading Return Value]
-
-A function object that, when invoked, passes the wrapped handler to the strand's dispatch function. Given a function object with the signature:
 
- R f(A1 a1, ... An an);
+[endsect]
 
 
-If this function object is passed to the wrap function like so:
+[section:scope_id ip::address_v6::scope_id]
 
- strand.wrap(f);
+[indexterm2 scope_id..ip::address_v6]
+The scope ID of the address.
 
 
-then the return value is a function object with the signature
+ unsigned long ``[link boost_asio.reference.ip__address_v6.scope_id.overload1 scope_id]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload1 more...]]``
 
- void g(A1 a1, ... An an);
+ void ``[link boost_asio.reference.ip__address_v6.scope_id.overload2 scope_id]``(
+ unsigned long id);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload2 more...]]``
 
 
-that, when invoked, executes code equivalent to:
+[section:overload1 ip::address_v6::scope_id (1 of 2 overloads)]
 
- strand.dispatch(boost::bind(f, a1, ... an));
 
+The scope ID of the address.
 
 
+ unsigned long scope_id() const;
 
 
+Returns the scope ID associated with the IPv6 address.
 
 
 [endsect]
 
 
 
-[section:_strand io_service::strand::~strand]
+[section:overload2 ip::address_v6::scope_id (2 of 2 overloads)]
 
-[indexterm2 ~strand..io_service::strand]
-Destructor.
 
+The scope ID of the address.
 
- ~strand();
 
+ void scope_id(
+ unsigned long id);
 
-Destroys a strand.
 
-Handlers posted through the strand that have not yet been invoked will still be dispatched in a way that meets the guarantee of non-concurrency.
+Modifies the scope ID associated with the IPv6 address.
 
 
 [endsect]
 
 
-
 [endsect]
 
-[section:io_service__work io_service::work]
 
+[section:to_bytes ip::address_v6::to_bytes]
 
-Class to inform the [link boost_asio.reference.io_service `io_service`] when it has work to do.
+[indexterm2 to_bytes..ip::address_v6]
+Get the address in bytes, in network byte order.
 
 
- class work
+ bytes_type to_bytes() const;
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.io_service__work.get_io_service [*get_io_service]]]
- [Get the io_service associated with the work. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__work.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the work. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__work.work [*work]]]
- [Constructor notifies the io_service that work is starting.
+[endsect]
 
- Copy constructor notifies the io_service that work is starting. ]
- ]
-
- [
- [[link boost_asio.reference.io_service__work._work [*~work]]]
- [Destructor notifies the io_service that the work is complete. ]
- ]
-
-]
 
-The work class is used to inform the [link boost_asio.reference.io_service `io_service`] when work starts and finishes. This ensures that the [link boost_asio.reference.io_service `io_service`] object's `run()` function will not exit while work is underway, and that it does exit when there is no unfinished work remaining.
+[section:to_string ip::address_v6::to_string]
 
-The work class is copy-constructible so that it may be used as a data member in a handler class. It is not assignable.
+[indexterm2 to_string..ip::address_v6]
+Get the address as a string.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/io_service.hpp]
+ std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload1 to_string]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload1 more...]]``
 
-[*Convenience header: ][^boost/asio.hpp]
+ std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload2 to_string]``(
+ boost::system::error_code & ec) const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload2 more...]]``
 
 
-[section:get_io_service io_service::work::get_io_service]
+[section:overload1 ip::address_v6::to_string (1 of 2 overloads)]
 
-[indexterm2 get_io_service..io_service::work]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the work.
 
+Get the address as a string.
 
- boost::asio::io_service & get_io_service();
+
+ std::string to_string() const;
 
 
 
@@ -38980,153 +57010,157 @@
 
 
 
-[section:io_service io_service::work::io_service]
+[section:overload2 ip::address_v6::to_string (2 of 2 overloads)]
+
 
-[indexterm2 io_service..io_service::work]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the work.
+Get the address as a string.
 
 
- boost::asio::io_service & io_service();
+ std::string to_string(
+ boost::system::error_code & ec) const;
 
 
 
 [endsect]
 
 
-[section:work io_service::work::work]
+[endsect]
 
-[indexterm2 work..io_service::work]
-Constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
 
+[section:to_v4 ip::address_v6::to_v4]
 
- explicit ``[link boost_asio.reference.io_service__work.work.overload1 work]``(
- boost::asio::io_service & io_service);
- `` [''''&raquo;''' [link boost_asio.reference.io_service__work.work.overload1 more...]]``
+[indexterm2 to_v4..ip::address_v6]
+Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address.
 
 
-Copy constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
+ address_v4 to_v4() const;
 
 
- ``[link boost_asio.reference.io_service__work.work.overload2 work]``(
- const work & other);
- `` [''''&raquo;''' [link boost_asio.reference.io_service__work.work.overload2 more...]]``
 
+[endsect]
 
-[section:overload1 io_service::work::work (1 of 2 overloads)]
 
 
-Constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
+[section:v4_compatible ip::address_v6::v4_compatible]
 
+[indexterm2 v4_compatible..ip::address_v6]
+Create an IPv4-compatible IPv6 address.
 
- work(
- boost::asio::io_service & io_service);
 
+ static address_v6 v4_compatible(
+ const address_v4 & addr);
 
-The constructor is used to inform the [link boost_asio.reference.io_service `io_service`] that some work has begun. This ensures that the [link boost_asio.reference.io_service `io_service`] object's `run()` function will not exit while the work is underway.
 
 
 [endsect]
 
 
 
-[section:overload2 io_service::work::work (2 of 2 overloads)]
-
-
-Copy constructor notifies the [link boost_asio.reference.io_service `io_service`] that work is starting.
-
-
- work(
- const work & other);
-
-
-The constructor is used to inform the [link boost_asio.reference.io_service `io_service`] that some work has begun. This ensures that the [link boost_asio.reference.io_service `io_service`] object's `run()` function will not exit while the work is underway.
-
+[section:v4_mapped ip::address_v6::v4_mapped]
 
-[endsect]
+[indexterm2 v4_mapped..ip::address_v6]
+Create an IPv4-mapped IPv6 address.
 
 
-[endsect]
+ static address_v6 v4_mapped(
+ const address_v4 & addr);
 
 
-[section:_work io_service::work::~work]
 
-[indexterm2 ~work..io_service::work]
-Destructor notifies the [link boost_asio.reference.io_service `io_service`] that the work is complete.
+[endsect]
 
 
- ~work();
 
+[endsect]
 
-The destructor is used to inform the [link boost_asio.reference.io_service `io_service`] that some work has finished. Once the count of unfinished work reaches zero, the [link boost_asio.reference.io_service `io_service`] object's `run()` function is permitted to exit.
+[section:ip__basic_endpoint ip::basic_endpoint]
 
 
-[endsect]
+Describes an endpoint for a version-independent IP socket.
 
 
+ template<
+ typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
+ class basic_endpoint
 
-[endsect]
 
-[section:ip__address ip::address]
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-Implements version-independent IP addresses.
+ [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
+ [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
+
+ ]
 
+ [
 
- class address
+ [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint. ]
+
+ ]
 
+]
 
 [heading Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__address.address [*address]]]
+ [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
+ [Get the IP address associated with the endpoint.
+
+ Set the IP address associated with the endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
     [Default constructor.
 
- Construct an address from an IPv4 address.
+ Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.
 
- Construct an address from an IPv6 address.
+ Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
 
      Copy constructor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.from_string [*from_string]]]
- [Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. ]
+ [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
+ [Get the capacity of the endpoint in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.is_v4 [*is_v4]]]
- [Get whether the address is an IP version 4 address. ]
+ [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
+ [Get the underlying endpoint in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.is_v6 [*is_v6]]]
- [Get whether the address is an IP version 6 address. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
+ [Assign from another endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.operator_eq_ [*operator=]]]
- [Assign from another address.
-
- Assign from an IPv4 address.
+ [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
+ [Get the port associated with the endpoint. The port number is always in the host's byte order.
 
- Assign from an IPv6 address. ]
+ Set the port associated with the endpoint. The port number is always in the host's byte order. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.to_string [*to_string]]]
- [Get the address as a string in dotted decimal format. ]
+ [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
+ [The protocol associated with the endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.to_v4 [*to_v4]]]
- [Get the address as an IP version 4 address. ]
+ [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
+ [Set the underlying size of the endpoint in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.to_v6 [*to_v6]]]
- [Get the address as an IP version 6 address. ]
+ [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
+ [Get the underlying size of the endpoint in the native type. ]
   ]
   
 ]
@@ -39136,33 +57170,33 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__address.operator_not__eq_ [*operator!=]]]
- [Compare two addresses for inequality. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
+ [Compare two endpoints for inequality. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.operator_lt_ [*operator<]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
+ [Compare endpoints for ordering. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.operator_lt__eq_ [*operator<=]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
+ [Compare endpoints for ordering. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.operator_eq__eq_ [*operator==]]]
- [Compare two addresses for equality. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
+ [Compare two endpoints for equality. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.operator_gt_ [*operator>]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
+ [Compare endpoints for ordering. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address.operator_gt__eq_ [*operator>=]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
+ [Compare endpoints for ordering. ]
   ]
   
 ]
@@ -39172,100 +57206,55 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__address.operator_lt__lt_ [*operator<<]]]
- [Output an address as a string. ]
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
+ [Output an endpoint as a string. ]
   ]
   
 ]
 
-The [link boost_asio.reference.ip__address `ip::address`] class provides the ability to use either IP version 4 or version 6 addresses.
+The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
+
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address.hpp]
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:address ip::address::address]
-
-[indexterm2 address..ip::address]
-Default constructor.
-
-
- ``[link boost_asio.reference.ip__address.address.overload1 address]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload1 more...]]``
-
-
-Construct an address from an IPv4 address.
-
-
- ``[link boost_asio.reference.ip__address.address.overload2 address]``(
- const boost::asio::ip::address_v4 & ipv4_address);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload2 more...]]``
-
-
-Construct an address from an IPv6 address.
-
-
- ``[link boost_asio.reference.ip__address.address.overload3 address]``(
- const boost::asio::ip::address_v6 & ipv6_address);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload3 more...]]``
-
-
-Copy constructor.
-
-
- ``[link boost_asio.reference.ip__address.address.overload4 address]``(
- const address & other);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.address.overload4 more...]]``
-
-
-[section:overload1 ip::address::address (1 of 4 overloads)]
-
-
-Default constructor.
-
-
- address();
-
-
-
-[endsect]
-
-
-
-[section:overload2 ip::address::address (2 of 4 overloads)]
-
+[section:address ip::basic_endpoint::address]
 
-Construct an address from an IPv4 address.
+[indexterm2 address..ip::basic_endpoint]
+Get the IP address associated with the endpoint.
 
 
- address(
- const boost::asio::ip::address_v4 & ipv4_address);
+ boost::asio::ip::address ``[link boost_asio.reference.ip__basic_endpoint.address.overload1 address]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload1 more...]]``
 
 
+Set the IP address associated with the endpoint.
 
-[endsect]
 
+ void ``[link boost_asio.reference.ip__basic_endpoint.address.overload2 address]``(
+ const boost::asio::ip::address & addr);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload2 more...]]``
 
 
-[section:overload3 ip::address::address (3 of 4 overloads)]
+[section:overload1 ip::basic_endpoint::address (1 of 2 overloads)]
 
 
-Construct an address from an IPv6 address.
+Get the IP address associated with the endpoint.
 
 
- address(
- const boost::asio::ip::address_v6 & ipv6_address);
+ boost::asio::ip::address address() const;
 
 
 
@@ -39273,14 +57262,14 @@
 
 
 
-[section:overload4 ip::address::address (4 of 4 overloads)]
+[section:overload2 ip::basic_endpoint::address (2 of 2 overloads)]
 
 
-Copy constructor.
+Set the IP address associated with the endpoint.
 
 
- address(
- const address & other);
+ void address(
+ const boost::asio::ip::address & addr);
 
 
 
@@ -39289,70 +57278,49 @@
 
 [endsect]
 
-[section:from_string ip::address::from_string]
-
-[indexterm2 from_string..ip::address]
-Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
-
-
- static address ``[link boost_asio.reference.ip__address.from_string.overload1 from_string]``(
- const char * str);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload1 more...]]``
-
- static address ``[link boost_asio.reference.ip__address.from_string.overload2 from_string]``(
- const char * str,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload2 more...]]``
-
- static address ``[link boost_asio.reference.ip__address.from_string.overload3 from_string]``(
- const std::string & str);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload3 more...]]``
-
- static address ``[link boost_asio.reference.ip__address.from_string.overload4 from_string]``(
- const std::string & str,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.from_string.overload4 more...]]``
-
-
-[section:overload1 ip::address::from_string (1 of 4 overloads)]
-
-
-Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
-
+[section:basic_endpoint ip::basic_endpoint::basic_endpoint]
 
- static address from_string(
- const char * str);
+[indexterm2 basic_endpoint..ip::basic_endpoint]
+Default constructor.
 
 
+ ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 more...]]``
 
-[endsect]
 
+Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR\_ANY or in6addr\_any). This constructor would typically be used for accepting new connections.
 
 
-[section:overload2 ip::address::from_string (2 of 4 overloads)]
+ ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
+ const InternetProtocol & internet_protocol,
+ unsigned short port_num);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 more...]]``
 
 
-Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
+Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
 
 
- static address from_string(
- const char * str,
- boost::system::error_code & ec);
+ ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
+ const boost::asio::ip::address & addr,
+ unsigned short port_num);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 more...]]``
 
 
+Copy constructor.
 
-[endsect]
 
+ ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
+ const basic_endpoint & other);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 more...]]``
 
 
-[section:overload3 ip::address::from_string (3 of 4 overloads)]
+[section:overload1 ip::basic_endpoint::basic_endpoint (1 of 4 overloads)]
 
 
-Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
+Default constructor.
 
 
- static address from_string(
- const std::string & str);
+ basic_endpoint();
 
 
 
@@ -39360,45 +57328,32 @@
 
 
 
-[section:overload4 ip::address::from_string (4 of 4 overloads)]
-
-
-Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
-
-
- static address from_string(
- const std::string & str,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
+[section:overload2 ip::basic_endpoint::basic_endpoint (2 of 4 overloads)]
 
-[endsect]
 
+Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR\_ANY or in6addr\_any). This constructor would typically be used for accepting new connections.
 
-[section:is_v4 ip::address::is_v4]
 
-[indexterm2 is_v4..ip::address]
-Get whether the address is an IP version 4 address.
+ basic_endpoint(
+ const InternetProtocol & internet_protocol,
+ unsigned short port_num);
 
 
- bool is_v4() const;
 
+[heading Examples]
+
+To initialise an IPv4 TCP endpoint for port 1234, use:
 
+ boost::asio::ip::tcp::endpoint ep(boost::asio::ip::tcp::v4(), 1234);
 
-[endsect]
 
 
 
-[section:is_v6 ip::address::is_v6]
+To specify an IPv6 UDP endpoint for port 9876, use:
 
-[indexterm2 is_v6..ip::address]
-Get whether the address is an IP version 6 address.
+ boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876);
 
 
- bool is_v6() const;
 
 
 
@@ -39406,146 +57361,72 @@
 
 
 
-[section:operator_not__eq_ ip::address::operator!=]
-
-[indexterm2 operator!=..ip::address]
-Compare two addresses for inequality.
-
+[section:overload3 ip::basic_endpoint::basic_endpoint (3 of 4 overloads)]
 
- friend bool operator!=(
- const address & a1,
- const address & a2);
 
+Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address.hpp]
+ basic_endpoint(
+ const boost::asio::ip::address & addr,
+ unsigned short port_num);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_lt_ ip::address::operator<]
-
-[indexterm2 operator<..ip::address]
-Compare addresses for ordering.
-
+[section:overload4 ip::basic_endpoint::basic_endpoint (4 of 4 overloads)]
 
- friend bool operator<(
- const address & a1,
- const address & a2);
 
+Copy constructor.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address.hpp]
+ basic_endpoint(
+ const basic_endpoint & other);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-
-[section:operator_lt__lt_ ip::address::operator<<]
-
-[indexterm2 operator<<..ip::address]
-Output an address as a string.
-
-
- template<
- typename Elem,
- typename Traits>
- std::basic_ostream< Elem, Traits > & operator<<(
- std::basic_ostream< Elem, Traits > & os,
- const address & addr);
-
-
-Used to output a human-readable string for a specified address.
-
-
-[heading Parameters]
-
-
-[variablelist
-
-[[os][The output stream to which the string will be written.]]
-
-[[addr][The address to be written.]]
-
-]
-
-
-[heading Return Value]
-
-The output stream.
-
-
-
-
 [endsect]
 
 
+[section:capacity ip::basic_endpoint::capacity]
 
-[section:operator_lt__eq_ ip::address::operator<=]
-
-[indexterm2 operator<=..ip::address]
-Compare addresses for ordering.
-
-
- friend bool operator<=(
- const address & a1,
- const address & a2);
-
+[indexterm2 capacity..ip::basic_endpoint]
+Get the capacity of the endpoint in the native type.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address.hpp]
+ std::size_t capacity() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:operator_eq_ ip::address::operator=]
-
-[indexterm2 operator=..ip::address]
-Assign from another address.
-
-
- address & ``[link boost_asio.reference.ip__address.operator_eq_.overload1 operator=]``(
- const address & other);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload1 more...]]``
-
-
-Assign from an IPv4 address.
-
-
- address & ``[link boost_asio.reference.ip__address.operator_eq_.overload2 operator=]``(
- const boost::asio::ip::address_v4 & ipv4_address);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload2 more...]]``
+[section:data ip::basic_endpoint::data]
 
+[indexterm2 data..ip::basic_endpoint]
+Get the underlying endpoint in the native type.
 
-Assign from an IPv6 address.
 
+ data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload1 data]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload1 more...]]``
 
- address & ``[link boost_asio.reference.ip__address.operator_eq_.overload3 operator=]``(
- const boost::asio::ip::address_v6 & ipv6_address);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.operator_eq_.overload3 more...]]``
+ const data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload2 data]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload2 more...]]``
 
 
-[section:overload1 ip::address::operator= (1 of 3 overloads)]
+[section:overload1 ip::basic_endpoint::data (1 of 2 overloads)]
 
 
-Assign from another address.
+Get the underlying endpoint in the native type.
 
 
- address & operator=(
- const address & other);
+ data_type * data();
 
 
 
@@ -39553,52 +57434,35 @@
 
 
 
-[section:overload2 ip::address::operator= (2 of 3 overloads)]
+[section:overload2 ip::basic_endpoint::data (2 of 2 overloads)]
 
 
-Assign from an IPv4 address.
+Get the underlying endpoint in the native type.
 
 
- address & operator=(
- const boost::asio::ip::address_v4 & ipv4_address);
+ const data_type * data() const;
 
 
 
 [endsect]
 
 
-
-[section:overload3 ip::address::operator= (3 of 3 overloads)]
-
-
-Assign from an IPv6 address.
-
-
- address & operator=(
- const boost::asio::ip::address_v6 & ipv6_address);
-
-
-
 [endsect]
 
 
-[endsect]
-
+[section:data_type ip::basic_endpoint::data_type]
 
-[section:operator_eq__eq_ ip::address::operator==]
+[indexterm2 data_type..ip::basic_endpoint]
+The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
 
-[indexterm2 operator==..ip::address]
-Compare two addresses for equality.
 
+ typedef implementation_defined data_type;
 
- friend bool operator==(
- const address & a1,
- const address & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address.hpp]
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -39607,20 +57471,20 @@
 
 
 
-[section:operator_gt_ ip::address::operator>]
+[section:operator_not__eq_ ip::basic_endpoint::operator!=]
 
-[indexterm2 operator>..ip::address]
-Compare addresses for ordering.
+[indexterm2 operator!=..ip::basic_endpoint]
+Compare two endpoints for inequality.
 
 
- friend bool operator>(
- const address & a1,
- const address & a2);
+ friend bool operator!=(
+ const basic_endpoint< InternetProtocol > & e1,
+ const basic_endpoint< InternetProtocol > & e2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address.hpp]
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -39629,20 +57493,20 @@
 
 
 
-[section:operator_gt__eq_ ip::address::operator>=]
+[section:operator_lt_ ip::basic_endpoint::operator<]
 
-[indexterm2 operator>=..ip::address]
-Compare addresses for ordering.
+[indexterm2 operator<..ip::basic_endpoint]
+Compare endpoints for ordering.
 
 
- friend bool operator>=(
- const address & a1,
- const address & a2);
+ friend bool operator<(
+ const basic_endpoint< InternetProtocol > & e1,
+ const basic_endpoint< InternetProtocol > & e2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address.hpp]
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -39650,292 +57514,171 @@
 [endsect]
 
 
-[section:to_string ip::address::to_string]
-
-[indexterm2 to_string..ip::address]
-Get the address as a string in dotted decimal format.
-
-
- std::string ``[link boost_asio.reference.ip__address.to_string.overload1 to_string]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload1 more...]]``
-
- std::string ``[link boost_asio.reference.ip__address.to_string.overload2 to_string]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__address.to_string.overload2 more...]]``
-
-
-[section:overload1 ip::address::to_string (1 of 2 overloads)]
 
+[section:operator_lt__lt_ ip::basic_endpoint::operator<<]
 
-Get the address as a string in dotted decimal format.
+[indexterm2 operator<<..ip::basic_endpoint]
+Output an endpoint as a string.
 
 
- std::string to_string() const;
+ std::basic_ostream< Elem, Traits > & operator<<(
+ std::basic_ostream< Elem, Traits > & os,
+ const basic_endpoint< InternetProtocol > & endpoint);
 
 
+Used to output a human-readable string for a specified endpoint.
 
-[endsect]
 
+[heading Parameters]
+
 
+[variablelist
+
+[[os][The output stream to which the string will be written.]]
 
-[section:overload2 ip::address::to_string (2 of 2 overloads)]
+[[endpoint][The endpoint to be written.]]
 
+]
 
-Get the address as a string in dotted decimal format.
 
+[heading Return Value]
+
+The output stream.
 
- std::string to_string(
- boost::system::error_code & ec) const;
 
 
 
 [endsect]
 
 
-[endsect]
-
 
-[section:to_v4 ip::address::to_v4]
+[section:operator_lt__eq_ ip::basic_endpoint::operator<=]
 
-[indexterm2 to_v4..ip::address]
-Get the address as an IP version 4 address.
+[indexterm2 operator<=..ip::basic_endpoint]
+Compare endpoints for ordering.
 
 
- boost::asio::ip::address_v4 to_v4() const;
+ friend bool operator<=(
+ const basic_endpoint< InternetProtocol > & e1,
+ const basic_endpoint< InternetProtocol > & e2);
 
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[section:to_v6 ip::address::to_v6]
+[endsect]
 
-[indexterm2 to_v6..ip::address]
-Get the address as an IP version 6 address.
 
 
- boost::asio::ip::address_v6 to_v6() const;
+[section:operator_eq_ ip::basic_endpoint::operator=]
 
+[indexterm2 operator=..ip::basic_endpoint]
+Assign from another endpoint.
 
 
-[endsect]
+ basic_endpoint & operator=(
+ const basic_endpoint & other);
 
 
 
 [endsect]
 
-[section:ip__address_v4 ip::address_v4]
 
 
-Implements IP version 4 style addresses.
+[section:operator_eq__eq_ ip::basic_endpoint::operator==]
 
+[indexterm2 operator==..ip::basic_endpoint]
+Compare two endpoints for equality.
 
- class address_v4
 
+ friend bool operator==(
+ const basic_endpoint< InternetProtocol > & e1,
+ const basic_endpoint< InternetProtocol > & e2);
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+[heading Requirements]
 
- [[link boost_asio.reference.ip__address_v4.bytes_type [*bytes_type]]]
- [The type used to represent an address as an array of bytes. ]
-
- ]
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
-]
+[*Convenience header: ][^boost/asio.hpp]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__address_v4.address_v4 [*address_v4]]]
- [Default constructor.
+[endsect]
 
- Construct an address from raw bytes.
 
- Construct an address from a unsigned long in host byte order.
 
- Copy constructor. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.any [*any]]]
- [Obtain an address object that represents any address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.broadcast [*broadcast]]]
- [Obtain an address object that represents the broadcast address.
+[section:operator_gt_ ip::basic_endpoint::operator>]
 
- Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.from_string [*from_string]]]
- [Create an address from an IP address string in dotted decimal form. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.is_class_a [*is_class_a]]]
- [Determine whether the address is a class A address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.is_class_b [*is_class_b]]]
- [Determine whether the address is a class B address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.is_class_c [*is_class_c]]]
- [Determine whether the address is a class C address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.is_multicast [*is_multicast]]]
- [Determine whether the address is a multicast address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.loopback [*loopback]]]
- [Obtain an address object that represents the loopback address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.netmask [*netmask]]]
- [Obtain the netmask that corresponds to the address, based on its address class. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.operator_eq_ [*operator=]]]
- [Assign from another address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.to_bytes [*to_bytes]]]
- [Get the address in bytes, in network byte order. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.to_string [*to_string]]]
- [Get the address as a string in dotted decimal format. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.to_ulong [*to_ulong]]]
- [Get the address as an unsigned long in host byte order. ]
- ]
-
-]
+[indexterm2 operator>..ip::basic_endpoint]
+Compare endpoints for ordering.
 
-[heading Friends]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__address_v4.operator_not__eq_ [*operator!=]]]
- [Compare two addresses for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.operator_lt_ [*operator<]]]
- [Compare addresses for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.operator_lt__eq_ [*operator<=]]]
- [Compare addresses for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.operator_eq__eq_ [*operator==]]]
- [Compare two addresses for equality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.operator_gt_ [*operator>]]]
- [Compare addresses for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v4.operator_gt__eq_ [*operator>=]]]
- [Compare addresses for ordering. ]
- ]
-
-]
+ friend bool operator>(
+ const basic_endpoint< InternetProtocol > & e1,
+ const basic_endpoint< InternetProtocol > & e2);
 
-[heading Related Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__address_v4.operator_lt__lt_ [*operator<<]]]
- [Output an address as a string. ]
- ]
-
-]
+[heading Requirements]
 
-The [link boost_asio.reference.ip__address_v4 `ip::address_v4`] class provides the ability to use and manipulate IP version 4 addresses.
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[endsect]
 
 
 
-[heading Requirements]
+[section:operator_gt__eq_ ip::basic_endpoint::operator>=]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+[indexterm2 operator>=..ip::basic_endpoint]
+Compare endpoints for ordering.
 
-[*Convenience header: ][^boost/asio.hpp]
 
-[section:address_v4 ip::address_v4::address_v4]
+ friend bool operator>=(
+ const basic_endpoint< InternetProtocol > & e1,
+ const basic_endpoint< InternetProtocol > & e2);
 
-[indexterm2 address_v4..ip::address_v4]
-Default constructor.
 
+[heading Requirements]
 
- ``[link boost_asio.reference.ip__address_v4.address_v4.overload1 address_v4]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload1 more...]]``
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Construct an address from raw bytes.
 
+[endsect]
 
- explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload2 address_v4]``(
- const bytes_type & bytes);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload2 more...]]``
 
+[section:port ip::basic_endpoint::port]
 
-Construct an address from a unsigned long in host byte order.
+[indexterm2 port..ip::basic_endpoint]
+Get the port associated with the endpoint. The port number is always in the host's byte order.
 
 
- explicit ``[link boost_asio.reference.ip__address_v4.address_v4.overload3 address_v4]``(
- unsigned long addr);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload3 more...]]``
+ unsigned short ``[link boost_asio.reference.ip__basic_endpoint.port.overload1 port]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload1 more...]]``
 
 
-Copy constructor.
+Set the port associated with the endpoint. The port number is always in the host's byte order.
 
 
- ``[link boost_asio.reference.ip__address_v4.address_v4.overload4 address_v4]``(
- const address_v4 & other);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.address_v4.overload4 more...]]``
+ void ``[link boost_asio.reference.ip__basic_endpoint.port.overload2 port]``(
+ unsigned short port_num);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload2 more...]]``
 
 
-[section:overload1 ip::address_v4::address_v4 (1 of 4 overloads)]
+[section:overload1 ip::basic_endpoint::port (1 of 2 overloads)]
 
 
-Default constructor.
+Get the port associated with the endpoint. The port number is always in the host's byte order.
 
 
- address_v4();
+ unsigned short port() const;
 
 
 
@@ -39943,29 +57686,30 @@
 
 
 
-[section:overload2 ip::address_v4::address_v4 (2 of 4 overloads)]
+[section:overload2 ip::basic_endpoint::port (2 of 2 overloads)]
 
 
-Construct an address from raw bytes.
+Set the port associated with the endpoint. The port number is always in the host's byte order.
 
 
- address_v4(
- const bytes_type & bytes);
+ void port(
+ unsigned short port_num);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload3 ip::address_v4::address_v4 (3 of 4 overloads)]
 
+[section:protocol ip::basic_endpoint::protocol]
 
-Construct an address from a unsigned long in host byte order.
+[indexterm2 protocol..ip::basic_endpoint]
+The protocol associated with the endpoint.
 
 
- address_v4(
- unsigned long addr);
+ protocol_type protocol() const;
 
 
 
@@ -39973,231 +57717,348 @@
 
 
 
-[section:overload4 ip::address_v4::address_v4 (4 of 4 overloads)]
+[section:protocol_type ip::basic_endpoint::protocol_type]
+
+[indexterm2 protocol_type..ip::basic_endpoint]
+The protocol type associated with the endpoint.
 
 
-Copy constructor.
+ typedef InternetProtocol protocol_type;
 
 
- address_v4(
- const address_v4 & other);
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:any ip::address_v4::any]
-
-[indexterm2 any..ip::address_v4]
-Obtain an address object that represents any address.
 
+[section:resize ip::basic_endpoint::resize]
 
- static address_v4 any();
+[indexterm2 resize..ip::basic_endpoint]
+Set the underlying size of the endpoint in the native type.
 
 
+ void resize(
+ std::size_t new_size);
 
-[endsect]
 
 
-[section:broadcast ip::address_v4::broadcast]
+[endsect]
 
-[indexterm2 broadcast..ip::address_v4]
-Obtain an address object that represents the broadcast address.
 
 
- static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload1 broadcast]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload1 more...]]``
+[section:size ip::basic_endpoint::size]
 
+[indexterm2 size..ip::basic_endpoint]
+Get the underlying size of the endpoint in the native type.
 
-Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask.
 
+ std::size_t size() const;
 
- static address_v4 ``[link boost_asio.reference.ip__address_v4.broadcast.overload2 broadcast]``(
- const address_v4 & addr,
- const address_v4 & mask);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.broadcast.overload2 more...]]``
 
 
-[section:overload1 ip::address_v4::broadcast (1 of 2 overloads)]
+[endsect]
 
 
-Obtain an address object that represents the broadcast address.
 
+[endsect]
 
- static address_v4 broadcast();
+[section:ip__basic_resolver ip::basic_resolver]
 
 
+Provides endpoint resolution functionality.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``,
+ typename ``[link boost_asio.reference.ResolverService ResolverService]`` = resolver_service<InternetProtocol>>
+ class basic_resolver :
+ public basic_io_object< ResolverService >
 
 
-[section:overload2 ip::address_v4::broadcast (2 of 2 overloads)]
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-Obtain an address object that represents the broadcast address that corresponds to the specified address and netmask.
+ [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
+ [
 
- static address_v4 broadcast(
- const address_v4 & addr,
- const address_v4 & mask);
+ [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
+ [The iterator type. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
+ [The query type. ]
+
+ ]
 
-[section:bytes_type ip::address_v4::bytes_type]
+ [
 
-[indexterm2 bytes_type..ip::address_v4]
-The type used to represent an address as an array of bytes.
+ [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+]
 
- typedef boost::array< unsigned char, 4 > bytes_type;
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
+ [Asynchronously perform forward resolution of a query to a list of entries.
 
+ Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
+ [Constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
+ [Cancel any asynchronous operations that are waiting on the resolver. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
+ [Perform forward resolution of a query to a list of entries.
 
-[heading Requirements]
+ Perform reverse resolution of an endpoint to a list of entries. ]
+ ]
+
+]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
 
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
-[section:from_string ip::address_v4::from_string]
+]
 
-[indexterm2 from_string..ip::address_v4]
-Create an address from an IP address string in dotted decimal form.
+The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
 
 
- static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload1 from_string]``(
- const char * str);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload1 more...]]``
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
- static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload2 from_string]``(
- const char * str,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload2 more...]]``
+[*Shared] [*objects:] Unsafe.
 
- static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload3 from_string]``(
- const std::string & str);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload3 more...]]``
 
- static address_v4 ``[link boost_asio.reference.ip__address_v4.from_string.overload4 from_string]``(
- const std::string & str,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.from_string.overload4 more...]]``
 
+[heading Requirements]
 
-[section:overload1 ip::address_v4::from_string (1 of 4 overloads)]
+[*Header: ][^boost/asio/ip/basic_resolver.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Create an address from an IP address string in dotted decimal form.
+[section:async_resolve ip::basic_resolver::async_resolve]
 
+[indexterm2 async_resolve..ip::basic_resolver]
+Asynchronously perform forward resolution of a query to a list of entries.
 
- static address_v4 from_string(
- const char * str);
 
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 async_resolve]``(
+ const query & q,
+ ResolveHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 more...]]``
 
 
-[endsect]
+Asynchronously perform reverse resolution of an endpoint to a list of entries.
 
 
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 async_resolve]``(
+ const endpoint_type & e,
+ ResolveHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 more...]]``
 
-[section:overload2 ip::address_v4::from_string (2 of 4 overloads)]
 
+[section:overload1 ip::basic_resolver::async_resolve (1 of 2 overloads)]
 
-Create an address from an IP address string in dotted decimal form.
 
+Asynchronously perform forward resolution of a query to a list of entries.
 
- static address_v4 from_string(
- const char * str,
- boost::system::error_code & ec);
 
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void async_resolve(
+ const query & q,
+ ResolveHandler handler);
 
 
-[endsect]
+This function is used to asynchronously resolve a query into a list of endpoint entries.
 
 
+[heading Parameters]
+
 
-[section:overload3 ip::address_v4::from_string (3 of 4 overloads)]
+[variablelist
+
+[[q][A query object that determines what endpoints will be returned.]]
 
+[[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ resolver::iterator iterator // Forward-only iterator that can
+ // be used to traverse the list
+ // of endpoint entries.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
-Create an address from an IP address string in dotted decimal form.
+]
 
 
- static address_v4 from_string(
- const std::string & str);
+[heading Remarks]
+
+A default constructed iterator represents the end of the list.
 
+A successful resolve operation is guaranteed to pass at least one entry to the handler.
 
 
 [endsect]
 
 
 
-[section:overload4 ip::address_v4::from_string (4 of 4 overloads)]
-
+[section:overload2 ip::basic_resolver::async_resolve (2 of 2 overloads)]
 
-Create an address from an IP address string in dotted decimal form.
 
+Asynchronously perform reverse resolution of an endpoint to a list of entries.
 
- static address_v4 from_string(
- const std::string & str,
- boost::system::error_code & ec);
 
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void async_resolve(
+ const endpoint_type & e,
+ ResolveHandler handler);
 
 
-[endsect]
+This function is used to asynchronously resolve an endpoint into a list of endpoint entries.
 
 
-[endsect]
+[heading Parameters]
+
 
+[variablelist
+
+[[e][An endpoint object that determines what endpoints will be returned.]]
 
-[section:is_class_a ip::address_v4::is_class_a]
+[[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ resolver::iterator iterator // Forward-only iterator that can
+ // be used to traverse the list
+ // of endpoint entries.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
 
-[indexterm2 is_class_a..ip::address_v4]
-Determine whether the address is a class A address.
+]
 
 
- bool is_class_a() const;
+[heading Remarks]
+
+A default constructed iterator represents the end of the list.
 
+A successful resolve operation is guaranteed to pass at least one entry to the handler.
 
 
 [endsect]
 
 
+[endsect]
 
-[section:is_class_b ip::address_v4::is_class_b]
-
-[indexterm2 is_class_b..ip::address_v4]
-Determine whether the address is a class B address.
 
+[section:basic_resolver ip::basic_resolver::basic_resolver]
 
- bool is_class_b() const;
+[indexterm2 basic_resolver..ip::basic_resolver]
+Constructor.
 
 
+ basic_resolver(
+ boost::asio::io_service & io_service);
 
-[endsect]
 
+This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`].
 
 
-[section:is_class_c ip::address_v4::is_class_c]
+[heading Parameters]
+
 
-[indexterm2 is_class_c..ip::address_v4]
-Determine whether the address is a class C address.
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the resolver will use to dispatch handlers for any asynchronous operations performed on the timer. ]]
 
+]
 
- bool is_class_c() const;
 
 
 
@@ -40205,125 +58066,109 @@
 
 
 
-[section:is_multicast ip::address_v4::is_multicast]
+[section:cancel ip::basic_resolver::cancel]
 
-[indexterm2 is_multicast..ip::address_v4]
-Determine whether the address is a multicast address.
+[indexterm2 cancel..ip::basic_resolver]
+Cancel any asynchronous operations that are waiting on the resolver.
 
 
- bool is_multicast() const;
+ void cancel();
+
 
+This function forces the completion of any pending asynchronous operations on the host resolver. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
 
 
 [endsect]
 
 
 
-[section:loopback ip::address_v4::loopback]
+[section:endpoint_type ip::basic_resolver::endpoint_type]
 
-[indexterm2 loopback..ip::address_v4]
-Obtain an address object that represents the loopback address.
+[indexterm2 endpoint_type..ip::basic_resolver]
+The endpoint type.
 
 
- static address_v4 loopback();
+ typedef InternetProtocol::endpoint endpoint_type;
 
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/basic_resolver.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:netmask ip::address_v4::netmask]
 
-[indexterm2 netmask..ip::address_v4]
-Obtain the netmask that corresponds to the address, based on its address class.
+[endsect]
 
 
- static address_v4 netmask(
- const address_v4 & addr);
+[section:get_implementation ip::basic_resolver::get_implementation]
 
+[indexterm2 get_implementation..ip::basic_resolver]
+Get the underlying implementation of the I/O object.
 
 
-[endsect]
+ implementation_type & ``[link boost_asio.reference.ip__basic_resolver.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.get_implementation.overload1 more...]]``
 
+ const implementation_type & ``[link boost_asio.reference.ip__basic_resolver.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.get_implementation.overload2 more...]]``
 
 
-[section:operator_not__eq_ ip::address_v4::operator!=]
+[section:overload1 ip::basic_resolver::get_implementation (1 of 2 overloads)]
 
-[indexterm2 operator!=..ip::address_v4]
-Compare two addresses for inequality.
 
+['Inherited from basic_io_object.]
 
- friend bool operator!=(
- const address_v4 & a1,
- const address_v4 & a2);
 
+Get the underlying implementation of the I/O object.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+ implementation_type & get_implementation();
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_lt_ ip::address_v4::operator<]
+[section:overload2 ip::basic_resolver::get_implementation (2 of 2 overloads)]
 
-[indexterm2 operator<..ip::address_v4]
-Compare addresses for ordering.
 
+['Inherited from basic_io_object.]
 
- friend bool operator<(
- const address_v4 & a1,
- const address_v4 & a2);
 
+Get the underlying implementation of the I/O object.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+ const implementation_type & get_implementation() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-
-[section:operator_lt__lt_ ip::address_v4::operator<<]
-
-[indexterm2 operator<<..ip::address_v4]
-Output an address as a string.
+[endsect]
 
 
- template<
- typename Elem,
- typename Traits>
- std::basic_ostream< Elem, Traits > & operator<<(
- std::basic_ostream< Elem, Traits > & os,
- const address_v4 & addr);
+[section:get_io_service ip::basic_resolver::get_io_service]
 
 
-Used to output a human-readable string for a specified address.
+['Inherited from basic_io_object.]
 
+[indexterm2 get_io_service..ip::basic_resolver]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
-[heading Parameters]
-
 
-[variablelist
-
-[[os][The output stream to which the string will be written.]]
+ boost::asio::io_service & get_io_service();
 
-[[addr][The address to be written.]]
 
-]
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
 [heading Return Value]
       
-The output stream.
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
 
 
@@ -40331,37 +58176,29 @@
 [endsect]
 
 
+[section:get_service ip::basic_resolver::get_service]
 
-[section:operator_lt__eq_ ip::address_v4::operator<=]
-
-[indexterm2 operator<=..ip::address_v4]
-Compare addresses for ordering.
-
-
- friend bool operator<=(
- const address_v4 & a1,
- const address_v4 & a2);
-
+[indexterm2 get_service..ip::basic_resolver]
+Get the service associated with the I/O object.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+ service_type & ``[link boost_asio.reference.ip__basic_resolver.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.get_service.overload1 more...]]``
 
-[*Convenience header: ][^boost/asio.hpp]
+ const service_type & ``[link boost_asio.reference.ip__basic_resolver.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.get_service.overload2 more...]]``
 
 
-[endsect]
+[section:overload1 ip::basic_resolver::get_service (1 of 2 overloads)]
 
 
+['Inherited from basic_io_object.]
 
-[section:operator_eq_ ip::address_v4::operator=]
 
-[indexterm2 operator=..ip::address_v4]
-Assign from another address.
+Get the service associated with the I/O object.
 
 
- address_v4 & operator=(
- const address_v4 & other);
+ service_type & get_service();
 
 
 
@@ -40369,64 +58206,58 @@
 
 
 
-[section:operator_eq__eq_ ip::address_v4::operator==]
+[section:overload2 ip::basic_resolver::get_service (2 of 2 overloads)]
 
-[indexterm2 operator==..ip::address_v4]
-Compare two addresses for equality.
 
+['Inherited from basic_io_object.]
 
- friend bool operator==(
- const address_v4 & a1,
- const address_v4 & a2);
 
+Get the service associated with the I/O object.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+ const service_type & get_service() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[endsect]
 
-[section:operator_gt_ ip::address_v4::operator>]
 
-[indexterm2 operator>..ip::address_v4]
-Compare addresses for ordering.
+[section:implementation ip::basic_resolver::implementation]
 
 
- friend bool operator>(
- const address_v4 & a1,
- const address_v4 & a2);
+['Inherited from basic_io_object.]
 
+[indexterm2 implementation..ip::basic_resolver]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+ implementation_type implementation;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_gt__eq_ ip::address_v4::operator>=]
+[section:implementation_type ip::basic_resolver::implementation_type]
 
-[indexterm2 operator>=..ip::address_v4]
-Compare addresses for ordering.
 
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation_type..ip::basic_resolver]
+The underlying implementation type of I/O object.
+
+
+ typedef service_type::implementation_type implementation_type;
 
- friend bool operator>=(
- const address_v4 & a1,
- const address_v4 & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v4.hpp]
+[*Header: ][^boost/asio/ip/basic_resolver.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -40435,87 +58266,165 @@
 
 
 
-[section:to_bytes ip::address_v4::to_bytes]
+[section:iterator ip::basic_resolver::iterator]
 
-[indexterm2 to_bytes..ip::address_v4]
-Get the address in bytes, in network byte order.
+[indexterm2 iterator..ip::basic_resolver]
+The iterator type.
 
 
- bytes_type to_bytes() const;
+ typedef basic_resolver_iterator< InternetProtocol > iterator;
 
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
+ [The type used for the distance between two iterators. ]
+
+ ]
 
-[section:to_string ip::address_v4::to_string]
+ [
 
-[indexterm2 to_string..ip::address_v4]
-Get the address as a string in dotted decimal format.
+ [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
+ [The iterator category. ]
+
+ ]
 
+ [
 
- std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload1 to_string]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload1 more...]]``
+ [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
+ [The type of the result of applying operator->() to the iterator. ]
+
+ ]
 
- std::string ``[link boost_asio.reference.ip__address_v4.to_string.overload2 to_string]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v4.to_string.overload2 more...]]``
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
+ [The type of the result of applying operator*() to the iterator. ]
+
+ ]
 
-[section:overload1 ip::address_v4::to_string (1 of 2 overloads)]
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
+ [The type of the value pointed to by the iterator. ]
+
+ ]
 
-Get the address as a string in dotted decimal format.
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
- std::string to_string() const;
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
+ [Default constructor creates an end iterator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
+ [Create an iterator from an addrinfo list returned by getaddrinfo.
 
+ Create an iterator from an endpoint, host name and service name. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
+ [Dereference an iterator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
+ [Increment operator (prefix).
 
+ Increment operator (postfix). ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
+ [Dereference an iterator. ]
+ ]
+
+]
 
-[endsect]
+[heading Friends]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
+ [Test two iterators for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
+ [Test two iterators for equality. ]
+ ]
+
+]
 
+The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
 
-[section:overload2 ip::address_v4::to_string (2 of 2 overloads)]
+The iterator's value\_type, obtained when the iterator is dereferenced, is:
 
+ const basic_resolver_entry<InternetProtocol>
 
-Get the address as a string in dotted decimal format.
 
 
- std::string to_string(
- boost::system::error_code & ec) const;
 
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
 
-[endsect]
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:to_ulong ip::address_v4::to_ulong]
 
-[indexterm2 to_ulong..ip::address_v4]
-Get the address as an unsigned long in host byte order.
+[section:protocol_type ip::basic_resolver::protocol_type]
 
+[indexterm2 protocol_type..ip::basic_resolver]
+The protocol type.
 
- unsigned long to_ulong() const;
+
+ typedef InternetProtocol protocol_type;
 
 
 
-[endsect]
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/basic_resolver.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
-[section:ip__address_v6 ip::address_v6]
 
 
-Implements IP version 6 style addresses.
+[section:query ip::basic_resolver::query]
 
+[indexterm2 query..ip::basic_resolver]
+The query type.
 
- class address_v6
+
+ typedef basic_resolver_query< InternetProtocol > query;
 
 
 [heading Types]
@@ -40524,8 +58433,15 @@
 
   [
 
- [[link boost_asio.reference.ip__address_v6.bytes_type [*bytes_type]]]
- [The type used to represent an address as an array of bytes. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
+ [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint query. ]
   
   ]
 
@@ -40536,174 +58452,75 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__address_v6.address_v6 [*address_v6]]]
- [Default constructor.
+ [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
+ [Construct with specified service name for any protocol.
 
- Construct an address from raw bytes and scope ID.
+ Construct with specified service name for a given protocol.
 
- Copy constructor. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.any [*any]]]
- [Obtain an address object that represents any address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.from_string [*from_string]]]
- [Create an address from an IP address string. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_link_local [*is_link_local]]]
- [Determine whether the address is link local. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_loopback [*is_loopback]]]
- [Determine whether the address is a loopback address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_multicast [*is_multicast]]]
- [Determine whether the address is a multicast address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_multicast_global [*is_multicast_global]]]
- [Determine whether the address is a global multicast address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_multicast_link_local [*is_multicast_link_local]]]
- [Determine whether the address is a link-local multicast address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_multicast_node_local [*is_multicast_node_local]]]
- [Determine whether the address is a node-local multicast address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_multicast_org_local [*is_multicast_org_local]]]
- [Determine whether the address is a org-local multicast address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_multicast_site_local [*is_multicast_site_local]]]
- [Determine whether the address is a site-local multicast address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_site_local [*is_site_local]]]
- [Determine whether the address is site local. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_unspecified [*is_unspecified]]]
- [Determine whether the address is unspecified. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_v4_compatible [*is_v4_compatible]]]
- [Determine whether the address is an IPv4-compatible address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.is_v4_mapped [*is_v4_mapped]]]
- [Determine whether the address is a mapped IPv4 address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.loopback [*loopback]]]
- [Obtain an address object that represents the loopback address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.operator_eq_ [*operator=]]]
- [Assign from another address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.scope_id [*scope_id]]]
- [The scope ID of the address. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.to_bytes [*to_bytes]]]
- [Get the address in bytes, in network byte order. ]
- ]
-
- [
- [[link boost_asio.reference.ip__address_v6.to_string [*to_string]]]
- [Get the address as a string. ]
+ Construct with specified host name and service name for any protocol.
+
+ Construct with specified host name and service name for a given protocol. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address_v6.to_v4 [*to_v4]]]
- [Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
+ [Get the hints associated with the query. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address_v6.v4_compatible [*v4_compatible]]]
- [Create an IPv4-compatible IPv6 address. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
+ [Get the host name associated with the query. ]
   ]
   
   [
- [[link boost_asio.reference.ip__address_v6.v4_mapped [*v4_mapped]]]
- [Create an IPv4-mapped IPv6 address. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
+ [Get the service name associated with the query. ]
   ]
   
 ]
 
-[heading Friends]
+[heading Data Members]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__address_v6.operator_not__eq_ [*operator!=]]]
- [Compare two addresses for inequality. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
+ [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__address_v6.operator_lt_ [*operator<]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
+ [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__address_v6.operator_lt__eq_ [*operator<=]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
+ [Determine the canonical name of the host specified in the query. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__address_v6.operator_eq__eq_ [*operator==]]]
- [Compare two addresses for equality. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
+ [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__address_v6.operator_gt_ [*operator>]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
+ [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__address_v6.operator_gt__eq_ [*operator>=]]]
- [Compare addresses for ordering. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
+ [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
   ]
-
-]
-
-[heading Related Functions]
-[table
- [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__address_v6.operator_lt__lt_ [*operator<<]]]
- [Output an address as a string. ]
+ [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
+ [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
   ]
-
+
 ]
 
-The [link boost_asio.reference.ip__address_v6 `ip::address_v6`] class provides the ability to use and manipulate IP version 6 addresses.
+The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
 
 
 [heading Thread Safety]
@@ -40714,300 +58531,388 @@
 
 
 
+
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
+[*Header: ][^boost/asio/ip/basic_resolver.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:address_v6 ip::address_v6::address_v6]
 
-[indexterm2 address_v6..ip::address_v6]
-Default constructor.
+[endsect]
 
 
- ``[link boost_asio.reference.ip__address_v6.address_v6.overload1 address_v6]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload1 more...]]``
+[section:resolve ip::basic_resolver::resolve]
 
+[indexterm2 resolve..ip::basic_resolver]
+Perform forward resolution of a query to a list of entries.
 
-Construct an address from raw bytes and scope ID.
 
+ iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload1 resolve]``(
+ const query & q);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload1 more...]]``
 
- explicit ``[link boost_asio.reference.ip__address_v6.address_v6.overload2 address_v6]``(
- const bytes_type & bytes,
- unsigned long scope_id = 0);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload2 more...]]``
+ iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload2 resolve]``(
+ const query & q,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload2 more...]]``
 
 
-Copy constructor.
+Perform reverse resolution of an endpoint to a list of entries.
 
 
- ``[link boost_asio.reference.ip__address_v6.address_v6.overload3 address_v6]``(
- const address_v6 & other);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.address_v6.overload3 more...]]``
+ iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload3 resolve]``(
+ const endpoint_type & e);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload3 more...]]``
 
+ iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload4 resolve]``(
+ const endpoint_type & e,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload4 more...]]``
 
-[section:overload1 ip::address_v6::address_v6 (1 of 3 overloads)]
 
+[section:overload1 ip::basic_resolver::resolve (1 of 4 overloads)]
 
-Default constructor.
 
+Perform forward resolution of a query to a list of entries.
 
- address_v6();
 
+ iterator resolve(
+ const query & q);
 
 
-[endsect]
+This function is used to resolve a query into a list of endpoint entries.
 
 
+[heading Parameters]
+
 
-[section:overload2 ip::address_v6::address_v6 (2 of 3 overloads)]
+[variablelist
+
+[[q][A query object that determines what endpoints will be returned.]]
 
+]
 
-Construct an address from raw bytes and scope ID.
 
+[heading Return Value]
+
+A forward-only iterator that can be used to traverse the list of endpoint entries.
 
- address_v6(
- const bytes_type & bytes,
- unsigned long scope_id = 0);
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[endsect]
+]
 
 
+[heading Remarks]
+
+A default constructed iterator represents the end of the list.
 
-[section:overload3 ip::address_v6::address_v6 (3 of 3 overloads)]
+A successful call to this function is guaranteed to return at least one entry.
 
 
-Copy constructor.
+[endsect]
 
 
- address_v6(
- const address_v6 & other);
 
+[section:overload2 ip::basic_resolver::resolve (2 of 4 overloads)]
 
 
-[endsect]
+Perform forward resolution of a query to a list of entries.
 
 
-[endsect]
+ iterator resolve(
+ const query & q,
+ boost::system::error_code & ec);
 
 
-[section:any ip::address_v6::any]
+This function is used to resolve a query into a list of endpoint entries.
 
-[indexterm2 any..ip::address_v6]
-Obtain an address object that represents any address.
 
+[heading Parameters]
+
 
- static address_v6 any();
+[variablelist
+
+[[q][A query object that determines what endpoints will be returned.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
-[endsect]
 
+[heading Return Value]
+
+A forward-only iterator that can be used to traverse the list of endpoint entries. Returns a default constructed iterator if an error occurs.
 
 
-[section:bytes_type ip::address_v6::bytes_type]
+[heading Remarks]
+
+A default constructed iterator represents the end of the list.
 
-[indexterm2 bytes_type..ip::address_v6]
-The type used to represent an address as an array of bytes.
+A successful call to this function is guaranteed to return at least one entry.
 
 
- typedef boost::array< unsigned char, 16 > bytes_type;
+[endsect]
 
 
 
-[heading Requirements]
+[section:overload3 ip::basic_resolver::resolve (3 of 4 overloads)]
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Perform reverse resolution of an endpoint to a list of entries.
 
 
-[endsect]
+ iterator resolve(
+ const endpoint_type & e);
 
 
-[section:from_string ip::address_v6::from_string]
+This function is used to resolve an endpoint into a list of endpoint entries.
 
-[indexterm2 from_string..ip::address_v6]
-Create an address from an IP address string.
 
+[heading Parameters]
+
 
- static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload1 from_string]``(
- const char * str);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload1 more...]]``
+[variablelist
+
+[[e][An endpoint object that determines what endpoints will be returned.]]
 
- static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload2 from_string]``(
- const char * str,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload2 more...]]``
+]
 
- static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload3 from_string]``(
- const std::string & str);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload3 more...]]``
 
- static address_v6 ``[link boost_asio.reference.ip__address_v6.from_string.overload4 from_string]``(
- const std::string & str,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.from_string.overload4 more...]]``
+[heading Return Value]
+
+A forward-only iterator that can be used to traverse the list of endpoint entries.
 
 
-[section:overload1 ip::address_v6::from_string (1 of 4 overloads)]
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-Create an address from an IP address string.
+]
 
 
- static address_v6 from_string(
- const char * str);
+[heading Remarks]
+
+A default constructed iterator represents the end of the list.
 
+A successful call to this function is guaranteed to return at least one entry.
 
 
 [endsect]
 
 
 
-[section:overload2 ip::address_v6::from_string (2 of 4 overloads)]
+[section:overload4 ip::basic_resolver::resolve (4 of 4 overloads)]
 
 
-Create an address from an IP address string.
+Perform reverse resolution of an endpoint to a list of entries.
 
 
- static address_v6 from_string(
- const char * str,
+ iterator resolve(
+ const endpoint_type & e,
       boost::system::error_code & ec);
 
 
+This function is used to resolve an endpoint into a list of endpoint entries.
+
 
-[endsect]
+[heading Parameters]
+
 
+[variablelist
+
+[[e][An endpoint object that determines what endpoints will be returned.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
-[section:overload3 ip::address_v6::from_string (3 of 4 overloads)]
+]
 
 
-Create an address from an IP address string.
+[heading Return Value]
+
+A forward-only iterator that can be used to traverse the list of endpoint entries. Returns a default constructed iterator if an error occurs.
 
 
- static address_v6 from_string(
- const std::string & str);
+[heading Remarks]
+
+A default constructed iterator represents the end of the list.
 
+A successful call to this function is guaranteed to return at least one entry.
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload4 ip::address_v6::from_string (4 of 4 overloads)]
 
+[section:service ip::basic_resolver::service]
 
-Create an address from an IP address string.
 
+['Inherited from basic_io_object.]
 
- static address_v6 from_string(
- const std::string & str,
- boost::system::error_code & ec);
+[indexterm2 service..ip::basic_resolver]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
+ service_type & service;
 
-[endsect]
 
 
-[endsect]
+[heading Remarks]
+
+Available only for services that do not support movability.
 
 
-[section:is_link_local ip::address_v6::is_link_local]
 
-[indexterm2 is_link_local..ip::address_v6]
-Determine whether the address is link local.
 
+[endsect]
 
- bool is_link_local() const;
 
 
+[section:service_type ip::basic_resolver::service_type]
 
-[endsect]
 
+['Inherited from basic_io_object.]
 
+[indexterm2 service_type..ip::basic_resolver]
+The type of the service that will be used to provide I/O operations.
 
-[section:is_loopback ip::address_v6::is_loopback]
 
-[indexterm2 is_loopback..ip::address_v6]
-Determine whether the address is a loopback address.
+ typedef ResolverService service_type;
 
 
- bool is_loopback() const;
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/basic_resolver.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
-[section:is_multicast ip::address_v6::is_multicast]
 
-[indexterm2 is_multicast..ip::address_v6]
-Determine whether the address is a multicast address.
 
+[endsect]
 
- bool is_multicast() const;
+[section:ip__basic_resolver_entry ip::basic_resolver_entry]
 
 
+An entry produced by a resolver.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
+ class basic_resolver_entry
 
 
-[section:is_multicast_global ip::address_v6::is_multicast_global]
+[heading Types]
+[table
+ [[Name][Description]]
 
-[indexterm2 is_multicast_global..ip::address_v6]
-Determine whether the address is a global multicast address.
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
+ [The endpoint type associated with the endpoint entry. ]
+
+ ]
 
- bool is_multicast_global() const;
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint entry. ]
+
+ ]
 
+]
 
-[endsect]
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
+ [Default constructor.
 
+ Construct with specified endpoint, host name and service name. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
+ [Get the endpoint associated with the entry. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
+ [Get the host name associated with the entry. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
+ [Convert to the endpoint associated with the entry. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
+ [Get the service name associated with the entry. ]
+ ]
+
+]
 
-[section:is_multicast_link_local ip::address_v6::is_multicast_link_local]
+The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
 
-[indexterm2 is_multicast_link_local..ip::address_v6]
-Determine whether the address is a link-local multicast address.
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
- bool is_multicast_link_local() const;
+[*Shared] [*objects:] Unsafe.
 
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:is_multicast_node_local ip::address_v6::is_multicast_node_local]
+[section:basic_resolver_entry ip::basic_resolver_entry::basic_resolver_entry]
 
-[indexterm2 is_multicast_node_local..ip::address_v6]
-Determine whether the address is a node-local multicast address.
+[indexterm2 basic_resolver_entry..ip::basic_resolver_entry]
+Default constructor.
 
 
- bool is_multicast_node_local() const;
+ ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 basic_resolver_entry]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 more...]]``
 
 
+Construct with specified endpoint, host name and service name.
 
-[endsect]
+
+ ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 basic_resolver_entry]``(
+ const endpoint_type & ep,
+ const std::string & host,
+ const std::string & service);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 more...]]``
 
 
+[section:overload1 ip::basic_resolver_entry::basic_resolver_entry (1 of 2 overloads)]
 
-[section:is_multicast_org_local ip::address_v6::is_multicast_org_local]
 
-[indexterm2 is_multicast_org_local..ip::address_v6]
-Determine whether the address is a org-local multicast address.
+Default constructor.
 
 
- bool is_multicast_org_local() const;
+ basic_resolver_entry();
 
 
 
@@ -41015,27 +58920,32 @@
 
 
 
-[section:is_multicast_site_local ip::address_v6::is_multicast_site_local]
+[section:overload2 ip::basic_resolver_entry::basic_resolver_entry (2 of 2 overloads)]
 
-[indexterm2 is_multicast_site_local..ip::address_v6]
-Determine whether the address is a site-local multicast address.
 
+Construct with specified endpoint, host name and service name.
 
- bool is_multicast_site_local() const;
+
+ basic_resolver_entry(
+ const endpoint_type & ep,
+ const std::string & host,
+ const std::string & service);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:is_site_local ip::address_v6::is_site_local]
 
-[indexterm2 is_site_local..ip::address_v6]
-Determine whether the address is site local.
+[section:endpoint ip::basic_resolver_entry::endpoint]
 
+[indexterm2 endpoint..ip::basic_resolver_entry]
+Get the endpoint associated with the entry.
 
- bool is_site_local() const;
+
+ endpoint_type endpoint() const;
 
 
 
@@ -41043,27 +58953,34 @@
 
 
 
-[section:is_unspecified ip::address_v6::is_unspecified]
+[section:endpoint_type ip::basic_resolver_entry::endpoint_type]
 
-[indexterm2 is_unspecified..ip::address_v6]
-Determine whether the address is unspecified.
+[indexterm2 endpoint_type..ip::basic_resolver_entry]
+The endpoint type associated with the endpoint entry.
 
 
- bool is_unspecified() const;
+ typedef InternetProtocol::endpoint endpoint_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:is_v4_compatible ip::address_v6::is_v4_compatible]
+[section:host_name ip::basic_resolver_entry::host_name]
 
-[indexterm2 is_v4_compatible..ip::address_v6]
-Determine whether the address is an IPv4-compatible address.
+[indexterm2 host_name..ip::basic_resolver_entry]
+Get the host name associated with the entry.
 
 
- bool is_v4_compatible() const;
+ std::string host_name() const;
 
 
 
@@ -41071,13 +58988,13 @@
 
 
 
-[section:is_v4_mapped ip::address_v6::is_v4_mapped]
+[section:operator_endpoint_type ip::basic_resolver_entry::operator endpoint_type]
 
-[indexterm2 is_v4_mapped..ip::address_v6]
-Determine whether the address is a mapped IPv4 address.
+[indexterm2 operator endpoint_type..ip::basic_resolver_entry]
+Convert to the endpoint associated with the entry.
 
 
- bool is_v4_mapped() const;
+ operator endpoint_type() const;
 
 
 
@@ -41085,199 +59002,256 @@
 
 
 
-[section:loopback ip::address_v6::loopback]
+[section:protocol_type ip::basic_resolver_entry::protocol_type]
 
-[indexterm2 loopback..ip::address_v6]
-Obtain an address object that represents the loopback address.
+[indexterm2 protocol_type..ip::basic_resolver_entry]
+The protocol type associated with the endpoint entry.
 
 
- static address_v6 loopback();
+ typedef InternetProtocol protocol_type;
 
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:operator_not__eq_ ip::address_v6::operator!=]
 
-[indexterm2 operator!=..ip::address_v6]
-Compare two addresses for inequality.
+[endsect]
 
 
- friend bool operator!=(
- const address_v6 & a1,
- const address_v6 & a2);
 
+[section:service_name ip::basic_resolver_entry::service_name]
 
-[heading Requirements]
+[indexterm2 service_name..ip::basic_resolver_entry]
+Get the service name associated with the entry.
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ std::string service_name() const;
+
 
 
 [endsect]
 
 
 
-[section:operator_lt_ ip::address_v6::operator<]
+[endsect]
 
-[indexterm2 operator<..ip::address_v6]
-Compare addresses for ordering.
+[section:ip__basic_resolver_iterator ip::basic_resolver_iterator]
 
 
- friend bool operator<(
- const address_v6 & a1,
- const address_v6 & a2);
+An iterator over the entries produced by a resolver.
 
 
-[heading Requirements]
+ template<
+ typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
+ class basic_resolver_iterator
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
+ [The type used for the distance between two iterators. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
+ [The iterator category. ]
+
+ ]
 
-[section:operator_lt__lt_ ip::address_v6::operator<<]
+ [
 
-[indexterm2 operator<<..ip::address_v6]
-Output an address as a string.
+ [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
+ [The type of the result of applying operator->() to the iterator. ]
+
+ ]
 
+ [
 
- template<
- typename Elem,
- typename Traits>
- std::basic_ostream< Elem, Traits > & operator<<(
- std::basic_ostream< Elem, Traits > & os,
- const address_v6 & addr);
+ [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
+ [The type of the result of applying operator*() to the iterator. ]
+
+ ]
 
+ [
 
-Used to output a human-readable string for a specified address.
+ [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
+ [The type of the value pointed to by the iterator. ]
+
+ ]
 
+]
 
-[heading Parameters]
-
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[variablelist
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
+ [Default constructor creates an end iterator. ]
+ ]
   
-[[os][The output stream to which the string will be written.]]
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
+ [Create an iterator from an addrinfo list returned by getaddrinfo.
 
-[[addr][The address to be written.]]
+ Create an iterator from an endpoint, host name and service name. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
+ [Dereference an iterator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
+ [Increment operator (prefix).
 
+ Increment operator (postfix). ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
+ [Dereference an iterator. ]
+ ]
+
 ]
 
+[heading Friends]
+[table
+ [[Name][Description]]
 
-[heading Return Value]
-
-The output stream.
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
+ [Test two iterators for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
+ [Test two iterators for equality. ]
+ ]
+
+]
 
+The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
 
+The iterator's value\_type, obtained when the iterator is dereferenced, is:
 
+ const basic_resolver_entry<InternetProtocol>
 
-[endsect]
 
 
 
-[section:operator_lt__eq_ ip::address_v6::operator<=]
 
-[indexterm2 operator<=..ip::address_v6]
-Compare addresses for ordering.
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
- friend bool operator<=(
- const address_v6 & a1,
- const address_v6 & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:basic_resolver_iterator ip::basic_resolver_iterator::basic_resolver_iterator]
+
+[indexterm2 basic_resolver_iterator..ip::basic_resolver_iterator]
+Default constructor creates an end iterator.
 
 
+ basic_resolver_iterator();
 
-[section:operator_eq_ ip::address_v6::operator=]
 
-[indexterm2 operator=..ip::address_v6]
-Assign from another address.
 
+[endsect]
 
- address_v6 & operator=(
- const address_v6 & other);
 
+[section:create ip::basic_resolver_iterator::create]
 
+[indexterm2 create..ip::basic_resolver_iterator]
+Create an iterator from an addrinfo list returned by getaddrinfo.
 
-[endsect]
+
+ static basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.create.overload1 create]``(
+ boost::asio::detail::addrinfo_type * address_info,
+ const std::string & host_name,
+ const std::string & service_name);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.create.overload1 more...]]``
 
 
+Create an iterator from an endpoint, host name and service name.
 
-[section:operator_eq__eq_ ip::address_v6::operator==]
 
-[indexterm2 operator==..ip::address_v6]
-Compare two addresses for equality.
+ static basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.create.overload2 create]``(
+ const typename InternetProtocol::endpoint & endpoint,
+ const std::string & host_name,
+ const std::string & service_name);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.create.overload2 more...]]``
 
 
- friend bool operator==(
- const address_v6 & a1,
- const address_v6 & a2);
+[section:overload1 ip::basic_resolver_iterator::create (1 of 2 overloads)]
 
 
-[heading Requirements]
+Create an iterator from an addrinfo list returned by getaddrinfo.
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ static basic_resolver_iterator create(
+ boost::asio::detail::addrinfo_type * address_info,
+ const std::string & host_name,
+ const std::string & service_name);
 
 
-[endsect]
 
+[endsect]
 
 
-[section:operator_gt_ ip::address_v6::operator>]
 
-[indexterm2 operator>..ip::address_v6]
-Compare addresses for ordering.
+[section:overload2 ip::basic_resolver_iterator::create (2 of 2 overloads)]
 
 
- friend bool operator>(
- const address_v6 & a1,
- const address_v6 & a2);
+Create an iterator from an endpoint, host name and service name.
 
 
-[heading Requirements]
+ static basic_resolver_iterator create(
+ const typename InternetProtocol::endpoint & endpoint,
+ const std::string & host_name,
+ const std::string & service_name);
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+
+[endsect]
 
 
 [endsect]
 
 
+[section:difference_type ip::basic_resolver_iterator::difference_type]
 
-[section:operator_gt__eq_ ip::address_v6::operator>=]
+[indexterm2 difference_type..ip::basic_resolver_iterator]
+The type used for the distance between two iterators.
 
-[indexterm2 operator>=..ip::address_v6]
-Compare addresses for ordering.
 
+ typedef std::ptrdiff_t difference_type;
 
- friend bool operator>=(
- const address_v6 & a1,
- const address_v6 & a2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/address_v6.hpp]
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -41285,89 +59259,88 @@
 [endsect]
 
 
-[section:scope_id ip::address_v6::scope_id]
 
-[indexterm2 scope_id..ip::address_v6]
-The scope ID of the address.
+[section:iterator_category ip::basic_resolver_iterator::iterator_category]
 
+[indexterm2 iterator_category..ip::basic_resolver_iterator]
+The iterator category.
 
- unsigned long ``[link boost_asio.reference.ip__address_v6.scope_id.overload1 scope_id]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload1 more...]]``
 
- void ``[link boost_asio.reference.ip__address_v6.scope_id.overload2 scope_id]``(
- unsigned long id);
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.scope_id.overload2 more...]]``
+ typedef std::forward_iterator_tag iterator_category;
 
 
-[section:overload1 ip::address_v6::scope_id (1 of 2 overloads)]
 
+[heading Requirements]
 
-The scope ID of the address.
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
- unsigned long scope_id() const;
 
+[endsect]
 
-Returns the scope ID associated with the IPv6 address.
 
 
-[endsect]
+[section:operator__star_ ip::basic_resolver_iterator::operator *]
 
+[indexterm2 operator *..ip::basic_resolver_iterator]
+Dereference an iterator.
 
 
-[section:overload2 ip::address_v6::scope_id (2 of 2 overloads)]
+ const basic_resolver_entry< InternetProtocol > & operator *() const;
 
 
-The scope ID of the address.
 
+[endsect]
 
- void scope_id(
- unsigned long id);
 
 
-Modifies the scope ID associated with the IPv6 address.
+[section:operator_not__eq_ ip::basic_resolver_iterator::operator!=]
 
+[indexterm2 operator!=..ip::basic_resolver_iterator]
+Test two iterators for inequality.
 
-[endsect]
 
+ friend bool operator!=(
+ const basic_resolver_iterator & a,
+ const basic_resolver_iterator & b);
 
-[endsect]
 
+[heading Requirements]
 
-[section:to_bytes ip::address_v6::to_bytes]
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
 
-[indexterm2 to_bytes..ip::address_v6]
-Get the address in bytes, in network byte order.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- bytes_type to_bytes() const;
+[endsect]
 
 
+[section:operator_plus__plus_ ip::basic_resolver_iterator::operator++]
 
-[endsect]
+[indexterm2 operator++..ip::basic_resolver_iterator]
+Increment operator (prefix).
 
 
-[section:to_string ip::address_v6::to_string]
+ basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 operator++]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 more...]]``
 
-[indexterm2 to_string..ip::address_v6]
-Get the address as a string.
 
+Increment operator (postfix).
 
- std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload1 to_string]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload1 more...]]``
 
- std::string ``[link boost_asio.reference.ip__address_v6.to_string.overload2 to_string]``(
- boost::system::error_code & ec) const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__address_v6.to_string.overload2 more...]]``
+ basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 operator++]``(
+ int );
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 more...]]``
 
 
-[section:overload1 ip::address_v6::to_string (1 of 2 overloads)]
+[section:overload1 ip::basic_resolver_iterator::operator++ (1 of 2 overloads)]
 
 
-Get the address as a string.
+Increment operator (prefix).
 
 
- std::string to_string() const;
+ basic_resolver_iterator & operator++();
 
 
 
@@ -41375,14 +59348,14 @@
 
 
 
-[section:overload2 ip::address_v6::to_string (2 of 2 overloads)]
+[section:overload2 ip::basic_resolver_iterator::operator++ (2 of 2 overloads)]
 
 
-Get the address as a string.
+Increment operator (postfix).
 
 
- std::string to_string(
- boost::system::error_code & ec) const;
+ basic_resolver_iterator operator++(
+ int );
 
 
 
@@ -41392,13 +59365,13 @@
 [endsect]
 
 
-[section:to_v4 ip::address_v6::to_v4]
+[section:operator_arrow_ ip::basic_resolver_iterator::operator->]
 
-[indexterm2 to_v4..ip::address_v6]
-Converts an IPv4-mapped or IPv4-compatible address to an IPv4 address.
+[indexterm2 operator->..ip::basic_resolver_iterator]
+Dereference an iterator.
 
 
- address_v4 to_v4() const;
+ const basic_resolver_entry< InternetProtocol > * operator->() const;
 
 
 
@@ -41406,47 +59379,56 @@
 
 
 
-[section:v4_compatible ip::address_v6::v4_compatible]
+[section:operator_eq__eq_ ip::basic_resolver_iterator::operator==]
 
-[indexterm2 v4_compatible..ip::address_v6]
-Create an IPv4-compatible IPv6 address.
+[indexterm2 operator==..ip::basic_resolver_iterator]
+Test two iterators for equality.
 
 
- static address_v6 v4_compatible(
- const address_v4 & addr);
+ friend bool operator==(
+ const basic_resolver_iterator & a,
+ const basic_resolver_iterator & b);
 
 
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
 
 [endsect]
 
 
 
-[section:v4_mapped ip::address_v6::v4_mapped]
+[section:pointer ip::basic_resolver_iterator::pointer]
 
-[indexterm2 v4_mapped..ip::address_v6]
-Create an IPv4-mapped IPv6 address.
+[indexterm2 pointer..ip::basic_resolver_iterator]
+The type of the result of applying `operator->()` to the iterator.
 
 
- static address_v6 v4_mapped(
- const address_v4 & addr);
+ typedef const basic_resolver_entry< InternetProtocol > * pointer;
 
 
 
-[endsect]
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
-[section:ip__basic_endpoint ip::basic_endpoint]
 
 
-Describes an endpoint for a version-independent IP socket.
+[section:reference ip::basic_resolver_iterator::reference]
 
+[indexterm2 reference..ip::basic_resolver_iterator]
+The type of the result of applying `operator*()` to the iterator.
 
- template<
- typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
- class basic_endpoint
+
+ typedef const basic_resolver_entry< InternetProtocol > & reference;
 
 
 [heading Types]
@@ -41455,15 +59437,15 @@
 
   [
 
- [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
- [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
+ [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
+ [The endpoint type associated with the endpoint entry. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint. ]
+ [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint entry. ]
   
   ]
 
@@ -41474,424 +59456,474 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
- [Get the IP address associated with the endpoint.
-
- Set the IP address associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
+ [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
     [Default constructor.
 
- Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.
-
- Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
-
- Copy constructor. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
- [Get the capacity of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
- [Get the underlying endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
- [Assign from another endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
- [Get the port associated with the endpoint. The port number is always in the host's byte order.
-
- Set the port associated with the endpoint. The port number is always in the host's byte order. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
- [The protocol associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
- [Set the underlying size of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
- [Get the underlying size of the endpoint in the native type. ]
- ]
-
-]
-
-[heading Friends]
-[table
- [[Name][Description]]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
- [Compare two endpoints for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
- [Compare endpoints for ordering. ]
+ Construct with specified endpoint, host name and service name. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
- [Compare two endpoints for equality. ]
+ [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
+ [Get the endpoint associated with the entry. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
+ [Get the host name associated with the entry. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
+ [Convert to the endpoint associated with the entry. ]
   ]
   
-]
-
-[heading Related Functions]
-[table
- [[Name][Description]]
-
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
- [Output an endpoint as a string. ]
+ [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
+ [Get the service name associated with the entry. ]
   ]
   
 ]
 
-The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
+The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:address ip::basic_endpoint::address]
-
-[indexterm2 address..ip::basic_endpoint]
-Get the IP address associated with the endpoint.
-
 
- boost::asio::ip::address ``[link boost_asio.reference.ip__basic_endpoint.address.overload1 address]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload1 more...]]``
+[endsect]
 
 
-Set the IP address associated with the endpoint.
 
+[section:value_type ip::basic_resolver_iterator::value_type]
 
- void ``[link boost_asio.reference.ip__basic_endpoint.address.overload2 address]``(
- const boost::asio::ip::address & addr);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.address.overload2 more...]]``
+[indexterm2 value_type..ip::basic_resolver_iterator]
+The type of the value pointed to by the iterator.
 
 
-[section:overload1 ip::basic_endpoint::address (1 of 2 overloads)]
+ typedef basic_resolver_entry< InternetProtocol > value_type;
 
 
-Get the IP address associated with the endpoint.
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
- boost::asio::ip::address address() const;
+ [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
+ [The endpoint type associated with the endpoint entry. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint entry. ]
+
+ ]
 
-[endsect]
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
+ [Default constructor.
 
-[section:overload2 ip::basic_endpoint::address (2 of 2 overloads)]
+ Construct with specified endpoint, host name and service name. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
+ [Get the endpoint associated with the entry. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
+ [Get the host name associated with the entry. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
+ [Convert to the endpoint associated with the entry. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
+ [Get the service name associated with the entry. ]
+ ]
+
+]
 
+The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
 
-Set the IP address associated with the endpoint.
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
- void address(
- const boost::asio::ip::address & addr);
+[*Shared] [*objects:] Unsafe.
 
 
 
-[endsect]
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
 
-[section:basic_endpoint ip::basic_endpoint::basic_endpoint]
+[*Convenience header: ][^boost/asio.hpp]
 
-[indexterm2 basic_endpoint..ip::basic_endpoint]
-Default constructor.
 
+[endsect]
 
- ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload1 more...]]``
 
 
-Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR\_ANY or in6addr\_any). This constructor would typically be used for accepting new connections.
+[endsect]
 
+[section:ip__basic_resolver_query ip::basic_resolver_query]
 
- ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
- const InternetProtocol & protocol,
- unsigned short port_num);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload2 more...]]``
 
+An query to be passed to a resolver.
 
-Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
 
+ template<
+ typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
+ class basic_resolver_query :
+ public ip::resolver_query_base
 
- ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
- const boost::asio::ip::address & addr,
- unsigned short port_num);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload3 more...]]``
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-Copy constructor.
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
+ [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+
+ ]
 
- ``[link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
- const basic_endpoint & other);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.basic_endpoint.overload4 more...]]``
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint query. ]
+
+ ]
 
-[section:overload1 ip::basic_endpoint::basic_endpoint (1 of 4 overloads)]
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-Default constructor.
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
+ [Construct with specified service name for any protocol.
 
+ Construct with specified service name for a given protocol.
 
- basic_endpoint();
+ Construct with specified host name and service name for any protocol.
 
+ Construct with specified host name and service name for a given protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
+ [Get the hints associated with the query. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
+ [Get the host name associated with the query. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
+ [Get the service name associated with the query. ]
+ ]
+
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
+ [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
+ [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
+ [Determine the canonical name of the host specified in the query. ]
+ ]
 
-[section:overload2 ip::basic_endpoint::basic_endpoint (2 of 4 overloads)]
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
+ [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
+ [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
+ ]
 
-Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR\_ANY or in6addr\_any). This constructor would typically be used for accepting new connections.
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
+ [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
+ [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ ]
 
- basic_endpoint(
- const InternetProtocol & protocol,
- unsigned short port_num);
+]
 
+The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
 
 
-[heading Examples]
+[heading Thread Safety]
   
-To initialise an IPv4 TCP endpoint for port 1234, use:
+[*Distinct] [*objects:] Safe.
 
- boost::asio::ip::tcp::endpoint ep(boost::asio::ip::tcp::v4(), 1234);
+[*Shared] [*objects:] Unsafe.
 
 
 
+[heading Requirements]
 
-To specify an IPv6 UDP endpoint for port 9876, use:
+[*Header: ][^boost/asio/ip/basic_resolver_query.hpp]
 
- boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876);
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[section:address_configured ip::basic_resolver_query::address_configured]
 
 
+['Inherited from ip::resolver_query_base.]
 
-[endsect]
+[indexterm2 address_configured..ip::basic_resolver_query]
+Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system.
 
 
+ static const flags address_configured = implementation_defined;
 
-[section:overload3 ip::basic_endpoint::basic_endpoint (3 of 4 overloads)]
 
 
-Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
+[endsect]
 
 
- basic_endpoint(
- const boost::asio::ip::address & addr,
- unsigned short port_num);
 
+[section:all_matching ip::basic_resolver_query::all_matching]
 
 
-[endsect]
+['Inherited from ip::resolver_query_base.]
 
+[indexterm2 all_matching..ip::basic_resolver_query]
+If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
 
 
-[section:overload4 ip::basic_endpoint::basic_endpoint (4 of 4 overloads)]
+ static const flags all_matching = implementation_defined;
 
 
-Copy constructor.
 
+[endsect]
 
- basic_endpoint(
- const basic_endpoint & other);
 
+[section:basic_resolver_query ip::basic_resolver_query::basic_resolver_query]
 
+[indexterm2 basic_resolver_query..ip::basic_resolver_query]
+Construct with specified service name for any protocol.
 
-[endsect]
 
+ ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 basic_resolver_query]``(
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = passive|address_configured);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 more...]]``
 
-[endsect]
 
+Construct with specified service name for a given protocol.
 
-[section:capacity ip::basic_endpoint::capacity]
 
-[indexterm2 capacity..ip::basic_endpoint]
-Get the capacity of the endpoint in the native type.
+ ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 basic_resolver_query]``(
+ const protocol_type & protocol,
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = passive|address_configured);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 more...]]``
 
 
- std::size_t capacity() const;
+Construct with specified host name and service name for any protocol.
 
 
+ ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 basic_resolver_query]``(
+ const std::string & host,
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = address_configured);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 more...]]``
 
-[endsect]
 
+Construct with specified host name and service name for a given protocol.
 
-[section:data ip::basic_endpoint::data]
 
-[indexterm2 data..ip::basic_endpoint]
-Get the underlying endpoint in the native type.
+ ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 basic_resolver_query]``(
+ const protocol_type & protocol,
+ const std::string & host,
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = address_configured);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 more...]]``
 
 
- data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload1 data]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload1 more...]]``
+[section:overload1 ip::basic_resolver_query::basic_resolver_query (1 of 4 overloads)]
 
- const data_type * ``[link boost_asio.reference.ip__basic_endpoint.data.overload2 data]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.data.overload2 more...]]``
 
+Construct with specified service name for any protocol.
 
-[section:overload1 ip::basic_endpoint::data (1 of 2 overloads)]
 
+ basic_resolver_query(
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = passive|address_configured);
 
-Get the underlying endpoint in the native type.
 
+This constructor is typically used to perform name resolution for local service binding.
 
- data_type * data();
 
+[heading Parameters]
+
 
+[variablelist
+
+[[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
 
-[endsect]
+[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
 
+]
 
 
-[section:overload2 ip::basic_endpoint::data (2 of 2 overloads)]
+[heading Remarks]
+
+On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
 
 
-Get the underlying endpoint in the native type.
 
 
- const data_type * data() const;
+[endsect]
 
 
 
-[endsect]
+[section:overload2 ip::basic_resolver_query::basic_resolver_query (2 of 4 overloads)]
 
 
-[endsect]
+Construct with specified service name for a given protocol.
 
 
-[section:data_type ip::basic_endpoint::data_type]
+ basic_resolver_query(
+ const protocol_type & protocol,
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = passive|address_configured);
 
-[indexterm2 data_type..ip::basic_endpoint]
-The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
 
+This constructor is typically used to perform name resolution for local service binding with a specific protocol version.
 
- typedef implementation_defined data_type;
 
+[heading Parameters]
+
 
+[variablelist
+
+[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
 
-[heading Requirements]
+[[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
 
-[*Convenience header: ][^boost/asio.hpp]
+]
 
 
-[endsect]
+[heading Remarks]
+
+On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
 
 
 
-[section:operator_not__eq_ ip::basic_endpoint::operator!=]
 
-[indexterm2 operator!=..ip::basic_endpoint]
-Compare two endpoints for inequality.
+[endsect]
 
 
- friend bool operator!=(
- const basic_endpoint< InternetProtocol > & e1,
- const basic_endpoint< InternetProtocol > & e2);
 
+[section:overload3 ip::basic_resolver_query::basic_resolver_query (3 of 4 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+Construct with specified host name and service name for any protocol.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ basic_resolver_query(
+ const std::string & host,
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = address_configured);
 
-[endsect]
 
+This constructor is typically used to perform name resolution for communication with remote hosts.
 
 
-[section:operator_lt_ ip::basic_endpoint::operator<]
+[heading Parameters]
+
 
-[indexterm2 operator<..ip::basic_endpoint]
-Compare endpoints for ordering.
+[variablelist
+
+[[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
 
+[[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
 
- friend bool operator<(
- const basic_endpoint< InternetProtocol > & e1,
- const basic_endpoint< InternetProtocol > & e2);
+[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
 
+]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+[heading Remarks]
+
+On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
 
-[*Convenience header: ][^boost/asio.hpp]
+On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
 
 
 [endsect]
 
 
 
-[section:operator_lt__lt_ ip::basic_endpoint::operator<<]
+[section:overload4 ip::basic_resolver_query::basic_resolver_query (4 of 4 overloads)]
 
-[indexterm2 operator<<..ip::basic_endpoint]
-Output an endpoint as a string.
 
+Construct with specified host name and service name for a given protocol.
 
- std::basic_ostream< Elem, Traits > & operator<<(
- std::basic_ostream< Elem, Traits > & os,
- const basic_endpoint< InternetProtocol > & endpoint);
 
+ basic_resolver_query(
+ const protocol_type & protocol,
+ const std::string & host,
+ const std::string & service,
+ resolver_query_base::flags resolve_flags = address_configured);
 
-Used to output a human-readable string for a specified endpoint.
+
+This constructor is typically used to perform name resolution for communication with remote hosts.
 
 
 [heading Parameters]
@@ -41899,151 +59931,143 @@
 
 [variablelist
   
-[[os][The output stream to which the string will be written.]]
+[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
 
-[[endpoint][The endpoint to be written.]]
+[[host][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
+
+[[service][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
+
+[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
 
 ]
 
 
-[heading Return Value]
+[heading Remarks]
       
-The output stream.
-
+On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
 
+On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
 
 
 [endsect]
 
 
+[endsect]
 
-[section:operator_lt__eq_ ip::basic_endpoint::operator<=]
 
-[indexterm2 operator<=..ip::basic_endpoint]
-Compare endpoints for ordering.
+[section:canonical_name ip::basic_resolver_query::canonical_name]
 
 
- friend bool operator<=(
- const basic_endpoint< InternetProtocol > & e1,
- const basic_endpoint< InternetProtocol > & e2);
+['Inherited from ip::resolver_query_base.]
 
+[indexterm2 canonical_name..ip::basic_resolver_query]
+Determine the canonical name of the host specified in the query.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+ static const flags canonical_name = implementation_defined;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_eq_ ip::basic_endpoint::operator=]
+[section:flags ip::basic_resolver_query::flags]
 
-[indexterm2 operator=..ip::basic_endpoint]
-Assign from another endpoint.
 
+['Inherited from ip::resolver_query_base.]
 
- basic_endpoint & operator=(
- const basic_endpoint & other);
+[indexterm2 flags..ip::basic_resolver_query]
+A bitmask type (C++ Std [lib.bitmask.types]).
 
 
+ typedef unspecified flags;
 
-[endsect]
 
 
+[heading Requirements]
 
-[section:operator_eq__eq_ ip::basic_endpoint::operator==]
+[*Header: ][^boost/asio/ip/basic_resolver_query.hpp]
 
-[indexterm2 operator==..ip::basic_endpoint]
-Compare two endpoints for equality.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- friend bool operator==(
- const basic_endpoint< InternetProtocol > & e1,
- const basic_endpoint< InternetProtocol > & e2);
+[endsect]
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+[section:hints ip::basic_resolver_query::hints]
 
-[*Convenience header: ][^boost/asio.hpp]
+[indexterm2 hints..ip::basic_resolver_query]
+Get the hints associated with the query.
 
 
-[endsect]
+ const boost::asio::detail::addrinfo_type & hints() const;
 
 
 
-[section:operator_gt_ ip::basic_endpoint::operator>]
+[endsect]
 
-[indexterm2 operator>..ip::basic_endpoint]
-Compare endpoints for ordering.
 
 
- friend bool operator>(
- const basic_endpoint< InternetProtocol > & e1,
- const basic_endpoint< InternetProtocol > & e2);
+[section:host_name ip::basic_resolver_query::host_name]
 
+[indexterm2 host_name..ip::basic_resolver_query]
+Get the host name associated with the query.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+ std::string host_name() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_gt__eq_ ip::basic_endpoint::operator>=]
-
-[indexterm2 operator>=..ip::basic_endpoint]
-Compare endpoints for ordering.
+[section:numeric_host ip::basic_resolver_query::numeric_host]
 
 
- friend bool operator>=(
- const basic_endpoint< InternetProtocol > & e1,
- const basic_endpoint< InternetProtocol > & e2);
+['Inherited from ip::resolver_query_base.]
 
+[indexterm2 numeric_host..ip::basic_resolver_query]
+Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
+ static const flags numeric_host = implementation_defined;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:port ip::basic_endpoint::port]
 
-[indexterm2 port..ip::basic_endpoint]
-Get the port associated with the endpoint. The port number is always in the host's byte order.
+[section:numeric_service ip::basic_resolver_query::numeric_service]
 
 
- unsigned short ``[link boost_asio.reference.ip__basic_endpoint.port.overload1 port]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload1 more...]]``
+['Inherited from ip::resolver_query_base.]
 
+[indexterm2 numeric_service..ip::basic_resolver_query]
+Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
 
-Set the port associated with the endpoint. The port number is always in the host's byte order.
 
+ static const flags numeric_service = implementation_defined;
 
- void ``[link boost_asio.reference.ip__basic_endpoint.port.overload2 port]``(
- unsigned short port_num);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_endpoint.port.overload2 more...]]``
 
 
-[section:overload1 ip::basic_endpoint::port (1 of 2 overloads)]
+[endsect]
 
 
-Get the port associated with the endpoint. The port number is always in the host's byte order.
 
+[section:passive ip::basic_resolver_query::passive]
 
- unsigned short port() const;
+
+['Inherited from ip::resolver_query_base.]
+
+[indexterm2 passive..ip::basic_resolver_query]
+Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
+
+
+ static const flags passive = implementation_defined;
 
 
 
@@ -42051,30 +60075,34 @@
 
 
 
-[section:overload2 ip::basic_endpoint::port (2 of 2 overloads)]
+[section:protocol_type ip::basic_resolver_query::protocol_type]
 
+[indexterm2 protocol_type..ip::basic_resolver_query]
+The protocol type associated with the endpoint query.
 
-Set the port associated with the endpoint. The port number is always in the host's byte order.
 
+ typedef InternetProtocol protocol_type;
 
- void port(
- unsigned short port_num);
 
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/ip/basic_resolver_query.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:protocol ip::basic_endpoint::protocol]
 
-[indexterm2 protocol..ip::basic_endpoint]
-The protocol associated with the endpoint.
+[section:service_name ip::basic_resolver_query::service_name]
+
+[indexterm2 service_name..ip::basic_resolver_query]
+Get the service name associated with the query.
 
 
- protocol_type protocol() const;
+ std::string service_name() const;
 
 
 
@@ -42082,114 +60110,106 @@
 
 
 
-[section:protocol_type ip::basic_endpoint::protocol_type]
+[section:v4_mapped ip::basic_resolver_query::v4_mapped]
 
-[indexterm2 protocol_type..ip::basic_endpoint]
-The protocol type associated with the endpoint.
 
+['Inherited from ip::resolver_query_base.]
 
- typedef InternetProtocol protocol_type;
+[indexterm2 v4_mapped..ip::basic_resolver_query]
+If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
 
 
+ static const flags v4_mapped = implementation_defined;
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_endpoint.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
+
 
 
 [endsect]
 
+[section:ip__host_name ip::host_name]
 
+[indexterm1 ip::host_name]
+Get the current host name.
 
-[section:resize ip::basic_endpoint::resize]
+
+ std::string ``[link boost_asio.reference.ip__host_name.overload1 host_name]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload1 more...]]``
 
-[indexterm2 resize..ip::basic_endpoint]
-Set the underlying size of the endpoint in the native type.
+ std::string ``[link boost_asio.reference.ip__host_name.overload2 host_name]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload2 more...]]``
 
+[heading Requirements]
 
- void resize(
- std::size_t size);
+[*Header: ][^boost/asio/ip/host_name.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:overload1 ip::host_name (1 of 2 overloads)]
 
 
+Get the current host name.
 
-[section:size ip::basic_endpoint::size]
 
-[indexterm2 size..ip::basic_endpoint]
-Get the underlying size of the endpoint in the native type.
+ std::string host_name();
 
 
- std::size_t size() const;
 
+[endsect]
 
 
-[endsect]
 
+[section:overload2 ip::host_name (2 of 2 overloads)]
 
 
-[endsect]
+Get the current host name.
 
-[section:ip__basic_resolver ip::basic_resolver]
 
+ std::string host_name(
+ boost::system::error_code & ec);
 
-Provides endpoint resolution functionality.
 
 
- template<
- typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``,
- typename ``[link boost_asio.reference.ResolverService ResolverService]`` = resolver_service<InternetProtocol>>
- class basic_resolver :
- public basic_io_object< ResolverService >
+[endsect]
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[endsect]
 
- [
+[section:ip__icmp ip::icmp]
 
- [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
 
- [
+Encapsulates the flags needed for ICMP.
 
- [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+ class icmp
 
- [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
- [The iterator type. ]
-
- ]
+
+[heading Types]
+[table
+ [[Name][Description]]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
- [The protocol type. ]
+ [[link boost_asio.reference.ip__icmp.endpoint [*endpoint]]]
+ [The type of a ICMP endpoint. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
- [The query type. ]
+ [[link boost_asio.reference.ip__icmp.resolver [*resolver]]]
+ [The ICMP resolver type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.ip__icmp.socket [*socket]]]
+ [The ICMP socket type. ]
   
   ]
 
@@ -42200,219 +60220,235 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously perform forward resolution of a query to a list of entries.
-
- Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
- [Constructor. ]
+ [[link boost_asio.reference.ip__icmp.family [*family]]]
+ [Obtain an identifier for the protocol family. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
- [Cancel any asynchronous operations that are waiting on the resolver. ]
+ [[link boost_asio.reference.ip__icmp.protocol [*protocol]]]
+ [Obtain an identifier for the protocol. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.ip__icmp.type [*type]]]
+ [Obtain an identifier for the type of the protocol. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.ip__icmp.v4 [*v4]]]
+ [Construct to represent the IPv4 ICMP protocol. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Perform forward resolution of a query to a list of entries.
-
- Perform reverse resolution of an endpoint to a list of entries. ]
+ [[link boost_asio.reference.ip__icmp.v6 [*v6]]]
+ [Construct to represent the IPv6 ICMP protocol. ]
   ]
   
 ]
 
-[heading Protected Data Members]
+[heading Friends]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.ip__icmp.operator_not__eq_ [*operator!=]]]
+ [Compare two protocols for inequality. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.ip__icmp.operator_eq__eq_ [*operator==]]]
+ [Compare two protocols for equality. ]
   ]
-
+
 ]
 
-The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
+The [link boost_asio.reference.ip__icmp `ip::icmp`] class contains flags necessary for ICMP sockets.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Safe.
+
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+[*Header: ][^boost/asio/ip/icmp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:async_resolve ip::basic_resolver::async_resolve]
-
-[indexterm2 async_resolve..ip::basic_resolver]
-Asynchronously perform forward resolution of a query to a list of entries.
-
-
- template<
- typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
- void ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 async_resolve]``(
- const query & q,
- ResolveHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload1 more...]]``
-
-
-Asynchronously perform reverse resolution of an endpoint to a list of entries.
-
-
- template<
- typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
- void ``[link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 async_resolve]``(
- const endpoint_type & e,
- ResolveHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.async_resolve.overload2 more...]]``
-
 
-[section:overload1 ip::basic_resolver::async_resolve (1 of 2 overloads)]
+[section:endpoint ip::icmp::endpoint]
 
+[indexterm2 endpoint..ip::icmp]
+The type of a ICMP endpoint.
 
-Asynchronously perform forward resolution of a query to a list of entries.
 
+ typedef basic_endpoint< icmp > endpoint;
 
- template<
- typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
- void async_resolve(
- const query & q,
- ResolveHandler handler);
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-This function is used to asynchronously resolve a query into a list of endpoint entries.
+ [
 
+ [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
+ [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
+
+ ]
 
-[heading Parameters]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint. ]
   
-[[q][A query object that determines what endpoints will be returned.]]
-
-[[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- resolver::iterator iterator // Forward-only iterator that can
- // be used to traverse the list
- // of endpoint entries.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+ ]
 
 ]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[heading Remarks]
-
-A default constructed iterator represents the end of the list.
-
-A successful resolve operation is guaranteed to pass at least one entry to the handler.
-
-
-[endsect]
-
-
-
-[section:overload2 ip::basic_resolver::async_resolve (2 of 2 overloads)]
-
-
-Asynchronously perform reverse resolution of an endpoint to a list of entries.
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
+ [Get the IP address associated with the endpoint.
 
+ Set the IP address associated with the endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
+ [Default constructor.
 
- template<
- typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
- void async_resolve(
- const endpoint_type & e,
- ResolveHandler handler);
+ Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.
 
+ Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
 
-This function is used to asynchronously resolve an endpoint into a list of endpoint entries.
+ Copy constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
+ [Get the capacity of the endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
+ [Get the underlying endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
+ [Assign from another endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
+ [Get the port associated with the endpoint. The port number is always in the host's byte order.
 
+ Set the port associated with the endpoint. The port number is always in the host's byte order. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
+ [The protocol associated with the endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
+ [Set the underlying size of the endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
+ [Get the underlying size of the endpoint in the native type. ]
+ ]
+
+]
 
-[heading Parameters]
-
+[heading Friends]
+[table
+ [[Name][Description]]
 
-[variablelist
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
+ [Compare two endpoints for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
+ [Compare two endpoints for equality. ]
+ ]
   
-[[e][An endpoint object that determines what endpoints will be returned.]]
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+]
 
-[[handler][The handler to be called when the resolve operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- resolver::iterator iterator // Forward-only iterator that can
- // be used to traverse the list
- // of endpoint entries.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
+ [Output an endpoint as a string. ]
+ ]
+
 ]
 
+The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
 
-[heading Remarks]
-
-A default constructed iterator represents the end of the list.
 
-A successful resolve operation is guaranteed to pass at least one entry to the handler.
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
-[endsect]
 
 
-[endsect]
 
 
-[section:basic_resolver ip::basic_resolver::basic_resolver]
+[heading Requirements]
 
-[indexterm2 basic_resolver..ip::basic_resolver]
-Constructor.
+[*Header: ][^boost/asio/ip/icmp.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
- basic_resolver(
- boost::asio::io_service & io_service);
 
+[endsect]
 
-This constructor creates a [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`].
 
 
-[heading Parameters]
-
+[section:family ip::icmp::family]
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the resolver will use to dispatch handlers for any asynchronous operations performed on the timer. ]]
+[indexterm2 family..ip::icmp]
+Obtain an identifier for the protocol family.
 
-]
 
+ int family() const;
 
 
 
@@ -42420,35 +60456,42 @@
 
 
 
-[section:cancel ip::basic_resolver::cancel]
+[section:operator_not__eq_ ip::icmp::operator!=]
 
-[indexterm2 cancel..ip::basic_resolver]
-Cancel any asynchronous operations that are waiting on the resolver.
+[indexterm2 operator!=..ip::icmp]
+Compare two protocols for inequality.
 
 
- void cancel();
+ friend bool operator!=(
+ const icmp & p1,
+ const icmp & p2);
 
 
-This function forces the completion of any pending asynchronous operations on the host resolver. The handler for each cancelled operation will be invoked with the `boost::asio::error::operation_aborted` error code.
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/icmp.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
-[section:endpoint_type ip::basic_resolver::endpoint_type]
 
-[indexterm2 endpoint_type..ip::basic_resolver]
-The endpoint type.
 
+[section:operator_eq__eq_ ip::icmp::operator==]
+
+[indexterm2 operator==..ip::icmp]
+Compare two protocols for equality.
 
- typedef InternetProtocol::endpoint endpoint_type;
 
+ friend bool operator==(
+ const icmp & p1,
+ const icmp & p2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+[*Header: ][^boost/asio/ip/icmp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -42457,25 +60500,13 @@
 
 
 
-[section:get_io_service ip::basic_resolver::get_io_service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 get_io_service..ip::basic_resolver]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
-
- boost::asio::io_service & get_io_service();
-
-
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[section:protocol ip::icmp::protocol]
 
+[indexterm2 protocol..ip::icmp]
+Obtain an identifier for the protocol.
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
+ int protocol() const;
 
 
 
@@ -42483,241 +60514,514 @@
 
 
 
-[section:implementation ip::basic_resolver::implementation]
+[section:resolver ip::icmp::resolver]
 
+[indexterm2 resolver..ip::icmp]
+The ICMP resolver type.
 
-['Inherited from basic_io_object.]
 
-[indexterm2 implementation..ip::basic_resolver]
-The underlying implementation of the I/O object.
+ typedef basic_resolver< icmp > resolver;
 
 
- implementation_type implementation;
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
+ [
 
-[section:implementation_type ip::basic_resolver::implementation_type]
+ [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
+ [The iterator type. ]
+
+ ]
 
+ [
 
-['Inherited from basic_io_object.]
+ [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
-[indexterm2 implementation_type..ip::basic_resolver]
-The underlying implementation type of I/O object.
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
+ [The query type. ]
+
+ ]
 
- typedef service_type::implementation_type implementation_type;
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+]
 
-[heading Requirements]
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+ [
+ [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
+ [Asynchronously perform forward resolution of a query to a list of entries.
 
-[*Convenience header: ][^boost/asio.hpp]
+ Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
+ [Constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
+ [Cancel any asynchronous operations that are waiting on the resolver. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
+ [Perform forward resolution of a query to a list of entries.
+
+ Perform reverse resolution of an endpoint to a list of entries. ]
+ ]
+
+]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
 
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
-[section:io_service ip::basic_resolver::io_service]
+ [
+ [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
+]
 
-['Inherited from basic_io_object.]
+The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
 
-[indexterm2 io_service..ip::basic_resolver]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
- boost::asio::io_service & io_service();
+[*Shared] [*objects:] Unsafe.
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/icmp.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:iterator ip::basic_resolver::iterator]
+[section:socket ip::icmp::socket]
 
-[indexterm2 iterator..ip::basic_resolver]
-The iterator type.
+[indexterm2 socket..ip::icmp]
+The ICMP socket type.
 
 
- typedef basic_resolver_iterator< InternetProtocol > iterator;
+ typedef basic_raw_socket< icmp > socket;
 
 
-[heading Member Functions]
+[heading Types]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
- [Default constructor creates an end iterator. ]
- ]
+
+ [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
   
+ ]
+
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
- [Create an iterator from an addrinfo list returned by getaddrinfo.
 
- Create an iterator from an endpoint, host name and service name. ]
- ]
+ [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
   
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
- [Dereference an iterator. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
- [Increment operator (prefix).
 
- Increment operator (postfix). ]
- ]
+ [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
   
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
- [Dereference an iterator. ]
   ]
-
-]
-
-[heading Friends]
-[table
- [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
- [Test two iterators for inequality. ]
+
+ [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
   
+ ]
+
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
- [Test two iterators for equality. ]
+
+ [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
   ]
+
+ [
+
+ [[link boost_asio.reference.basic_raw_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
-]
+ ]
 
-The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
+ [
 
-The iterator's value\_type, obtained when the iterator is dereferenced, is:
+ [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
 
- const basic_resolver_entry<InternetProtocol>
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
 
+ [
 
-[heading Thread Safety]
+ [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
   
-[*Distinct] [*objects:] Safe.
+ ]
 
-[*Shared] [*objects:] Unsafe.
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
 
-[heading Requirements]
+ [
 
-[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+ [[link boost_asio.reference.basic_raw_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
+ [
 
-[section:protocol_type ip::basic_resolver::protocol_type]
+ [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
-[indexterm2 protocol_type..ip::basic_resolver]
-The protocol type.
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
 
- typedef InternetProtocol protocol_type;
+ [
 
+ [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
 
+ [
 
-[heading Requirements]
+ [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
 
-[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+ [
 
-[*Convenience header: ][^boost/asio.hpp]
+ [[link boost_asio.reference.basic_raw_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
 
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[section:query ip::basic_resolver::query]
+ [
+ [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
+ [Start an asynchronous receive on a connected socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
+ [Start an asynchronous receive. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
+ [Start an asynchronous send on a connected socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
+ [Start an asynchronous send. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
+ [Construct a basic_raw_socket without opening it.
 
-[indexterm2 query..ip::basic_resolver]
-The query type.
+ Construct and open a basic_raw_socket.
 
+ Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
 
- typedef basic_resolver_query< InternetProtocol > query;
+ Construct a basic_raw_socket on an existing native socket.
+
+ Move-construct a basic_raw_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
 
-[heading Types]
-[table
- [[Name][Description]]
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
+ ]
+
   [
-
- [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
- [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+ [[link boost_asio.reference.basic_raw_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_raw_socket from another. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
+ [Receive some data on a connected socket. ]
   ]
-
+
   [
-
- [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint query. ]
+ [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
+ [Receive raw data with the endpoint of the sender. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
   ]
-
-]
-
-[heading Member Functions]
-[table
- [[Name][Description]]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
- [Construct with specified service name for any protocol.
-
- Construct with specified service name for a given protocol.
-
- Construct with specified host name and service name for any protocol.
-
- Construct with specified host name and service name for a given protocol. ]
+ [[link boost_asio.reference.basic_raw_socket.send [*send]]]
+ [Send some data on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
- [Get the hints associated with the query. ]
+ [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
+ [Send raw data to the specified endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
- [Get the host name associated with the query. ]
+ [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
- [Get the service name associated with the query. ]
+ [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
   
 ]
@@ -42727,43 +61031,49 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
- [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
+ [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
   ]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
- [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
+ [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
   ]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
- [Determine the canonical name of the host specified in the query. ]
+ [[link boost_asio.reference.basic_raw_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
   ]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
- [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
+ [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
   ]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
- [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
+ [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
   ]
 
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
- [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
+ [[link boost_asio.reference.basic_raw_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
- [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ [[link boost_asio.reference.basic_raw_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
+The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
 
 
 [heading Thread Safety]
@@ -42777,7 +61087,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+[*Header: ][^boost/asio/ip/icmp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -42785,252 +61095,146 @@
 [endsect]
 
 
-[section:resolve ip::basic_resolver::resolve]
-
-[indexterm2 resolve..ip::basic_resolver]
-Perform forward resolution of a query to a list of entries.
-
-
- iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload1 resolve]``(
- const query & q);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload1 more...]]``
-
- iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload2 resolve]``(
- const query & q,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload2 more...]]``
 
+[section:type ip::icmp::type]
 
-Perform reverse resolution of an endpoint to a list of entries.
+[indexterm2 type..ip::icmp]
+Obtain an identifier for the type of the protocol.
 
 
- iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload3 resolve]``(
- const endpoint_type & e);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload3 more...]]``
+ int type() const;
 
- iterator ``[link boost_asio.reference.ip__basic_resolver.resolve.overload4 resolve]``(
- const endpoint_type & e,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver.resolve.overload4 more...]]``
 
 
-[section:overload1 ip::basic_resolver::resolve (1 of 4 overloads)]
+[endsect]
 
 
-Perform forward resolution of a query to a list of entries.
 
+[section:v4 ip::icmp::v4]
 
- iterator resolve(
- const query & q);
+[indexterm2 v4..ip::icmp]
+Construct to represent the IPv4 ICMP protocol.
 
 
-This function is used to resolve a query into a list of endpoint entries.
+ static icmp v4();
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[q][A query object that determines what endpoints will be returned.]]
+[endsect]
 
-]
 
 
-[heading Return Value]
-
-A forward-only iterator that can be used to traverse the list of endpoint entries.
+[section:v6 ip::icmp::v6]
 
+[indexterm2 v6..ip::icmp]
+Construct to represent the IPv6 ICMP protocol.
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+ static icmp v6();
 
-]
 
 
-[heading Remarks]
-
-A default constructed iterator represents the end of the list.
+[endsect]
 
-A successful call to this function is guaranteed to return at least one entry.
 
 
 [endsect]
 
 
+[section:ip__multicast__enable_loopback ip::multicast::enable_loopback]
 
-[section:overload2 ip::basic_resolver::resolve (2 of 4 overloads)]
-
-
-Perform forward resolution of a query to a list of entries.
+[indexterm1 ip::multicast::enable_loopback]
+Socket option determining whether outgoing multicast packets will be received on the same socket if it is a member of the multicast group.
 
 
- iterator resolve(
- const query & q,
- boost::system::error_code & ec);
+ typedef implementation_defined enable_loopback;
 
 
-This function is used to resolve a query into a list of endpoint entries.
 
+Implements the IPPROTO\_IP/IP\_MULTICAST\_LOOP socket option.
 
-[heading Parameters]
-
 
-[variablelist
+[heading Examples]
   
-[[q][A query object that determines what endpoints will be returned.]]
-
-[[ec][Set to indicate what error occurred, if any.]]
-
-]
-
-
-[heading Return Value]
-
-A forward-only iterator that can be used to traverse the list of endpoint entries. Returns a default constructed iterator if an error occurs.
-
-
-[heading Remarks]
-
-A default constructed iterator represents the end of the list.
-
-A successful call to this function is guaranteed to return at least one entry.
-
-
-[endsect]
-
-
-
-[section:overload3 ip::basic_resolver::resolve (3 of 4 overloads)]
-
-
-Perform reverse resolution of an endpoint to a list of entries.
-
+Setting the option:
 
- iterator resolve(
- const endpoint_type & e);
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::multicast::enable_loopback option(true);
+ socket.set_option(option);
 
 
-This function is used to resolve an endpoint into a list of endpoint entries.
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[e][An endpoint object that determines what endpoints will be returned.]]
+Getting the current option value:
 
-]
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::multicast::enable_loopback option;
+ socket.get_option(option);
+ bool is_set = option.value();
 
 
-[heading Return Value]
-
-A forward-only iterator that can be used to traverse the list of endpoint entries.
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
 
-]
 
+[heading Requirements]
 
-[heading Remarks]
-
-A default constructed iterator represents the end of the list.
+[*Header: ][^boost/asio/ip/multicast.hpp]
 
-A successful call to this function is guaranteed to return at least one entry.
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload4 ip::basic_resolver::resolve (4 of 4 overloads)]
-
+[section:ip__multicast__hops ip::multicast::hops]
 
-Perform reverse resolution of an endpoint to a list of entries.
+[indexterm1 ip::multicast::hops]
+Socket option for time-to-live associated with outgoing multicast packets.
 
 
- iterator resolve(
- const endpoint_type & e,
- boost::system::error_code & ec);
+ typedef implementation_defined hops;
 
 
-This function is used to resolve an endpoint into a list of endpoint entries.
 
+Implements the IPPROTO\_IP/IP\_MULTICAST\_TTL socket option.
 
-[heading Parameters]
-
 
-[variablelist
+[heading Examples]
   
-[[e][An endpoint object that determines what endpoints will be returned.]]
-
-[[ec][Set to indicate what error occurred, if any.]]
-
-]
-
-
-[heading Return Value]
-
-A forward-only iterator that can be used to traverse the list of endpoint entries. Returns a default constructed iterator if an error occurs.
-
-
-[heading Remarks]
-
-A default constructed iterator represents the end of the list.
-
-A successful call to this function is guaranteed to return at least one entry.
-
-
-[endsect]
-
-
-[endsect]
-
-
-[section:service ip::basic_resolver::service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 service..ip::basic_resolver]
-The service associated with the I/O object.
-
-
- service_type & service;
+Setting the option:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::multicast::hops option(4);
+ socket.set_option(option);
 
 
-[endsect]
 
 
 
-[section:service_type ip::basic_resolver::service_type]
+Getting the current option value:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::multicast::hops option;
+ socket.get_option(option);
+ int ttl = option.value();
 
-['Inherited from basic_io_object.]
 
-[indexterm2 service_type..ip::basic_resolver]
-The type of the service that will be used to provide I/O operations.
 
 
- typedef ResolverService service_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver.hpp]
+[*Header: ][^boost/asio/ip/multicast.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -43039,169 +61243,80 @@
 
 
 
-[endsect]
-
-[section:ip__basic_resolver_entry ip::basic_resolver_entry]
-
-
-An entry produced by a resolver.
+[section:ip__multicast__join_group ip::multicast::join_group]
 
+[indexterm1 ip::multicast::join_group]
+Socket option to join a multicast group on a specified interface.
 
- template<
- typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
- class basic_resolver_entry
 
+ typedef implementation_defined join_group;
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
 
- [[link boost_asio.reference.ip__basic_resolver_entry.endpoint_type [*endpoint_type]]]
- [The endpoint type associated with the endpoint entry. ]
-
- ]
+Implements the IPPROTO\_IP/IP\_ADD\_MEMBERSHIP socket option.
 
- [
 
- [[link boost_asio.reference.ip__basic_resolver_entry.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint entry. ]
+[heading Examples]
   
- ]
-
-]
-
-[heading Member Functions]
-[table
- [[Name][Description]]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry [*basic_resolver_entry]]]
- [Default constructor.
+Setting the option to join a multicast group:
 
- Construct with specified endpoint, host name and service name. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_entry.endpoint [*endpoint]]]
- [Get the endpoint associated with the entry. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_entry.host_name [*host_name]]]
- [Get the host name associated with the entry. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_entry.operator_endpoint_type [*operator endpoint_type]]]
- [Convert to the endpoint associated with the entry. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_entry.service_name [*service_name]]]
- [Get the service name associated with the entry. ]
- ]
-
-]
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::address multicast_address =
+ boost::asio::ip::address::from_string("225.0.0.1");
+ boost::asio::ip::multicast::join_group option(multicast_address);
+ socket.set_option(option);
 
-The [link boost_asio.reference.ip__basic_resolver_entry `ip::basic_resolver_entry`] class template describes an entry as returned by a resolver.
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
+[*Header: ][^boost/asio/ip/multicast.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:basic_resolver_entry ip::basic_resolver_entry::basic_resolver_entry]
-
-[indexterm2 basic_resolver_entry..ip::basic_resolver_entry]
-Default constructor.
-
-
- ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 basic_resolver_entry]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload1 more...]]``
-
-
-Construct with specified endpoint, host name and service name.
-
-
- ``[link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 basic_resolver_entry]``(
- const endpoint_type & endpoint,
- const std::string & host_name,
- const std::string & service_name);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_entry.basic_resolver_entry.overload2 more...]]``
-
-
-[section:overload1 ip::basic_resolver_entry::basic_resolver_entry (1 of 2 overloads)]
-
-
-Default constructor.
-
-
- basic_resolver_entry();
-
-
-
-[endsect]
-
-
-
-[section:overload2 ip::basic_resolver_entry::basic_resolver_entry (2 of 2 overloads)]
-
-
-Construct with specified endpoint, host name and service name.
-
-
- basic_resolver_entry(
- const endpoint_type & endpoint,
- const std::string & host_name,
- const std::string & service_name);
-
-
 
 [endsect]
 
 
-[endsect]
 
+[section:ip__multicast__leave_group ip::multicast::leave_group]
 
-[section:endpoint ip::basic_resolver_entry::endpoint]
+[indexterm1 ip::multicast::leave_group]
+Socket option to leave a multicast group on a specified interface.
 
-[indexterm2 endpoint..ip::basic_resolver_entry]
-Get the endpoint associated with the entry.
 
+ typedef implementation_defined leave_group;
 
- endpoint_type endpoint() const;
 
 
+Implements the IPPROTO\_IP/IP\_DROP\_MEMBERSHIP socket option.
 
-[endsect]
 
+[heading Examples]
+
+Setting the option to leave a multicast group:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::address multicast_address =
+ boost::asio::ip::address::from_string("225.0.0.1");
+ boost::asio::ip::multicast::leave_group option(multicast_address);
+ socket.set_option(option);
 
-[section:endpoint_type ip::basic_resolver_entry::endpoint_type]
 
-[indexterm2 endpoint_type..ip::basic_resolver_entry]
-The endpoint type associated with the endpoint entry.
 
 
- typedef InternetProtocol::endpoint endpoint_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
+[*Header: ][^boost/asio/ip/multicast.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -43210,204 +61325,148 @@
 
 
 
-[section:host_name ip::basic_resolver_entry::host_name]
-
-[indexterm2 host_name..ip::basic_resolver_entry]
-Get the host name associated with the entry.
-
-
- std::string host_name() const;
-
-
-
-[endsect]
-
-
-
-[section:operator_endpoint_type ip::basic_resolver_entry::operator endpoint_type]
-
-[indexterm2 operator endpoint_type..ip::basic_resolver_entry]
-Convert to the endpoint associated with the entry.
-
-
- operator endpoint_type() const;
-
-
-
-[endsect]
-
-
-
-[section:protocol_type ip::basic_resolver_entry::protocol_type]
-
-[indexterm2 protocol_type..ip::basic_resolver_entry]
-The protocol type associated with the endpoint entry.
-
-
- typedef InternetProtocol protocol_type;
+[section:ip__multicast__outbound_interface ip::multicast::outbound_interface]
 
+[indexterm1 ip::multicast::outbound_interface]
+Socket option for local interface to use for outgoing multicast packets.
 
 
-[heading Requirements]
+ typedef implementation_defined outbound_interface;
 
-[*Header: ][^boost/asio/ip/basic_resolver_entry.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+Implements the IPPROTO\_IP/IP\_MULTICAST\_IF socket option.
 
-[endsect]
 
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::address_v4 local_interface =
+ boost::asio::ip::address_v4::from_string("1.2.3.4");
+ boost::asio::ip::multicast::outbound_interface option(local_interface);
+ socket.set_option(option);
 
-[section:service_name ip::basic_resolver_entry::service_name]
 
-[indexterm2 service_name..ip::basic_resolver_entry]
-Get the service name associated with the entry.
 
 
- std::string service_name() const;
 
 
 
-[endsect]
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/multicast.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
-[section:ip__basic_resolver_iterator ip::basic_resolver_iterator]
+
+[section:ip__resolver_query_base ip::resolver_query_base]
 
 
-An iterator over the entries produced by a resolver.
+The [link boost_asio.reference.ip__resolver_query_base `ip::resolver_query_base`] class is used as a base for the [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class templates to provide a common place to define the flag constants.
 
 
- template<
- typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
- class basic_resolver_iterator
+ class resolver_query_base
 
 
-[heading Member Functions]
+[heading Types]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
- [Default constructor creates an end iterator. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
- [Create an iterator from an addrinfo list returned by getaddrinfo.
 
- Create an iterator from an endpoint, host name and service name. ]
- ]
+ [[link boost_asio.reference.ip__resolver_query_base.flags [*flags]]]
+ [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
   
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
- [Dereference an iterator. ]
   ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
- [Increment operator (prefix).
 
- Increment operator (postfix). ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
- [Dereference an iterator. ]
- ]
-
 ]
 
-[heading Friends]
+[heading Protected Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
- [Test two iterators for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
- [Test two iterators for equality. ]
+ [[link boost_asio.reference.ip__resolver_query_base._resolver_query_base [*~resolver_query_base]]]
+ [Protected destructor to prevent deletion through this type. ]
   ]
   
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
-
-The iterator's value\_type, obtained when the iterator is dereferenced, is:
-
- const basic_resolver_entry<InternetProtocol>
+[heading Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__resolver_query_base.address_configured [*address_configured]]]
+ [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__resolver_query_base.all_matching [*all_matching]]]
+ [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__resolver_query_base.canonical_name [*canonical_name]]]
+ [Determine the canonical name of the host specified in the query. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__resolver_query_base.numeric_host [*numeric_host]]]
+ [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
+ ]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+ [
+ [[link boost_asio.reference.ip__resolver_query_base.numeric_service [*numeric_service]]]
+ [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
+ ]
 
-[*Shared] [*objects:] Unsafe.
+ [
+ [[link boost_asio.reference.ip__resolver_query_base.passive [*passive]]]
+ [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__resolver_query_base.v4_mapped [*v4_mapped]]]
+ [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ ]
 
+]
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
+[*Header: ][^boost/asio/ip/resolver_query_base.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:basic_resolver_iterator ip::basic_resolver_iterator::basic_resolver_iterator]
+[section:address_configured ip::resolver_query_base::address_configured]
 
-[indexterm2 basic_resolver_iterator..ip::basic_resolver_iterator]
-Default constructor creates an end iterator.
+[indexterm2 address_configured..ip::resolver_query_base]
+Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system.
 
 
- basic_resolver_iterator();
+ static const flags address_configured = implementation_defined;
 
 
 
 [endsect]
 
 
-[section:create ip::basic_resolver_iterator::create]
-
-[indexterm2 create..ip::basic_resolver_iterator]
-Create an iterator from an addrinfo list returned by getaddrinfo.
-
-
- static basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.create.overload1 create]``(
- boost::asio::detail::addrinfo_type * address_info,
- const std::string & host_name,
- const std::string & service_name);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.create.overload1 more...]]``
-
-
-Create an iterator from an endpoint, host name and service name.
-
-
- static basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.create.overload2 create]``(
- const typename InternetProtocol::endpoint & endpoint,
- const std::string & host_name,
- const std::string & service_name);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.create.overload2 more...]]``
-
-
-[section:overload1 ip::basic_resolver_iterator::create (1 of 2 overloads)]
 
+[section:all_matching ip::resolver_query_base::all_matching]
 
-Create an iterator from an addrinfo list returned by getaddrinfo.
+[indexterm2 all_matching..ip::resolver_query_base]
+If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
 
 
- static basic_resolver_iterator create(
- boost::asio::detail::addrinfo_type * address_info,
- const std::string & host_name,
- const std::string & service_name);
+ static const flags all_matching = implementation_defined;
 
 
 
@@ -43415,53 +61474,33 @@
 
 
 
-[section:overload2 ip::basic_resolver_iterator::create (2 of 2 overloads)]
-
-
-Create an iterator from an endpoint, host name and service name.
-
+[section:canonical_name ip::resolver_query_base::canonical_name]
 
- static basic_resolver_iterator create(
- const typename InternetProtocol::endpoint & endpoint,
- const std::string & host_name,
- const std::string & service_name);
+[indexterm2 canonical_name..ip::resolver_query_base]
+Determine the canonical name of the host specified in the query.
 
 
+ static const flags canonical_name = implementation_defined;
 
-[endsect]
 
 
 [endsect]
 
 
-[section:operator__star_ ip::basic_resolver_iterator::operator *]
-
-[indexterm2 operator *..ip::basic_resolver_iterator]
-Dereference an iterator.
-
-
- const basic_resolver_entry< InternetProtocol > & operator *() const;
-
-
-
-[endsect]
-
 
+[section:flags ip::resolver_query_base::flags]
 
-[section:operator_not__eq_ ip::basic_resolver_iterator::operator!=]
+[indexterm2 flags..ip::resolver_query_base]
+A bitmask type (C++ Std [lib.bitmask.types]).
 
-[indexterm2 operator!=..ip::basic_resolver_iterator]
-Test two iterators for inequality.
 
+ typedef unspecified flags;
 
- friend bool operator!=(
- const basic_resolver_iterator & a,
- const basic_resolver_iterator & b);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
+[*Header: ][^boost/asio/ip/resolver_query_base.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -43469,31 +61508,28 @@
 [endsect]
 
 
-[section:operator_plus__plus_ ip::basic_resolver_iterator::operator++]
 
-[indexterm2 operator++..ip::basic_resolver_iterator]
-Increment operator (prefix).
+[section:numeric_host ip::resolver_query_base::numeric_host]
 
+[indexterm2 numeric_host..ip::resolver_query_base]
+Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
 
- basic_resolver_iterator & ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 operator++]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload1 more...]]``
 
+ static const flags numeric_host = implementation_defined;
 
-Increment operator (postfix).
 
 
- basic_resolver_iterator ``[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 operator++]``(
- int );
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_.overload2 more...]]``
+[endsect]
 
 
-[section:overload1 ip::basic_resolver_iterator::operator++ (1 of 2 overloads)]
 
+[section:numeric_service ip::resolver_query_base::numeric_service]
 
-Increment operator (prefix).
+[indexterm2 numeric_service..ip::resolver_query_base]
+Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
 
 
- basic_resolver_iterator & operator++();
+ static const flags numeric_service = implementation_defined;
 
 
 
@@ -43501,30 +61537,27 @@
 
 
 
-[section:overload2 ip::basic_resolver_iterator::operator++ (2 of 2 overloads)]
-
+[section:passive ip::resolver_query_base::passive]
 
-Increment operator (postfix).
+[indexterm2 passive..ip::resolver_query_base]
+Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
 
 
- basic_resolver_iterator operator++(
- int );
+ static const flags passive = implementation_defined;
 
 
 
 [endsect]
 
 
-[endsect]
-
 
-[section:operator_arrow_ ip::basic_resolver_iterator::operator->]
+[section:v4_mapped ip::resolver_query_base::v4_mapped]
 
-[indexterm2 operator->..ip::basic_resolver_iterator]
-Dereference an iterator.
+[indexterm2 v4_mapped..ip::resolver_query_base]
+If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
 
 
- const basic_resolver_entry< InternetProtocol > * operator->() const;
+ static const flags v4_mapped = implementation_defined;
 
 
 
@@ -43532,22 +61565,14 @@
 
 
 
-[section:operator_eq__eq_ ip::basic_resolver_iterator::operator==]
-
-[indexterm2 operator==..ip::basic_resolver_iterator]
-Test two iterators for equality.
-
-
- friend bool operator==(
- const basic_resolver_iterator & a,
- const basic_resolver_iterator & b);
+[section:_resolver_query_base ip::resolver_query_base::~resolver_query_base]
 
+[indexterm2 ~resolver_query_base..ip::resolver_query_base]
+Protected destructor to prevent deletion through this type.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver_iterator.hpp]
+ ~resolver_query_base();
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
@@ -43556,16 +61581,16 @@
 
 [endsect]
 
-[section:ip__basic_resolver_query ip::basic_resolver_query]
+[section:ip__resolver_service ip::resolver_service]
 
 
-An query to be passed to a resolver.
+Default service implementation for a resolver.
 
 
   template<
       typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
- class basic_resolver_query :
- public ip::resolver_query_base
+ class resolver_service :
+ public io_service::service
 
 
 [heading Types]
@@ -43574,15 +61599,36 @@
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
- [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+ [[link boost_asio.reference.ip__resolver_service.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint query. ]
+ [[link boost_asio.reference.ip__resolver_service.implementation_type [*implementation_type]]]
+ [The type of a resolver implementation. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__resolver_service.iterator_type [*iterator_type]]]
+ [The iterator type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__resolver_service.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__resolver_service.query_type [*query_type]]]
+ [The query type. ]
   
   ]
 
@@ -43593,29 +61639,42 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
- [Construct with specified service name for any protocol.
-
- Construct with specified service name for a given protocol.
-
- Construct with specified host name and service name for any protocol.
+ [[link boost_asio.reference.ip__resolver_service.async_resolve [*async_resolve]]]
+ [Asynchronously resolve a query to a list of entries.
 
- Construct with specified host name and service name for a given protocol. ]
+ Asynchronously resolve an endpoint to a list of entries. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
- [Get the hints associated with the query. ]
+ [[link boost_asio.reference.ip__resolver_service.cancel [*cancel]]]
+ [Cancel pending asynchronous operations. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
- [Get the host name associated with the query. ]
+ [[link boost_asio.reference.ip__resolver_service.construct [*construct]]]
+ [Construct a new resolver implementation. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
- [Get the service name associated with the query. ]
+ [[link boost_asio.reference.ip__resolver_service.destroy [*destroy]]]
+ [Destroy a resolver implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__resolver_service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__resolver_service.resolve [*resolve]]]
+ [Resolve a query to a list of entries.
+
+ Resolve an endpoint to a list of entries. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__resolver_service.resolver_service [*resolver_service]]]
+ [Construct a new resolver service for the specified io_service. ]
   ]
   
 ]
@@ -43625,331 +61684,472 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
- [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
+ [[link boost_asio.reference.ip__resolver_service.id [*id]]]
+ [The unique service identifier. ]
   ]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
- [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
- ]
+]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
- [Determine the canonical name of the host specified in the query. ]
- ]
+[heading Requirements]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
- [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
- ]
+[*Header: ][^boost/asio/ip/resolver_service.hpp]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
- [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
- ]
+[*Convenience header: ][^boost/asio.hpp]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
- [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
- ]
+[section:async_resolve ip::resolver_service::async_resolve]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
- [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
- ]
+[indexterm2 async_resolve..ip::resolver_service]
+Asynchronously resolve a query to a list of entries.
 
-]
 
-The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void ``[link boost_asio.reference.ip__resolver_service.async_resolve.overload1 async_resolve]``(
+ implementation_type & impl,
+ const query_type & query,
+ ResolveHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.async_resolve.overload1 more...]]``
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+Asynchronously resolve an endpoint to a list of entries.
 
-[*Shared] [*objects:] Unsafe.
 
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void ``[link boost_asio.reference.ip__resolver_service.async_resolve.overload2 async_resolve]``(
+ implementation_type & impl,
+ const endpoint_type & endpoint,
+ ResolveHandler handler);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.async_resolve.overload2 more...]]``
 
 
-[heading Requirements]
+[section:overload1 ip::resolver_service::async_resolve (1 of 2 overloads)]
 
-[*Header: ][^boost/asio/ip/basic_resolver_query.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Asynchronously resolve a query to a list of entries.
 
 
-[section:address_configured ip::basic_resolver_query::address_configured]
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void async_resolve(
+ implementation_type & impl,
+ const query_type & query,
+ ResolveHandler handler);
 
 
-['Inherited from ip::resolver_query_base.]
 
-[indexterm2 address_configured..ip::basic_resolver_query]
-Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system.
+[endsect]
 
 
- static const flags address_configured = implementation_defined;
+
+[section:overload2 ip::resolver_service::async_resolve (2 of 2 overloads)]
+
+
+Asynchronously resolve an endpoint to a list of entries.
+
+
+ template<
+ typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
+ void async_resolve(
+ implementation_type & impl,
+ const endpoint_type & endpoint,
+ ResolveHandler handler);
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:all_matching ip::basic_resolver_query::all_matching]
 
+[section:cancel ip::resolver_service::cancel]
 
-['Inherited from ip::resolver_query_base.]
+[indexterm2 cancel..ip::resolver_service]
+Cancel pending asynchronous operations.
 
-[indexterm2 all_matching..ip::basic_resolver_query]
-If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
+
+ void cancel(
+ implementation_type & impl);
 
 
- static const flags all_matching = implementation_defined;
+
+[endsect]
+
+
+
+[section:construct ip::resolver_service::construct]
+
+[indexterm2 construct..ip::resolver_service]
+Construct a new resolver implementation.
+
+
+ void construct(
+ implementation_type & impl);
 
 
 
 [endsect]
 
 
-[section:basic_resolver_query ip::basic_resolver_query::basic_resolver_query]
 
-[indexterm2 basic_resolver_query..ip::basic_resolver_query]
-Construct with specified service name for any protocol.
+[section:destroy ip::resolver_service::destroy]
 
+[indexterm2 destroy..ip::resolver_service]
+Destroy a resolver implementation.
 
- ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 basic_resolver_query]``(
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = passive|address_configured);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload1 more...]]``
 
+ void destroy(
+ implementation_type & impl);
 
-Construct with specified service name for a given protocol.
 
 
- ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 basic_resolver_query]``(
- const protocol_type & protocol,
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = passive|address_configured);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload2 more...]]``
+[endsect]
 
 
-Construct with specified host name and service name for any protocol.
 
+[section:endpoint_type ip::resolver_service::endpoint_type]
 
- ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 basic_resolver_query]``(
- const std::string & host_name,
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = address_configured);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload3 more...]]``
+[indexterm2 endpoint_type..ip::resolver_service]
+The endpoint type.
 
 
-Construct with specified host name and service name for a given protocol.
+ typedef InternetProtocol::endpoint endpoint_type;
 
 
- ``[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 basic_resolver_query]``(
- const protocol_type & protocol,
- const std::string & host_name,
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = address_configured);
- `` [''''&raquo;''' [link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query.overload4 more...]]``
 
+[heading Requirements]
 
-[section:overload1 ip::basic_resolver_query::basic_resolver_query (1 of 4 overloads)]
+[*Header: ][^boost/asio/ip/resolver_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Construct with specified service name for any protocol.
 
+[endsect]
 
- basic_resolver_query(
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = passive|address_configured);
 
 
-This constructor is typically used to perform name resolution for local service binding.
+[section:get_io_service ip::resolver_service::get_io_service]
 
 
-[heading Parameters]
-
+['Inherited from io_service.]
 
-[variablelist
-
-[[service_name][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
+[indexterm2 get_io_service..ip::resolver_service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
-[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
 
-]
+ boost::asio::io_service & get_io_service();
 
 
-[heading Remarks]
-
-On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
 
+[endsect]
+
+
+
+[section:id ip::resolver_service::id]
+
+[indexterm2 id..ip::resolver_service]
+The unique service identifier.
+
+
+ static boost::asio::io_service::id id;
+
+
+
+[endsect]
+
+
+
+[section:implementation_type ip::resolver_service::implementation_type]
+
+[indexterm2 implementation_type..ip::resolver_service]
+The type of a resolver implementation.
 
 
+ typedef implementation_defined implementation_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/ip/resolver_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:iterator_type ip::resolver_service::iterator_type]
 
-[endsect]
+[indexterm2 iterator_type..ip::resolver_service]
+The iterator type.
 
 
+ typedef basic_resolver_iterator< InternetProtocol > iterator_type;
 
-[section:overload2 ip::basic_resolver_query::basic_resolver_query (2 of 4 overloads)]
 
+[heading Types]
+[table
+ [[Name][Description]]
 
-Construct with specified service name for a given protocol.
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_iterator.difference_type [*difference_type]]]
+ [The type used for the distance between two iterators. ]
+
+ ]
 
- basic_resolver_query(
- const protocol_type & protocol,
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = passive|address_configured);
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_iterator.iterator_category [*iterator_category]]]
+ [The iterator category. ]
+
+ ]
 
-This constructor is typically used to perform name resolution for local service binding with a specific protocol version.
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_iterator.pointer [*pointer]]]
+ [The type of the result of applying operator->() to the iterator. ]
+
+ ]
 
-[heading Parameters]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.ip__basic_resolver_iterator.reference [*reference]]]
+ [The type of the result of applying operator*() to the iterator. ]
   
-[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
+ ]
 
-[[service_name][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number.]]
+ [
 
-[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for local service binding.]]
+ [[link boost_asio.reference.ip__basic_resolver_iterator.value_type [*value_type]]]
+ [The type of the value pointed to by the iterator. ]
+
+ ]
 
 ]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[heading Remarks]
-
-On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
+ [Default constructor creates an end iterator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
+ [Create an iterator from an addrinfo list returned by getaddrinfo.
 
+ Create an iterator from an endpoint, host name and service name. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
+ [Dereference an iterator. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
+ [Increment operator (prefix).
 
+ Increment operator (postfix). ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
+ [Dereference an iterator. ]
+ ]
+
+]
 
+[heading Friends]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
+ [Test two iterators for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
+ [Test two iterators for equality. ]
+ ]
+
+]
 
+The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
 
+The iterator's value\_type, obtained when the iterator is dereferenced, is:
 
-[section:overload3 ip::basic_resolver_query::basic_resolver_query (3 of 4 overloads)]
+ const basic_resolver_entry<InternetProtocol>
 
 
-Construct with specified host name and service name for any protocol.
 
 
- basic_resolver_query(
- const std::string & host_name,
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = address_configured);
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
-This constructor is typically used to perform name resolution for communication with remote hosts.
+[*Shared] [*objects:] Unsafe.
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[host_name][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
 
-[[service_name][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
+[heading Requirements]
 
-[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
+[*Header: ][^boost/asio/ip/resolver_service.hpp]
 
-]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Remarks]
-
-On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
+[endsect]
 
-On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
 
 
-[endsect]
+[section:protocol_type ip::resolver_service::protocol_type]
 
+[indexterm2 protocol_type..ip::resolver_service]
+The protocol type.
 
 
-[section:overload4 ip::basic_resolver_query::basic_resolver_query (4 of 4 overloads)]
+ typedef InternetProtocol protocol_type;
 
 
-Construct with specified host name and service name for a given protocol.
 
+[heading Requirements]
 
- basic_resolver_query(
- const protocol_type & protocol,
- const std::string & host_name,
- const std::string & service_name,
- resolver_query_base::flags resolve_flags = address_configured);
+[*Header: ][^boost/asio/ip/resolver_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-This constructor is typically used to perform name resolution for communication with remote hosts.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[protocol][A protocol object, normally representing either the IPv4 or IPv6 version of an internet protocol.]]
 
-[[host_name][A string identifying a location. May be a descriptive name or a numeric address string. If an empty string and the passive flag has been specified, the resolved endpoints are suitable for local service binding. If an empty string and passive is not specified, the resolved endpoints will use the loopback address.]]
+[section:query_type ip::resolver_service::query_type]
 
-[[service_name][A string identifying the requested service. This may be a descriptive name or a numeric string corresponding to a port number. May be an empty string, in which case all resolved endpoints will have a port number of 0.]]
+[indexterm2 query_type..ip::resolver_service]
+The query type.
 
-[[resolve_flags][A set of flags that determine how name resolution should be performed. The default flags are suitable for communication with remote hosts.]]
 
-]
+ typedef basic_resolver_query< InternetProtocol > query_type;
 
 
-[heading Remarks]
-
-On POSIX systems, host names may be locally defined in the file `/etc/hosts`. On Windows, host names may be defined in the file `c:\windows\system32\drivers\etc\hosts`. Remote host name resolution is performed using DNS. Operating systems may use additional locations when resolving host names (such as NETBIOS names on Windows).
+[heading Types]
+[table
+ [[Name][Description]]
 
-On POSIX systems, service names are typically defined in the file `/etc/services`. On Windows, service names may be found in the file `c:\windows\system32\drivers\etc\services`. Operating systems may use additional locations when resolving service names.
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
+ [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint query. ]
+
+ ]
 
-[endsect]
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[section:canonical_name ip::basic_resolver_query::canonical_name]
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
+ [Construct with specified service name for any protocol.
 
+ Construct with specified service name for a given protocol.
 
-['Inherited from ip::resolver_query_base.]
+ Construct with specified host name and service name for any protocol.
 
-[indexterm2 canonical_name..ip::basic_resolver_query]
-Determine the canonical name of the host specified in the query.
+ Construct with specified host name and service name for a given protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
+ [Get the hints associated with the query. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
+ [Get the host name associated with the query. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
+ [Get the service name associated with the query. ]
+ ]
+
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
- static const flags canonical_name = implementation_defined;
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
+ [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
+ [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
+ [Determine the canonical name of the host specified in the query. ]
+ ]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
+ [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
+ [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
+ ]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
+ [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
+ ]
 
-[section:flags ip::basic_resolver_query::flags]
+ [
+ [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
+ [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ ]
 
+]
 
-['Inherited from ip::resolver_query_base.]
+The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
 
-[indexterm2 flags..ip::basic_resolver_query]
-A bitmask type (C++ Std [lib.bitmask.types]).
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
 
- typedef unspecified flags;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/basic_resolver_query.hpp]
+[*Header: ][^boost/asio/ip/resolver_service.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -43957,28 +62157,39 @@
 [endsect]
 
 
+[section:resolve ip::resolver_service::resolve]
 
-[section:hints ip::basic_resolver_query::hints]
+[indexterm2 resolve..ip::resolver_service]
+Resolve a query to a list of entries.
 
-[indexterm2 hints..ip::basic_resolver_query]
-Get the hints associated with the query.
 
+ iterator_type ``[link boost_asio.reference.ip__resolver_service.resolve.overload1 resolve]``(
+ implementation_type & impl,
+ const query_type & query,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.resolve.overload1 more...]]``
 
- const boost::asio::detail::addrinfo_type & hints() const;
 
+Resolve an endpoint to a list of entries.
 
 
-[endsect]
+ iterator_type ``[link boost_asio.reference.ip__resolver_service.resolve.overload2 resolve]``(
+ implementation_type & impl,
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.resolve.overload2 more...]]``
 
 
+[section:overload1 ip::resolver_service::resolve (1 of 2 overloads)]
 
-[section:host_name ip::basic_resolver_query::host_name]
 
-[indexterm2 host_name..ip::basic_resolver_query]
-Get the host name associated with the query.
+Resolve a query to a list of entries.
 
 
- std::string host_name() const;
+ iterator_type resolve(
+ implementation_type & impl,
+ const query_type & query,
+ boost::system::error_code & ec);
 
 
 
@@ -43986,33 +62197,33 @@
 
 
 
-[section:numeric_host ip::basic_resolver_query::numeric_host]
-
+[section:overload2 ip::resolver_service::resolve (2 of 2 overloads)]
 
-['Inherited from ip::resolver_query_base.]
 
-[indexterm2 numeric_host..ip::basic_resolver_query]
-Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
+Resolve an endpoint to a list of entries.
 
 
- static const flags numeric_host = implementation_defined;
+ iterator_type resolve(
+ implementation_type & impl,
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
-
-[section:numeric_service ip::basic_resolver_query::numeric_service]
+[endsect]
 
 
-['Inherited from ip::resolver_query_base.]
+[section:resolver_service ip::resolver_service::resolver_service]
 
-[indexterm2 numeric_service..ip::basic_resolver_query]
-Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
+[indexterm2 resolver_service..ip::resolver_service]
+Construct a new resolver service for the specified [link boost_asio.reference.io_service `io_service`].
 
 
- static const flags numeric_service = implementation_defined;
+ resolver_service(
+ boost::asio::io_service & io_service);
 
 
 
@@ -44020,172 +62231,288 @@
 
 
 
-[section:passive ip::basic_resolver_query::passive]
-
-
-['Inherited from ip::resolver_query_base.]
-
-[indexterm2 passive..ip::basic_resolver_query]
-Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
-
-
- static const flags passive = implementation_defined;
-
+[endsect]
 
+[section:ip__tcp ip::tcp]
 
-[endsect]
 
+Encapsulates the flags needed for TCP.
 
 
-[section:protocol_type ip::basic_resolver_query::protocol_type]
+ class tcp
 
-[indexterm2 protocol_type..ip::basic_resolver_query]
-The protocol type associated with the endpoint query.
 
+[heading Types]
+[table
+ [[Name][Description]]
 
- typedef InternetProtocol protocol_type;
+ [
 
+ [[link boost_asio.reference.ip__tcp.acceptor [*acceptor]]]
+ [The TCP acceptor type. ]
+
+ ]
 
+ [
 
-[heading Requirements]
+ [[link boost_asio.reference.ip__tcp.endpoint [*endpoint]]]
+ [The type of a TCP endpoint. ]
+
+ ]
 
-[*Header: ][^boost/asio/ip/basic_resolver_query.hpp]
+ [
 
-[*Convenience header: ][^boost/asio.hpp]
+ [[link boost_asio.reference.ip__tcp.iostream [*iostream]]]
+ [The TCP iostream type. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.ip__tcp.no_delay [*no_delay]]]
+ [Socket option for disabling the Nagle algorithm. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.ip__tcp.resolver [*resolver]]]
+ [The TCP resolver type. ]
+
+ ]
 
-[section:service_name ip::basic_resolver_query::service_name]
+ [
 
-[indexterm2 service_name..ip::basic_resolver_query]
-Get the service name associated with the query.
+ [[link boost_asio.reference.ip__tcp.socket [*socket]]]
+ [The TCP socket type. ]
+
+ ]
 
+]
 
- std::string service_name() const;
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__tcp.family [*family]]]
+ [Obtain an identifier for the protocol family. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__tcp.protocol [*protocol]]]
+ [Obtain an identifier for the protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__tcp.type [*type]]]
+ [Obtain an identifier for the type of the protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__tcp.v4 [*v4]]]
+ [Construct to represent the IPv4 TCP protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__tcp.v6 [*v6]]]
+ [Construct to represent the IPv6 TCP protocol. ]
+ ]
+
+]
 
+[heading Friends]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__tcp.operator_not__eq_ [*operator!=]]]
+ [Compare two protocols for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__tcp.operator_eq__eq_ [*operator==]]]
+ [Compare two protocols for equality. ]
+ ]
+
+]
 
+The [link boost_asio.reference.ip__tcp `ip::tcp`] class contains flags necessary for TCP sockets.
 
 
-[section:v4_mapped ip::basic_resolver_query::v4_mapped]
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Safe.
 
-['Inherited from ip::resolver_query_base.]
 
-[indexterm2 v4_mapped..ip::basic_resolver_query]
-If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
 
 
- static const flags v4_mapped = implementation_defined;
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[endsect]
 
+[section:acceptor ip::tcp::acceptor]
 
+[indexterm2 acceptor..ip::tcp]
+The TCP acceptor type.
 
-[endsect]
 
-[section:ip__host_name ip::host_name]
+ typedef basic_socket_acceptor< tcp > acceptor;
 
-[indexterm1 ip::host_name]
-Get the current host name.
 
-
- std::string ``[link boost_asio.reference.ip__host_name.overload1 host_name]``();
- `` [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload1 more...]]``
+[heading Types]
+[table
+ [[Name][Description]]
 
- std::string ``[link boost_asio.reference.ip__host_name.overload2 host_name]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__host_name.overload2 more...]]``
+ [
 
-[heading Requirements]
+ [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
 
-[*Header: ][^boost/asio/ip/host_name.hpp]
+ [
 
-[*Convenience header: ][^boost/asio.hpp]
+ [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
+ [
 
-[section:overload1 ip::host_name (1 of 2 overloads)]
+ [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
 
+ [
 
-Get the current host name.
+ [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
 
+ [
 
- std::string host_name();
+ [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
+ [
 
-[section:overload2 ip::host_name (2 of 2 overloads)]
+ [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
 
+ [
 
-Get the current host name.
+ [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
 
+ [
 
- std::string host_name(
- boost::system::error_code & ec);
+ [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
+ [The native representation of an acceptor. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of an acceptor. ]
+
+ ]
 
-[endsect]
+ [
 
-[section:ip__icmp ip::icmp]
+ [[link boost_asio.reference.basic_socket_acceptor.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
 
+ [
 
-Encapsulates the flags needed for ICMP.
+ [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
+ [
 
- class icmp
+ [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
+ [
 
-[heading Types]
-[table
- [[Name][Description]]
+ [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
   [
 
- [[link boost_asio.reference.ip__icmp.endpoint [*endpoint]]]
- [The type of a ICMP endpoint. ]
+ [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__icmp.resolver [*resolver]]]
- [The ICMP resolver type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__icmp.resolver_iterator [*resolver_iterator]]]
- [(Deprecated: use resolver::iterator.) The type of a resolver iterator. ]
+ [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__icmp.resolver_query [*resolver_query]]]
- [(Deprecated: use resolver::query.) The type of a resolver query. ]
+ [[link boost_asio.reference.basic_socket_acceptor.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__icmp.socket [*socket]]]
- [The ICMP socket type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
   
   ]
 
@@ -44196,74 +62523,229 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__icmp.family [*family]]]
- [Obtain an identifier for the protocol family. ]
+ [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
+ [Accept a new connection.
+
+ Accept a new connection and obtain the endpoint of the peer. ]
   ]
   
   [
- [[link boost_asio.reference.ip__icmp.protocol [*protocol]]]
- [Obtain an identifier for the protocol. ]
+ [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
+ [Assigns an existing native acceptor to the acceptor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__icmp.type [*type]]]
- [Obtain an identifier for the type of the protocol. ]
+ [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
+ [Start an asynchronous accept. ]
   ]
   
   [
- [[link boost_asio.reference.ip__icmp.v4 [*v4]]]
- [Construct to represent the IPv4 ICMP protocol. ]
+ [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
+ [Construct an acceptor without opening it.
+
+ Construct an open acceptor.
+
+ Construct an acceptor opened on the given endpoint.
+
+ Construct a basic_socket_acceptor on an existing native acceptor.
+
+ Move-construct a basic_socket_acceptor from another. ]
   ]
   
   [
- [[link boost_asio.reference.ip__icmp.v6 [*v6]]]
- [Construct to represent the IPv6 ICMP protocol. ]
+ [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
+ [Bind the acceptor to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
+ [Close the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
+ [Get an option from the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
+ [Perform an IO control command on the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
+ [Determine whether the acceptor is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
+ [Place the acceptor into the state where it will listen for new connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native acceptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
+ [Get the native acceptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native acceptor implementation.
+
+ Sets the non-blocking mode of the native acceptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the acceptor.
+
+ Sets the non-blocking mode of the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
+ [Open the acceptor using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket_acceptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
+ [Set an option on the acceptor. ]
   ]
   
 ]
 
-[heading Friends]
+[heading Protected Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__icmp.operator_not__eq_ [*operator!=]]]
- [Compare two protocols for inequality. ]
+ [[link boost_asio.reference.basic_socket_acceptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
   ]
   
   [
- [[link boost_asio.reference.ip__icmp.operator_eq__eq_ [*operator==]]]
- [Compare two protocols for equality. ]
+ [[link boost_asio.reference.basic_socket_acceptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
   
 ]
 
-The [link boost_asio.reference.ip__icmp `ip::icmp`] class contains flags necessary for ICMP sockets.
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
+
+]
+
+The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Safe.
+[*Shared] [*objects:] Unsafe.
+
+
+[heading Example]
+
+Opening a socket acceptor with the SO\_REUSEADDR option enabled:
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
+ acceptor.open(endpoint.protocol());
+ acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
+ acceptor.bind(endpoint);
+ acceptor.listen();
+
+
+
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/icmp.hpp]
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:endpoint ip::icmp::endpoint]
+[endsect]
 
-[indexterm2 endpoint..ip::icmp]
-The type of a ICMP endpoint.
 
 
- typedef basic_endpoint< icmp > endpoint;
+[section:endpoint ip::tcp::endpoint]
+
+[indexterm2 endpoint..ip::tcp]
+The type of a TCP endpoint.
+
+
+ typedef basic_endpoint< tcp > endpoint;
 
 
 [heading Types]
@@ -44409,7 +62891,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/icmp.hpp]
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -44418,9 +62900,9 @@
 
 
 
-[section:family ip::icmp::family]
+[section:family ip::tcp::family]
 
-[indexterm2 family..ip::icmp]
+[indexterm2 family..ip::tcp]
 Obtain an identifier for the protocol family.
 
 
@@ -44432,71 +62914,13 @@
 
 
 
-[section:operator_not__eq_ ip::icmp::operator!=]
-
-[indexterm2 operator!=..ip::icmp]
-Compare two protocols for inequality.
-
-
- friend bool operator!=(
- const icmp & p1,
- const icmp & p2);
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/ip/icmp.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:operator_eq__eq_ ip::icmp::operator==]
-
-[indexterm2 operator==..ip::icmp]
-Compare two protocols for equality.
-
-
- friend bool operator==(
- const icmp & p1,
- const icmp & p2);
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/ip/icmp.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:protocol ip::icmp::protocol]
-
-[indexterm2 protocol..ip::icmp]
-Obtain an identifier for the protocol.
-
-
- int protocol() const;
-
-
-
-[endsect]
-
-
-
-[section:resolver ip::icmp::resolver]
+[section:iostream ip::tcp::iostream]
 
-[indexterm2 resolver..ip::icmp]
-The ICMP resolver type.
+[indexterm2 iostream..ip::tcp]
+The TCP iostream type.
 
 
- typedef basic_resolver< icmp > resolver;
+ typedef basic_socket_iostream< tcp > iostream;
 
 
 [heading Types]
@@ -44505,43 +62929,22 @@
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
- [The iterator type. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
- [The protocol type. ]
+ [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
+ [The duration type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
- [The query type. ]
+ [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
+ [The time type. ]
   
   ]
 
@@ -44552,72 +62955,103 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously perform forward resolution of a query to a list of entries.
+ [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
+ [Construct a basic_socket_iostream without establishing a connection.
 
- Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
+ Establish a connection to an endpoint corresponding to a resolver query. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
- [Constructor. ]
+ [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
+ [Close the connection. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
- [Cancel any asynchronous operations that are waiting on the resolver. ]
+ [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
+ [Establish a connection to an endpoint corresponding to a resolver query. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
+ [Get the last error associated with the stream. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
+ [Get the stream's expiry time as an absolute time.
+
+ Set the stream's expiry time as an absolute time. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Perform forward resolution of a query to a list of entries.
+ [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
+ [Get the timer's expiry time relative to now.
 
- Perform reverse resolution of an endpoint to a list of entries. ]
+ Set the stream's expiry time relative to now. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
+ [Return a pointer to the underlying streambuf. ]
   ]
   
 ]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
+[heading Requirements]
 
- [
- [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
- [The service associated with the I/O object. ]
- ]
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
-]
+[*Convenience header: ][^boost/asio.hpp]
 
-The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
 
+[endsect]
 
-[heading Thread Safety]
+
+
+[section:no_delay ip::tcp::no_delay]
+
+[indexterm2 no_delay..ip::tcp]
+Socket option for disabling the Nagle algorithm.
+
+
+ typedef implementation_defined no_delay;
+
+
+
+Implements the IPPROTO\_TCP/TCP\_NODELAY socket option.
+
+
+[heading Examples]
   
-[*Distinct] [*objects:] Safe.
+Setting the option:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ socket.set_option(option);
+
+
+
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::tcp::no_delay option;
+ socket.get_option(option);
+ bool is_set = option.value();
+
+
 
-[*Shared] [*objects:] Unsafe.
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/icmp.hpp]
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -44626,103 +63060,71 @@
 
 
 
-[section:resolver_iterator ip::icmp::resolver_iterator]
+[section:operator_not__eq_ ip::tcp::operator!=]
 
-[indexterm2 resolver_iterator..ip::icmp]
-(Deprecated: use `resolver::iterator`.) The type of a resolver iterator.
+[indexterm2 operator!=..ip::tcp]
+Compare two protocols for inequality.
 
 
- typedef basic_resolver_iterator< icmp > resolver_iterator;
+ friend bool operator!=(
+ const tcp & p1,
+ const tcp & p2);
 
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[heading Requirements]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
- [Default constructor creates an end iterator. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
- [Create an iterator from an addrinfo list returned by getaddrinfo.
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
- Create an iterator from an endpoint, host name and service name. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
- [Dereference an iterator. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
- [Increment operator (prefix).
+[*Convenience header: ][^boost/asio.hpp]
 
- Increment operator (postfix). ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
- [Dereference an iterator. ]
- ]
-
-]
 
-[heading Friends]
-[table
- [[Name][Description]]
+[endsect]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
- [Test two iterators for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
- [Test two iterators for equality. ]
- ]
-
-]
 
-The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
 
-The iterator's value\_type, obtained when the iterator is dereferenced, is:
+[section:operator_eq__eq_ ip::tcp::operator==]
 
- const basic_resolver_entry<InternetProtocol>
+[indexterm2 operator==..ip::tcp]
+Compare two protocols for equality.
+
+
+ friend bool operator==(
+ const tcp & p1,
+ const tcp & p2);
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[endsect]
 
 
 
+[section:protocol ip::tcp::protocol]
 
-[heading Requirements]
+[indexterm2 protocol..ip::tcp]
+Obtain an identifier for the protocol.
 
-[*Header: ][^boost/asio/ip/icmp.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ int protocol() const;
+
 
 
 [endsect]
 
 
 
-[section:resolver_query ip::icmp::resolver_query]
+[section:resolver ip::tcp::resolver]
 
-[indexterm2 resolver_query..ip::icmp]
-(Deprecated: use `resolver::query`.) The type of a resolver query.
+[indexterm2 resolver..ip::tcp]
+The TCP resolver type.
 
 
- typedef basic_resolver_query< icmp > resolver_query;
+ typedef basic_resolver< tcp > resolver;
 
 
 [heading Types]
@@ -44731,15 +63133,43 @@
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
- [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+ [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint query. ]
+ [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
+ [The iterator type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
+ [The query type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
@@ -44749,76 +63179,70 @@
 [table
   [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
- [Construct with specified service name for any protocol.
-
- Construct with specified service name for a given protocol.
-
- Construct with specified host name and service name for any protocol.
+ [
+ [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
+ [Asynchronously perform forward resolution of a query to a list of entries.
 
- Construct with specified host name and service name for a given protocol. ]
+ Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
- [Get the hints associated with the query. ]
+ [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
+ [Constructor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
- [Get the host name associated with the query. ]
+ [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
+ [Cancel any asynchronous operations that are waiting on the resolver. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
- [Get the service name associated with the query. ]
+ [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
+ [Perform forward resolution of a query to a list of entries.
+
+ Perform reverse resolution of an endpoint to a list of entries. ]
   ]
   
 ]
 
-[heading Data Members]
+[heading Protected Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
- [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
- [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
- [Determine the canonical name of the host specified in the query. ]
+ [[link boost_asio.reference.ip__basic_resolver.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
- [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
+ [[link boost_asio.reference.ip__basic_resolver.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
+
+]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
- [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
- ]
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
- [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
+ [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
- [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
+The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
 
 
 [heading Thread Safety]
@@ -44832,7 +63256,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/icmp.hpp]
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -44841,13 +63265,13 @@
 
 
 
-[section:socket ip::icmp::socket]
+[section:socket ip::tcp::socket]
 
-[indexterm2 socket..ip::icmp]
-The ICMP socket type.
+[indexterm2 socket..ip::tcp]
+The TCP socket type.
 
 
- typedef basic_raw_socket< icmp > socket;
+ typedef basic_stream_socket< tcp > socket;
 
 
 [heading Types]
@@ -44856,147 +63280,154 @@
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
+ [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
     [Socket option to permit sending of broadcast messages. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.bytes_readable [*bytes_readable]]]
+ [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
     [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
+ [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
     [Socket option to enable socket-level debugging. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.do_not_route [*do_not_route]]]
+ [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
     [Socket option to prevent routing, use local interfaces only. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
     [Socket option to report aborted connections on accept. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
+ [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
     [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.implementation_type [*implementation_type]]]
+ [[link boost_asio.reference.basic_stream_socket.implementation_type [*implementation_type]]]
     [The underlying implementation type of I/O object. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
+ [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
     [Socket option to send keep-alives. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.linger [*linger]]]
+ [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.lowest_layer_type [*lowest_layer_type]]]
+ [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
     [A basic_socket is always the lowest layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.message_flags [*message_flags]]]
+ [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
     [Bitmask type for flags that can be passed to send and receive operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
     [The native representation of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [[link boost_asio.reference.basic_stream_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
+ [[link boost_asio.reference.basic_stream_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
     [The protocol type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.receive_buffer_size [*receive_buffer_size]]]
+ [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
     [Socket option for the receive buffer size of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
+ [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
     [Socket option for the receive low watermark. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.reuse_address [*reuse_address]]]
+ [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
     [Socket option to allow the socket to be bound to an address that is already in use. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.send_buffer_size [*send_buffer_size]]]
+ [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
     [Socket option for the send buffer size of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
+ [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
     [Socket option for the send low watermark. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.service_type [*service_type]]]
+ [[link boost_asio.reference.basic_stream_socket.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
+ [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
     [Different ways a socket may be shutdown. ]
   
   ]
@@ -45008,158 +63439,197 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
+ [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
     [Assign an existing native socket to the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.async_connect [*async_connect]]]
+ [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
     [Start an asynchronous connect. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.async_receive [*async_receive]]]
- [Start an asynchronous receive on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
+ [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
     [Start an asynchronous receive. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
- [Start an asynchronous send on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
- [Start an asynchronous send. ]
+ [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.at_mark [*at_mark]]]
+ [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
     [Determine whether the socket is at the out-of-band data mark. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.available [*available]]]
+ [[link boost_asio.reference.basic_stream_socket.available [*available]]]
     [Determine the number of bytes available for reading. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.basic_raw_socket [*basic_raw_socket]]]
- [Construct a basic_raw_socket without opening it.
+ [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
+ [Construct a basic_stream_socket without opening it.
 
- Construct and open a basic_raw_socket.
+ Construct and open a basic_stream_socket.
 
- Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
+ Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
+
+ Construct a basic_stream_socket on an existing native socket.
 
- Construct a basic_raw_socket on an existing native socket. ]
+ Move-construct a basic_stream_socket from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.bind [*bind]]]
+ [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
     [Bind the socket to the given local endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.cancel [*cancel]]]
+ [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
     [Cancel all asynchronous operations associated with the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.close [*close]]]
+ [[link boost_asio.reference.basic_stream_socket.close [*close]]]
     [Close the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
+ [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
     [Connect the socket to the specified endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.get_io_service [*get_io_service]]]
+ [[link boost_asio.reference.basic_stream_socket.get_io_service [*get_io_service]]]
     [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
+ [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
     [Get an option from the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
+ [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
     [Perform an IO control command on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
+ [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
+ [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
     [Get the local endpoint of the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
+ [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
     [Get a reference to the lowest layer.
 
      Get a const reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.native [*native]]]
+ [[link boost_asio.reference.basic_stream_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
     [Get the native socket representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.open [*open]]]
+ [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.open [*open]]]
     [Open the socket using the specified protocol. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
- [Receive some data on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_stream_socket from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.receive_from [*receive_from]]]
- [Receive raw data with the endpoint of the sender. ]
+ [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
+ [Read some data from the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
+ [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
+ [Receive some data on the socket.
+
+ Receive some data on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.send [*send]]]
- [Send some data on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
- [Send raw data to the specified endpoint. ]
+ [[link boost_asio.reference.basic_stream_socket.send [*send]]]
+ [Send some data on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
+ [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
     [Set an option on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
+ [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
     [Disable sends or receives on the socket. ]
   ]
   
+ [
+ [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
+ [Write some data to the socket. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
 ]
 
 [heading Data Members]
@@ -45167,22 +63637,27 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_raw_socket.max_connections [*max_connections]]]
+ [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
     [The maximum length of the queue of pending incoming connections. ]
   ]
 
   [
- [[link boost_asio.reference.basic_raw_socket.message_do_not_route [*message_do_not_route]]]
+ [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
     [Specify that the data should not be subject to routing. ]
   ]
 
   [
- [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
+ [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
 
   [
- [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
+ [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
     [Peek at incoming data without removing it from the input queue. ]
   ]
 
@@ -45193,32 +63668,33 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_raw_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.basic_stream_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.basic_raw_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.basic_stream_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.basic_raw_socket `basic_raw_socket`] class template provides asynchronous and blocking raw-oriented socket functionality.
+The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
+
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/icmp.hpp]
+[*Header: ][^boost/asio/ip/tcp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -45227,9 +63703,9 @@
 
 
 
-[section:type ip::icmp::type]
+[section:type ip::tcp::type]
 
-[indexterm2 type..ip::icmp]
+[indexterm2 type..ip::tcp]
 Obtain an identifier for the type of the protocol.
 
 
@@ -45241,13 +63717,13 @@
 
 
 
-[section:v4 ip::icmp::v4]
+[section:v4 ip::tcp::v4]
 
-[indexterm2 v4..ip::icmp]
-Construct to represent the IPv4 ICMP protocol.
+[indexterm2 v4..ip::tcp]
+Construct to represent the IPv4 TCP protocol.
 
 
- static icmp v4();
+ static tcp v4();
 
 
 
@@ -45255,13 +63731,13 @@
 
 
 
-[section:v6 ip::icmp::v6]
+[section:v6 ip::tcp::v6]
 
-[indexterm2 v6..ip::icmp]
-Construct to represent the IPv6 ICMP protocol.
+[indexterm2 v6..ip::tcp]
+Construct to represent the IPv6 TCP protocol.
 
 
- static icmp v6();
+ static tcp v6();
 
 
 
@@ -45271,134 +63747,253 @@
 
 [endsect]
 
+[section:ip__udp ip::udp]
 
-[section:ip__multicast__enable_loopback ip::multicast::enable_loopback]
-
-[indexterm1 ip::multicast::enable_loopback]
-Socket option determining whether outgoing multicast packets will be received on the same socket if it is a member of the multicast group.
 
+Encapsulates the flags needed for UDP.
 
- typedef implementation_defined enable_loopback;
 
+ class udp
 
 
-Implements the IPPROTO\_IP/IP\_MULTICAST\_LOOP socket option.
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-[heading Examples]
+ [[link boost_asio.reference.ip__udp.endpoint [*endpoint]]]
+ [The type of a UDP endpoint. ]
   
-Setting the option:
-
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::multicast::enable_loopback option(true);
- socket.set_option(option);
+ ]
 
+ [
 
+ [[link boost_asio.reference.ip__udp.resolver [*resolver]]]
+ [The UDP resolver type. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.ip__udp.socket [*socket]]]
+ [The UDP socket type. ]
+
+ ]
 
-Getting the current option value:
+]
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::multicast::enable_loopback option;
- socket.get_option(option);
- bool is_set = option.value();
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__udp.family [*family]]]
+ [Obtain an identifier for the protocol family. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__udp.protocol [*protocol]]]
+ [Obtain an identifier for the protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__udp.type [*type]]]
+ [Obtain an identifier for the type of the protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__udp.v4 [*v4]]]
+ [Construct to represent the IPv4 UDP protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__udp.v6 [*v6]]]
+ [Construct to represent the IPv6 UDP protocol. ]
+ ]
+
+]
 
+[heading Friends]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__udp.operator_not__eq_ [*operator!=]]]
+ [Compare two protocols for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__udp.operator_eq__eq_ [*operator==]]]
+ [Compare two protocols for equality. ]
+ ]
+
+]
 
+The [link boost_asio.reference.ip__udp `ip::udp`] class contains flags necessary for UDP sockets.
 
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
-[heading Requirements]
+[*Shared] [*objects:] Safe.
 
-[*Header: ][^boost/asio/ip/multicast.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/udp.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:ip__multicast__hops ip::multicast::hops]
 
-[indexterm1 ip::multicast::hops]
-Socket option for time-to-live associated with outgoing multicast packets.
+[section:endpoint ip::udp::endpoint]
 
+[indexterm2 endpoint..ip::udp]
+The type of a UDP endpoint.
 
- typedef implementation_defined hops;
 
+ typedef basic_endpoint< udp > endpoint;
 
 
-Implements the IPPROTO\_IP/IP\_MULTICAST\_TTL socket option.
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-[heading Examples]
+ [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
+ [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
   
-Setting the option:
-
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::multicast::hops option(4);
- socket.set_option(option);
-
-
-
-
-
-Getting the current option value:
-
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::multicast::hops option;
- socket.get_option(option);
- int ttl = option.value();
-
-
-
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/ip/multicast.hpp]
+ ]
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
 
+ [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint. ]
+
+ ]
 
-[endsect]
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
+ [Get the IP address associated with the endpoint.
 
-[section:ip__multicast__join_group ip::multicast::join_group]
+ Set the IP address associated with the endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
+ [Default constructor.
 
-[indexterm1 ip::multicast::join_group]
-Socket option to join a multicast group on a specified interface.
+ Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.
 
+ Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
 
- typedef implementation_defined join_group;
+ Copy constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
+ [Get the capacity of the endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
+ [Get the underlying endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
+ [Assign from another endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
+ [Get the port associated with the endpoint. The port number is always in the host's byte order.
 
+ Set the port associated with the endpoint. The port number is always in the host's byte order. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
+ [The protocol associated with the endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
+ [Set the underlying size of the endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
+ [Get the underlying size of the endpoint in the native type. ]
+ ]
+
+]
 
+[heading Friends]
+[table
+ [[Name][Description]]
 
-Implements the IPPROTO\_IP/IP\_ADD\_MEMBERSHIP socket option.
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
+ [Compare two endpoints for inequality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
+ [Compare two endpoints for equality. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+]
 
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
-[heading Examples]
+ [
+ [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
+ [Output an endpoint as a string. ]
+ ]
   
-Setting the option to join a multicast group:
+]
+
+The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::address multicast_address =
- boost::asio::ip::address::from_string("225.0.0.1");
- boost::asio::ip::multicast::join_group option(multicast_address);
- socket.set_option(option);
 
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
 
 
@@ -45406,7 +64001,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/multicast.hpp]
+[*Header: ][^boost/asio/ip/udp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -45415,39 +64010,34 @@
 
 
 
-[section:ip__multicast__leave_group ip::multicast::leave_group]
-
-[indexterm1 ip::multicast::leave_group]
-Socket option to leave a multicast group on a specified interface.
-
+[section:family ip::udp::family]
 
- typedef implementation_defined leave_group;
+[indexterm2 family..ip::udp]
+Obtain an identifier for the protocol family.
 
 
+ int family() const;
 
-Implements the IPPROTO\_IP/IP\_DROP\_MEMBERSHIP socket option.
 
 
-[heading Examples]
-
-Setting the option to leave a multicast group:
+[endsect]
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::address multicast_address =
- boost::asio::ip::address::from_string("225.0.0.1");
- boost::asio::ip::multicast::leave_group option(multicast_address);
- socket.set_option(option);
 
 
+[section:operator_not__eq_ ip::udp::operator!=]
 
+[indexterm2 operator!=..ip::udp]
+Compare two protocols for inequality.
 
 
+ friend bool operator!=(
+ const udp & p1,
+ const udp & p2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/multicast.hpp]
+[*Header: ][^boost/asio/ip/udp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -45456,53 +64046,49 @@
 
 
 
-[section:ip__multicast__outbound_interface ip::multicast::outbound_interface]
-
-[indexterm1 ip::multicast::outbound_interface]
-Socket option for local interface to use for outgoing multicast packets.
-
+[section:operator_eq__eq_ ip::udp::operator==]
 
- typedef implementation_defined outbound_interface;
+[indexterm2 operator==..ip::udp]
+Compare two protocols for equality.
 
 
+ friend bool operator==(
+ const udp & p1,
+ const udp & p2);
 
-Implements the IPPROTO\_IP/IP\_MULTICAST\_IF socket option.
 
+[heading Requirements]
 
-[heading Examples]
-
-Setting the option:
+[*Header: ][^boost/asio/ip/udp.hpp]
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::address_v4 local_interface =
- boost::asio::ip::address_v4::from_string("1.2.3.4");
- boost::asio::ip::multicast::outbound_interface option(local_interface);
- socket.set_option(option);
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
 
+[section:protocol ip::udp::protocol]
 
+[indexterm2 protocol..ip::udp]
+Obtain an identifier for the protocol.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/multicast.hpp]
+ int protocol() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:ip__resolver_query_base ip::resolver_query_base]
 
+[section:resolver ip::udp::resolver]
 
-The [link boost_asio.reference.ip__resolver_query_base `ip::resolver_query_base`] class is used as a base for the [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class templates to provide a common place to define the flag constants.
+[indexterm2 resolver..ip::udp]
+The UDP resolver type.
 
 
- class resolver_query_base
+ typedef basic_resolver< udp > resolver;
 
 
 [heading Types]
@@ -45511,127 +64097,130 @@
 
   [
 
- [[link boost_asio.reference.ip__resolver_query_base.flags [*flags]]]
- [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+ [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
   
   ]
 
-]
+ [
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
+ [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
   [
- [[link boost_asio.reference.ip__resolver_query_base._resolver_query_base [*~resolver_query_base]]]
- [Protected destructor to prevent deletion through this type. ]
- ]
-
-]
 
-[heading Data Members]
-[table
- [[Name][Description]]
+ [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
+ [The iterator type. ]
+
+ ]
 
   [
- [[link boost_asio.reference.ip__resolver_query_base.address_configured [*address_configured]]]
- [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
+
+ [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
   ]
 
   [
- [[link boost_asio.reference.ip__resolver_query_base.all_matching [*all_matching]]]
- [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
+
+ [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
+ [The query type. ]
+
   ]
 
   [
- [[link boost_asio.reference.ip__resolver_query_base.canonical_name [*canonical_name]]]
- [Determine the canonical name of the host specified in the query. ]
+
+ [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
   ]
 
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.ip__resolver_query_base.numeric_host [*numeric_host]]]
- [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
- ]
+ [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
+ [Asynchronously perform forward resolution of a query to a list of entries.
 
+ Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
+ ]
+
   [
- [[link boost_asio.reference.ip__resolver_query_base.numeric_service [*numeric_service]]]
- [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
+ [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
+ [Constructor. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__resolver_query_base.passive [*passive]]]
- [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
+ [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
+ [Cancel any asynchronous operations that are waiting on the resolver. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__resolver_query_base.v4_mapped [*v4_mapped]]]
- [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
   ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
+ [Perform forward resolution of a query to a list of entries.
 
+ Perform reverse resolution of an endpoint to a list of entries. ]
+ ]
+
 ]
 
-[heading Requirements]
-
-[*Header: ][^boost/asio/ip/resolver_query_base.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[section:address_configured ip::resolver_query_base::address_configured]
-
-[indexterm2 address_configured..ip::resolver_query_base]
-Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system.
-
-
- static const flags address_configured = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:all_matching ip::resolver_query_base::all_matching]
-
-[indexterm2 all_matching..ip::resolver_query_base]
-If used with v4\_mapped, return all matching IPv6 and IPv4 addresses.
-
-
- static const flags all_matching = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:canonical_name ip::resolver_query_base::canonical_name]
-
-[indexterm2 canonical_name..ip::resolver_query_base]
-Determine the canonical name of the host specified in the query.
-
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
- static const flags canonical_name = implementation_defined;
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ip__basic_resolver.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
 
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
-[endsect]
+ [
+ [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
+]
 
+The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
 
-[section:flags ip::resolver_query_base::flags]
 
-[indexterm2 flags..ip::resolver_query_base]
-A bitmask type (C++ Std [lib.bitmask.types]).
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
- typedef unspecified flags;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/resolver_query_base.hpp]
+[*Header: ][^boost/asio/ip/udp.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -45640,182 +64229,367 @@
 
 
 
-[section:numeric_host ip::resolver_query_base::numeric_host]
-
-[indexterm2 numeric_host..ip::resolver_query_base]
-Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
+[section:socket ip::udp::socket]
 
+[indexterm2 socket..ip::udp]
+The UDP socket type.
 
- static const flags numeric_host = implementation_defined;
 
+ typedef basic_datagram_socket< udp > socket;
 
 
-[endsect]
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
 
-[section:numeric_service ip::resolver_query_base::numeric_service]
+ [
 
-[indexterm2 numeric_service..ip::resolver_query_base]
-Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
+ [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
+ [
 
- static const flags numeric_service = implementation_defined;
+ [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
 
+ [
 
-[section:passive ip::resolver_query_base::passive]
+ [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
-[indexterm2 passive..ip::resolver_query_base]
-Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
- static const flags passive = implementation_defined;
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_socket is always the lowest layer. ]
+
+ ]
 
-[section:v4_mapped ip::resolver_query_base::v4_mapped]
+ [
 
-[indexterm2 v4_mapped..ip::resolver_query_base]
-If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.
+ [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
+
+ ]
 
+ [
 
- static const flags v4_mapped = implementation_defined;
+ [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
+ [The native representation of a socket. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
+
+ ]
 
-[endsect]
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
 
+ [
 
-[section:_resolver_query_base ip::resolver_query_base::~resolver_query_base]
+ [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
-[indexterm2 ~resolver_query_base..ip::resolver_query_base]
-Protected destructor to prevent deletion through this type.
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
- ~resolver_query_base();
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
 
-[endsect]
+ [
 
-[section:ip__resolver_service ip::resolver_service]
+ [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
 
+ [
 
-Default service implementation for a resolver.
+ [[link boost_asio.reference.basic_datagram_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+ [
 
- template<
- typename ``[link boost_asio.reference.InternetProtocol InternetProtocol]``>
- class resolver_service :
- public io_service::service
+ [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
+
+ ]
 
+]
 
-[heading Types]
+[heading Member Functions]
 [table
   [[Name][Description]]
 
   [
-
- [[link boost_asio.reference.ip__resolver_service.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
+ [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
   ]
-
+
   [
-
- [[link boost_asio.reference.ip__resolver_service.implementation_type [*implementation_type]]]
- [The type of a resolver implementation. ]
+ [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
+ [Start an asynchronous receive on a connected socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
+ [Start an asynchronous receive. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
+ [Start an asynchronous send on a connected socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
+ [Start an asynchronous send. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
   ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
+ [Construct a basic_datagram_socket without opening it.
+
+ Construct and open a basic_datagram_socket.
 
+ Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
+
+ Construct a basic_datagram_socket on an existing native socket.
+
+ Move-construct a basic_datagram_socket from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
+ [Close the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
+ [Connect the socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
+ [Get an option from the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
   [
+ [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
- [[link boost_asio.reference.ip__resolver_service.iterator_type [*iterator_type]]]
- [The iterator type. ]
+ Get a const reference to the lowest layer. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_datagram_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
+ [Get the native socket representation. ]
   ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
 
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
   [
+ [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
- [[link boost_asio.reference.ip__resolver_service.protocol_type [*protocol_type]]]
- [The protocol type. ]
+ Sets the non-blocking mode of the socket. ]
+ ]
   
+ [
+ [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
+ [Open the socket using the specified protocol. ]
   ]
-
- [
-
- [[link boost_asio.reference.ip__resolver_service.query_type [*query_type]]]
- [The query type. ]
   
+ [
+ [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_datagram_socket from another. ]
   ]
-
-]
-
-[heading Member Functions]
-[table
- [[Name][Description]]
-
+
   [
- [[link boost_asio.reference.ip__resolver_service.async_resolve [*async_resolve]]]
- [Asynchronously resolve a query to a list of entries.
-
- Asynchronously resolve an endpoint to a list of entries. ]
+ [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
+ [Receive some data on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.ip__resolver_service.cancel [*cancel]]]
- [Cancel pending asynchronous operations. ]
+ [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
+ [Receive a datagram with the endpoint of the sender. ]
   ]
   
   [
- [[link boost_asio.reference.ip__resolver_service.construct [*construct]]]
- [Construct a new resolver implementation. ]
+ [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
   ]
   
   [
- [[link boost_asio.reference.ip__resolver_service.destroy [*destroy]]]
- [Destroy a resolver implementation. ]
+ [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
+ [Send some data on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.ip__resolver_service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
+ [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
+ [Send a datagram to the specified endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__resolver_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
+ [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
+ [Set an option on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.ip__resolver_service.resolve [*resolve]]]
- [Resolve a query to a list of entries.
-
- Resolve an endpoint to a list of entries. ]
+ [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
   ]
   
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
   [
- [[link boost_asio.reference.ip__resolver_service.resolver_service [*resolver_service]]]
- [Construct a new resolver service for the specified io_service. ]
+ [[link boost_asio.reference.basic_datagram_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
   ]
   
   [
- [[link boost_asio.reference.ip__resolver_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
+ [[link boost_asio.reference.basic_datagram_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
   
 ]
@@ -45825,93 +64599,92 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__resolver_service.id [*id]]]
- [The unique service identifier. ]
+ [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
   ]
 
-]
+ [
+ [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
 
-[heading Requirements]
+ [
+ [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
 
-[*Header: ][^boost/asio/ip/resolver_service.hpp]
+ [
+ [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
+ [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
 
-[section:async_resolve ip::resolver_service::async_resolve]
+]
 
-[indexterm2 async_resolve..ip::resolver_service]
-Asynchronously resolve a query to a list of entries.
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.basic_datagram_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
- template<
- typename ``[link boost_asio.reference.Handler Handler]``>
- void ``[link boost_asio.reference.ip__resolver_service.async_resolve.overload1 async_resolve]``(
- implementation_type & impl,
- const query_type & query,
- Handler handler);
- `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.async_resolve.overload1 more...]]``
+ [
+ [[link boost_asio.reference.basic_datagram_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
+]
 
-Asynchronously resolve an endpoint to a list of entries.
+The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
 
 
- template<
- typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
- void ``[link boost_asio.reference.ip__resolver_service.async_resolve.overload2 async_resolve]``(
- implementation_type & impl,
- const endpoint_type & endpoint,
- ResolveHandler handler);
- `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.async_resolve.overload2 more...]]``
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
+[*Shared] [*objects:] Unsafe.
 
-[section:overload1 ip::resolver_service::async_resolve (1 of 2 overloads)]
 
 
-Asynchronously resolve a query to a list of entries.
 
+[heading Requirements]
 
- template<
- typename ``[link boost_asio.reference.Handler Handler]``>
- void async_resolve(
- implementation_type & impl,
- const query_type & query,
- Handler handler);
+[*Header: ][^boost/asio/ip/udp.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 ip::resolver_service::async_resolve (2 of 2 overloads)]
-
+[section:type ip::udp::type]
 
-Asynchronously resolve an endpoint to a list of entries.
+[indexterm2 type..ip::udp]
+Obtain an identifier for the type of the protocol.
 
 
- template<
- typename ``[link boost_asio.reference.ResolveHandler ResolveHandler]``>
- void async_resolve(
- implementation_type & impl,
- const endpoint_type & endpoint,
- ResolveHandler handler);
+ int type() const;
 
 
 
 [endsect]
 
 
-[endsect]
-
 
-[section:cancel ip::resolver_service::cancel]
+[section:v4 ip::udp::v4]
 
-[indexterm2 cancel..ip::resolver_service]
-Cancel pending asynchronous operations.
+[indexterm2 v4..ip::udp]
+Construct to represent the IPv4 UDP protocol.
 
 
- void cancel(
- implementation_type & impl);
+ static udp v4();
 
 
 
@@ -45919,14 +64692,13 @@
 
 
 
-[section:construct ip::resolver_service::construct]
+[section:v6 ip::udp::v6]
 
-[indexterm2 construct..ip::resolver_service]
-Construct a new resolver implementation.
+[indexterm2 v6..ip::udp]
+Construct to represent the IPv6 UDP protocol.
 
 
- void construct(
- implementation_type & impl);
+ static udp v6();
 
 
 
@@ -45934,379 +64706,191 @@
 
 
 
-[section:destroy ip::resolver_service::destroy]
-
-[indexterm2 destroy..ip::resolver_service]
-Destroy a resolver implementation.
-
-
- void destroy(
- implementation_type & impl);
-
-
-
 [endsect]
 
 
+[section:ip__unicast__hops ip::unicast::hops]
 
-[section:endpoint_type ip::resolver_service::endpoint_type]
+[indexterm1 ip::unicast::hops]
+Socket option for time-to-live associated with outgoing unicast packets.
 
-[indexterm2 endpoint_type..ip::resolver_service]
-The endpoint type.
 
+ typedef implementation_defined hops;
 
- typedef InternetProtocol::endpoint endpoint_type;
 
 
+Implements the IPPROTO\_IP/IP\_UNICAST\_TTL socket option.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/resolver_service.hpp]
+[heading Examples]
+
+Setting the option:
 
-[*Convenience header: ][^boost/asio.hpp]
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::unicast::hops option(4);
+ socket.set_option(option);
 
 
-[endsect]
 
 
 
-[section:get_io_service ip::resolver_service::get_io_service]
+Getting the current option value:
 
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::ip::unicast::hops option;
+ socket.get_option(option);
+ int ttl = option.value();
 
-['Inherited from io_service.]
 
-[indexterm2 get_io_service..ip::resolver_service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
 
- boost::asio::io_service & get_io_service();
 
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/ip/unicast.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:id ip::resolver_service::id]
 
-[indexterm2 id..ip::resolver_service]
-The unique service identifier.
+[endsect]
 
 
- static boost::asio::io_service::id id;
 
+[section:ip__v6_only ip::v6_only]
 
+[indexterm1 ip::v6_only]
+Socket option for determining whether an IPv6 socket supports IPv6 communication only.
 
-[endsect]
 
+ typedef implementation_defined v6_only;
 
 
-[section:implementation_type ip::resolver_service::implementation_type]
 
-[indexterm2 implementation_type..ip::resolver_service]
-The type of a resolver implementation.
+Implements the IPPROTO\_IPV6/IP\_V6ONLY socket option.
 
 
- typedef implementation_defined implementation_type;
+[heading Examples]
+
+Setting the option:
 
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::v6_only option(true);
+ socket.set_option(option);
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/resolver_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+Getting the current option value:
 
-[endsect]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::ip::v6_only option;
+ socket.get_option(option);
+ bool v6_only = option.value();
 
 
 
-[section:io_service ip::resolver_service::io_service]
 
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..ip::resolver_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
+[heading Requirements]
 
- boost::asio::io_service & io_service();
+[*Header: ][^boost/asio/ip/v6_only.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:is_match_condition is_match_condition]
 
-[section:iterator_type ip::resolver_service::iterator_type]
 
-[indexterm2 iterator_type..ip::resolver_service]
-The iterator type.
+Type trait used to determine whether a type can be used as a match condition function with read\_until and async\_read\_until.
 
 
- typedef basic_resolver_iterator< InternetProtocol > iterator_type;
+ template<
+ typename T>
+ struct is_match_condition
 
 
-[heading Member Functions]
+[heading Data Members]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
- [Default constructor creates an end iterator. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
- [Create an iterator from an addrinfo list returned by getaddrinfo.
-
- Create an iterator from an endpoint, host name and service name. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
- [Dereference an iterator. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
- [Increment operator (prefix).
-
- Increment operator (postfix). ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
- [Dereference an iterator. ]
+ [[link boost_asio.reference.is_match_condition.value [*value]]]
+ [The value member is true if the type may be used as a match condition. ]
   ]
-
-]
-
-[heading Friends]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
- [Test two iterators for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
- [Test two iterators for equality. ]
- ]
-
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
-
-The iterator's value\_type, obtained when the iterator is dereferenced, is:
-
- const basic_resolver_entry<InternetProtocol>
-
-
-
-
-
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
-
-[*Shared] [*objects:] Unsafe.
-
-
-
-
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/resolver_service.hpp]
+[*Header: ][^boost/asio/read_until.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
-
-
-
-[section:protocol_type ip::resolver_service::protocol_type]
-
-[indexterm2 protocol_type..ip::resolver_service]
-The protocol type.
-
-
- typedef InternetProtocol protocol_type;
-
+[section:value is_match_condition::value]
 
+[indexterm2 value..is_match_condition]
+The value member is true if the type may be used as a match condition.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/resolver_service.hpp]
+ static const bool value;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:query_type ip::resolver_service::query_type]
-
-[indexterm2 query_type..ip::resolver_service]
-The query type.
-
-
- typedef basic_resolver_query< InternetProtocol > query_type;
-
-
-[heading Types]
-[table
- [[Name][Description]]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
- [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint query. ]
-
- ]
+[endsect]
 
-]
+[section:is_read_buffered is_read_buffered]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
- [Construct with specified service name for any protocol.
+The [link boost_asio.reference.is_read_buffered `is_read_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of read data.
 
- Construct with specified service name for a given protocol.
 
- Construct with specified host name and service name for any protocol.
+ template<
+ typename Stream>
+ class is_read_buffered
 
- Construct with specified host name and service name for a given protocol. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
- [Get the hints associated with the query. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
- [Get the host name associated with the query. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
- [Get the service name associated with the query. ]
- ]
-
-]
 
 [heading Data Members]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
- [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
- [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
- [Determine the canonical name of the host specified in the query. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
- [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
- [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
- [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
- [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ [[link boost_asio.reference.is_read_buffered.value [*value]]]
+ [The value member is true only if the Stream type supports buffering of read data. ]
   ]
 
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
-
-
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
-
-[*Shared] [*objects:] Unsafe.
-
-
-
-
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/resolver_service.hpp]
+[*Header: ][^boost/asio/is_read_buffered.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
-
-
-[section:resolve ip::resolver_service::resolve]
-
-[indexterm2 resolve..ip::resolver_service]
-Resolve a query to a list of entries.
-
-
- iterator_type ``[link boost_asio.reference.ip__resolver_service.resolve.overload1 resolve]``(
- implementation_type & impl,
- const query_type & query,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.resolve.overload1 more...]]``
-
-
-Resolve an endpoint to a list of entries.
-
-
- iterator_type ``[link boost_asio.reference.ip__resolver_service.resolve.overload2 resolve]``(
- implementation_type & impl,
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ip__resolver_service.resolve.overload2 more...]]``
-
-
-[section:overload1 ip::resolver_service::resolve (1 of 2 overloads)]
-
+[section:value is_read_buffered::value]
 
-Resolve a query to a list of entries.
+[indexterm2 value..is_read_buffered]
+The value member is true only if the Stream type supports buffering of read data.
 
 
- iterator_type resolve(
- implementation_type & impl,
- const query_type & query,
- boost::system::error_code & ec);
+ static const bool value;
 
 
 
@@ -46314,47 +64898,44 @@
 
 
 
-[section:overload2 ip::resolver_service::resolve (2 of 2 overloads)]
-
-
-Resolve an endpoint to a list of entries.
-
-
- iterator_type resolve(
- implementation_type & impl,
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
-
-
-
 [endsect]
 
+[section:is_write_buffered is_write_buffered]
 
-[endsect]
 
+The [link boost_asio.reference.is_write_buffered `is_write_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of written data.
 
-[section:resolver_service ip::resolver_service::resolver_service]
 
-[indexterm2 resolver_service..ip::resolver_service]
-Construct a new resolver service for the specified [link boost_asio.reference.io_service `io_service`].
+ template<
+ typename Stream>
+ class is_write_buffered
 
 
- resolver_service(
- boost::asio::io_service & io_service);
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.is_write_buffered.value [*value]]]
+ [The value member is true only if the Stream type supports buffering of written data. ]
+ ]
 
+]
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/is_write_buffered.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[section:shutdown_service ip::resolver_service::shutdown_service]
+[section:value is_write_buffered::value]
 
-[indexterm2 shutdown_service..ip::resolver_service]
-Destroy all user-defined handler objects owned by the service.
+[indexterm2 value..is_write_buffered]
+The value member is true only if the Stream type supports buffering of written data.
 
 
- virtual void shutdown_service();
+ static const bool value;
 
 
 
@@ -46364,13 +64945,15 @@
 
 [endsect]
 
-[section:ip__tcp ip::tcp]
+[section:local__basic_endpoint local::basic_endpoint]
 
 
-Encapsulates the flags needed for TCP.
+Describes an endpoint for a UNIX socket.
 
 
- class tcp
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``>
+ class basic_endpoint
 
 
 [heading Types]
@@ -46379,610 +64962,437 @@
 
   [
 
- [[link boost_asio.reference.ip__tcp.acceptor [*acceptor]]]
- [The TCP acceptor type. ]
+ [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
+ [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__tcp.endpoint [*endpoint]]]
- [The type of a TCP endpoint. ]
+ [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint. ]
   
   ]
 
- [
+]
 
- [[link boost_asio.reference.ip__tcp.iostream [*iostream]]]
- [The TCP iostream type. ]
-
- ]
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
   [
+ [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
+ [Default constructor.
 
- [[link boost_asio.reference.ip__tcp.no_delay [*no_delay]]]
- [Socket option for disabling the Nagle algorithm. ]
-
- ]
-
- [
+ Construct an endpoint using the specified path name.
 
- [[link boost_asio.reference.ip__tcp.resolver [*resolver]]]
- [The TCP resolver type. ]
+ Copy constructor. ]
+ ]
   
+ [
+ [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
+ [Get the capacity of the endpoint in the native type. ]
   ]
-
+
   [
-
- [[link boost_asio.reference.ip__tcp.resolver_iterator [*resolver_iterator]]]
- [(Deprecated: use resolver::iterator.) The type of a resolver iterator. ]
+ [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
+ [Get the underlying endpoint in the native type. ]
+ ]
   
+ [
+ [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
+ [Assign from another endpoint. ]
   ]
-
+
   [
+ [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
+ [Get the path associated with the endpoint.
 
- [[link boost_asio.reference.ip__tcp.resolver_query [*resolver_query]]]
- [(Deprecated: use resolver::query.) The type of a resolver query. ]
+ Set the path associated with the endpoint. ]
+ ]
   
+ [
+ [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
+ [The protocol associated with the endpoint. ]
   ]
-
+
   [
-
- [[link boost_asio.reference.ip__tcp.socket [*socket]]]
- [The TCP socket type. ]
+ [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
+ [Set the underlying size of the endpoint in the native type. ]
+ ]
   
+ [
+ [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
+ [Get the underlying size of the endpoint in the native type. ]
   ]
-
+
 ]
 
-[heading Member Functions]
+[heading Friends]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__tcp.family [*family]]]
- [Obtain an identifier for the protocol family. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
+ [Compare two endpoints for inequality. ]
   ]
   
   [
- [[link boost_asio.reference.ip__tcp.protocol [*protocol]]]
- [Obtain an identifier for the protocol. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
+ [Compare endpoints for ordering. ]
   ]
   
   [
- [[link boost_asio.reference.ip__tcp.type [*type]]]
- [Obtain an identifier for the type of the protocol. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
+ [Compare endpoints for ordering. ]
   ]
   
   [
- [[link boost_asio.reference.ip__tcp.v4 [*v4]]]
- [Construct to represent the IPv4 TCP protocol. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
+ [Compare two endpoints for equality. ]
   ]
   
   [
- [[link boost_asio.reference.ip__tcp.v6 [*v6]]]
- [Construct to represent the IPv6 TCP protocol. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
+ [Compare endpoints for ordering. ]
   ]
   
 ]
 
-[heading Friends]
+[heading Related Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__tcp.operator_not__eq_ [*operator!=]]]
- [Compare two protocols for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__tcp.operator_eq__eq_ [*operator==]]]
- [Compare two protocols for equality. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
+ [Output an endpoint as a string. ]
   ]
   
 ]
 
-The [link boost_asio.reference.ip__tcp `ip::tcp`] class contains flags necessary for TCP sockets.
+The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Safe.
+[*Shared] [*objects:] Unsafe.
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
+[section:basic_endpoint local::basic_endpoint::basic_endpoint]
 
-[section:acceptor ip::tcp::acceptor]
+[indexterm2 basic_endpoint..local::basic_endpoint]
+Default constructor.
 
-[indexterm2 acceptor..ip::tcp]
-The TCP acceptor type.
 
+ ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 more...]]``
 
- typedef basic_socket_acceptor< tcp > acceptor;
 
+Construct an endpoint using the specified path name.
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+ ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
+ const char * path_name);
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 more...]]``
 
- [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+ ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
+ const std::string & path_name);
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 more...]]``
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+Copy constructor.
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+ ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
+ const basic_endpoint & other);
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 more...]]``
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
+[section:overload1 local::basic_endpoint::basic_endpoint (1 of 4 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
+Default constructor.
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
+ basic_endpoint();
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
+[section:overload2 local::basic_endpoint::basic_endpoint (2 of 4 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
+Construct an endpoint using the specified path name.
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
- [The native representation of an acceptor. ]
-
- ]
+ basic_endpoint(
+ const char * path_name);
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
+[section:overload3 local::basic_endpoint::basic_endpoint (3 of 4 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
+Construct an endpoint using the specified path name.
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
+ basic_endpoint(
+ const std::string & path_name);
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
+[section:overload4 local::basic_endpoint::basic_endpoint (4 of 4 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
+Copy constructor.
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+ basic_endpoint(
+ const basic_endpoint & other);
 
- [
- [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
- [Accept a new connection.
 
- Accept a new connection and obtain the endpoint of the peer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
- [Assigns an existing native acceptor to the acceptor. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
- [Start an asynchronous accept. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
- [Construct an acceptor without opening it.
 
- Construct an open acceptor.
+[endsect]
 
- Construct an acceptor opened on the given endpoint.
 
- Construct a basic_socket_acceptor on an existing native acceptor. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
- [Bind the acceptor to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the acceptor. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
- [Close the acceptor. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
- [Get an option from the acceptor. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
- [Determine whether the acceptor is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
- [Place the acceptor into the state where it will listen for new connections. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the acceptor. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.native [*native]]]
- [Get the native acceptor representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
- [Open the acceptor using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
- [Set an option on the acceptor. ]
- ]
-
-]
+[endsect]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
+[section:capacity local::basic_endpoint::capacity]
 
- [
- [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
+[indexterm2 capacity..local::basic_endpoint]
+Get the capacity of the endpoint in the native type.
 
- [
- [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
 
- [
- [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
+ std::size_t capacity() const;
 
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket_acceptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
+[endsect]
 
- [
- [[link boost_asio.reference.basic_socket_acceptor.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
+[section:data local::basic_endpoint::data]
 
-The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
+[indexterm2 data..local::basic_endpoint]
+Get the underlying endpoint in the native type.
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+ data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload1 data]``();
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload1 more...]]``
 
-[*Shared] [*objects:] Unsafe.
+ const data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload2 data]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload2 more...]]``
 
 
-[heading Example]
-
-Opening a socket acceptor with the SO\_REUSEADDR option enabled:
+[section:overload1 local::basic_endpoint::data (1 of 2 overloads)]
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
- acceptor.open(endpoint.protocol());
- acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
- acceptor.bind(endpoint);
- acceptor.listen();
+
+Get the underlying endpoint in the native type.
+
+
+ data_type * data();
+
+
+
+[endsect]
+
+
+
+[section:overload2 local::basic_endpoint::data (2 of 2 overloads)]
+
+
+Get the underlying endpoint in the native type.
+
+
+ const data_type * data() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:data_type local::basic_endpoint::data_type]
+
+[indexterm2 data_type..local::basic_endpoint]
+The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
+
+
+ typedef implementation_defined data_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
 
 
 
+[section:operator_not__eq_ local::basic_endpoint::operator!=]
+
+[indexterm2 operator!=..local::basic_endpoint]
+Compare two endpoints for inequality.
+
+
+ friend bool operator!=(
+ const basic_endpoint< Protocol > & e1,
+ const basic_endpoint< Protocol > & e2);
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:operator_lt_ local::basic_endpoint::operator<]
+
+[indexterm2 operator<..local::basic_endpoint]
+Compare endpoints for ordering.
+
+
+ friend bool operator<(
+ const basic_endpoint< Protocol > & e1,
+ const basic_endpoint< Protocol > & e2);
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:operator_lt__lt_ local::basic_endpoint::operator<<]
+
+[indexterm2 operator<<..local::basic_endpoint]
+Output an endpoint as a string.
+
+
+ std::basic_ostream< Elem, Traits > & operator<<(
+ std::basic_ostream< Elem, Traits > & os,
+ const basic_endpoint< Protocol > & endpoint);
+
+
+Used to output a human-readable string for a specified endpoint.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[os][The output stream to which the string will be written.]]
 
+[[endpoint][The endpoint to be written.]]
 
+]
 
 
-[heading Requirements]
+[heading Return Value]
+
+The output stream.
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:endpoint ip::tcp::endpoint]
-
-[indexterm2 endpoint..ip::tcp]
-The type of a TCP endpoint.
-
-
- typedef basic_endpoint< tcp > endpoint;
-
+[section:operator_lt__eq_ local::basic_endpoint::operator<=]
 
-[heading Types]
-[table
- [[Name][Description]]
+[indexterm2 operator<=..local::basic_endpoint]
+Compare endpoints for ordering.
 
- [
 
- [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
- [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
-
- ]
+ friend bool operator<=(
+ const basic_endpoint< Protocol > & e1,
+ const basic_endpoint< Protocol > & e2);
 
- [
 
- [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint. ]
-
- ]
+[heading Requirements]
 
-]
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[*Convenience header: ][^boost/asio.hpp]
 
- [
- [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
- [Get the IP address associated with the endpoint.
 
- Set the IP address associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
- [Default constructor.
+[endsect]
 
- Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.
 
- Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
 
- Copy constructor. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
- [Get the capacity of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
- [Get the underlying endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
- [Assign from another endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
- [Get the port associated with the endpoint. The port number is always in the host's byte order.
+[section:operator_eq_ local::basic_endpoint::operator=]
 
- Set the port associated with the endpoint. The port number is always in the host's byte order. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
- [The protocol associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
- [Set the underlying size of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
- [Get the underlying size of the endpoint in the native type. ]
- ]
-
-]
+[indexterm2 operator=..local::basic_endpoint]
+Assign from another endpoint.
 
-[heading Friends]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
- [Compare two endpoints for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
- [Compare two endpoints for equality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
- [Compare endpoints for ordering. ]
- ]
-
-]
+ basic_endpoint & operator=(
+ const basic_endpoint & other);
 
-[heading Related Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
- [Output an endpoint as a string. ]
- ]
-
-]
 
-The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
+[endsect]
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[section:operator_eq__eq_ local::basic_endpoint::operator==]
 
+[indexterm2 operator==..local::basic_endpoint]
+Compare two endpoints for equality.
 
 
+ friend bool operator==(
+ const basic_endpoint< Protocol > & e1,
+ const basic_endpoint< Protocol > & e2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -46991,61 +65401,42 @@
 
 
 
-[section:family ip::tcp::family]
-
-[indexterm2 family..ip::tcp]
-Obtain an identifier for the protocol family.
+[section:operator_gt_ local::basic_endpoint::operator>]
 
+[indexterm2 operator>..local::basic_endpoint]
+Compare endpoints for ordering.
 
- int family() const;
 
+ friend bool operator>(
+ const basic_endpoint< Protocol > & e1,
+ const basic_endpoint< Protocol > & e2);
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:iostream ip::tcp::iostream]
 
-[indexterm2 iostream..ip::tcp]
-The TCP iostream type.
+[endsect]
 
 
- typedef basic_socket_iostream< tcp > iostream;
 
+[section:operator_gt__eq_ local::basic_endpoint::operator>=]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[indexterm2 operator>=..local::basic_endpoint]
+Compare endpoints for ordering.
 
- [
- [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
- [Construct a basic_socket_iostream without establishing a connection.
 
- Establish a connection to an endpoint corresponding to a resolver query. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
- [Close the connection. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
- [Establish a connection to an endpoint corresponding to a resolver query. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
- [Return a pointer to the underlying streambuf. ]
- ]
-
-]
+ friend bool operator>=(
+ const basic_endpoint< Protocol > & e1,
+ const basic_endpoint< Protocol > & e2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -47053,94 +65444,101 @@
 [endsect]
 
 
+[section:path local::basic_endpoint::path]
 
-[section:no_delay ip::tcp::no_delay]
+[indexterm2 path..local::basic_endpoint]
+Get the path associated with the endpoint.
 
-[indexterm2 no_delay..ip::tcp]
-Socket option for disabling the Nagle algorithm.
 
+ std::string ``[link boost_asio.reference.local__basic_endpoint.path.overload1 path]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload1 more...]]``
 
- typedef implementation_defined no_delay;
 
+Set the path associated with the endpoint.
 
 
-Implements the IPPROTO\_TCP/TCP\_NODELAY socket option.
+ void ``[link boost_asio.reference.local__basic_endpoint.path.overload2 path]``(
+ const char * p);
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload2 more...]]``
 
+ void ``[link boost_asio.reference.local__basic_endpoint.path.overload3 path]``(
+ const std::string & p);
+ `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload3 more...]]``
 
-[heading Examples]
-
-Setting the option:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::no_delay option(true);
- socket.set_option(option);
+[section:overload1 local::basic_endpoint::path (1 of 3 overloads)]
 
 
+Get the path associated with the endpoint.
 
 
+ std::string path() const;
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::tcp::no_delay option;
- socket.get_option(option);
- bool is_set = option.value();
 
+[endsect]
 
 
 
+[section:overload2 local::basic_endpoint::path (2 of 3 overloads)]
 
 
+Set the path associated with the endpoint.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+ void path(
+ const char * p);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:operator_not__eq_ ip::tcp::operator!=]
+[section:overload3 local::basic_endpoint::path (3 of 3 overloads)]
 
-[indexterm2 operator!=..ip::tcp]
-Compare two protocols for inequality.
 
+Set the path associated with the endpoint.
 
- friend bool operator!=(
- const tcp & p1,
- const tcp & p2);
 
+ void path(
+ const std::string & p);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
 
+[section:protocol local::basic_endpoint::protocol]
 
-[section:operator_eq__eq_ ip::tcp::operator==]
+[indexterm2 protocol..local::basic_endpoint]
+The protocol associated with the endpoint.
 
-[indexterm2 operator==..ip::tcp]
-Compare two protocols for equality.
 
+ protocol_type protocol() const;
+
+
+
+[endsect]
+
+
+
+[section:protocol_type local::basic_endpoint::protocol_type]
+
+[indexterm2 protocol_type..local::basic_endpoint]
+The protocol type associated with the endpoint.
+
+
+ typedef Protocol protocol_type;
 
- friend bool operator==(
- const tcp & p1,
- const tcp & p2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -47149,13 +65547,14 @@
 
 
 
-[section:protocol ip::tcp::protocol]
+[section:resize local::basic_endpoint::resize]
 
-[indexterm2 protocol..ip::tcp]
-Obtain an identifier for the protocol.
+[indexterm2 resize..local::basic_endpoint]
+Set the underlying size of the endpoint in the native type.
 
 
- int protocol() const;
+ void resize(
+ std::size_t new_size);
 
 
 
@@ -47163,239 +65562,172 @@
 
 
 
-[section:resolver ip::tcp::resolver]
-
-[indexterm2 resolver..ip::tcp]
-The TCP resolver type.
+[section:size local::basic_endpoint::size]
 
+[indexterm2 size..local::basic_endpoint]
+Get the underlying size of the endpoint in the native type.
 
- typedef basic_resolver< tcp > resolver;
 
+ std::size_t size() const;
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
 
- [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
- [The iterator type. ]
-
- ]
+[section:local__connect_pair local::connect_pair]
 
- [
+[indexterm1 local::connect_pair]
+Create a pair of connected sockets.
 
- [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService1]``,
+ typename ``[link boost_asio.reference.SocketService SocketService2]``>
+ void ``[link boost_asio.reference.local__connect_pair.overload1 connect_pair]``(
+ basic_socket< Protocol, SocketService1 > & socket1,
+ basic_socket< Protocol, SocketService2 > & socket2);
+ `` [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload1 more...]]``
 
- [
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService1]``,
+ typename ``[link boost_asio.reference.SocketService SocketService2]``>
+ boost::system::error_code ``[link boost_asio.reference.local__connect_pair.overload2 connect_pair]``(
+ basic_socket< Protocol, SocketService1 > & socket1,
+ basic_socket< Protocol, SocketService2 > & socket2,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload2 more...]]``
 
- [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
- [The query type. ]
-
- ]
+[heading Requirements]
 
- [
+[*Header: ][^boost/asio/local/connect_pair.hpp]
 
- [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
+[*Convenience header: ][^boost/asio.hpp]
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[section:overload1 local::connect_pair (1 of 2 overloads)]
 
- [
- [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously perform forward resolution of a query to a list of entries.
 
- Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
- [Constructor. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
- [Cancel any asynchronous operations that are waiting on the resolver. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Perform forward resolution of a query to a list of entries.
+Create a pair of connected sockets.
 
- Perform reverse resolution of an endpoint to a list of entries. ]
- ]
-
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService1]``,
+ typename ``[link boost_asio.reference.SocketService SocketService2]``>
+ void connect_pair(
+ basic_socket< Protocol, SocketService1 > & socket1,
+ basic_socket< Protocol, SocketService2 > & socket2);
 
- [
- [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
 
- [
- [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
+[endsect]
 
-The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+[section:overload2 local::connect_pair (2 of 2 overloads)]
 
-[*Shared] [*objects:] Unsafe.
 
+Create a pair of connected sockets.
 
 
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.SocketService SocketService1]``,
+ typename ``[link boost_asio.reference.SocketService SocketService2]``>
+ boost::system::error_code connect_pair(
+ basic_socket< Protocol, SocketService1 > & socket1,
+ basic_socket< Protocol, SocketService2 > & socket2,
+ boost::system::error_code & ec);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
+[section:local__datagram_protocol local::datagram_protocol]
 
 
-[section:resolver_iterator ip::tcp::resolver_iterator]
-
-[indexterm2 resolver_iterator..ip::tcp]
-(Deprecated: use `resolver::iterator`.) The type of a resolver iterator.
+Encapsulates the flags needed for datagram-oriented UNIX sockets.
 
 
- typedef basic_resolver_iterator< tcp > resolver_iterator;
+ class datagram_protocol
 
 
-[heading Member Functions]
+[heading Types]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
- [Default constructor creates an end iterator. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
- [Create an iterator from an addrinfo list returned by getaddrinfo.
 
- Create an iterator from an endpoint, host name and service name. ]
- ]
+ [[link boost_asio.reference.local__datagram_protocol.endpoint [*endpoint]]]
+ [The type of a UNIX domain endpoint. ]
   
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
- [Dereference an iterator. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
- [Increment operator (prefix).
 
- Increment operator (postfix). ]
- ]
+ [[link boost_asio.reference.local__datagram_protocol.socket [*socket]]]
+ [The UNIX domain socket type. ]
   
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
- [Dereference an iterator. ]
   ]
-
+
 ]
 
-[heading Friends]
+[heading Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
- [Test two iterators for inequality. ]
+ [[link boost_asio.reference.local__datagram_protocol.family [*family]]]
+ [Obtain an identifier for the protocol family. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
- [Test two iterators for equality. ]
+ [[link boost_asio.reference.local__datagram_protocol.protocol [*protocol]]]
+ [Obtain an identifier for the protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__datagram_protocol.type [*type]]]
+ [Obtain an identifier for the type of the protocol. ]
   ]
   
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
-
-The iterator's value\_type, obtained when the iterator is dereferenced, is:
-
- const basic_resolver_entry<InternetProtocol>
-
-
-
+The [link boost_asio.reference.local__datagram_protocol `local::datagram_protocol`] class contains flags necessary for datagram-oriented UNIX domain sockets.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Safe.
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+[*Header: ][^boost/asio/local/datagram_protocol.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
-
-
-
-[section:resolver_query ip::tcp::resolver_query]
+[section:endpoint local::datagram_protocol::endpoint]
 
-[indexterm2 resolver_query..ip::tcp]
-(Deprecated: use `resolver::query`.) The type of a resolver query.
+[indexterm2 endpoint..local::datagram_protocol]
+The type of a UNIX domain endpoint.
 
 
- typedef basic_resolver_query< tcp > resolver_query;
+ typedef basic_endpoint< datagram_protocol > endpoint;
 
 
 [heading Types]
@@ -47403,16 +65735,16 @@
   [[Name][Description]]
 
   [
-
- [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
- [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+
+ [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
+ [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint query. ]
+ [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint. ]
   
   ]
 
@@ -47423,89 +65755,116 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
- [Construct with specified service name for any protocol.
+ [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
+ [Default constructor.
 
- Construct with specified service name for a given protocol.
+ Construct an endpoint using the specified path name.
 
- Construct with specified host name and service name for any protocol.
+ Copy constructor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
+ [Get the capacity of the endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
+ [Get the underlying endpoint in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
+ [Assign from another endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
+ [Get the path associated with the endpoint.
 
- Construct with specified host name and service name for a given protocol. ]
+ Set the path associated with the endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
- [Get the hints associated with the query. ]
+ [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
+ [The protocol associated with the endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
- [Get the host name associated with the query. ]
+ [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
+ [Set the underlying size of the endpoint in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
- [Get the service name associated with the query. ]
+ [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
+ [Get the underlying size of the endpoint in the native type. ]
   ]
   
 ]
 
-[heading Data Members]
+[heading Friends]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
- [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
+ [Compare two endpoints for inequality. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
- [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
+ [Compare endpoints for ordering. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
- [Determine the canonical name of the host specified in the query. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
+ [Compare endpoints for ordering. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
- [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
+ [Compare two endpoints for equality. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
- [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
+ [Compare endpoints for ordering. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
- [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
+ [Compare endpoints for ordering. ]
   ]
+
+]
+
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
- [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
+ [Output an endpoint as a string. ]
   ]
-
+
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
+The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
+
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+[*Header: ][^boost/asio/local/datagram_protocol.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -47514,13 +65873,41 @@
 
 
 
-[section:socket ip::tcp::socket]
+[section:family local::datagram_protocol::family]
 
-[indexterm2 socket..ip::tcp]
-The TCP socket type.
+[indexterm2 family..local::datagram_protocol]
+Obtain an identifier for the protocol family.
+
+
+ int family() const;
+
+
+
+[endsect]
+
+
+
+[section:protocol local::datagram_protocol::protocol]
+
+[indexterm2 protocol..local::datagram_protocol]
+Obtain an identifier for the protocol.
+
+
+ int protocol() const;
 
 
- typedef basic_stream_socket< tcp > socket;
+
+[endsect]
+
+
+
+[section:socket local::datagram_protocol::socket]
+
+[indexterm2 socket..local::datagram_protocol]
+The UNIX domain socket type.
+
+
+ typedef basic_datagram_socket< datagram_protocol > socket;
 
 
 [heading Types]
@@ -47529,147 +65916,154 @@
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
+ [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
     [Socket option to permit sending of broadcast messages. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
+ [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
     [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
+ [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
     [Socket option to enable socket-level debugging. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
+ [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
     [Socket option to prevent routing, use local interfaces only. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
     [Socket option to report aborted connections on accept. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
     [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.implementation_type [*implementation_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.implementation_type [*implementation_type]]]
     [The underlying implementation type of I/O object. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
+ [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
     [Socket option to send keep-alives. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
+ [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
     [A basic_socket is always the lowest layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
+ [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
     [Bitmask type for flags that can be passed to send and receive operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.native_handle_type [*native_handle_type]]]
     [The native representation of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [[link boost_asio.reference.basic_datagram_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
     [The protocol type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
+ [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
     [Socket option for the receive buffer size of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
+ [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
     [Socket option for the receive low watermark. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
+ [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
     [Socket option to allow the socket to be bound to an address that is already in use. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
+ [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
     [Socket option for the send buffer size of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
+ [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
     [Socket option for the send low watermark. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.service_type [*service_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
+ [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
     [Different ways a socket may be shutdown. ]
   
   ]
@@ -47681,158 +66075,193 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
+ [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
     [Assign an existing native socket to the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
+ [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
     [Start an asynchronous connect. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
+ [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
+ [Start an asynchronous receive on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
+ [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
     [Start an asynchronous receive. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
- [Start an asynchronous send. ]
+ [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
+ [Start an asynchronous send on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
+ [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
+ [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
     [Determine whether the socket is at the out-of-band data mark. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.available [*available]]]
+ [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
     [Determine the number of bytes available for reading. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
- [Construct a basic_stream_socket without opening it.
+ [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
+ [Construct a basic_datagram_socket without opening it.
 
- Construct and open a basic_stream_socket.
+ Construct and open a basic_datagram_socket.
 
- Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
+ Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
+
+ Construct a basic_datagram_socket on an existing native socket.
 
- Construct a basic_stream_socket on an existing native socket. ]
+ Move-construct a basic_datagram_socket from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
+ [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
     [Bind the socket to the given local endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
+ [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
     [Cancel all asynchronous operations associated with the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.close [*close]]]
+ [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
     [Close the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
+ [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
     [Connect the socket to the specified endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.get_io_service [*get_io_service]]]
+ [[link boost_asio.reference.basic_datagram_socket.get_io_service [*get_io_service]]]
     [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
+ [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
     [Get an option from the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
+ [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
     [Perform an IO control command on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
+ [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
+ [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
     [Get the local endpoint of the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
+ [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
     [Get a reference to the lowest layer.
 
      Get a const reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.native [*native]]]
+ [[link boost_asio.reference.basic_datagram_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.native_handle [*native_handle]]]
     [Get the native socket representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.open [*open]]]
+ [[link boost_asio.reference.basic_datagram_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
     [Open the socket using the specified protocol. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
- [Read some data from the socket. ]
+ [[link boost_asio.reference.basic_datagram_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_datagram_socket from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
- [Receive some data on the socket.
-
- Receive some data on a connected socket. ]
+ [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
+ [Receive some data on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
+ [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
+ [Receive a datagram with the endpoint of the sender. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
     [Get the remote endpoint of the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.send [*send]]]
- [Send some data on the socket. ]
+ [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
+ [Send some data on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
+ [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
+ [Send a datagram to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
     [Set an option on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
+ [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
     [Disable sends or receives on the socket. ]
   ]
   
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
   [
- [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
- [Write some data to the socket. ]
+ [[link boost_asio.reference.basic_datagram_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
   
 ]
@@ -47842,22 +66271,27 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
+ [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
     [The maximum length of the queue of pending incoming connections. ]
   ]
 
   [
- [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
+ [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
     [Specify that the data should not be subject to routing. ]
   ]
 
   [
- [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
+ [[link boost_asio.reference.basic_datagram_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
 
   [
- [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
+ [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
     [Peek at incoming data without removing it from the input queue. ]
   ]
 
@@ -47868,33 +66302,32 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_stream_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.basic_datagram_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.basic_stream_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.basic_datagram_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
+The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
-
+[*Shared] [*objects:] Unsafe.
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/tcp.hpp]
+[*Header: ][^boost/asio/local/datagram_protocol.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -47903,9 +66336,9 @@
 
 
 
-[section:type ip::tcp::type]
+[section:type local::datagram_protocol::type]
 
-[indexterm2 type..ip::tcp]
+[indexterm2 type..local::datagram_protocol]
 Obtain an identifier for the type of the protocol.
 
 
@@ -47917,43 +66350,98 @@
 
 
 
-[section:v4 ip::tcp::v4]
+[endsect]
 
-[indexterm2 v4..ip::tcp]
-Construct to represent the IPv4 TCP protocol.
+[section:local__stream_protocol local::stream_protocol]
 
 
- static tcp v4();
+Encapsulates the flags needed for stream-oriented UNIX sockets.
 
 
+ class stream_protocol
 
-[endsect]
 
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-[section:v6 ip::tcp::v6]
+ [[link boost_asio.reference.local__stream_protocol.acceptor [*acceptor]]]
+ [The UNIX domain acceptor type. ]
+
+ ]
 
-[indexterm2 v6..ip::tcp]
-Construct to represent the IPv6 TCP protocol.
+ [
 
+ [[link boost_asio.reference.local__stream_protocol.endpoint [*endpoint]]]
+ [The type of a UNIX domain endpoint. ]
+
+ ]
 
- static tcp v6();
+ [
 
+ [[link boost_asio.reference.local__stream_protocol.iostream [*iostream]]]
+ [The UNIX domain iostream type. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.local__stream_protocol.socket [*socket]]]
+ [The UNIX domain socket type. ]
+
+ ]
 
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.local__stream_protocol.family [*family]]]
+ [Obtain an identifier for the protocol family. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__stream_protocol.protocol [*protocol]]]
+ [Obtain an identifier for the protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__stream_protocol.type [*type]]]
+ [Obtain an identifier for the type of the protocol. ]
+ ]
+
+]
 
-[section:ip__udp ip::udp]
+The [link boost_asio.reference.local__stream_protocol `local::stream_protocol`] class contains flags necessary for stream-oriented UNIX domain sockets.
 
 
-Encapsulates the flags needed for UDP.
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Safe.
 
 
- class udp
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/local/stream_protocol.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:acceptor local::stream_protocol::acceptor]
+
+[indexterm2 acceptor..local::stream_protocol]
+The UNIX domain acceptor type.
+
+
+ typedef basic_socket_acceptor< stream_protocol > acceptor;
 
 
 [heading Types]
@@ -47962,131 +66450,148 @@
 
   [
 
- [[link boost_asio.reference.ip__udp.endpoint [*endpoint]]]
- [The type of a UDP endpoint. ]
+ [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__udp.resolver [*resolver]]]
- [The UDP resolver type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__udp.resolver_iterator [*resolver_iterator]]]
- [(Deprecated: use resolver::iterator.) The type of a resolver iterator. ]
+ [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__udp.resolver_query [*resolver_query]]]
- [(Deprecated: use resolver::query.) The type of a resolver query. ]
+ [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__udp.socket [*socket]]]
- [The UDP socket type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
   
   ]
 
-]
+ [
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+ [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
   [
- [[link boost_asio.reference.ip__udp.family [*family]]]
- [Obtain an identifier for the protocol family. ]
- ]
+
+ [[link boost_asio.reference.basic_socket_acceptor.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
- [
- [[link boost_asio.reference.ip__udp.protocol [*protocol]]]
- [Obtain an identifier for the protocol. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__udp.type [*type]]]
- [Obtain an identifier for the type of the protocol. ]
- ]
+
+ [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
   
- [
- [[link boost_asio.reference.ip__udp.v4 [*v4]]]
- [Construct to represent the IPv4 UDP protocol. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__udp.v6 [*v6]]]
- [Construct to represent the IPv6 UDP protocol. ]
- ]
-
-]
 
-[heading Friends]
-[table
- [[Name][Description]]
+ [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+
+ ]
 
   [
- [[link boost_asio.reference.ip__udp.operator_not__eq_ [*operator!=]]]
- [Compare two protocols for inequality. ]
- ]
+
+ [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
+ [Bitmask type for flags that can be passed to send and receive operations. ]
   
- [
- [[link boost_asio.reference.ip__udp.operator_eq__eq_ [*operator==]]]
- [Compare two protocols for equality. ]
   ]
-
-]
 
-The [link boost_asio.reference.ip__udp `ip::udp`] class contains flags necessary for UDP sockets.
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.native_handle_type [*native_handle_type]]]
+ [The native representation of an acceptor. ]
+
+ ]
 
-[heading Thread Safety]
+ [
+
+ [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of an acceptor. ]
   
-[*Distinct] [*objects:] Safe.
+ ]
 
-[*Shared] [*objects:] Safe.
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
-[heading Requirements]
+ [
 
-[*Header: ][^boost/asio/ip/udp.hpp]
+ [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
+ [Socket option for the receive buffer size of a socket. ]
+
+ ]
 
-[*Convenience header: ][^boost/asio.hpp]
+ [
 
+ [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
 
-[section:endpoint ip::udp::endpoint]
+ [
 
-[indexterm2 endpoint..ip::udp]
-The type of a UDP endpoint.
+ [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
+ [Socket option to allow the socket to be bound to an address that is already in use. ]
+
+ ]
 
+ [
 
- typedef basic_endpoint< udp > endpoint;
+ [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
 
+ [
 
-[heading Types]
-[table
- [[Name][Description]]
+ [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
 
   [
 
- [[link boost_asio.reference.ip__basic_endpoint.data_type [*data_type]]]
- [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
+ [[link boost_asio.reference.basic_socket_acceptor.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_endpoint.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint. ]
+ [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
   
   ]
 
@@ -48097,183 +66602,214 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_endpoint.address [*address]]]
- [Get the IP address associated with the endpoint.
+ [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
+ [Accept a new connection.
 
- Set the IP address associated with the endpoint. ]
+ Accept a new connection and obtain the endpoint of the peer. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.basic_endpoint [*basic_endpoint]]]
- [Default constructor.
+ [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
+ [Assigns an existing native acceptor to the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
+ [Start an asynchronous accept. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
+ [Construct an acceptor without opening it.
 
- Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.
+ Construct an open acceptor.
 
- Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
+ Construct an acceptor opened on the given endpoint.
 
- Copy constructor. ]
+ Construct a basic_socket_acceptor on an existing native acceptor.
+
+ Move-construct a basic_socket_acceptor from another. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.capacity [*capacity]]]
- [Get the capacity of the endpoint in the native type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
+ [Bind the acceptor to the given local endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.data [*data]]]
- [Get the underlying endpoint in the native type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the acceptor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_eq_ [*operator=]]]
- [Assign from another endpoint. ]
+ [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
+ [Close the acceptor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.port [*port]]]
- [Get the port associated with the endpoint. The port number is always in the host's byte order.
-
- Set the port associated with the endpoint. The port number is always in the host's byte order. ]
+ [[link boost_asio.reference.basic_socket_acceptor.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.protocol [*protocol]]]
- [The protocol associated with the endpoint. ]
+ [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
+ [Get an option from the acceptor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.resize [*resize]]]
- [Set the underlying size of the endpoint in the native type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.io_control [*io_control]]]
+ [Perform an IO control command on the acceptor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.size [*size]]]
- [Get the underlying size of the endpoint in the native type. ]
+ [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
+ [Determine whether the acceptor is open. ]
   ]
   
-]
-
-[heading Friends]
-[table
- [[Name][Description]]
-
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_not__eq_ [*operator!=]]]
- [Compare two endpoints for inequality. ]
+ [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
+ [Place the acceptor into the state where it will listen for new connections. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt_ [*operator<]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the acceptor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt__eq_ [*operator<=]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.basic_socket_acceptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native acceptor representation. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_eq__eq_ [*operator==]]]
- [Compare two endpoints for equality. ]
+ [[link boost_asio.reference.basic_socket_acceptor.native_handle [*native_handle]]]
+ [Get the native acceptor representation. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_gt_ [*operator>]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.basic_socket_acceptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native acceptor implementation.
+
+ Sets the non-blocking mode of the native acceptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_gt__eq_ [*operator>=]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.basic_socket_acceptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the acceptor.
+
+ Sets the non-blocking mode of the acceptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
+ [Open the acceptor using the specified protocol. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_socket_acceptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
+ [Set an option on the acceptor. ]
   ]
   
 ]
 
-[heading Related Functions]
+[heading Protected Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_endpoint.operator_lt__lt_ [*operator<<]]]
- [Output an endpoint as a string. ]
+ [[link boost_asio.reference.basic_socket_acceptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
   ]
   
-]
-
-The [link boost_asio.reference.ip__basic_endpoint `ip::basic_endpoint`] class template describes an endpoint that may be associated with a particular socket.
-
-
-[heading Thread Safety]
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
   
-[*Distinct] [*objects:] Safe.
-
-[*Shared] [*objects:] Unsafe.
-
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/ip/udp.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:family ip::udp::family]
-
-[indexterm2 family..ip::udp]
-Obtain an identifier for the protocol family.
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
- int family() const;
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
+ [The maximum length of the queue of pending incoming connections. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
+ [Specify that the data should not be subject to routing. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
 
-[endsect]
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
+ [Process out-of-band data. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
+ [Peek at incoming data without removing it from the input queue. ]
+ ]
 
+]
 
-[section:operator_not__eq_ ip::udp::operator!=]
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
-[indexterm2 operator!=..ip::udp]
-Compare two protocols for inequality.
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
- friend bool operator!=(
- const udp & p1,
- const udp & p2);
+]
 
+The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/udp.hpp]
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
 
-[*Convenience header: ][^boost/asio.hpp]
+[*Shared] [*objects:] Unsafe.
 
 
-[endsect]
+[heading Example]
+
+Opening a socket acceptor with the SO\_REUSEADDR option enabled:
 
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
+ acceptor.open(endpoint.protocol());
+ acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
+ acceptor.bind(endpoint);
+ acceptor.listen();
 
 
-[section:operator_eq__eq_ ip::udp::operator==]
 
-[indexterm2 operator==..ip::udp]
-Compare two protocols for equality.
 
 
- friend bool operator==(
- const udp & p1,
- const udp & p2);
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/udp.hpp]
+[*Header: ][^boost/asio/local/stream_protocol.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -48282,27 +66818,13 @@
 
 
 
-[section:protocol ip::udp::protocol]
-
-[indexterm2 protocol..ip::udp]
-Obtain an identifier for the protocol.
-
-
- int protocol() const;
-
-
-
-[endsect]
-
-
-
-[section:resolver ip::udp::resolver]
+[section:endpoint local::stream_protocol::endpoint]
 
-[indexterm2 resolver..ip::udp]
-The UDP resolver type.
+[indexterm2 endpoint..local::stream_protocol]
+The type of a UNIX domain endpoint.
 
 
- typedef basic_resolver< udp > resolver;
+ typedef basic_endpoint< stream_protocol > endpoint;
 
 
 [heading Types]
@@ -48311,43 +66833,15 @@
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver.iterator [*iterator]]]
- [The iterator type. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ip__basic_resolver.query [*query]]]
- [The query type. ]
+ [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
+ [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
+ [The protocol type associated with the endpoint. ]
   
   ]
 
@@ -48358,162 +66852,116 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver.async_resolve [*async_resolve]]]
- [Asynchronously perform forward resolution of a query to a list of entries.
+ [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
+ [Default constructor.
 
- Asynchronously perform reverse resolution of an endpoint to a list of entries. ]
+ Construct an endpoint using the specified path name.
+
+ Copy constructor. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.basic_resolver [*basic_resolver]]]
- [Constructor. ]
+ [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
+ [Get the capacity of the endpoint in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.cancel [*cancel]]]
- [Cancel any asynchronous operations that are waiting on the resolver. ]
+ [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
+ [Get the underlying endpoint in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
+ [Assign from another endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
+ [Get the path associated with the endpoint.
+
+ Set the path associated with the endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver.resolve [*resolve]]]
- [Perform forward resolution of a query to a list of entries.
-
- Perform reverse resolution of an endpoint to a list of entries. ]
+ [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
+ [The protocol associated with the endpoint. ]
   ]
   
-]
-
-[heading Protected Data Members]
-[table
- [[Name][Description]]
-
   [
- [[link boost_asio.reference.ip__basic_resolver.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
+ [Set the underlying size of the endpoint in the native type. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
+ [Get the underlying size of the endpoint in the native type. ]
   ]
-
-]
-
-The [link boost_asio.reference.ip__basic_resolver `ip::basic_resolver`] class template provides the ability to resolve a query to a list of endpoints.
-
-
-[heading Thread Safety]
   
-[*Distinct] [*objects:] Safe.
-
-[*Shared] [*objects:] Unsafe.
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/ip/udp.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:resolver_iterator ip::udp::resolver_iterator]
-
-[indexterm2 resolver_iterator..ip::udp]
-(Deprecated: use `resolver::iterator`.) The type of a resolver iterator.
-
-
- typedef basic_resolver_iterator< udp > resolver_iterator;
-
+]
 
-[heading Member Functions]
+[heading Friends]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.basic_resolver_iterator [*basic_resolver_iterator]]]
- [Default constructor creates an end iterator. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
+ [Compare two endpoints for inequality. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.create [*create]]]
- [Create an iterator from an addrinfo list returned by getaddrinfo.
-
- Create an iterator from an endpoint, host name and service name. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
+ [Compare endpoints for ordering. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator__star_ [*operator *]]]
- [Dereference an iterator. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
+ [Compare endpoints for ordering. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_plus__plus_ [*operator++]]]
- [Increment operator (prefix).
-
- Increment operator (postfix). ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
+ [Compare two endpoints for equality. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_arrow_ [*operator->]]]
- [Dereference an iterator. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
+ [Compare endpoints for ordering. ]
+ ]
+
+ [
+ [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
+ [Compare endpoints for ordering. ]
   ]
   
 ]
 
-[heading Friends]
+[heading Related Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_not__eq_ [*operator!=]]]
- [Test two iterators for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.ip__basic_resolver_iterator.operator_eq__eq_ [*operator==]]]
- [Test two iterators for equality. ]
+ [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
+ [Output an endpoint as a string. ]
   ]
   
 ]
 
-The [link boost_asio.reference.ip__basic_resolver_iterator `ip::basic_resolver_iterator`] class template is used to define iterators over the results returned by a resolver.
-
-The iterator's value\_type, obtained when the iterator is dereferenced, is:
-
- const basic_resolver_entry<InternetProtocol>
-
-
-
+The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
+
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/udp.hpp]
+[*Header: ][^boost/asio/local/stream_protocol.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -48522,13 +66970,27 @@
 
 
 
-[section:resolver_query ip::udp::resolver_query]
+[section:family local::stream_protocol::family]
+
+[indexterm2 family..local::stream_protocol]
+Obtain an identifier for the protocol family.
+
+
+ int family() const;
+
+
+
+[endsect]
+
+
+
+[section:iostream local::stream_protocol::iostream]
 
-[indexterm2 resolver_query..ip::udp]
-(Deprecated: use `resolver::query`.) The type of a resolver query.
+[indexterm2 iostream..local::stream_protocol]
+The UNIX domain iostream type.
 
 
- typedef basic_resolver_query< udp > resolver_query;
+ typedef basic_socket_iostream< stream_protocol > iostream;
 
 
 [heading Types]
@@ -48537,15 +66999,22 @@
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver_query.flags [*flags]]]
- [A bitmask type (C++ Std \[lib.bitmask.types\]). ]
+ [[link boost_asio.reference.basic_socket_iostream.duration_type [*duration_type]]]
+ [The duration type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ip__basic_resolver_query.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint query. ]
+ [[link boost_asio.reference.basic_socket_iostream.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_socket_iostream.time_type [*time_type]]]
+ [The time type. ]
   
   ]
 
@@ -48556,104 +67025,81 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ip__basic_resolver_query.basic_resolver_query [*basic_resolver_query]]]
- [Construct with specified service name for any protocol.
-
- Construct with specified service name for a given protocol.
-
- Construct with specified host name and service name for any protocol.
+ [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
+ [Construct a basic_socket_iostream without establishing a connection.
 
- Construct with specified host name and service name for a given protocol. ]
+ Establish a connection to an endpoint corresponding to a resolver query. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.hints [*hints]]]
- [Get the hints associated with the query. ]
+ [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
+ [Close the connection. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.host_name [*host_name]]]
- [Get the host name associated with the query. ]
+ [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
+ [Establish a connection to an endpoint corresponding to a resolver query. ]
   ]
   
   [
- [[link boost_asio.reference.ip__basic_resolver_query.service_name [*service_name]]]
- [Get the service name associated with the query. ]
+ [[link boost_asio.reference.basic_socket_iostream.error [*error]]]
+ [Get the last error associated with the stream. ]
   ]
   
-]
-
-[heading Data Members]
-[table
- [[Name][Description]]
-
   [
- [[link boost_asio.reference.ip__basic_resolver_query.address_configured [*address_configured]]]
- [Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system. ]
- ]
+ [[link boost_asio.reference.basic_socket_iostream.expires_at [*expires_at]]]
+ [Get the stream's expiry time as an absolute time.
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.all_matching [*all_matching]]]
- [If used with v4_mapped, return all matching IPv6 and IPv4 addresses. ]
+ Set the stream's expiry time as an absolute time. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.canonical_name [*canonical_name]]]
- [Determine the canonical name of the host specified in the query. ]
- ]
+ [[link boost_asio.reference.basic_socket_iostream.expires_from_now [*expires_from_now]]]
+ [Get the timer's expiry time relative to now.
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_host [*numeric_host]]]
- [Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. ]
+ Set the stream's expiry time relative to now. ]
   ]
-
+
   [
- [[link boost_asio.reference.ip__basic_resolver_query.numeric_service [*numeric_service]]]
- [Service name should be treated as a numeric string defining a port number and no name resolution should be attempted. ]
+ [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
+ [Return a pointer to the underlying streambuf. ]
   ]
+
+]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.passive [*passive]]]
- [Indicate that returned endpoint is intended for use as a locally bound socket endpoint. ]
- ]
 
- [
- [[link boost_asio.reference.ip__basic_resolver_query.v4_mapped [*v4_mapped]]]
- [If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses. ]
- ]
+[heading Requirements]
 
-]
+[*Header: ][^boost/asio/local/stream_protocol.hpp]
 
-The [link boost_asio.reference.ip__basic_resolver_query `ip::basic_resolver_query`] class template describes a query that can be passed to a resolver.
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+[endsect]
 
-[*Shared] [*objects:] Unsafe.
 
 
+[section:protocol local::stream_protocol::protocol]
 
+[indexterm2 protocol..local::stream_protocol]
+Obtain an identifier for the protocol.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ip/udp.hpp]
+ int protocol() const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:socket ip::udp::socket]
+[section:socket local::stream_protocol::socket]
 
-[indexterm2 socket..ip::udp]
-The UDP socket type.
+[indexterm2 socket..local::stream_protocol]
+The UNIX domain socket type.
 
 
- typedef basic_datagram_socket< udp > socket;
+ typedef basic_stream_socket< stream_protocol > socket;
 
 
 [heading Types]
@@ -48662,147 +67108,154 @@
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
+ [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
     [Socket option to permit sending of broadcast messages. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
+ [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
     [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
+ [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
     [Socket option to enable socket-level debugging. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
+ [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
     [Socket option to prevent routing, use local interfaces only. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
     [Socket option to report aborted connections on accept. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
+ [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
     [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.implementation_type [*implementation_type]]]
+ [[link boost_asio.reference.basic_stream_socket.implementation_type [*implementation_type]]]
     [The underlying implementation type of I/O object. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
+ [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
     [Socket option to send keep-alives. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
+ [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
     [Socket option to specify whether the socket lingers on close if unsent data is present. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
+ [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
     [A basic_socket is always the lowest layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
+ [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
     [Bitmask type for flags that can be passed to send and receive operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_stream_socket.native_handle_type [*native_handle_type]]]
     [The native representation of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [[link boost_asio.reference.basic_stream_socket.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
+ [[link boost_asio.reference.basic_stream_socket.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
     [The protocol type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
+ [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
     [Socket option for the receive buffer size of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
+ [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
     [Socket option for the receive low watermark. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
+ [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
     [Socket option to allow the socket to be bound to an address that is already in use. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
+ [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
     [Socket option for the send buffer size of a socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
+ [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
     [Socket option for the send low watermark. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.service_type [*service_type]]]
+ [[link boost_asio.reference.basic_stream_socket.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
+ [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
     [Different ways a socket may be shutdown. ]
   
   ]
@@ -48814,158 +67267,197 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
+ [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
     [Assign an existing native socket to the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
+ [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
     [Start an asynchronous connect. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
- [Start an asynchronous receive on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
+ [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
     [Start an asynchronous receive. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
- [Start an asynchronous send on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
- [Start an asynchronous send. ]
+ [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
+ [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
     [Determine whether the socket is at the out-of-band data mark. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
+ [[link boost_asio.reference.basic_stream_socket.available [*available]]]
     [Determine the number of bytes available for reading. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
- [Construct a basic_datagram_socket without opening it.
+ [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
+ [Construct a basic_stream_socket without opening it.
 
- Construct and open a basic_datagram_socket.
+ Construct and open a basic_stream_socket.
 
- Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
+ Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_datagram_socket on an existing native socket. ]
+ Construct a basic_stream_socket on an existing native socket.
+
+ Move-construct a basic_stream_socket from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
+ [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
     [Bind the socket to the given local endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
+ [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
     [Cancel all asynchronous operations associated with the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
+ [[link boost_asio.reference.basic_stream_socket.close [*close]]]
     [Close the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
+ [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
     [Connect the socket to the specified endpoint. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.get_io_service [*get_io_service]]]
+ [[link boost_asio.reference.basic_stream_socket.get_io_service [*get_io_service]]]
     [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
+ [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
     [Get an option from the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
+ [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
     [Perform an IO control command on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
+ [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
+ [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
     [Get the local endpoint of the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
+ [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
     [Get a reference to the lowest layer.
 
      Get a const reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.native [*native]]]
+ [[link boost_asio.reference.basic_stream_socket.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.native_handle [*native_handle]]]
     [Get the native socket representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
+ [[link boost_asio.reference.basic_stream_socket.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.open [*open]]]
     [Open the socket using the specified protocol. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
- [Receive some data on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.operator_eq_ [*operator=]]]
+ [Move-assign a basic_stream_socket from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
- [Receive a datagram with the endpoint of the sender. ]
+ [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
+ [Read some data from the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
+ [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
+ [Receive some data on the socket.
+
+ Receive some data on a connected socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
- [Send some data on a connected socket. ]
+ [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint of the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
- [Send a datagram to the specified endpoint. ]
+ [[link boost_asio.reference.basic_stream_socket.send [*send]]]
+ [Send some data on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
+ [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
     [Set an option on the socket. ]
   ]
   
   [
- [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
+ [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
     [Disable sends or receives on the socket. ]
   ]
   
+ [
+ [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
+ [Write some data to the socket. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
 ]
 
 [heading Data Members]
@@ -48973,22 +67465,27 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
+ [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
     [The maximum length of the queue of pending incoming connections. ]
   ]
 
   [
- [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
+ [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
     [Specify that the data should not be subject to routing. ]
   ]
 
   [
- [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
+ [[link boost_asio.reference.basic_stream_socket.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
 
   [
- [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
+ [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
     [Peek at incoming data without removing it from the input queue. ]
   ]
 
@@ -48999,32 +67496,33 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_datagram_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.basic_stream_socket.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.basic_datagram_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.basic_stream_socket.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
+The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
+
 
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ip/udp.hpp]
+[*Header: ][^boost/asio/local/stream_protocol.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -49033,9 +67531,9 @@
 
 
 
-[section:type ip::udp::type]
+[section:type local::stream_protocol::type]
 
-[indexterm2 type..ip::udp]
+[indexterm2 type..local::stream_protocol]
 Obtain an identifier for the type of the protocol.
 
 
@@ -49047,174 +67545,248 @@
 
 
 
-[section:v4 ip::udp::v4]
+[endsect]
 
-[indexterm2 v4..ip::udp]
-Construct to represent the IPv4 UDP protocol.
+[section:mutable_buffer mutable_buffer]
 
 
- static udp v4();
+Holds a buffer that can be modified.
 
 
+ class mutable_buffer
 
-[endsect]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
+ [Construct an empty buffer.
 
-[section:v6 ip::udp::v6]
+ Construct a buffer to represent a given memory range. ]
+ ]
+
+]
 
-[indexterm2 v6..ip::udp]
-Construct to represent the IPv6 UDP protocol.
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
+ [Create a new modifiable buffer that is offset from the start of another. ]
+ ]
+
+]
 
- static udp v6();
+The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
 
 
+[heading Accessing Buffer Contents]
+
 
-[endsect]
 
+The contents of a buffer may be accessed using the [link boost_asio.reference.buffer_size `buffer_size`] and [link boost_asio.reference.buffer_cast `buffer_cast`] functions:
 
 
-[endsect]
 
+ boost::asio::mutable_buffer b1 = ...;
+ std::size_t s1 = boost::asio::buffer_size(b1);
+ unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1);
 
-[section:ip__unicast__hops ip::unicast::hops]
 
-[indexterm1 ip::unicast::hops]
-Socket option for time-to-live associated with outgoing unicast packets.
 
 
- typedef implementation_defined hops;
+The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffer.hpp]
 
-Implements the IPPROTO\_IP/IP\_UNICAST\_TTL socket option.
+[*Convenience header: ][^boost/asio.hpp]
 
+[section:mutable_buffer mutable_buffer::mutable_buffer]
 
-[heading Examples]
-
-Setting the option:
+[indexterm2 mutable_buffer..mutable_buffer]
+Construct an empty buffer.
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::unicast::hops option(4);
- socket.set_option(option);
 
+ ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 mutable_buffer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 more...]]``
 
 
+Construct a buffer to represent a given memory range.
 
 
-Getting the current option value:
+ ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 mutable_buffer]``(
+ void * data,
+ std::size_t size);
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 more...]]``
 
- boost::asio::ip::udp::socket socket(io_service);
- ...
- boost::asio::ip::unicast::hops option;
- socket.get_option(option);
- int ttl = option.value();
+
+[section:overload1 mutable_buffer::mutable_buffer (1 of 2 overloads)]
 
 
+Construct an empty buffer.
 
 
+ mutable_buffer();
 
 
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/ip/unicast.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+
+[section:overload2 mutable_buffer::mutable_buffer (2 of 2 overloads)]
+
+
+Construct a buffer to represent a given memory range.
+
+
+ mutable_buffer(
+ void * data,
+ std::size_t size);
+
 
 
 [endsect]
 
 
+[endsect]
 
-[section:ip__v6_only ip::v6_only]
+[section:operator_plus_ mutable_buffer::operator+]
 
-[indexterm1 ip::v6_only]
-Socket option for determining whether an IPv6 socket supports IPv6 communication only.
+[indexterm2 operator+..mutable_buffer]
+Create a new modifiable buffer that is offset from the start of another.
 
 
- typedef implementation_defined v6_only;
+ mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload1 operator+]``(
+ const mutable_buffer & b,
+ std::size_t start);
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload1 more...]]``
 
+ mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload2 operator+]``(
+ std::size_t start,
+ const mutable_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload2 more...]]``
 
 
-Implements the IPPROTO\_IPV6/IP\_V6ONLY socket option.
+[section:overload1 mutable_buffer::operator+ (1 of 2 overloads)]
 
 
-[heading Examples]
-
-Setting the option:
+Create a new modifiable buffer that is offset from the start of another.
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::v6_only option(true);
- socket.set_option(option);
 
+ mutable_buffer operator+(
+ const mutable_buffer & b,
+ std::size_t start);
 
 
 
+[endsect]
 
-Getting the current option value:
 
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::ip::v6_only option;
- socket.get_option(option);
- bool v6_only = option.value();
+
+[section:overload2 mutable_buffer::operator+ (2 of 2 overloads)]
 
 
+Create a new modifiable buffer that is offset from the start of another.
 
 
+ mutable_buffer operator+(
+ std::size_t start,
+ const mutable_buffer & b);
 
 
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/ip/v6_only.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
+[section:mutable_buffers_1 mutable_buffers_1]
 
-[section:is_match_condition is_match_condition]
 
+Adapts a single modifiable buffer so that it meets the requirements of the MutableBufferSequence concept.
 
-Type trait used to determine whether a type can be used as a match condition function with read\_until and async\_read\_until.
 
+ class mutable_buffers_1 :
+ public mutable_buffer
 
- template<
- typename T>
- struct is_match_condition
 
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
 
-[heading Data Members]
+ [[link boost_asio.reference.mutable_buffers_1.const_iterator [*const_iterator]]]
+ [A random-access iterator type that may be used to read elements. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.mutable_buffers_1.value_type [*value_type]]]
+ [The type for each element in the list of buffers. ]
+
+ ]
+
+]
+
+[heading Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.is_match_condition.value [*value]]]
- [The value member is true if the type may be used as a match condition. ]
+ [[link boost_asio.reference.mutable_buffers_1.begin [*begin]]]
+ [Get a random-access iterator to the first element. ]
+ ]
+
+ [
+ [[link boost_asio.reference.mutable_buffers_1.end [*end]]]
+ [Get a random-access iterator for one past the last element. ]
+ ]
+
+ [
+ [[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1 [*mutable_buffers_1]]]
+ [Construct to represent a given memory range.
+
+ Construct to represent a single modifiable buffer. ]
   ]
+
+]
 
+[heading Related Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.mutable_buffers_1.operator_plus_ [*operator+]]]
+ [Create a new modifiable buffer that is offset from the start of another. ]
+ ]
+
 ]
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/read_until.hpp]
+[*Header: ][^boost/asio/buffer.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:value is_match_condition::value]
+[section:begin mutable_buffers_1::begin]
 
-[indexterm2 value..is_match_condition]
-The value member is true if the type may be used as a match condition.
+[indexterm2 begin..mutable_buffers_1]
+Get a random-access iterator to the first element.
 
 
- static const bool value;
+ const_iterator begin() const;
 
 
 
@@ -49222,283 +67794,310 @@
 
 
 
+[section:const_iterator mutable_buffers_1::const_iterator]
+
+[indexterm2 const_iterator..mutable_buffers_1]
+A random-access iterator type that may be used to read elements.
+
+
+ typedef const mutable_buffer * const_iterator;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/buffer.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
 [endsect]
 
-[section:is_read_buffered is_read_buffered]
 
 
-The [link boost_asio.reference.is_read_buffered `is_read_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of read data.
+[section:end mutable_buffers_1::end]
+
+[indexterm2 end..mutable_buffers_1]
+Get a random-access iterator for one past the last element.
 
 
- template<
- typename Stream>
- class is_read_buffered
+ const_iterator end() const;
+
+
+
+[endsect]
+
+
+[section:mutable_buffers_1 mutable_buffers_1::mutable_buffers_1]
+
+[indexterm2 mutable_buffers_1..mutable_buffers_1]
+Construct to represent a given memory range.
+
+
+ ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 mutable_buffers_1]``(
+ void * data,
+ std::size_t size);
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 more...]]``
+
+
+Construct to represent a single modifiable buffer.
+
+
+ explicit ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 mutable_buffers_1]``(
+ const mutable_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 more...]]``
+
+
+[section:overload1 mutable_buffers_1::mutable_buffers_1 (1 of 2 overloads)]
+
+
+Construct to represent a given memory range.
+
+
+ mutable_buffers_1(
+ void * data,
+ std::size_t size);
+
+
+
+[endsect]
+
+
+
+[section:overload2 mutable_buffers_1::mutable_buffers_1 (2 of 2 overloads)]
+
+
+Construct to represent a single modifiable buffer.
+
+
+ mutable_buffers_1(
+ const mutable_buffer & b);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:operator_plus_ mutable_buffers_1::operator+]
+
+[indexterm2 operator+..mutable_buffers_1]
+Create a new modifiable buffer that is offset from the start of another.
+
+
+ mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 operator+]``(
+ const mutable_buffer & b,
+ std::size_t start);
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 more...]]``
+
+ mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 operator+]``(
+ std::size_t start,
+ const mutable_buffer & b);
+ `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 more...]]``
+
+
+[section:overload1 mutable_buffers_1::operator+ (1 of 2 overloads)]
+
+
+['Inherited from mutable_buffer.]
+
+
+Create a new modifiable buffer that is offset from the start of another.
+
+
+ mutable_buffer operator+(
+ const mutable_buffer & b,
+ std::size_t start);
 
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.is_read_buffered.value [*value]]]
- [The value member is true only if the Stream type supports buffering of read data. ]
- ]
+[endsect]
 
-]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/is_read_buffered.hpp]
+[section:overload2 mutable_buffers_1::operator+ (2 of 2 overloads)]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+['Inherited from mutable_buffer.]
 
-[section:value is_read_buffered::value]
 
-[indexterm2 value..is_read_buffered]
-The value member is true only if the Stream type supports buffering of read data.
+Create a new modifiable buffer that is offset from the start of another.
 
 
- static const bool value;
+ mutable_buffer operator+(
+ std::size_t start,
+ const mutable_buffer & b);
 
 
 
 [endsect]
 
 
-
 [endsect]
 
-[section:is_write_buffered is_write_buffered]
 
+[section:value_type mutable_buffers_1::value_type]
 
-The [link boost_asio.reference.is_write_buffered `is_write_buffered`] class is a traits class that may be used to determine whether a stream type supports buffering of written data.
+[indexterm2 value_type..mutable_buffers_1]
+The type for each element in the list of buffers.
 
 
- template<
- typename Stream>
- class is_write_buffered
+ typedef mutable_buffer value_type;
 
 
-[heading Data Members]
+[heading Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.is_write_buffered.value [*value]]]
- [The value member is true only if the Stream type supports buffering of written data. ]
+ [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
+ [Construct an empty buffer.
+
+ Construct a buffer to represent a given memory range. ]
   ]
+
+]
+
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
+ [Create a new modifiable buffer that is offset from the start of another. ]
+ ]
+
 ]
 
-[heading Requirements]
+The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
 
-[*Header: ][^boost/asio/is_write_buffered.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Accessing Buffer Contents]
+
 
 
-[section:value is_write_buffered::value]
+The contents of a buffer may be accessed using the [link boost_asio.reference.buffer_size `buffer_size`] and [link boost_asio.reference.buffer_cast `buffer_cast`] functions:
 
-[indexterm2 value..is_write_buffered]
-The value member is true only if the Stream type supports buffering of written data.
 
 
- static const bool value;
+ boost::asio::mutable_buffer b1 = ...;
+ std::size_t s1 = boost::asio::buffer_size(b1);
+ unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1);
 
 
 
-[endsect]
 
+The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
 
 
-[endsect]
+[heading Requirements]
 
-[section:local__basic_endpoint local::basic_endpoint]
+[*Header: ][^boost/asio/buffer.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-Describes an endpoint for a UNIX socket.
 
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``>
- class basic_endpoint
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[endsect]
 
- [
+[section:null_buffers null_buffers]
 
- [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
- [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
-
- ]
 
- [
+An implementation of both the ConstBufferSequence and MutableBufferSequence concepts to represent a null buffer sequence.
 
- [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint. ]
-
- ]
 
-]
+ class null_buffers
 
-[heading Member Functions]
+
+[heading Types]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
- [Default constructor.
-
- Construct an endpoint using the specified path name.
 
- Copy constructor. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
- [Get the capacity of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
- [Get the underlying endpoint in the native type. ]
- ]
+ [[link boost_asio.reference.null_buffers.const_iterator [*const_iterator]]]
+ [A random-access iterator type that may be used to read elements. ]
   
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
- [Assign from another endpoint. ]
   ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
- [Get the path associated with the endpoint.
 
- Set the path associated with the endpoint. ]
- ]
-
   [
- [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
- [The protocol associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
- [Set the underlying size of the endpoint in the native type. ]
- ]
+
+ [[link boost_asio.reference.null_buffers.value_type [*value_type]]]
+ [The type for each element in the list of buffers. ]
   
- [
- [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
- [Get the underlying size of the endpoint in the native type. ]
   ]
-
+
 ]
 
-[heading Friends]
+[heading Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
- [Compare two endpoints for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
- [Compare two endpoints for equality. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.null_buffers.begin [*begin]]]
+ [Get a random-access iterator to the first element. ]
   ]
   
   [
- [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
- [Compare endpoints for ordering. ]
+ [[link boost_asio.reference.null_buffers.end [*end]]]
+ [Get a random-access iterator for one past the last element. ]
   ]
   
 ]
 
-[heading Related Functions]
-[table
- [[Name][Description]]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
- [Output an endpoint as a string. ]
- ]
-
-]
+[heading Requirements]
 
-The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
+[*Header: ][^boost/asio/buffer.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[section:begin null_buffers::begin]
 
+[indexterm2 begin..null_buffers]
+Get a random-access iterator to the first element.
 
 
+ const_iterator begin() const;
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
-[section:basic_endpoint local::basic_endpoint::basic_endpoint]
 
-[indexterm2 basic_endpoint..local::basic_endpoint]
-Default constructor.
 
+[section:const_iterator null_buffers::const_iterator]
 
- ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 basic_endpoint]``();
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload1 more...]]``
+[indexterm2 const_iterator..null_buffers]
+A random-access iterator type that may be used to read elements.
 
 
-Construct an endpoint using the specified path name.
+ typedef const mutable_buffer * const_iterator;
 
 
- ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 basic_endpoint]``(
- const char * path);
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload2 more...]]``
 
- ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 basic_endpoint]``(
- const std::string & path);
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload3 more...]]``
+[heading Requirements]
 
+[*Header: ][^boost/asio/buffer.hpp]
 
-Copy constructor.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- ``[link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 basic_endpoint]``(
- const basic_endpoint & other);
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.basic_endpoint.overload4 more...]]``
+[endsect]
 
 
-[section:overload1 local::basic_endpoint::basic_endpoint (1 of 4 overloads)]
 
+[section:end null_buffers::end]
 
-Default constructor.
+[indexterm2 end..null_buffers]
+Get a random-access iterator for one past the last element.
 
 
- basic_endpoint();
+ const_iterator end() const;
 
 
 
@@ -49506,122 +68105,146 @@
 
 
 
-[section:overload2 local::basic_endpoint::basic_endpoint (2 of 4 overloads)]
+[section:value_type null_buffers::value_type]
 
+[indexterm2 value_type..null_buffers]
+The type for each element in the list of buffers.
 
-Construct an endpoint using the specified path name.
 
+ typedef mutable_buffer value_type;
 
- basic_endpoint(
- const char * path);
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
+ [Construct an empty buffer.
 
-[endsect]
+ Construct a buffer to represent a given memory range. ]
+ ]
+
+]
 
+[heading Related Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
+ [Create a new modifiable buffer that is offset from the start of another. ]
+ ]
+
+]
 
-[section:overload3 local::basic_endpoint::basic_endpoint (3 of 4 overloads)]
+The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
 
 
-Construct an endpoint using the specified path name.
+[heading Accessing Buffer Contents]
+
 
 
- basic_endpoint(
- const std::string & path);
+The contents of a buffer may be accessed using the [link boost_asio.reference.buffer_size `buffer_size`] and [link boost_asio.reference.buffer_cast `buffer_cast`] functions:
 
 
 
-[endsect]
+ boost::asio::mutable_buffer b1 = ...;
+ std::size_t s1 = boost::asio::buffer_size(b1);
+ unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1);
 
 
 
-[section:overload4 local::basic_endpoint::basic_endpoint (4 of 4 overloads)]
 
+The `boost::asio::buffer_cast` function permits violations of type safety, so uses of it in application code should be carefully considered.
 
-Copy constructor.
 
+[heading Requirements]
 
- basic_endpoint(
- const basic_endpoint & other);
+[*Header: ][^boost/asio/buffer.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+
 [endsect]
 
 
-[section:capacity local::basic_endpoint::capacity]
+[section:placeholders__bytes_transferred placeholders::bytes_transferred]
 
-[indexterm2 capacity..local::basic_endpoint]
-Get the capacity of the endpoint in the native type.
+[indexterm1 placeholders::bytes_transferred]
+An argument placeholder, for use with boost::bind(), that corresponds to the bytes\_transferred argument of a handler for asynchronous functions such as `boost::asio::basic_stream_socket::async_write_some` or `boost::asio::async_write`.
 
 
- std::size_t capacity() const;
+ unspecified bytes_transferred;
 
 
+[heading Requirements]
 
-[endsect]
+[*Header: ][^boost/asio/placeholders.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[section:data local::basic_endpoint::data]
 
-[indexterm2 data..local::basic_endpoint]
-Get the underlying endpoint in the native type.
+[endsect]
 
 
- data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload1 data]``();
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload1 more...]]``
 
- const data_type * ``[link boost_asio.reference.local__basic_endpoint.data.overload2 data]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.data.overload2 more...]]``
+[section:placeholders__error placeholders::error]
 
+[indexterm1 placeholders::error]
+An argument placeholder, for use with boost::bind(), that corresponds to the error argument of a handler for any of the asynchronous functions.
 
-[section:overload1 local::basic_endpoint::data (1 of 2 overloads)]
 
+ unspecified error;
 
-Get the underlying endpoint in the native type.
 
+[heading Requirements]
 
- data_type * data();
+[*Header: ][^boost/asio/placeholders.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 local::basic_endpoint::data (2 of 2 overloads)]
+[section:placeholders__iterator placeholders::iterator]
 
+[indexterm1 placeholders::iterator]
+An argument placeholder, for use with boost::bind(), that corresponds to the iterator argument of a handler for asynchronous functions such as boost::asio::basic\_resolver::async\_resolve.
 
-Get the underlying endpoint in the native type.
 
+ unspecified iterator;
 
- const data_type * data() const;
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/placeholders.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:data_type local::basic_endpoint::data_type]
 
-[indexterm2 data_type..local::basic_endpoint]
-The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
+[section:placeholders__signal_number placeholders::signal_number]
 
+[indexterm1 placeholders::signal_number]
+An argument placeholder, for use with boost::bind(), that corresponds to the signal\_number argument of a handler for asynchronous functions such as `boost::asio::signal_set::async_wait`.
 
- typedef implementation_defined data_type;
 
+ unspecified signal_number;
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+[*Header: ][^boost/asio/placeholders.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -49629,81 +68252,238 @@
 [endsect]
 
 
+[section:posix__basic_descriptor posix::basic_descriptor]
 
-[section:operator_not__eq_ local::basic_endpoint::operator!=]
 
-[indexterm2 operator!=..local::basic_endpoint]
-Compare two endpoints for inequality.
+Provides POSIX descriptor functionality.
 
 
- friend bool operator!=(
- const basic_endpoint< Protocol > & e1,
- const basic_endpoint< Protocol > & e2);
+ template<
+ typename ``[link boost_asio.reference.DescriptorService DescriptorService]``>
+ class basic_descriptor :
+ public basic_io_object< DescriptorService >,
+ public posix::descriptor_base
 
 
-[heading Requirements]
+[heading Types]
+[table
+ [[Name][Description]]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+ [
 
-[*Convenience header: ][^boost/asio.hpp]
+ [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
+ [
 
-[endsect]
+ [[link boost_asio.reference.posix__basic_descriptor.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
 
+ [
 
+ [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_descriptor is always the lowest layer. ]
+
+ ]
 
-[section:operator_lt_ local::basic_endpoint::operator<]
+ [
 
-[indexterm2 operator<..local::basic_endpoint]
-Compare endpoints for ordering.
+ [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
+ [The native representation of a descriptor. ]
+
+ ]
 
+ [
 
- friend bool operator<(
- const basic_endpoint< Protocol > & e1,
- const basic_endpoint< Protocol > & e2);
+ [[link boost_asio.reference.posix__basic_descriptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a descriptor. ]
+
+ ]
 
+ [
 
-[heading Requirements]
+ [[link boost_asio.reference.posix__basic_descriptor.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the descriptor. ]
+
+ ]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+ [
 
-[*Convenience header: ][^boost/asio.hpp]
+ [[link boost_asio.reference.posix__basic_descriptor.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
 
+]
 
-[endsect]
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
+ [Assign an existing native descriptor to the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
+ [Construct a basic_descriptor without opening it.
 
+ Construct a basic_descriptor on an existing native descriptor.
 
+ Move-construct a basic_descriptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
+ [Close the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
+ [Perform an IO control command on the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
+ [Determine whether the descriptor is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
 
-[section:operator_lt__lt_ local::basic_endpoint::operator<<]
+ Get a const reference to the lowest layer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native descriptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
+ [Get the native descriptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native descriptor implementation.
 
-[indexterm2 operator<<..local::basic_endpoint]
-Output an endpoint as a string.
+ Sets the non-blocking mode of the native descriptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the descriptor.
 
+ Sets the non-blocking mode of the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_descriptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
+ [Release ownership of the native descriptor implementation. ]
+ ]
+
+]
 
- std::basic_ostream< Elem, Traits > & operator<<(
- std::basic_ostream< Elem, Traits > & os,
- const basic_endpoint< Protocol > & endpoint);
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
 
-Used to output a human-readable string for a specified endpoint.
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
 
-[heading Parameters]
-
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
 
-[variablelist
+]
+
+The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
+
+
+[heading Thread Safety]
   
-[[os][The output stream to which the string will be written.]]
+[*Distinct] [*objects:] Safe.
 
-[[endpoint][The endpoint to be written.]]
+[*Shared] [*objects:] Unsafe.
 
-]
 
 
-[heading Return Value]
-
-The output stream.
+[heading Requirements]
+
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+[section:assign posix::basic_descriptor::assign]
+
+[indexterm2 assign..posix::basic_descriptor]
+Assign an existing native descriptor to the descriptor.
+
+
+ void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload1 assign]``(
+ const native_handle_type & native_descriptor);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.assign.overload2 assign]``(
+ const native_handle_type & native_descriptor,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload2 more...]]``
+
+
+[section:overload1 posix::basic_descriptor::assign (1 of 2 overloads)]
+
+
+Assign an existing native descriptor to the descriptor.
+
 
+ void assign(
+ const native_handle_type & native_descriptor);
 
 
 
@@ -49711,219 +68491,235 @@
 
 
 
-[section:operator_lt__eq_ local::basic_endpoint::operator<=]
+[section:overload2 posix::basic_descriptor::assign (2 of 2 overloads)]
 
-[indexterm2 operator<=..local::basic_endpoint]
-Compare endpoints for ordering.
 
+Assign an existing native descriptor to the descriptor.
 
- friend bool operator<=(
- const basic_endpoint< Protocol > & e1,
- const basic_endpoint< Protocol > & e2);
 
+ boost::system::error_code assign(
+ const native_handle_type & native_descriptor,
+ boost::system::error_code & ec);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
+[section:basic_descriptor posix::basic_descriptor::basic_descriptor]
 
+[indexterm2 basic_descriptor..posix::basic_descriptor]
+Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] without opening it.
 
-[section:operator_eq_ local::basic_endpoint::operator=]
 
-[indexterm2 operator=..local::basic_endpoint]
-Assign from another endpoint.
+ explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 basic_descriptor]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 more...]]``
 
 
- basic_endpoint & operator=(
- const basic_endpoint & other);
+Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] on an existing native descriptor.
 
 
+ ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 basic_descriptor]``(
+ boost::asio::io_service & io_service,
+ const native_handle_type & native_descriptor);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 more...]]``
 
-[endsect]
 
+Move-construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] from another.
 
 
-[section:operator_eq__eq_ local::basic_endpoint::operator==]
+ ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 basic_descriptor]``(
+ basic_descriptor && other);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload3 more...]]``
 
-[indexterm2 operator==..local::basic_endpoint]
-Compare two endpoints for equality.
 
+[section:overload1 posix::basic_descriptor::basic_descriptor (1 of 3 overloads)]
 
- friend bool operator==(
- const basic_endpoint< Protocol > & e1,
- const basic_endpoint< Protocol > & e2);
 
+Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] without opening it.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+ basic_descriptor(
+ boost::asio::io_service & io_service);
 
-[*Convenience header: ][^boost/asio.hpp]
 
+This constructor creates a descriptor without opening it.
 
-[endsect]
 
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
 
-[section:operator_gt_ local::basic_endpoint::operator>]
+]
 
-[indexterm2 operator>..local::basic_endpoint]
-Compare endpoints for ordering.
 
 
- friend bool operator>(
- const basic_endpoint< Protocol > & e1,
- const basic_endpoint< Protocol > & e2);
 
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[section:overload2 posix::basic_descriptor::basic_descriptor (2 of 3 overloads)]
 
 
-[endsect]
+Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] on an existing native descriptor.
 
 
+ basic_descriptor(
+ boost::asio::io_service & io_service,
+ const native_handle_type & native_descriptor);
 
-[section:operator_gt__eq_ local::basic_endpoint::operator>=]
 
-[indexterm2 operator>=..local::basic_endpoint]
-Compare endpoints for ordering.
+This constructor creates a descriptor object to hold an existing native descriptor.
 
 
- friend bool operator>=(
- const basic_endpoint< Protocol > & e1,
- const basic_endpoint< Protocol > & e2);
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor.]]
 
-[heading Requirements]
+[[native_descriptor][A native descriptor.]]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[heading Exceptions]
+
 
-[endsect]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
-[section:path local::basic_endpoint::path]
 
-[indexterm2 path..local::basic_endpoint]
-Get the path associated with the endpoint.
 
 
- std::string ``[link boost_asio.reference.local__basic_endpoint.path.overload1 path]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload1 more...]]``
+[endsect]
 
 
-Set the path associated with the endpoint.
 
+[section:overload3 posix::basic_descriptor::basic_descriptor (3 of 3 overloads)]
 
- void ``[link boost_asio.reference.local__basic_endpoint.path.overload2 path]``(
- const char * p);
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload2 more...]]``
 
- void ``[link boost_asio.reference.local__basic_endpoint.path.overload3 path]``(
- const std::string & p);
- `` [''''&raquo;''' [link boost_asio.reference.local__basic_endpoint.path.overload3 more...]]``
+Move-construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] from another.
 
 
-[section:overload1 local::basic_endpoint::path (1 of 3 overloads)]
+ basic_descriptor(
+ basic_descriptor && other);
 
 
-Get the path associated with the endpoint.
+This constructor moves a descriptor from one object to another.
 
 
- std::string path() const;
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] object from which the move will occur.]]
 
+]
 
 
-[endsect]
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(io_service&) constructor`.
 
 
 
-[section:overload2 local::basic_endpoint::path (2 of 3 overloads)]
+
+[endsect]
 
 
-Set the path associated with the endpoint.
+[endsect]
 
 
- void path(
- const char * p);
+[section:bytes_readable posix::basic_descriptor::bytes_readable]
 
 
+['Inherited from posix::descriptor_base.]
 
-[endsect]
+[indexterm2 bytes_readable..posix::basic_descriptor]
+IO control command to get the amount of data that can be read without blocking.
 
 
+ typedef implementation_defined bytes_readable;
 
-[section:overload3 local::basic_endpoint::path (3 of 3 overloads)]
 
 
-Set the path associated with the endpoint.
+Implements the FIONREAD IO control command.
 
 
- void path(
- const std::string & p);
+[heading Example]
+
 
 
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::descriptor_base::bytes_readable command(true);
+ descriptor.io_control(command);
+ std::size_t bytes_readable = command.get();
 
-[endsect]
 
 
-[endsect]
 
 
-[section:protocol local::basic_endpoint::protocol]
 
-[indexterm2 protocol..local::basic_endpoint]
-The protocol associated with the endpoint.
 
+[heading Requirements]
 
- protocol_type protocol() const;
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:cancel posix::basic_descriptor::cancel]
 
-[section:protocol_type local::basic_endpoint::protocol_type]
+[indexterm2 cancel..posix::basic_descriptor]
+Cancel all asynchronous operations associated with the descriptor.
 
-[indexterm2 protocol_type..local::basic_endpoint]
-The protocol type associated with the endpoint.
 
+ void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload1 more...]]``
 
- typedef Protocol protocol_type;
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload2 more...]]``
 
 
+[section:overload1 posix::basic_descriptor::cancel (1 of 2 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/local/basic_endpoint.hpp]
+Cancel all asynchronous operations associated with the descriptor.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ void cancel();
 
-[endsect]
 
+This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
 
-[section:resize local::basic_endpoint::resize]
+[heading Exceptions]
+
 
-[indexterm2 resize..local::basic_endpoint]
-Set the underlying size of the endpoint in the native type.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
- void resize(
- std::size_t size);
 
 
 
@@ -49931,980 +68727,540 @@
 
 
 
-[section:size local::basic_endpoint::size]
+[section:overload2 posix::basic_descriptor::cancel (2 of 2 overloads)]
 
-[indexterm2 size..local::basic_endpoint]
-Get the underlying size of the endpoint in the native type.
 
+Cancel all asynchronous operations associated with the descriptor.
 
- std::size_t size() const;
 
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
 
 
-[endsect]
+This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
 
+[heading Parameters]
+
 
-[endsect]
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. ]]
 
-[section:local__connect_pair local::connect_pair]
+]
 
-[indexterm1 local::connect_pair]
-Create a pair of connected sockets.
 
-
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.SocketService SocketService1]``,
- typename ``[link boost_asio.reference.SocketService SocketService2]``>
- void ``[link boost_asio.reference.local__connect_pair.overload1 connect_pair]``(
- basic_socket< Protocol, SocketService1 > & socket1,
- basic_socket< Protocol, SocketService2 > & socket2);
- `` [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.SocketService SocketService1]``,
- typename ``[link boost_asio.reference.SocketService SocketService2]``>
- boost::system::error_code ``[link boost_asio.reference.local__connect_pair.overload2 connect_pair]``(
- basic_socket< Protocol, SocketService1 > & socket1,
- basic_socket< Protocol, SocketService2 > & socket2,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.local__connect_pair.overload2 more...]]``
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/local/connect_pair.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
+[section:close posix::basic_descriptor::close]
 
-[section:overload1 local::connect_pair (1 of 2 overloads)]
+[indexterm2 close..posix::basic_descriptor]
+Close the descriptor.
 
 
-Create a pair of connected sockets.
+ void ``[link boost_asio.reference.posix__basic_descriptor.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload2 more...]]``
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.SocketService SocketService1]``,
- typename ``[link boost_asio.reference.SocketService SocketService2]``>
- void connect_pair(
- basic_socket< Protocol, SocketService1 > & socket1,
- basic_socket< Protocol, SocketService2 > & socket2);
 
+[section:overload1 posix::basic_descriptor::close (1 of 2 overloads)]
 
 
-[endsect]
+Close the descriptor.
 
 
+ void close();
 
-[section:overload2 local::connect_pair (2 of 2 overloads)]
 
+This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
-Create a pair of connected sockets.
 
+[heading Exceptions]
+
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.SocketService SocketService1]``,
- typename ``[link boost_asio.reference.SocketService SocketService2]``>
- boost::system::error_code connect_pair(
- basic_socket< Protocol, SocketService1 > & socket1,
- basic_socket< Protocol, SocketService2 > & socket2,
- boost::system::error_code & ec);
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
 
+]
 
 
-[endsect]
 
 
 [endsect]
 
-[section:local__datagram_protocol local::datagram_protocol]
 
 
-Encapsulates the flags needed for datagram-oriented UNIX sockets.
+[section:overload2 posix::basic_descriptor::close (2 of 2 overloads)]
 
 
- class datagram_protocol
+Close the descriptor.
 
 
-[heading Types]
-[table
- [[Name][Description]]
+ boost::system::error_code close(
+ boost::system::error_code & ec);
 
- [
 
- [[link boost_asio.reference.local__datagram_protocol.endpoint [*endpoint]]]
- [The type of a UNIX domain endpoint. ]
-
- ]
+This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
- [
 
- [[link boost_asio.reference.local__datagram_protocol.socket [*socket]]]
- [The UNIX domain socket type. ]
+[heading Parameters]
+
+
+[variablelist
   
- ]
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
 
 ]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.local__datagram_protocol.family [*family]]]
- [Obtain an identifier for the protocol family. ]
- ]
-
- [
- [[link boost_asio.reference.local__datagram_protocol.protocol [*protocol]]]
- [Obtain an identifier for the protocol. ]
- ]
-
- [
- [[link boost_asio.reference.local__datagram_protocol.type [*type]]]
- [Obtain an identifier for the type of the protocol. ]
- ]
-
-]
 
-The [link boost_asio.reference.local__datagram_protocol `local::datagram_protocol`] class contains flags necessary for datagram-oriented UNIX domain sockets.
 
+[endsect]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Safe.
+[endsect]
 
+[section:get_implementation posix::basic_descriptor::get_implementation]
 
+[indexterm2 get_implementation..posix::basic_descriptor]
+Get the underlying implementation of the I/O object.
 
 
-[heading Requirements]
+ implementation_type & ``[link boost_asio.reference.posix__basic_descriptor.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.get_implementation.overload1 more...]]``
 
-[*Header: ][^boost/asio/local/datagram_protocol.hpp]
+ const implementation_type & ``[link boost_asio.reference.posix__basic_descriptor.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.get_implementation.overload2 more...]]``
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[section:overload1 posix::basic_descriptor::get_implementation (1 of 2 overloads)]
 
-[section:endpoint local::datagram_protocol::endpoint]
 
-[indexterm2 endpoint..local::datagram_protocol]
-The type of a UNIX domain endpoint.
+['Inherited from basic_io_object.]
 
 
- typedef basic_endpoint< datagram_protocol > endpoint;
+Get the underlying implementation of the I/O object.
 
 
-[heading Types]
-[table
- [[Name][Description]]
+ implementation_type & get_implementation();
 
- [
 
- [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
- [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint. ]
-
- ]
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[section:overload2 posix::basic_descriptor::get_implementation (2 of 2 overloads)]
 
- [
- [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
- [Default constructor.
 
- Construct an endpoint using the specified path name.
+['Inherited from basic_io_object.]
 
- Copy constructor. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
- [Get the capacity of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
- [Get the underlying endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
- [Assign from another endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
- [Get the path associated with the endpoint.
 
- Set the path associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
- [The protocol associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
- [Set the underlying size of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
- [Get the underlying size of the endpoint in the native type. ]
- ]
-
-]
+Get the underlying implementation of the I/O object.
 
-[heading Friends]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
- [Compare two endpoints for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
- [Compare two endpoints for equality. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
- [Compare endpoints for ordering. ]
- ]
-
-]
+ const implementation_type & get_implementation() const;
 
-[heading Related Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
- [Output an endpoint as a string. ]
- ]
-
-]
 
-The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
+[endsect]
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+[endsect]
 
-[*Shared] [*objects:] Unsafe.
 
+[section:get_io_service posix::basic_descriptor::get_io_service]
 
 
+['Inherited from basic_io_object.]
 
+[indexterm2 get_io_service..posix::basic_descriptor]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/local/datagram_protocol.hpp]
+ boost::asio::io_service & get_io_service();
 
-[*Convenience header: ][^boost/asio.hpp]
+
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
-[endsect]
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
 
 
-[section:family local::datagram_protocol::family]
 
-[indexterm2 family..local::datagram_protocol]
-Obtain an identifier for the protocol family.
+[endsect]
 
 
- int family() const;
+[section:get_service posix::basic_descriptor::get_service]
 
+[indexterm2 get_service..posix::basic_descriptor]
+Get the service associated with the I/O object.
 
 
-[endsect]
+ service_type & ``[link boost_asio.reference.posix__basic_descriptor.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.get_service.overload1 more...]]``
 
+ const service_type & ``[link boost_asio.reference.posix__basic_descriptor.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.get_service.overload2 more...]]``
 
 
-[section:protocol local::datagram_protocol::protocol]
+[section:overload1 posix::basic_descriptor::get_service (1 of 2 overloads)]
 
-[indexterm2 protocol..local::datagram_protocol]
-Obtain an identifier for the protocol.
 
+['Inherited from basic_io_object.]
 
- int protocol() const;
 
+Get the service associated with the I/O object.
 
 
-[endsect]
+ service_type & get_service();
 
 
 
-[section:socket local::datagram_protocol::socket]
+[endsect]
 
-[indexterm2 socket..local::datagram_protocol]
-The UNIX domain socket type.
 
 
- typedef basic_datagram_socket< datagram_protocol > socket;
+[section:overload2 posix::basic_descriptor::get_service (2 of 2 overloads)]
 
 
-[heading Types]
-[table
- [[Name][Description]]
+['Inherited from basic_io_object.]
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+Get the service associated with the I/O object.
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+ const service_type & get_service() const;
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
+[section:implementation posix::basic_descriptor::implementation]
 
- [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
 
- [
+['Inherited from basic_io_object.]
 
- [[link boost_asio.reference.basic_datagram_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+[indexterm2 implementation..posix::basic_descriptor]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
+[section:implementation_type posix::basic_descriptor::implementation_type]
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
+['Inherited from basic_io_object.]
 
- [
+[indexterm2 implementation_type..posix::basic_descriptor]
+The underlying implementation type of I/O object.
 
- [[link boost_asio.reference.basic_datagram_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
 
- [
+ typedef service_type::implementation_type implementation_type;
 
- [[link boost_asio.reference.basic_datagram_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+[heading Requirements]
 
- [
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
 
- [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
+[*Convenience header: ][^boost/asio.hpp]
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
-
- ]
+[section:io_control posix::basic_descriptor::io_control]
 
- [
+[indexterm2 io_control..posix::basic_descriptor]
+Perform an IO control command on the descriptor.
 
- [[link boost_asio.reference.basic_datagram_socket.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
 
- [
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload1 io_control]``(
+ IoControlCommand & command);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload1 more...]]``
 
- [[link boost_asio.reference.basic_datagram_socket.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload2 io_control]``(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload2 more...]]``
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
+[section:overload1 posix::basic_descriptor::io_control (1 of 2 overloads)]
 
- [
 
- [[link boost_asio.reference.basic_datagram_socket.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
+Perform an IO control command on the descriptor.
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void io_control(
+ IoControlCommand & command);
 
- [
- [[link boost_asio.reference.basic_datagram_socket.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.async_receive [*async_receive]]]
- [Start an asynchronous receive on a connected socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.async_receive_from [*async_receive_from]]]
- [Start an asynchronous receive. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.async_send [*async_send]]]
- [Start an asynchronous send on a connected socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.async_send_to [*async_send_to]]]
- [Start an asynchronous send. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket [*basic_datagram_socket]]]
- [Construct a basic_datagram_socket without opening it.
 
- Construct and open a basic_datagram_socket.
+This function is used to execute an IO control command on the descriptor.
 
- Construct a basic_datagram_socket, opening it and binding it to the given local endpoint.
 
- Construct a basic_datagram_socket on an existing native socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.close [*close]]]
- [Close the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.get_option [*get_option]]]
- [Get an option from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
+[heading Parameters]
+
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.open [*open]]]
- [Open the socket using the specified protocol. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.receive [*receive]]]
- [Receive some data on a connected socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.receive_from [*receive_from]]]
- [Receive a datagram with the endpoint of the sender. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.send [*send]]]
- [Send some data on a connected socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.send_to [*send_to]]]
- [Send a datagram to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_datagram_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
+[variablelist
   
+[[command][The IO control command to be performed on the descriptor.]]
+
 ]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_datagram_socket.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
+[heading Exceptions]
+
 
- [
- [[link boost_asio.reference.basic_datagram_socket.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
- [
- [[link boost_asio.reference.basic_datagram_socket.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
- ]
+]
 
- [
- [[link boost_asio.reference.basic_datagram_socket.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
- ]
 
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
+[heading Example]
+
+Getting the number of bytes ready to read:
 
- [
- [[link boost_asio.reference.basic_datagram_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::posix::stream_descriptor::bytes_readable command;
+ descriptor.io_control(command);
+ std::size_t bytes_readable = command.get();
 
- [
- [[link boost_asio.reference.basic_datagram_socket.service [*service]]]
- [The service associated with the I/O object. ]
- ]
 
-]
 
-The [link boost_asio.reference.basic_datagram_socket `basic_datagram_socket`] class template provides asynchronous and blocking datagram-oriented socket functionality.
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
 
+[endsect]
 
 
 
-[heading Requirements]
+[section:overload2 posix::basic_descriptor::io_control (2 of 2 overloads)]
 
-[*Header: ][^boost/asio/local/datagram_protocol.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Perform an IO control command on the descriptor.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
 
 
+This function is used to execute an IO control command on the descriptor.
 
-[section:type local::datagram_protocol::type]
 
-[indexterm2 type..local::datagram_protocol]
-Obtain an identifier for the type of the protocol.
+[heading Parameters]
+
 
+[variablelist
+
+[[command][The IO control command to be performed on the descriptor.]]
 
- int type() const;
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
-[endsect]
 
+[heading Example]
+
+Getting the number of bytes ready to read:
 
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::posix::stream_descriptor::bytes_readable command;
+ boost::system::error_code ec;
+ descriptor.io_control(command, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ std::size_t bytes_readable = command.get();
 
-[endsect]
 
-[section:local__stream_protocol local::stream_protocol]
 
 
-Encapsulates the flags needed for stream-oriented UNIX sockets.
 
 
- class stream_protocol
 
+[endsect]
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+[endsect]
 
- [[link boost_asio.reference.local__stream_protocol.acceptor [*acceptor]]]
- [The UNIX domain acceptor type. ]
-
- ]
 
- [
+[section:is_open posix::basic_descriptor::is_open]
 
- [[link boost_asio.reference.local__stream_protocol.endpoint [*endpoint]]]
- [The type of a UNIX domain endpoint. ]
-
- ]
+[indexterm2 is_open..posix::basic_descriptor]
+Determine whether the descriptor is open.
 
- [
 
- [[link boost_asio.reference.local__stream_protocol.iostream [*iostream]]]
- [The UNIX domain iostream type. ]
-
- ]
+ bool is_open() const;
 
- [
 
- [[link boost_asio.reference.local__stream_protocol.socket [*socket]]]
- [The UNIX domain socket type. ]
-
- ]
 
-]
+[endsect]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.local__stream_protocol.family [*family]]]
- [Obtain an identifier for the protocol family. ]
- ]
-
- [
- [[link boost_asio.reference.local__stream_protocol.protocol [*protocol]]]
- [Obtain an identifier for the protocol. ]
- ]
-
- [
- [[link boost_asio.reference.local__stream_protocol.type [*type]]]
- [Obtain an identifier for the type of the protocol. ]
- ]
-
-]
+[section:lowest_layer posix::basic_descriptor::lowest_layer]
 
-The [link boost_asio.reference.local__stream_protocol `local::stream_protocol`] class contains flags necessary for stream-oriented UNIX domain sockets.
+[indexterm2 lowest_layer..posix::basic_descriptor]
+Get a reference to the lowest layer.
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+ lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 more...]]``
 
-[*Shared] [*objects:] Safe.
 
+Get a const reference to the lowest layer.
 
 
+ const lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 more...]]``
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/local/stream_protocol.hpp]
+[section:overload1 posix::basic_descriptor::lowest_layer (1 of 2 overloads)]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+Get a reference to the lowest layer.
 
-[section:acceptor local::stream_protocol::acceptor]
 
-[indexterm2 acceptor..local::stream_protocol]
-The UNIX domain acceptor type.
+ lowest_layer_type & lowest_layer();
 
 
- typedef basic_socket_acceptor< stream_protocol > acceptor;
+This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[heading Return Value]
+
+A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
 
- [
+[section:overload2 posix::basic_descriptor::lowest_layer (2 of 2 overloads)]
 
- [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+Get a const reference to the lowest layer.
 
- [[link boost_asio.reference.basic_socket_acceptor.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
 
- [
+ const lowest_layer_type & lowest_layer() const;
 
- [[link boost_asio.reference.basic_socket_acceptor.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
 
- [
+This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
 
- [[link boost_asio.reference.basic_socket_acceptor.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
- [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
- [The native representation of an acceptor. ]
-
- ]
 
- [
+[section:lowest_layer_type posix::basic_descriptor::lowest_layer_type]
 
- [[link boost_asio.reference.basic_socket_acceptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
+[indexterm2 lowest_layer_type..posix::basic_descriptor]
+A [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] is always the lowest layer.
 
- [
 
- [[link boost_asio.reference.basic_socket_acceptor.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+ typedef basic_descriptor< DescriptorService > lowest_layer_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
+ [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
+ [[link boost_asio.reference.posix__basic_descriptor.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
+ [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_descriptor is always the lowest layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
+ [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
+ [The native representation of a descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
+ [[link boost_asio.reference.posix__basic_descriptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.posix__basic_descriptor.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
+ [[link boost_asio.reference.posix__basic_descriptor.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
@@ -50915,119 +69271,106 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
- [Accept a new connection.
-
- Accept a new connection and obtain the endpoint of the peer. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
- [Assigns an existing native acceptor to the acceptor. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.async_accept [*async_accept]]]
- [Start an asynchronous accept. ]
+ [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
+ [Assign an existing native descriptor to the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
- [Construct an acceptor without opening it.
-
- Construct an open acceptor.
+ [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
+ [Construct a basic_descriptor without opening it.
 
- Construct an acceptor opened on the given endpoint.
+ Construct a basic_descriptor on an existing native descriptor.
 
- Construct a basic_socket_acceptor on an existing native acceptor. ]
+ Move-construct a basic_descriptor from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
- [Bind the acceptor to the given local endpoint. ]
+ [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the acceptor. ]
+ [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
+ [Close the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
- [Close the acceptor. ]
+ [[link boost_asio.reference.posix__basic_descriptor.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
+ [Perform an IO control command on the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.get_option [*get_option]]]
- [Get an option from the acceptor. ]
+ [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
+ [Determine whether the descriptor is open. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer.
+
+ Get a const reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
- [Determine whether the acceptor is open. ]
+ [[link boost_asio.reference.posix__basic_descriptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native descriptor representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.listen [*listen]]]
- [Place the acceptor into the state where it will listen for new connections. ]
+ [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
+ [Get the native descriptor representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the acceptor. ]
+ [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native descriptor implementation.
+
+ Sets the non-blocking mode of the native descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.native [*native]]]
- [Get the native acceptor representation. ]
+ [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the descriptor.
+
+ Sets the non-blocking mode of the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
- [Open the acceptor using the specified protocol. ]
+ [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_descriptor from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
- [Set an option on the acceptor. ]
+ [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
+ [Release ownership of the native descriptor implementation. ]
   ]
   
 ]
 
-[heading Data Members]
+[heading Protected Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_acceptor.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
+ [[link boost_asio.reference.posix__basic_descriptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_socket_acceptor.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
+ [[link boost_asio.reference.posix__basic_descriptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
+ [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
+ [Protected destructor to prevent deletion through this type. ]
   ]
-
+
 ]
 
 [heading Protected Data Members]
@@ -51035,47 +69378,85 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.posix__basic_descriptor.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.basic_socket_acceptor.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.posix__basic_descriptor.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.basic_socket_acceptor `basic_socket_acceptor`] class template is used for accepting new socket connections.
+The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe.
 
 
-[heading Example]
-
-Opening a socket acceptor with the SO\_REUSEADDR option enabled:
 
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
- acceptor.open(endpoint.protocol());
- acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
- acceptor.bind(endpoint);
- acceptor.listen();
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:native posix::basic_descriptor::native]
+
+[indexterm2 native..posix::basic_descriptor]
+(Deprecated: Use `native_handle()`.) Get the native descriptor representation.
+
+
+ native_type native();
+
+
+This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle posix::basic_descriptor::native_handle]
+
+[indexterm2 native_handle..posix::basic_descriptor]
+Get the native descriptor representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
+
+
+[endsect]
 
 
 
+[section:native_handle_type posix::basic_descriptor::native_handle_type]
+
+[indexterm2 native_handle_type..posix::basic_descriptor]
+The native representation of a descriptor.
 
 
+ typedef DescriptorService::native_handle_type native_handle_type;
+
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/local/stream_protocol.hpp]
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -51083,151 +69464,143 @@
 [endsect]
 
 
+[section:native_non_blocking posix::basic_descriptor::native_non_blocking]
 
-[section:endpoint local::stream_protocol::endpoint]
+[indexterm2 native_non_blocking..posix::basic_descriptor]
+Gets the non-blocking mode of the native descriptor implementation.
 
-[indexterm2 endpoint..local::stream_protocol]
-The type of a UNIX domain endpoint.
 
+ bool ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload1 more...]]``
 
- typedef basic_endpoint< stream_protocol > endpoint;
 
+Sets the non-blocking mode of the native descriptor implementation.
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+ void ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload2 more...]]``
 
- [[link boost_asio.reference.local__basic_endpoint.data_type [*data_type]]]
- [The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer. ]
-
- ]
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.native_non_blocking.overload3 more...]]``
 
- [
 
- [[link boost_asio.reference.local__basic_endpoint.protocol_type [*protocol_type]]]
- [The protocol type associated with the endpoint. ]
-
- ]
+[section:overload1 posix::basic_descriptor::native_non_blocking (1 of 3 overloads)]
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+Gets the non-blocking mode of the native descriptor implementation.
 
- [
- [[link boost_asio.reference.local__basic_endpoint.basic_endpoint [*basic_endpoint]]]
- [Default constructor.
 
- Construct an endpoint using the specified path name.
+ bool native_non_blocking() const;
 
- Copy constructor. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.capacity [*capacity]]]
- [Get the capacity of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.data [*data]]]
- [Get the underlying endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_eq_ [*operator=]]]
- [Assign from another endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.path [*path]]]
- [Get the path associated with the endpoint.
 
- Set the path associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.protocol [*protocol]]]
- [The protocol associated with the endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.resize [*resize]]]
- [Set the underlying size of the endpoint in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.size [*size]]]
- [Get the underlying size of the endpoint in the native type. ]
- ]
+This function is used to retrieve the non-blocking mode of the underlying native descriptor. This mode has no effect on the behaviour of the descriptor object's synchronous operations.
+
+
+[heading Return Value]
+
+`true` if the underlying descriptor is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
+
+
+[heading Remarks]
+
+The current non-blocking mode is cached by the descriptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native descriptor.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 posix::basic_descriptor::native_non_blocking (2 of 3 overloads)]
+
+
+Sets the non-blocking mode of the native descriptor implementation.
+
+
+ void native_non_blocking(
+ bool mode);
+
+
+This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
   
+[[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
 ]
 
-[heading Friends]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_not__eq_ [*operator!=]]]
- [Compare two endpoints for inequality. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt_ [*operator<]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt__eq_ [*operator<=]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_eq__eq_ [*operator==]]]
- [Compare two endpoints for equality. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_gt_ [*operator>]]]
- [Compare endpoints for ordering. ]
- ]
-
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_gt__eq_ [*operator>=]]]
- [Compare endpoints for ordering. ]
- ]
+[heading Exceptions]
+
+
+[variablelist
   
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
+
 ]
 
-[heading Related Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.local__basic_endpoint.operator_lt__lt_ [*operator<<]]]
- [Output an endpoint as a string. ]
- ]
+
+
+[endsect]
+
+
+
+[section:overload3 posix::basic_descriptor::native_non_blocking (3 of 3 overloads)]
+
+
+Sets the non-blocking mode of the native descriptor implementation.
+
+
+ boost::system::error_code native_non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
+
+
+[heading Parameters]
+
+
+[variablelist
   
+[[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
+
 ]
 
-The [link boost_asio.reference.local__basic_endpoint `local::basic_endpoint`] class template describes an endpoint that may be associated with a particular UNIX socket.
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[endsect]
+
+
+[endsect]
+
+
+[section:native_type posix::basic_descriptor::native_type]
+
+[indexterm2 native_type..posix::basic_descriptor]
+(Deprecated: Use native\_handle\_type.) The native representation of a descriptor.
 
 
+ typedef DescriptorService::native_handle_type native_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/local/stream_protocol.hpp]
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -51235,14 +69608,48 @@
 [endsect]
 
 
+[section:non_blocking posix::basic_descriptor::non_blocking]
 
-[section:family local::stream_protocol::family]
+[indexterm2 non_blocking..posix::basic_descriptor]
+Gets the non-blocking mode of the descriptor.
 
-[indexterm2 family..local::stream_protocol]
-Obtain an identifier for the protocol family.
 
+ bool ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the descriptor.
+
+
+ void ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.non_blocking.overload3 more...]]``
+
+
+[section:overload1 posix::basic_descriptor::non_blocking (1 of 3 overloads)]
+
+
+Gets the non-blocking mode of the descriptor.
+
+
+ bool non_blocking() const;
+
+
+
+[heading Return Value]
+
+`true` if the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
 
- int family() const;
 
 
 
@@ -51250,226 +69657,305 @@
 
 
 
-[section:iostream local::stream_protocol::iostream]
+[section:overload2 posix::basic_descriptor::non_blocking (2 of 3 overloads)]
 
-[indexterm2 iostream..local::stream_protocol]
-The UNIX domain iostream type.
 
+Sets the non-blocking mode of the descriptor.
 
- typedef basic_socket_iostream< stream_protocol > iostream;
 
+ void non_blocking(
+ bool mode);
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream [*basic_socket_iostream]]]
- [Construct a basic_socket_iostream without establishing a connection.
 
- Establish a connection to an endpoint corresponding to a resolver query. ]
- ]
+[heading Parameters]
+
+
+[variablelist
   
- [
- [[link boost_asio.reference.basic_socket_iostream.close [*close]]]
- [Close the connection. ]
- ]
+[[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
   
- [
- [[link boost_asio.reference.basic_socket_iostream.connect [*connect]]]
- [Establish a connection to an endpoint corresponding to a resolver query. ]
- ]
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 posix::basic_descriptor::non_blocking (3 of 3 overloads)]
+
+
+Sets the non-blocking mode of the descriptor.
+
+
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[heading Parameters]
+
+
+[variablelist
   
- [
- [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
- [Return a pointer to the underlying streambuf. ]
- ]
+[[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:non_blocking_io posix::basic_descriptor::non_blocking_io]
+
+
+['Inherited from posix::descriptor_base.]
+
+[indexterm2 non_blocking_io..posix::basic_descriptor]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the descriptor.
+
+
+ typedef implementation_defined non_blocking_io;
+
+
+
+Implements the FIONBIO IO control command.
+
+
+[heading Example]
+
+
+
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::descriptor_base::non_blocking_io command(true);
+ descriptor.io_control(command);
+
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:operator_eq_ posix::basic_descriptor::operator=]
+
+[indexterm2 operator=..posix::basic_descriptor]
+Move-assign a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] from another.
+
+
+ basic_descriptor & operator=(
+ basic_descriptor && other);
+
+
+This assignment operator moves a descriptor from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
   
+[[other][The other [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] object from which the move will occur.]]
+
 ]
 
 
-[heading Requirements]
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_descriptor(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
+
+[section:release posix::basic_descriptor::release]
+
+[indexterm2 release..posix::basic_descriptor]
+Release ownership of the native descriptor implementation.
+
+
+ native_handle_type release();
+
 
-[*Header: ][^boost/asio/local/stream_protocol.hpp]
+This function may be used to obtain the underlying representation of the descriptor. After calling this function, `is_open()` returns false. The caller is responsible for closing the descriptor.
 
-[*Convenience header: ][^boost/asio.hpp]
+All outstanding asynchronous read or write operations will finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
 
 [endsect]
 
 
 
-[section:protocol local::stream_protocol::protocol]
+[section:service posix::basic_descriptor::service]
 
-[indexterm2 protocol..local::stream_protocol]
-Obtain an identifier for the protocol.
 
+['Inherited from basic_io_object.]
 
- int protocol() const;
+[indexterm2 service..posix::basic_descriptor]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
+ service_type & service;
 
-[endsect]
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
 
-[section:socket local::stream_protocol::socket]
 
-[indexterm2 socket..local::stream_protocol]
-The UNIX domain socket type.
 
 
- typedef basic_stream_socket< stream_protocol > socket;
+[endsect]
 
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+[section:service_type posix::basic_descriptor::service_type]
 
- [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
 
- [
+['Inherited from basic_io_object.]
 
- [[link boost_asio.reference.basic_stream_socket.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+[indexterm2 service_type..posix::basic_descriptor]
+The type of the service that will be used to provide I/O operations.
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+ typedef DescriptorService service_type;
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
 
- [
+[heading Requirements]
 
- [[link boost_asio.reference.basic_stream_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
+[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
 
- [
+[*Convenience header: ][^boost/asio.hpp]
 
- [[link boost_asio.reference.basic_stream_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_stream_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
+[section:_basic_descriptor posix::basic_descriptor::~basic_descriptor]
 
- [
+[indexterm2 ~basic_descriptor..posix::basic_descriptor]
+Protected destructor to prevent deletion through this type.
 
- [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
 
- [
+ ~basic_descriptor();
 
- [[link boost_asio.reference.basic_stream_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
+[endsect]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.basic_stream_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
+[section:posix__basic_stream_descriptor posix::basic_stream_descriptor]
 
- [
 
- [[link boost_asio.reference.basic_stream_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+Provides stream-oriented descriptor functionality.
+
+
+ template<
+ typename ``[link boost_asio.reference.StreamDescriptorService StreamDescriptorService]`` = stream_descriptor_service>
+ class basic_stream_descriptor :
+ public posix::basic_descriptor< StreamDescriptorService >
+
+
+[heading Types]
+[table
+ [[Name][Description]]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.reuse_address [*reuse_address]]]
- [Socket option to allow the socket to be bound to an address that is already in use. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_descriptor is always the lowest layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
+ [The native representation of a descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.basic_stream_socket.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
   
   ]
 
@@ -51480,186 +69966,121 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_stream_socket.assign [*assign]]]
- [Assign an existing native socket to the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
+ [Assign an existing native descriptor to the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.async_read_some [*async_read_some]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
     [Start an asynchronous read. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.async_receive [*async_receive]]]
- [Start an asynchronous receive. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_send [*async_send]]]
- [Start an asynchronous send. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.async_write_some [*async_write_some]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
     [Start an asynchronous write. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.basic_stream_socket [*basic_stream_socket]]]
- [Construct a basic_stream_socket without opening it.
-
- Construct and open a basic_stream_socket.
+ [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
+ [Construct a basic_stream_descriptor without opening it.
 
- Construct a basic_stream_socket, opening it and binding it to the given local endpoint.
+ Construct a basic_stream_descriptor on an existing native descriptor.
 
- Construct a basic_stream_socket on an existing native socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
+ Move-construct a basic_stream_descriptor from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.close [*close]]]
- [Close the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
+ [Close the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.get_io_service [*get_io_service]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.get_io_service [*get_io_service]]]
     [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.get_option [*get_option]]]
- [Get an option from the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.is_open [*is_open]]]
- [Determine whether the socket is open. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
+ [Perform an IO control command on the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.local_endpoint [*local_endpoint]]]
- [Get the local endpoint of the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
+ [Determine whether the descriptor is open. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.lowest_layer [*lowest_layer]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
     [Get a reference to the lowest layer.
 
      Get a const reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.native [*native]]]
- [Get the native socket representation. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.open [*open]]]
- [Open the socket using the specified protocol. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native descriptor representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.read_some [*read_some]]]
- [Read some data from the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
+ [Get the native descriptor representation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.receive [*receive]]]
- [Receive some data on the socket.
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native descriptor implementation.
 
- Receive some data on a connected socket. ]
+ Sets the non-blocking mode of the native descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the descriptor.
+
+ Sets the non-blocking mode of the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.send [*send]]]
- [Send some data on the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_stream_descriptor from another. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
+ [Read some data from the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
+ [Release ownership of the native descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
- [Write some data to the socket. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
+ [Write some data to the descriptor. ]
   ]
   
 ]
 
-[heading Data Members]
+[heading Protected Member Functions]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
- [The maximum length of the queue of pending incoming connections. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.message_do_not_route [*message_do_not_route]]]
- [Specify that the data should not be subject to routing. ]
- ]
-
- [
- [[link boost_asio.reference.basic_stream_socket.message_out_of_band [*message_out_of_band]]]
- [Process out-of-band data. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
   ]
-
+
   [
- [[link boost_asio.reference.basic_stream_socket.message_peek [*message_peek]]]
- [Peek at incoming data without removing it from the input queue. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
-
+
 ]
 
 [heading Protected Data Members]
@@ -51667,48 +70088,295 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.basic_stream_socket.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.basic_stream_socket.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.basic_stream_socket `basic_stream_socket`] class template provides asynchronous and blocking stream-oriented socket functionality.
+The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+[section:assign posix::basic_stream_descriptor::assign]
+
+[indexterm2 assign..posix::basic_stream_descriptor]
+Assign an existing native descriptor to the descriptor.
+
+
+ void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 assign]``(
+ const native_handle_type & native_descriptor);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 assign]``(
+ const native_handle_type & native_descriptor,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 more...]]``
+
+
+[section:overload1 posix::basic_stream_descriptor::assign (1 of 2 overloads)]
+
+
+['Inherited from posix::basic_descriptor.]
+
+
+Assign an existing native descriptor to the descriptor.
+
+
+ void assign(
+ const native_handle_type & native_descriptor);
+
+
+
+[endsect]
+
+
+
+[section:overload2 posix::basic_stream_descriptor::assign (2 of 2 overloads)]
+
+
+['Inherited from posix::basic_descriptor.]
+
+
+Assign an existing native descriptor to the descriptor.
+
+
+ boost::system::error_code assign(
+ const native_handle_type & native_descriptor,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:async_read_some posix::basic_stream_descriptor::async_read_some]
+
+[indexterm2 async_read_some..posix::basic_stream_descriptor]
+Start an asynchronous read.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_some(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+
+
+This function is used to asynchronously read data from the stream descriptor. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes read.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
+
+
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ descriptor.async_read_some(boost::asio::buffer(data, size), handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+
+[section:async_write_some posix::basic_stream_descriptor::async_write_some]
+
+[indexterm2 async_write_some..posix::basic_stream_descriptor]
+Start an asynchronous write.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_some(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
+
+
+This function is used to asynchronously write data to the stream descriptor. The function call always returns immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be written to the descriptor. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
+
+[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
+``
+ void handler(
+ const boost::system::error_code& error, // Result of operation.
+ std::size_t bytes_transferred // Number of bytes written.
+ );
+``
+Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
+
+]
+
+
+[heading Remarks]
+
+The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
+
+
+[heading Example]
+
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ descriptor.async_write_some(boost::asio::buffer(data, size), handler);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+
+
+[endsect]
+
+
+[section:basic_stream_descriptor posix::basic_stream_descriptor::basic_stream_descriptor]
+
+[indexterm2 basic_stream_descriptor..posix::basic_stream_descriptor]
+Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] without opening it.
+
+
+ explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 basic_stream_descriptor]``(
+ boost::asio::io_service & io_service);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 more...]]``
+
+
+Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] on an existing native descriptor.
+
+
+ ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 basic_stream_descriptor]``(
+ boost::asio::io_service & io_service,
+ const native_handle_type & native_descriptor);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 more...]]``
+
+
+Move-construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] from another.
+
+
+ ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 basic_stream_descriptor]``(
+ basic_stream_descriptor && other);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload3 more...]]``
+
+
+[section:overload1 posix::basic_stream_descriptor::basic_stream_descriptor (1 of 3 overloads)]
+
+
+Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] without opening it.
+
+
+ basic_stream_descriptor(
+ boost::asio::io_service & io_service);
+
+
+This constructor creates a stream descriptor without opening it. The descriptor needs to be opened and then connected or accepted before data can be sent or received on it.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
+
+]
+
+
+
+
+[endsect]
+
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+[section:overload2 posix::basic_stream_descriptor::basic_stream_descriptor (2 of 3 overloads)]
 
-[*Shared] [*objects:] Unsafe.
 
+Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] on an existing native descriptor.
 
 
+ basic_stream_descriptor(
+ boost::asio::io_service & io_service,
+ const native_handle_type & native_descriptor);
 
 
-[heading Requirements]
+This constructor creates a stream descriptor object to hold an existing native descriptor.
 
-[*Header: ][^boost/asio/local/stream_protocol.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Parameters]
+
 
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor.]]
 
-[endsect]
+[[native_descriptor][The new underlying descriptor implementation.]]
 
+]
 
 
-[section:type local::stream_protocol::type]
+[heading Exceptions]
+
 
-[indexterm2 type..local::stream_protocol]
-Obtain an identifier for the type of the protocol.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
- int type() const;
 
 
 
@@ -51716,187 +70384,155 @@
 
 
 
-[endsect]
+[section:overload3 posix::basic_stream_descriptor::basic_stream_descriptor (3 of 3 overloads)]
 
-[section:mutable_buffer mutable_buffer]
 
+Move-construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] from another.
 
-Holds a buffer that can be modified.
 
+ basic_stream_descriptor(
+ basic_stream_descriptor && other);
 
- class mutable_buffer
 
+This constructor moves a stream descriptor from one object to another.
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
- [Construct an empty buffer.
+[heading Parameters]
+
 
- Construct a buffer to represent a given memory range. ]
- ]
+[variablelist
   
-]
-
-[heading Related Functions]
-[table
- [[Name][Description]]
+[[other][The other [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] object from which the move will occur.]]
 
- [
- [[link boost_asio.reference.mutable_buffer.buffer_cast [*buffer_cast]]]
- [Cast a non-modifiable buffer to a specified pointer to POD type. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffer.buffer_size [*buffer_size]]]
- [Get the number of bytes in a non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
- [Create a new modifiable buffer that is offset from the start of another. ]
- ]
-
 ]
 
-The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
-
-[heading Requirements]
 
-[*Header: ][^boost/asio/buffer.hpp]
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(io_service&) constructor`.
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[section:buffer_cast mutable_buffer::buffer_cast]
 
-[indexterm2 buffer_cast..mutable_buffer]
-Cast a non-modifiable buffer to a specified pointer to POD type.
+[endsect]
 
 
- template<
- typename PointerToPodType>
- PointerToPodType buffer_cast(
- const mutable_buffer & b);
+[endsect]
 
 
+[section:bytes_readable posix::basic_stream_descriptor::bytes_readable]
 
-[endsect]
 
+['Inherited from posix::descriptor_base.]
 
+[indexterm2 bytes_readable..posix::basic_stream_descriptor]
+IO control command to get the amount of data that can be read without blocking.
 
-[section:buffer_size mutable_buffer::buffer_size]
 
-[indexterm2 buffer_size..mutable_buffer]
-Get the number of bytes in a non-modifiable buffer.
+ typedef implementation_defined bytes_readable;
 
 
- std::size_t buffer_size(
- const mutable_buffer & b);
 
+Implements the FIONREAD IO control command.
 
 
-[endsect]
+[heading Example]
+
 
 
-[section:mutable_buffer mutable_buffer::mutable_buffer]
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::descriptor_base::bytes_readable command(true);
+ descriptor.io_control(command);
+ std::size_t bytes_readable = command.get();
 
-[indexterm2 mutable_buffer..mutable_buffer]
-Construct an empty buffer.
 
 
- ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 mutable_buffer]``();
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload1 more...]]``
 
 
-Construct a buffer to represent a given memory range.
 
 
- ``[link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 mutable_buffer]``(
- void * data,
- std::size_t size);
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.mutable_buffer.overload2 more...]]``
+[heading Requirements]
 
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
 
-[section:overload1 mutable_buffer::mutable_buffer (1 of 2 overloads)]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Construct an empty buffer.
+[endsect]
 
 
- mutable_buffer();
+[section:cancel posix::basic_stream_descriptor::cancel]
 
+[indexterm2 cancel..posix::basic_stream_descriptor]
+Cancel all asynchronous operations associated with the descriptor.
 
 
-[endsect]
+ void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 cancel]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 more...]]``
 
 
-[section:overload2 mutable_buffer::mutable_buffer (2 of 2 overloads)]
+[section:overload1 posix::basic_stream_descriptor::cancel (1 of 2 overloads)]
 
 
-Construct a buffer to represent a given memory range.
+['Inherited from posix::basic_descriptor.]
 
 
- mutable_buffer(
- void * data,
- std::size_t size);
+Cancel all asynchronous operations associated with the descriptor.
 
 
+ void cancel();
 
-[endsect]
 
+This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
-[endsect]
 
-[section:operator_plus_ mutable_buffer::operator+]
+[heading Exceptions]
+
 
-[indexterm2 operator+..mutable_buffer]
-Create a new modifiable buffer that is offset from the start of another.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
- mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload1 operator+]``(
- const mutable_buffer & b,
- std::size_t start);
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload1 more...]]``
 
- mutable_buffer ``[link boost_asio.reference.mutable_buffer.operator_plus_.overload2 operator+]``(
- std::size_t start,
- const mutable_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffer.operator_plus_.overload2 more...]]``
 
 
-[section:overload1 mutable_buffer::operator+ (1 of 2 overloads)]
+[endsect]
 
 
-Create a new modifiable buffer that is offset from the start of another.
 
+[section:overload2 posix::basic_stream_descriptor::cancel (2 of 2 overloads)]
 
- mutable_buffer operator+(
- const mutable_buffer & b,
- std::size_t start);
 
+['Inherited from posix::basic_descriptor.]
 
 
-[endsect]
+Cancel all asynchronous operations associated with the descriptor.
 
 
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
 
-[section:overload2 mutable_buffer::operator+ (2 of 2 overloads)]
 
+This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
 
-Create a new modifiable buffer that is offset from the start of another.
 
+[heading Parameters]
+
 
- mutable_buffer operator+(
- std::size_t start,
- const mutable_buffer & b);
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. ]]
 
+]
 
 
-[endsect]
 
 
 [endsect]
@@ -51904,400 +70540,315 @@
 
 [endsect]
 
-[section:mutable_buffers_1 mutable_buffers_1]
+[section:close posix::basic_stream_descriptor::close]
 
+[indexterm2 close..posix::basic_stream_descriptor]
+Close the descriptor.
 
-Adapts a single modifiable buffer so that it meets the requirements of the MutableBufferSequence concept.
 
+ void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 close]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 more...]]``
 
- class mutable_buffers_1 :
- public mutable_buffer
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 close]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 more...]]``
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[section:overload1 posix::basic_stream_descriptor::close (1 of 2 overloads)]
 
- [
 
- [[link boost_asio.reference.mutable_buffers_1.const_iterator [*const_iterator]]]
- [A random-access iterator type that may be used to read elements. ]
-
- ]
+['Inherited from posix::basic_descriptor.]
 
- [
 
- [[link boost_asio.reference.mutable_buffers_1.value_type [*value_type]]]
- [The type for each element in the list of buffers. ]
-
- ]
+Close the descriptor.
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+ void close();
 
- [
- [[link boost_asio.reference.mutable_buffers_1.begin [*begin]]]
- [Get a random-access iterator to the first element. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffers_1.end [*end]]]
- [Get a random-access iterator for one past the last element. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1 [*mutable_buffers_1]]]
- [Construct to represent a given memory range.
 
- Construct to represent a single modifiable buffer. ]
- ]
-
-]
+This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
-[heading Related Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.mutable_buffers_1.buffer_cast [*buffer_cast]]]
- [Cast a non-modifiable buffer to a specified pointer to POD type. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffers_1.buffer_size [*buffer_size]]]
- [Get the number of bytes in a non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffers_1.operator_plus_ [*operator+]]]
- [Create a new modifiable buffer that is offset from the start of another. ]
- ]
-
-]
+[heading Exceptions]
+
 
-[heading Requirements]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
 
-[*Header: ][^boost/asio/buffer.hpp]
+]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[section:begin mutable_buffers_1::begin]
 
-[indexterm2 begin..mutable_buffers_1]
-Get a random-access iterator to the first element.
+[endsect]
 
 
- const_iterator begin() const;
 
+[section:overload2 posix::basic_stream_descriptor::close (2 of 2 overloads)]
 
 
-[endsect]
+['Inherited from posix::basic_descriptor.]
 
 
+Close the descriptor.
 
-[section:buffer_cast mutable_buffers_1::buffer_cast]
 
+ boost::system::error_code close(
+ boost::system::error_code & ec);
 
-['Inherited from mutable_buffer.]
 
-[indexterm2 buffer_cast..mutable_buffers_1]
-Cast a non-modifiable buffer to a specified pointer to POD type.
+This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
 
- template<
- typename PointerToPodType>
- PointerToPodType buffer_cast(
- const mutable_buffer & b);
+[heading Parameters]
+
 
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. Note that, even if the function indicates an error, the underlying descriptor is closed. ]]
 
+]
 
-[endsect]
 
 
 
-[section:buffer_size mutable_buffers_1::buffer_size]
+[endsect]
 
 
-['Inherited from mutable_buffer.]
+[endsect]
 
-[indexterm2 buffer_size..mutable_buffers_1]
-Get the number of bytes in a non-modifiable buffer.
+[section:get_implementation posix::basic_stream_descriptor::get_implementation]
 
+[indexterm2 get_implementation..posix::basic_stream_descriptor]
+Get the underlying implementation of the I/O object.
 
- std::size_t buffer_size(
- const mutable_buffer & b);
 
+ implementation_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.get_implementation.overload1 more...]]``
 
+ const implementation_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.get_implementation.overload2 more...]]``
 
-[endsect]
 
+[section:overload1 posix::basic_stream_descriptor::get_implementation (1 of 2 overloads)]
 
 
-[section:const_iterator mutable_buffers_1::const_iterator]
+['Inherited from basic_io_object.]
 
-[indexterm2 const_iterator..mutable_buffers_1]
-A random-access iterator type that may be used to read elements.
 
+Get the underlying implementation of the I/O object.
 
- typedef const mutable_buffer * const_iterator;
 
+ implementation_type & get_implementation();
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/buffer.hpp]
+[endsect]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
-[endsect]
+[section:overload2 posix::basic_stream_descriptor::get_implementation (2 of 2 overloads)]
 
 
+['Inherited from basic_io_object.]
 
-[section:end mutable_buffers_1::end]
 
-[indexterm2 end..mutable_buffers_1]
-Get a random-access iterator for one past the last element.
+Get the underlying implementation of the I/O object.
 
 
- const_iterator end() const;
+ const implementation_type & get_implementation() const;
 
 
 
 [endsect]
 
 
-[section:mutable_buffers_1 mutable_buffers_1::mutable_buffers_1]
-
-[indexterm2 mutable_buffers_1..mutable_buffers_1]
-Construct to represent a given memory range.
+[endsect]
 
 
- ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 mutable_buffers_1]``(
- void * data,
- std::size_t size);
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload1 more...]]``
+[section:get_io_service posix::basic_stream_descriptor::get_io_service]
 
 
-Construct to represent a single modifiable buffer.
+['Inherited from basic_io_object.]
 
+[indexterm2 get_io_service..posix::basic_stream_descriptor]
+Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
- explicit ``[link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 mutable_buffers_1]``(
- const mutable_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.mutable_buffers_1.overload2 more...]]``
 
+ boost::asio::io_service & get_io_service();
 
-[section:overload1 mutable_buffers_1::mutable_buffers_1 (1 of 2 overloads)]
 
+This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
-Construct to represent a given memory range.
 
+[heading Return Value]
+
+A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
- mutable_buffers_1(
- void * data,
- std::size_t size);
 
 
 
 [endsect]
 
 
+[section:get_service posix::basic_stream_descriptor::get_service]
 
-[section:overload2 mutable_buffers_1::mutable_buffers_1 (2 of 2 overloads)]
+[indexterm2 get_service..posix::basic_stream_descriptor]
+Get the service associated with the I/O object.
 
 
-Construct to represent a single modifiable buffer.
+ service_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.get_service.overload1 more...]]``
 
+ const service_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.get_service.overload2 more...]]``
 
- mutable_buffers_1(
- const mutable_buffer & b);
 
+[section:overload1 posix::basic_stream_descriptor::get_service (1 of 2 overloads)]
 
 
-[endsect]
+['Inherited from basic_io_object.]
 
 
-[endsect]
+Get the service associated with the I/O object.
 
-[section:operator_plus_ mutable_buffers_1::operator+]
 
-[indexterm2 operator+..mutable_buffers_1]
-Create a new modifiable buffer that is offset from the start of another.
+ service_type & get_service();
 
 
- mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 operator+]``(
- const mutable_buffer & b,
- std::size_t start);
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload1 more...]]``
 
- mutable_buffer ``[link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 operator+]``(
- std::size_t start,
- const mutable_buffer & b);
- `` [''''&raquo;''' [link boost_asio.reference.mutable_buffers_1.operator_plus_.overload2 more...]]``
+[endsect]
 
 
-[section:overload1 mutable_buffers_1::operator+ (1 of 2 overloads)]
 
+[section:overload2 posix::basic_stream_descriptor::get_service (2 of 2 overloads)]
 
-['Inherited from mutable_buffer.]
 
+['Inherited from basic_io_object.]
 
-Create a new modifiable buffer that is offset from the start of another.
 
+Get the service associated with the I/O object.
 
- mutable_buffer operator+(
- const mutable_buffer & b,
- std::size_t start);
+
+ const service_type & get_service() const;
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:overload2 mutable_buffers_1::operator+ (2 of 2 overloads)]
 
+[section:implementation posix::basic_stream_descriptor::implementation]
 
-['Inherited from mutable_buffer.]
 
+['Inherited from basic_io_object.]
 
-Create a new modifiable buffer that is offset from the start of another.
+[indexterm2 implementation..posix::basic_stream_descriptor]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
 
 
- mutable_buffer operator+(
- std::size_t start,
- const mutable_buffer & b);
+ implementation_type implementation;
 
 
 
 [endsect]
 
 
-[endsect]
 
+[section:implementation_type posix::basic_stream_descriptor::implementation_type]
 
-[section:value_type mutable_buffers_1::value_type]
 
-[indexterm2 value_type..mutable_buffers_1]
-The type for each element in the list of buffers.
+['Inherited from basic_io_object.]
 
+[indexterm2 implementation_type..posix::basic_stream_descriptor]
+The underlying implementation type of I/O object.
 
- typedef mutable_buffer value_type;
 
+ typedef service_type::implementation_type implementation_type;
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
- [Construct an empty buffer.
 
- Construct a buffer to represent a given memory range. ]
- ]
-
-]
+[heading Requirements]
 
-[heading Related Functions]
-[table
- [[Name][Description]]
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
 
- [
- [[link boost_asio.reference.mutable_buffer.buffer_cast [*buffer_cast]]]
- [Cast a non-modifiable buffer to a specified pointer to POD type. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffer.buffer_size [*buffer_size]]]
- [Get the number of bytes in a non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
- [Create a new modifiable buffer that is offset from the start of another. ]
- ]
-
-]
+[*Convenience header: ][^boost/asio.hpp]
 
-The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
 
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/buffer.hpp]
+[section:io_control posix::basic_stream_descriptor::io_control]
 
-[*Convenience header: ][^boost/asio.hpp]
+[indexterm2 io_control..posix::basic_stream_descriptor]
+Perform an IO control command on the descriptor.
 
 
-[endsect]
+ void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 io_control]``(
+ IoControlCommand & command);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 more...]]``
 
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 io_control]``(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 more...]]``
 
 
-[endsect]
+[section:overload1 posix::basic_stream_descriptor::io_control (1 of 2 overloads)]
 
-[section:null_buffers null_buffers]
 
+['Inherited from posix::basic_descriptor.]
 
-An implementation of both the ConstBufferSequence and MutableBufferSequence concepts to represent a null buffer sequence.
 
+Perform an IO control command on the descriptor.
 
- class null_buffers
 
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void io_control(
+ IoControlCommand & command);
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+This function is used to execute an IO control command on the descriptor.
 
- [[link boost_asio.reference.null_buffers.const_iterator [*const_iterator]]]
- [A random-access iterator type that may be used to read elements. ]
-
- ]
 
- [
+[heading Parameters]
+
 
- [[link boost_asio.reference.null_buffers.value_type [*value_type]]]
- [The type for each element in the list of buffers. ]
+[variablelist
   
- ]
+[[command][The IO control command to be performed on the descriptor.]]
 
 ]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.null_buffers.begin [*begin]]]
- [Get a random-access iterator to the first element. ]
- ]
-
- [
- [[link boost_asio.reference.null_buffers.end [*end]]]
- [Get a random-access iterator for one past the last element. ]
- ]
+[heading Exceptions]
+
+
+[variablelist
   
+[[boost::system::system_error][Thrown on failure.]]
+
 ]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/buffer.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Example]
+
+Getting the number of bytes ready to read:
 
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::posix::stream_descriptor::bytes_readable command;
+ descriptor.io_control(command);
+ std::size_t bytes_readable = command.get();
 
-[section:begin null_buffers::begin]
 
-[indexterm2 begin..null_buffers]
-Get a random-access iterator to the first element.
 
 
- const_iterator begin() const;
 
 
 
@@ -52305,171 +70856,162 @@
 
 
 
-[section:const_iterator null_buffers::const_iterator]
+[section:overload2 posix::basic_stream_descriptor::io_control (2 of 2 overloads)]
 
-[indexterm2 const_iterator..null_buffers]
-A random-access iterator type that may be used to read elements.
 
+['Inherited from posix::basic_descriptor.]
 
- typedef const mutable_buffer * const_iterator;
 
+Perform an IO control command on the descriptor.
 
 
-[heading Requirements]
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
 
-[*Header: ][^boost/asio/buffer.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+This function is used to execute an IO control command on the descriptor.
 
 
-[endsect]
+[heading Parameters]
+
+
+[variablelist
+
+[[command][The IO control command to be performed on the descriptor.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
+
+
+
+[heading Example]
+
+Getting the number of bytes ready to read:
 
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::posix::stream_descriptor::bytes_readable command;
+ boost::system::error_code ec;
+ descriptor.io_control(command, ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ std::size_t bytes_readable = command.get();
 
-[section:end null_buffers::end]
 
-[indexterm2 end..null_buffers]
-Get a random-access iterator for one past the last element.
 
 
- const_iterator end() const;
 
 
 
 [endsect]
 
 
+[endsect]
 
-[section:value_type null_buffers::value_type]
-
-[indexterm2 value_type..null_buffers]
-The type for each element in the list of buffers.
 
+[section:is_open posix::basic_stream_descriptor::is_open]
 
- typedef mutable_buffer value_type;
 
+['Inherited from posix::basic_descriptor.]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[indexterm2 is_open..posix::basic_stream_descriptor]
+Determine whether the descriptor is open.
 
- [
- [[link boost_asio.reference.mutable_buffer.mutable_buffer [*mutable_buffer]]]
- [Construct an empty buffer.
 
- Construct a buffer to represent a given memory range. ]
- ]
-
-]
+ bool is_open() const;
 
-[heading Related Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.mutable_buffer.buffer_cast [*buffer_cast]]]
- [Cast a non-modifiable buffer to a specified pointer to POD type. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffer.buffer_size [*buffer_size]]]
- [Get the number of bytes in a non-modifiable buffer. ]
- ]
-
- [
- [[link boost_asio.reference.mutable_buffer.operator_plus_ [*operator+]]]
- [Create a new modifiable buffer that is offset from the start of another. ]
- ]
-
-]
 
-The [link boost_asio.reference.mutable_buffer `mutable_buffer`] class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.
+[endsect]
 
 
-[heading Requirements]
+[section:lowest_layer posix::basic_stream_descriptor::lowest_layer]
 
-[*Header: ][^boost/asio/buffer.hpp]
+[indexterm2 lowest_layer..posix::basic_stream_descriptor]
+Get a reference to the lowest layer.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 more...]]``
 
-[endsect]
 
+Get a const reference to the lowest layer.
 
 
-[endsect]
+ const lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 more...]]``
 
 
-[section:placeholders__bytes_transferred placeholders::bytes_transferred]
+[section:overload1 posix::basic_stream_descriptor::lowest_layer (1 of 2 overloads)]
 
-[indexterm1 placeholders::bytes_transferred]
-An argument placeholder, for use with boost::bind(), that corresponds to the bytes\_transferred argument of a handler for asynchronous functions such as `boost::asio::basic_stream_socket::async_write_some` or `boost::asio::async_write`.
 
+['Inherited from posix::basic_descriptor.]
 
- unspecified bytes_transferred;
 
+Get a reference to the lowest layer.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/placeholders.hpp]
+ lowest_layer_type & lowest_layer();
 
-[*Convenience header: ][^boost/asio.hpp]
 
+This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
 
-[endsect]
 
+[heading Return Value]
+
+A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
 
-[section:placeholders__error placeholders::error]
 
-[indexterm1 placeholders::error]
-An argument placeholder, for use with boost::bind(), that corresponds to the error argument of a handler for any of the asynchronous functions.
 
+[endsect]
 
- unspecified error;
 
 
-[heading Requirements]
+[section:overload2 posix::basic_stream_descriptor::lowest_layer (2 of 2 overloads)]
 
-[*Header: ][^boost/asio/placeholders.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+['Inherited from posix::basic_descriptor.]
 
 
-[endsect]
+Get a const reference to the lowest layer.
 
 
+ const lowest_layer_type & lowest_layer() const;
 
-[section:placeholders__iterator placeholders::iterator]
 
-[indexterm1 placeholders::iterator]
-An argument placeholder, for use with boost::bind(), that corresponds to the iterator argument of a handler for asynchronous functions such as boost::asio::basic\_resolver::resolve.
+This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
 
 
- unspecified iterator;
+[heading Return Value]
+
+A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/placeholders.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
 [endsect]
 
 
-[section:posix__basic_descriptor posix::basic_descriptor]
+[section:lowest_layer_type posix::basic_stream_descriptor::lowest_layer_type]
 
 
-Provides POSIX descriptor functionality.
+['Inherited from posix::basic_descriptor.]
 
+[indexterm2 lowest_layer_type..posix::basic_stream_descriptor]
+A [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] is always the lowest layer.
 
- template<
- typename ``[link boost_asio.reference.DescriptorService DescriptorService]``>
- class basic_descriptor :
- public basic_io_object< DescriptorService >,
- public posix::descriptor_base
+
+ typedef basic_descriptor< StreamDescriptorService > lowest_layer_type;
 
 
 [heading Types]
@@ -52499,15 +71041,22 @@
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.native_type [*native_type]]]
+ [[link boost_asio.reference.posix__basic_descriptor.native_handle_type [*native_handle_type]]]
     [The native representation of a descriptor. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.posix__basic_descriptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a descriptor. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.posix__basic_descriptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the descriptor. ]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the descriptor. ]
   
   ]
 
@@ -52533,7 +71082,9 @@
     [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
     [Construct a basic_descriptor without opening it.
 
- Construct a basic_descriptor on an existing native descriptor. ]
+ Construct a basic_descriptor on an existing native descriptor.
+
+ Move-construct a basic_descriptor from another. ]
   ]
   
   [
@@ -52557,11 +71108,6 @@
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
     [Determine whether the descriptor is open. ]
   ]
@@ -52575,9 +71121,38 @@
   
   [
     [[link boost_asio.reference.posix__basic_descriptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native descriptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.native_handle [*native_handle]]]
     [Get the native descriptor representation. ]
   ]
   
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native descriptor implementation.
+
+ Sets the non-blocking mode of the native descriptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the descriptor.
+
+ Sets the non-blocking mode of the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_descriptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.release [*release]]]
+ [Release ownership of the native descriptor implementation. ]
+ ]
+
 ]
 
 [heading Protected Member Functions]
@@ -52585,6 +71160,16 @@
   [[Name][Description]]
 
   [
+ [[link boost_asio.reference.posix__basic_descriptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_descriptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
     [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
     [Protected destructor to prevent deletion through this type. ]
   ]
@@ -52597,12 +71182,12 @@
 
   [
     [[link boost_asio.reference.posix__basic_descriptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.posix__basic_descriptor.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -52618,101 +71203,122 @@
 
 
 
+
 [heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:assign posix::basic_descriptor::assign]
 
-[indexterm2 assign..posix::basic_descriptor]
-Assign an existing native descriptor to the descriptor.
+[endsect]
 
 
- void ``[link boost_asio.reference.posix__basic_descriptor.assign.overload1 assign]``(
- const native_type & native_descriptor);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.assign.overload2 assign]``(
- const native_type & native_descriptor,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.assign.overload2 more...]]``
+[section:native posix::basic_stream_descriptor::native]
 
 
-[section:overload1 posix::basic_descriptor::assign (1 of 2 overloads)]
+['Inherited from posix::basic_descriptor.]
 
+[indexterm2 native..posix::basic_stream_descriptor]
+(Deprecated: Use `native_handle()`.) Get the native descriptor representation.
 
-Assign an existing native descriptor to the descriptor.
 
+ native_type native();
 
- void assign(
- const native_type & native_descriptor);
 
+This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
 
 
 [endsect]
 
 
 
-[section:overload2 posix::basic_descriptor::assign (2 of 2 overloads)]
+[section:native_handle posix::basic_stream_descriptor::native_handle]
 
 
-Assign an existing native descriptor to the descriptor.
+['Inherited from posix::basic_descriptor.]
 
+[indexterm2 native_handle..posix::basic_stream_descriptor]
+Get the native descriptor representation.
 
- boost::system::error_code assign(
- const native_type & native_descriptor,
- boost::system::error_code & ec);
 
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
 
 
 [endsect]
 
 
+
+[section:native_handle_type posix::basic_stream_descriptor::native_handle_type]
+
+[indexterm2 native_handle_type..posix::basic_stream_descriptor]
+The native representation of a descriptor.
+
+
+ typedef StreamDescriptorService::native_handle_type native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
 [endsect]
 
-[section:basic_descriptor posix::basic_descriptor::basic_descriptor]
 
-[indexterm2 basic_descriptor..posix::basic_descriptor]
-Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] without opening it.
+[section:native_non_blocking posix::basic_stream_descriptor::native_non_blocking]
 
+[indexterm2 native_non_blocking..posix::basic_stream_descriptor]
+Gets the non-blocking mode of the native descriptor implementation.
 
- explicit ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 basic_descriptor]``(
- boost::asio::io_service & io_service);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload1 more...]]``
 
+ bool ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 native_non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload1 more...]]``
 
-Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] on an existing native descriptor.
 
+Sets the non-blocking mode of the native descriptor implementation.
 
- ``[link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 basic_descriptor]``(
- boost::asio::io_service & io_service,
- const native_type & native_descriptor);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.basic_descriptor.overload2 more...]]``
 
+ void ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 native_non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload2 more...]]``
 
-[section:overload1 posix::basic_descriptor::basic_descriptor (1 of 2 overloads)]
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 native_non_blocking]``(
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking.overload3 more...]]``
 
 
-Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] without opening it.
+[section:overload1 posix::basic_stream_descriptor::native_non_blocking (1 of 3 overloads)]
 
 
- basic_descriptor(
- boost::asio::io_service & io_service);
+['Inherited from posix::basic_descriptor.]
 
 
-This constructor creates a descriptor without opening it.
+Gets the non-blocking mode of the native descriptor implementation.
 
 
-[heading Parameters]
-
+ bool native_non_blocking() const;
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
 
-]
+This function is used to retrieve the non-blocking mode of the underlying native descriptor. This mode has no effect on the behaviour of the descriptor object's synchronous operations.
+
+
+[heading Return Value]
+
+`true` if the underlying descriptor is in non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).
+
+
+[heading Remarks]
+
+The current non-blocking mode is cached by the descriptor object. Consequently, the return value may be incorrect if the non-blocking mode was set directly on the native descriptor.
 
 
 
@@ -52721,18 +71327,20 @@
 
 
 
-[section:overload2 posix::basic_descriptor::basic_descriptor (2 of 2 overloads)]
+[section:overload2 posix::basic_stream_descriptor::native_non_blocking (2 of 3 overloads)]
 
 
-Construct a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] on an existing native descriptor.
+['Inherited from posix::basic_descriptor.]
 
 
- basic_descriptor(
- boost::asio::io_service & io_service,
- const native_type & native_descriptor);
+Sets the non-blocking mode of the native descriptor implementation.
 
 
-This constructor creates a descriptor object to hold an existing native descriptor.
+ void native_non_blocking(
+ bool mode);
+
+
+This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
 
 
 [heading Parameters]
@@ -52740,9 +71348,7 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor.]]
-
-[[native_descriptor][A native descriptor.]]
+[[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
 
 ]
 
@@ -52752,7 +71358,7 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
 
 ]
 
@@ -52762,44 +71368,57 @@
 [endsect]
 
 
-[endsect]
 
+[section:overload3 posix::basic_stream_descriptor::native_non_blocking (3 of 3 overloads)]
 
-[section:bytes_readable posix::basic_descriptor::bytes_readable]
 
+['Inherited from posix::basic_descriptor.]
 
-['Inherited from posix::descriptor_base.]
 
-[indexterm2 bytes_readable..posix::basic_descriptor]
-IO control command to get the amount of data that can be read without blocking.
+Sets the non-blocking mode of the native descriptor implementation.
 
 
- typedef implementation_defined bytes_readable;
+ boost::system::error_code native_non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
 
 
+This function is used to modify the non-blocking mode of the underlying native descriptor. It has no effect on the behaviour of the descriptor object's synchronous operations.
 
-Implements the FIONREAD IO control command.
 
+[heading Parameters]
+
 
-[heading Example]
+[variablelist
   
+[[mode][If `true`, the underlying descriptor is put into non-blocking mode and direct system calls may fail with `boost::asio::error::would_block` (or the equivalent system error).]]
+
+[[ec][Set to indicate what error occurred, if any. If the `mode` is `false`, but the current value of `non_blocking()` is `true`, this function fails with `boost::asio::error::invalid_argument`, as the combination does not make sense. ]]
+
+]
 
 
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::descriptor_base::bytes_readable command(true);
- descriptor.io_control(command);
- std::size_t bytes_readable = command.get();
 
 
+[endsect]
+
+
+[endsect]
+
+
+[section:native_type posix::basic_stream_descriptor::native_type]
+
+[indexterm2 native_type..posix::basic_stream_descriptor]
+(Deprecated: Use native\_handle\_type.) The native representation of a descriptor.
 
 
+ typedef StreamDescriptorService::native_handle_type native_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -52807,30 +71426,80 @@
 [endsect]
 
 
-[section:cancel posix::basic_descriptor::cancel]
+[section:non_blocking posix::basic_stream_descriptor::non_blocking]
 
-[indexterm2 cancel..posix::basic_descriptor]
-Cancel all asynchronous operations associated with the descriptor.
+[indexterm2 non_blocking..posix::basic_stream_descriptor]
+Gets the non-blocking mode of the descriptor.
 
 
- void ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload1 cancel]``();
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload1 more...]]``
+ bool ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 non_blocking]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.cancel.overload2 cancel]``(
+
+Sets the non-blocking mode of the descriptor.
+
+
+ void ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 non_blocking]``(
+ bool mode);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload2 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 non_blocking]``(
+ bool mode,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.cancel.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.non_blocking.overload3 more...]]``
 
 
-[section:overload1 posix::basic_descriptor::cancel (1 of 2 overloads)]
+[section:overload1 posix::basic_stream_descriptor::non_blocking (1 of 3 overloads)]
 
 
-Cancel all asynchronous operations associated with the descriptor.
+['Inherited from posix::basic_descriptor.]
 
 
- void cancel();
+Gets the non-blocking mode of the descriptor.
 
 
-This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+ bool non_blocking() const;
+
+
+
+[heading Return Value]
+
+`true` if the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.
+
+
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 posix::basic_stream_descriptor::non_blocking (2 of 3 overloads)]
+
+
+['Inherited from posix::basic_descriptor.]
+
+
+Sets the non-blocking mode of the descriptor.
+
+
+ void non_blocking(
+ bool mode);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+]
 
 
 [heading Exceptions]
@@ -52838,28 +71507,35 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 posix::basic_descriptor::cancel (2 of 2 overloads)]
+[section:overload3 posix::basic_stream_descriptor::non_blocking (3 of 3 overloads)]
 
 
-Cancel all asynchronous operations associated with the descriptor.
+['Inherited from posix::basic_descriptor.]
 
 
- boost::system::error_code cancel(
- boost::system::error_code & ec);
+Sets the non-blocking mode of the descriptor.
 
 
-This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+ boost::system::error_code non_blocking(
+ bool mode,
+ boost::system::error_code & ec);
+
 
 
 [heading Parameters]
@@ -52867,11 +71543,18 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any. ]]
+[[mode][If `true`, the descriptor's synchronous operations will fail with `boost::asio::error::would_block` if they are unable to perform the requested operation immediately. If `false`, synchronous operations will block until complete.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+The non-blocking mode has no effect on the behaviour of asynchronous operations. Asynchronous operations will never fail with the error `boost::asio::error::would_block`.
+
+
 
 
 [endsect]
@@ -52879,59 +71562,115 @@
 
 [endsect]
 
-[section:close posix::basic_descriptor::close]
 
-[indexterm2 close..posix::basic_descriptor]
-Close the descriptor.
+[section:non_blocking_io posix::basic_stream_descriptor::non_blocking_io]
 
 
- void ``[link boost_asio.reference.posix__basic_descriptor.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload1 more...]]``
+['Inherited from posix::descriptor_base.]
 
- boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.close.overload2 close]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.close.overload2 more...]]``
+[indexterm2 non_blocking_io..posix::basic_stream_descriptor]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the descriptor.
 
 
-[section:overload1 posix::basic_descriptor::close (1 of 2 overloads)]
+ typedef implementation_defined non_blocking_io;
 
 
-Close the descriptor.
 
+Implements the FIONBIO IO control command.
 
- void close();
+
+[heading Example]
+
 
 
-This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::descriptor_base::non_blocking_io command(true);
+ descriptor.io_control(command);
 
 
-[heading Exceptions]
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:operator_eq_ posix::basic_stream_descriptor::operator=]
+
+[indexterm2 operator=..posix::basic_stream_descriptor]
+Move-assign a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] from another.
+
+
+ basic_stream_descriptor & operator=(
+ basic_stream_descriptor && other);
+
+
+This assignment operator moves a stream descriptor from one object to another.
+
+
+[heading Parameters]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[other][The other [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] object from which the move will occur.]]
 
 ]
 
 
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_descriptor(io_service&) constructor`.
+
 
 
-[endsect]
 
+[endsect]
 
 
-[section:overload2 posix::basic_descriptor::close (2 of 2 overloads)]
+[section:read_some posix::basic_stream_descriptor::read_some]
 
+[indexterm2 read_some..posix::basic_stream_descriptor]
+Read some data from the descriptor.
 
-Close the descriptor.
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 read_some]``(
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 more...]]``
 
- boost::system::error_code close(
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 read_some]``(
+ const MutableBufferSequence & buffers,
       boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 more...]]``
 
 
-This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
+[section:overload1 posix::basic_stream_descriptor::read_some (1 of 2 overloads)]
+
+
+Read some data from the descriptor.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
+
+
+This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -52939,55 +71678,131 @@
 
 [variablelist
   
-[[ec][Set to indicate what error occurred, if any. ]]
+[[buffers][One or more buffers into which the data will be read.]]
 
 ]
 
 
+[heading Return Value]
+
+The number of bytes read.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+
+]
+
+
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
+
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ descriptor.read_some(boost::asio::buffer(data, size));
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
-[endsect]
 
 
 [endsect]
 
 
-[section:get_io_service posix::basic_descriptor::get_io_service]
+
+[section:overload2 posix::basic_stream_descriptor::read_some (2 of 2 overloads)]
 
 
-['Inherited from basic_io_object.]
+Read some data from the descriptor.
 
-[indexterm2 get_io_service..posix::basic_descriptor]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
 
- boost::asio::io_service & get_io_service();
+This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be read.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
 
 
 [heading Return Value]
       
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+The number of bytes read. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
 
 
 
+[endsect]
+
 
 [endsect]
 
 
+[section:release posix::basic_stream_descriptor::release]
+
+
+['Inherited from posix::basic_descriptor.]
+
+[indexterm2 release..posix::basic_stream_descriptor]
+Release ownership of the native descriptor implementation.
+
+
+ native_handle_type release();
+
+
+This function may be used to obtain the underlying representation of the descriptor. After calling this function, `is_open()` returns false. The caller is responsible for closing the descriptor.
+
+All outstanding asynchronous read or write operations will finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
+
+
+[endsect]
+
 
-[section:implementation posix::basic_descriptor::implementation]
+
+[section:service posix::basic_stream_descriptor::service]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation..posix::basic_descriptor]
-The underlying implementation of the I/O object.
+[indexterm2 service..posix::basic_stream_descriptor]
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
+
+
+ service_type & service;
 
 
- implementation_type implementation;
+
+[heading Remarks]
+
+Available only for services that do not support movability.
+
 
 
 
@@ -52995,22 +71810,22 @@
 
 
 
-[section:implementation_type posix::basic_descriptor::implementation_type]
+[section:service_type posix::basic_stream_descriptor::service_type]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..posix::basic_descriptor]
-The underlying implementation type of I/O object.
+[indexterm2 service_type..posix::basic_stream_descriptor]
+The type of the service that will be used to provide I/O operations.
 
 
- typedef service_type::implementation_type implementation_type;
+ typedef StreamDescriptorService service_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
+[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -53018,39 +71833,39 @@
 [endsect]
 
 
-[section:io_control posix::basic_descriptor::io_control]
+[section:write_some posix::basic_stream_descriptor::write_some]
 
-[indexterm2 io_control..posix::basic_descriptor]
-Perform an IO control command on the descriptor.
+[indexterm2 write_some..posix::basic_stream_descriptor]
+Write some data to the descriptor.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload1 io_control]``(
- IoControlCommand & command);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload1 more...]]``
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 more...]]``
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code ``[link boost_asio.reference.posix__basic_descriptor.io_control.overload2 io_control]``(
- IoControlCommand & command,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 write_some]``(
+ const ConstBufferSequence & buffers,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.io_control.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 more...]]``
 
 
-[section:overload1 posix::basic_descriptor::io_control (1 of 2 overloads)]
+[section:overload1 posix::basic_stream_descriptor::write_some (1 of 2 overloads)]
 
 
-Perform an IO control command on the descriptor.
+Write some data to the descriptor.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void io_control(
- IoControlCommand & command);
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers);
 
 
-This function is used to execute an IO control command on the descriptor.
+This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -53058,34 +71873,39 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the descriptor.]]
+[[buffers][One or more data buffers to be written to the descriptor.]]
 
 ]
 
 
+[heading Return Value]
+
+The number of bytes written.
+
+
 [heading Exceptions]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
 
 ]
 
 
+[heading Remarks]
+
+The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+
 
 [heading Example]
   
-Getting the number of bytes ready to read:
-
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::posix::stream_descriptor::bytes_readable command;
- descriptor.io_control(command);
- std::size_t bytes_readable = command.get();
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ descriptor.write_some(boost::asio::buffer(data, size));
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
 
@@ -53094,20 +71914,20 @@
 
 
 
-[section:overload2 posix::basic_descriptor::io_control (2 of 2 overloads)]
+[section:overload2 posix::basic_stream_descriptor::write_some (2 of 2 overloads)]
 
 
-Perform an IO control command on the descriptor.
+Write some data to the descriptor.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- IoControlCommand & command,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
       boost::system::error_code & ec);
 
 
-This function is used to execute an IO control command on the descriptor.
+This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -53115,33 +71935,26 @@
 
 [variablelist
   
-[[command][The IO control command to be performed on the descriptor.]]
+[[buffers][One or more data buffers to be written to the descriptor.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Return Value]
+
+The number of bytes written. Returns 0 if an error occurred.
 
-[heading Example]
-
-Getting the number of bytes ready to read:
-
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::posix::stream_descriptor::bytes_readable command;
- boost::system::error_code ec;
- descriptor.io_control(command, ec);
- if (ec)
- {
- // An error occurred.
- }
- std::size_t bytes_readable = command.get();
 
+[heading Remarks]
+
+The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
 
 
 
+[endsect]
 
 
 [endsect]
@@ -53149,118 +71962,156 @@
 
 [endsect]
 
+[section:posix__descriptor_base posix::descriptor_base]
+
 
-[section:io_service posix::basic_descriptor::io_service]
+The [link boost_asio.reference.posix__descriptor_base `posix::descriptor_base`] class is used as a base for the [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template so that we have a common place to define the associated IO control commands.
 
 
-['Inherited from basic_io_object.]
+ class descriptor_base
 
-[indexterm2 io_service..posix::basic_descriptor]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
+[heading Types]
+[table
+ [[Name][Description]]
 
- boost::asio::io_service & io_service();
+ [
 
+ [[link boost_asio.reference.posix__descriptor_base.bytes_readable [*bytes_readable]]]
+ [IO control command to get the amount of data that can be read without blocking. ]
+
+ ]
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+ [
 
+ [[link boost_asio.reference.posix__descriptor_base.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the descriptor. ]
+
+ ]
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.posix__descriptor_base._descriptor_base [*~descriptor_base]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/posix/descriptor_base.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[endsect]
 
+[section:bytes_readable posix::descriptor_base::bytes_readable]
 
+[indexterm2 bytes_readable..posix::descriptor_base]
+IO control command to get the amount of data that can be read without blocking.
 
-[section:is_open posix::basic_descriptor::is_open]
 
-[indexterm2 is_open..posix::basic_descriptor]
-Determine whether the descriptor is open.
+ typedef implementation_defined bytes_readable;
 
 
- bool is_open() const;
 
+Implements the FIONREAD IO control command.
 
 
-[endsect]
+[heading Example]
+
 
 
-[section:lowest_layer posix::basic_descriptor::lowest_layer]
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::descriptor_base::bytes_readable command(true);
+ descriptor.io_control(command);
+ std::size_t bytes_readable = command.get();
 
-[indexterm2 lowest_layer..posix::basic_descriptor]
-Get a reference to the lowest layer.
 
 
- lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload1 more...]]``
 
 
-Get a const reference to the lowest layer.
 
 
- const lowest_layer_type & ``[link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_descriptor.lowest_layer.overload2 more...]]``
+[heading Requirements]
 
+[*Header: ][^boost/asio/posix/descriptor_base.hpp]
 
-[section:overload1 posix::basic_descriptor::lowest_layer (1 of 2 overloads)]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-Get a reference to the lowest layer.
+[endsect]
 
 
- lowest_layer_type & lowest_layer();
 
+[section:non_blocking_io posix::descriptor_base::non_blocking_io]
 
-This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
+[indexterm2 non_blocking_io..posix::descriptor_base]
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the descriptor.
 
 
-[heading Return Value]
-
-A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+ typedef implementation_defined non_blocking_io;
 
 
 
+Implements the FIONBIO IO control command.
 
-[endsect]
 
+[heading Example]
+
 
 
-[section:overload2 posix::basic_descriptor::lowest_layer (2 of 2 overloads)]
+ boost::asio::posix::stream_descriptor descriptor(io_service);
+ ...
+ boost::asio::descriptor_base::non_blocking_io command(true);
+ descriptor.io_control(command);
 
 
-Get a const reference to the lowest layer.
 
 
- const lowest_layer_type & lowest_layer() const;
 
 
-This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
 
+[heading Requirements]
 
-[heading Return Value]
-
-A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
+[*Header: ][^boost/asio/posix/descriptor_base.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:_descriptor_base posix::descriptor_base::~descriptor_base]
 
+[indexterm2 ~descriptor_base..posix::descriptor_base]
+Protected destructor to prevent deletion through this type.
+
+
+ ~descriptor_base();
 
 
 
 [endsect]
 
 
+
 [endsect]
 
 
-[section:lowest_layer_type posix::basic_descriptor::lowest_layer_type]
+[section:posix__stream_descriptor posix::stream_descriptor]
 
-[indexterm2 lowest_layer_type..posix::basic_descriptor]
-A [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] is always the lowest layer.
+[indexterm1 posix::stream_descriptor]
+Typedef for the typical usage of a stream-oriented descriptor.
 
 
- typedef basic_descriptor< DescriptorService > lowest_layer_type;
+ typedef basic_stream_descriptor stream_descriptor;
 
 
 [heading Types]
@@ -53269,42 +72120,49 @@
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
     [IO control command to get the amount of data that can be read without blocking. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.implementation_type [*implementation_type]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.implementation_type [*implementation_type]]]
     [The underlying implementation type of I/O object. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
     [A basic_descriptor is always the lowest layer. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.native_type [*native_type]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle_type [*native_handle_type]]]
     [The native representation of a descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the descriptor. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a descriptor. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.service_type [*service_type]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking_io [*non_blocking_io]]]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the descriptor. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.posix__basic_stream_descriptor.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
   ]
@@ -53316,59 +72174,105 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
     [Assign an existing native descriptor to the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
- [Construct a basic_descriptor without opening it.
+ [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
+ [Construct a basic_stream_descriptor without opening it.
+
+ Construct a basic_stream_descriptor on an existing native descriptor.
 
- Construct a basic_descriptor on an existing native descriptor. ]
+ Move-construct a basic_stream_descriptor from another. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
     [Cancel all asynchronous operations associated with the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
     [Close the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.get_io_service [*get_io_service]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.get_io_service [*get_io_service]]]
     [Get the io_service associated with the object. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
     [Perform an IO control command on the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
     [Determine whether the descriptor is open. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
     [Get a reference to the lowest layer.
 
      Get a const reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.native [*native]]]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native descriptor representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_handle [*native_handle]]]
     [Get the native descriptor representation. ]
   ]
   
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native descriptor implementation.
+
+ Sets the non-blocking mode of the native descriptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the descriptor.
+
+ Sets the non-blocking mode of the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.operator_eq_ [*operator=]]]
+ [Move-assign a basic_stream_descriptor from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
+ [Read some data from the descriptor. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.release [*release]]]
+ [Release ownership of the native descriptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
+ [Write some data to the descriptor. ]
+ ]
+
 ]
 
 [heading Protected Member Functions]
@@ -53376,8 +72280,13 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
- [Protected destructor to prevent deletion through this type. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.posix__basic_stream_descriptor.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
   ]
   
 ]
@@ -53387,152 +72296,33 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.posix__basic_descriptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
- [[link boost_asio.reference.posix__basic_descriptor.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.posix__basic_stream_descriptor.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
 
-The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
+The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
 
 
 [heading Thread Safety]
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:native posix::basic_descriptor::native]
-
-[indexterm2 native..posix::basic_descriptor]
-Get the native descriptor representation.
-
-
- native_type native();
-
-
-This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
-
-
-[endsect]
-
-
-
-[section:native_type posix::basic_descriptor::native_type]
-
-[indexterm2 native_type..posix::basic_descriptor]
-The native representation of a descriptor.
-
-
- typedef DescriptorService::native_type native_type;
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:non_blocking_io posix::basic_descriptor::non_blocking_io]
-
-
-['Inherited from posix::descriptor_base.]
-
-[indexterm2 non_blocking_io..posix::basic_descriptor]
-IO control command to set the blocking mode of the descriptor.
-
-
- typedef implementation_defined non_blocking_io;
-
-
-
-Implements the FIONBIO IO control command.
-
-
-[heading Example]
-
-
-
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::descriptor_base::non_blocking_io command(true);
- descriptor.io_control(command);
-
-
-
-
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
-
-[*Convenience header: ][^boost/asio.hpp]
-
-
-[endsect]
-
-
-
-[section:service posix::basic_descriptor::service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 service..posix::basic_descriptor]
-The service associated with the I/O object.
-
-
- service_type & service;
-
-
-
-[endsect]
-
-
-
-[section:service_type posix::basic_descriptor::service_type]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 service_type..posix::basic_descriptor]
-The type of the service that will be used to provide I/O operations.
+[*Shared] [*objects:] Unsafe.
 
 
- typedef DescriptorService service_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_descriptor.hpp]
+[*Header: ][^boost/asio/posix/stream_descriptor.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
@@ -53540,33 +72330,14 @@
 [endsect]
 
 
-
-[section:_basic_descriptor posix::basic_descriptor::~basic_descriptor]
-
-[indexterm2 ~basic_descriptor..posix::basic_descriptor]
-Protected destructor to prevent deletion through this type.
-
-
- ~basic_descriptor();
-
-
-
-[endsect]
-
-
-
-[endsect]
-
-[section:posix__basic_stream_descriptor posix::basic_stream_descriptor]
+[section:posix__stream_descriptor_service posix::stream_descriptor_service]
 
 
-Provides stream-oriented descriptor functionality.
+Default service implementation for a stream descriptor.
 
 
- template<
- typename ``[link boost_asio.reference.StreamDescriptorService StreamDescriptorService]`` = stream_descriptor_service>
- class basic_stream_descriptor :
- public posix::basic_descriptor< StreamDescriptorService >
+ class stream_descriptor_service :
+ public io_service::service
 
 
 [heading Types]
@@ -53575,207 +72346,164 @@
 
   [
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.implementation_type [*implementation_type]]]
+ [The type of a stream descriptor implementation. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.native_handle_type [*native_handle_type]]]
+ [The native descriptor type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
- [A basic_descriptor is always the lowest layer. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native descriptor type. ]
   
   ]
 
- [
+]
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.native_type [*native_type]]]
- [The native representation of a descriptor. ]
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.posix__stream_descriptor_service.assign [*assign]]]
+ [Assign an existing native descriptor to a stream descriptor. ]
+ ]
   
+ [
+ [[link boost_asio.reference.posix__stream_descriptor_service.async_read_some [*async_read_some]]]
+ [Start an asynchronous read. ]
   ]
-
+
   [
-
- [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.async_write_some [*async_write_some]]]
+ [Start an asynchronous write. ]
+ ]
   
+ [
+ [[link boost_asio.reference.posix__stream_descriptor_service.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the descriptor. ]
   ]
-
+
   [
-
- [[link boost_asio.reference.posix__basic_stream_descriptor.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.close [*close]]]
+ [Close a stream descriptor implementation. ]
+ ]
   
+ [
+ [[link boost_asio.reference.posix__stream_descriptor_service.construct [*construct]]]
+ [Construct a new stream descriptor implementation. ]
   ]
-
-]
-
-[heading Member Functions]
-[table
- [[Name][Description]]
-
+
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
- [Assign an existing native descriptor to the descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.destroy [*destroy]]]
+ [Destroy a stream descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.io_control [*io_control]]]
+ [Perform an IO control command on the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
- [Construct a basic_stream_descriptor without opening it.
-
- Construct a basic_stream_descriptor on an existing native descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.is_open [*is_open]]]
+ [Determine whether the descriptor is open. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.move_assign [*move_assign]]]
+ [Move-assign from another stream descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
- [Close the descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.move_construct [*move_construct]]]
+ [Move-construct a new stream descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
- [Perform an IO control command on the descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.native_handle [*native_handle]]]
+ [Get the native descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native descriptor implementation.
+
+ Sets the non-blocking mode of the native descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
- [Determine whether the descriptor is open. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the descriptor.
+
+ Sets the non-blocking mode of the descriptor. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
-
- Get a const reference to the lowest layer. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.read_some [*read_some]]]
+ [Read some data from the stream. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.native [*native]]]
- [Get the native descriptor representation. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.release [*release]]]
+ [Release ownership of the native descriptor implementation. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
- [Read some data from the descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.stream_descriptor_service [*stream_descriptor_service]]]
+ [Construct a new stream descriptor service for the specified io_service. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
- [Write some data to the descriptor. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.write_some [*write_some]]]
+ [Write the given data to the stream. ]
   ]
   
 ]
 
-[heading Protected Data Members]
+[heading Data Members]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.posix__basic_stream_descriptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.posix__stream_descriptor_service.id [*id]]]
+ [The unique service identifier. ]
   ]
 
 ]
 
-The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
-
-
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
-
-[*Shared] [*objects:] Unsafe.
-
-
-
-
 [heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+[*Header: ][^boost/asio/posix/stream_descriptor_service.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
-[section:assign posix::basic_stream_descriptor::assign]
-
-[indexterm2 assign..posix::basic_stream_descriptor]
-Assign an existing native descriptor to the descriptor.
-
-
- void ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 assign]``(
- const native_type & native_descriptor);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload1 more...]]``
-
- boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 assign]``(
- const native_type & native_descriptor,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.assign.overload2 more...]]``
-
-
-[section:overload1 posix::basic_stream_descriptor::assign (1 of 2 overloads)]
-
-
-['Inherited from posix::basic_descriptor.]
-
-
-Assign an existing native descriptor to the descriptor.
-
-
- void assign(
- const native_type & native_descriptor);
-
-
-
-[endsect]
-
-
-
-[section:overload2 posix::basic_stream_descriptor::assign (2 of 2 overloads)]
-
-
-['Inherited from posix::basic_descriptor.]
 
+[section:assign posix::stream_descriptor_service::assign]
 
-Assign an existing native descriptor to the descriptor.
+[indexterm2 assign..posix::stream_descriptor_service]
+Assign an existing native descriptor to a stream descriptor.
 
 
   boost::system::error_code assign(
- const native_type & native_descriptor,
+ implementation_type & impl,
+ const native_handle_type & native_descriptor,
       boost::system::error_code & ec);
 
 
@@ -53783,12 +72511,10 @@
 [endsect]
 
 
-[endsect]
-
 
-[section:async_read_some posix::basic_stream_descriptor::async_read_some]
+[section:async_read_some posix::stream_descriptor_service::async_read_some]
 
-[indexterm2 async_read_some..posix::basic_stream_descriptor]
+[indexterm2 async_read_some..posix::stream_descriptor_service]
 Start an asynchronous read.
 
 
@@ -53796,56 +72522,19 @@
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
       typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
   void async_read_some(
+ implementation_type & impl,
       const MutableBufferSequence & buffers,
       ReadHandler handler);
 
 
-This function is used to asynchronously read data from the stream descriptor. The function call always returns immediately.
-
-
-[heading Parameters]
-
-
-[variablelist
-
-[[buffers][One or more buffers into which the data will be read. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
-
-[[handler][The handler to be called when the read operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes read.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
-
-]
-
-
-[heading Remarks]
-
-The read operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.async_read `async_read`] function if you need to ensure that the requested amount of data is read before the asynchronous operation completes.
-
-
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
-
- descriptor.async_read_some(boost::asio::buffer(data, size), handler);
-
-
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
-
-
-
 
 [endsect]
 
 
 
-[section:async_write_some posix::basic_stream_descriptor::async_write_some]
+[section:async_write_some posix::stream_descriptor_service::async_write_some]
 
-[indexterm2 async_write_some..posix::basic_stream_descriptor]
+[indexterm2 async_write_some..posix::stream_descriptor_service]
 Start an asynchronous write.
 
 
@@ -53853,94 +72542,25 @@
       typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
       typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
   void async_write_some(
+ implementation_type & impl,
       const ConstBufferSequence & buffers,
       WriteHandler handler);
 
 
-This function is used to asynchronously write data to the stream descriptor. The function call always returns immediately.
-
-
-[heading Parameters]
-
-
-[variablelist
-
-[[buffers][One or more data buffers to be written to the descriptor. Although the buffers object may be copied as necessary, ownership of the underlying memory blocks is retained by the caller, which must guarantee that they remain valid until the handler is called.]]
-
-[[handler][The handler to be called when the write operation completes. Copies will be made of the handler as required. The function signature of the handler must be:
-``
- void handler(
- const boost::system::error_code& error, // Result of operation.
- std::size_t bytes_transferred // Number of bytes written.
- );
-``
-Regardless of whether the asynchronous operation completes immediately or not, the handler will not be invoked from within this function. Invocation of the handler will be performed in a manner equivalent to using `boost::asio::io_service::post()`.]]
-
-]
-
-
-[heading Remarks]
-
-The write operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.async_write `async_write`] function if you need to ensure that all data is written before the asynchronous operation completes.
-
-
-[heading Example]
-
-To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
-
- descriptor.async_write_some(boost::asio::buffer(data, size), handler);
-
-
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
-
-
-
 
 [endsect]
 
 
-[section:basic_stream_descriptor posix::basic_stream_descriptor::basic_stream_descriptor]
-
-[indexterm2 basic_stream_descriptor..posix::basic_stream_descriptor]
-Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] without opening it.
-
-
- explicit ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 basic_stream_descriptor]``(
- boost::asio::io_service & io_service);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload1 more...]]``
-
-
-Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] on an existing native descriptor.
-
-
- ``[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 basic_stream_descriptor]``(
- boost::asio::io_service & io_service,
- const native_type & native_descriptor);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor.overload2 more...]]``
-
-
-[section:overload1 posix::basic_stream_descriptor::basic_stream_descriptor (1 of 2 overloads)]
-
-
-Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] without opening it.
-
-
- basic_stream_descriptor(
- boost::asio::io_service & io_service);
-
-
-This constructor creates a stream descriptor without opening it. The descriptor needs to be opened and then connected or accepted before data can be sent or received on it.
-
 
-[heading Parameters]
-
+[section:cancel posix::stream_descriptor_service::cancel]
 
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor. ]]
+[indexterm2 cancel..posix::stream_descriptor_service]
+Cancel all asynchronous operations associated with the descriptor.
 
-]
 
+ boost::system::error_code cancel(
+ implementation_type & impl,
+ boost::system::error_code & ec);
 
 
 
@@ -53948,130 +72568,45 @@
 
 
 
-[section:overload2 posix::basic_stream_descriptor::basic_stream_descriptor (2 of 2 overloads)]
-
-
-Construct a [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] on an existing native descriptor.
-
-
- basic_stream_descriptor(
- boost::asio::io_service & io_service,
- const native_type & native_descriptor);
-
-
-This constructor creates a stream descriptor object to hold an existing native descriptor.
-
-
-[heading Parameters]
-
-
-[variablelist
-
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream descriptor will use to dispatch handlers for any asynchronous operations performed on the descriptor.]]
-
-[[native_descriptor][The new underlying descriptor implementation.]]
-
-]
-
-
-[heading Exceptions]
-
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
-
-]
+[section:close posix::stream_descriptor_service::close]
 
+[indexterm2 close..posix::stream_descriptor_service]
+Close a stream descriptor implementation.
 
 
+ boost::system::error_code close(
+ implementation_type & impl,
+ boost::system::error_code & ec);
 
-[endsect]
 
 
 [endsect]
 
 
-[section:bytes_readable posix::basic_stream_descriptor::bytes_readable]
-
-
-['Inherited from posix::descriptor_base.]
-
-[indexterm2 bytes_readable..posix::basic_stream_descriptor]
-IO control command to get the amount of data that can be read without blocking.
-
-
- typedef implementation_defined bytes_readable;
-
-
-
-Implements the FIONREAD IO control command.
-
-
-[heading Example]
-
-
-
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::descriptor_base::bytes_readable command(true);
- descriptor.io_control(command);
- std::size_t bytes_readable = command.get();
-
-
-
-
 
+[section:construct posix::stream_descriptor_service::construct]
 
+[indexterm2 construct..posix::stream_descriptor_service]
+Construct a new stream descriptor implementation.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+ void construct(
+ implementation_type & impl);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:cancel posix::basic_stream_descriptor::cancel]
-
-[indexterm2 cancel..posix::basic_stream_descriptor]
-Cancel all asynchronous operations associated with the descriptor.
-
-
- void ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 cancel]``();
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload1 more...]]``
-
- boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 cancel]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.cancel.overload2 more...]]``
-
-
-[section:overload1 posix::basic_stream_descriptor::cancel (1 of 2 overloads)]
-
-
-['Inherited from posix::basic_descriptor.]
-
-
-Cancel all asynchronous operations associated with the descriptor.
-
-
- void cancel();
-
-
-This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
-
 
-[heading Exceptions]
-
+[section:destroy posix::stream_descriptor_service::destroy]
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+[indexterm2 destroy..posix::stream_descriptor_service]
+Destroy a stream descriptor implementation.
 
-]
 
+ void destroy(
+ implementation_type & impl);
 
 
 
@@ -54079,137 +72614,85 @@
 
 
 
-[section:overload2 posix::basic_stream_descriptor::cancel (2 of 2 overloads)]
-
-
-['Inherited from posix::basic_descriptor.]
-
-
-Cancel all asynchronous operations associated with the descriptor.
-
-
- boost::system::error_code cancel(
- boost::system::error_code & ec);
-
-
-This function causes all outstanding asynchronous read or write operations to finish immediately, and the handlers for cancelled operations will be passed the `boost::asio::error::operation_aborted` error.
-
-
-[heading Parameters]
-
+[section:get_io_service posix::stream_descriptor_service::get_io_service]
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any. ]]
 
-]
+['Inherited from io_service.]
 
+[indexterm2 get_io_service..posix::stream_descriptor_service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
 
+ boost::asio::io_service & get_io_service();
 
-[endsect]
 
 
 [endsect]
 
-[section:close posix::basic_stream_descriptor::close]
-
-[indexterm2 close..posix::basic_stream_descriptor]
-Close the descriptor.
 
 
- void ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 close]``();
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload1 more...]]``
+[section:id posix::stream_descriptor_service::id]
 
- boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 close]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.close.overload2 more...]]``
+[indexterm2 id..posix::stream_descriptor_service]
+The unique service identifier.
 
 
-[section:overload1 posix::basic_stream_descriptor::close (1 of 2 overloads)]
+ static boost::asio::io_service::id id;
 
 
-['Inherited from posix::basic_descriptor.]
 
+[endsect]
 
-Close the descriptor.
 
 
- void close();
+[section:implementation_type posix::stream_descriptor_service::implementation_type]
 
+[indexterm2 implementation_type..posix::stream_descriptor_service]
+The type of a stream descriptor implementation.
 
-This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
 
+ typedef implementation_defined implementation_type;
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+[heading Requirements]
 
+[*Header: ][^boost/asio/posix/stream_descriptor_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:overload2 posix::basic_stream_descriptor::close (2 of 2 overloads)]
-
-
-['Inherited from posix::basic_descriptor.]
-
+[section:io_control posix::stream_descriptor_service::io_control]
 
-Close the descriptor.
+[indexterm2 io_control..posix::stream_descriptor_service]
+Perform an IO control command on the descriptor.
 
 
- boost::system::error_code close(
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ implementation_type & impl,
+ IoControlCommand & command,
       boost::system::error_code & ec);
 
 
-This function is used to close the descriptor. Any asynchronous read or write operations will be cancelled immediately, and will complete with the `boost::asio::error::operation_aborted` error.
-
-
-[heading Parameters]
-
-
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any. ]]
-
-]
-
-
-
 
 [endsect]
 
 
-[endsect]
-
-
-[section:get_io_service posix::basic_stream_descriptor::get_io_service]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 get_io_service..posix::basic_stream_descriptor]
-Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
-
- boost::asio::io_service & get_io_service();
-
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[section:is_open posix::stream_descriptor_service::is_open]
 
+[indexterm2 is_open..posix::stream_descriptor_service]
+Determine whether the descriptor is open.
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
 
+ bool is_open(
+ const implementation_type & impl) const;
 
 
 
@@ -54217,16 +72700,16 @@
 
 
 
-[section:implementation posix::basic_stream_descriptor::implementation]
-
-
-['Inherited from basic_io_object.]
+[section:move_assign posix::stream_descriptor_service::move_assign]
 
-[indexterm2 implementation..posix::basic_stream_descriptor]
-The underlying implementation of the I/O object.
+[indexterm2 move_assign..posix::stream_descriptor_service]
+Move-assign from another stream descriptor implementation.
 
 
- implementation_type implementation;
+ void move_assign(
+ implementation_type & impl,
+ stream_descriptor_service & other_service,
+ implementation_type & other_impl);
 
 
 
@@ -54234,154 +72717,118 @@
 
 
 
-[section:implementation_type posix::basic_stream_descriptor::implementation_type]
-
-
-['Inherited from basic_io_object.]
-
-[indexterm2 implementation_type..posix::basic_stream_descriptor]
-The underlying implementation type of I/O object.
-
-
- typedef service_type::implementation_type implementation_type;
-
+[section:move_construct posix::stream_descriptor_service::move_construct]
 
+[indexterm2 move_construct..posix::stream_descriptor_service]
+Move-construct a new stream descriptor implementation.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:io_control posix::basic_stream_descriptor::io_control]
-
-[indexterm2 io_control..posix::basic_stream_descriptor]
-Perform an IO control command on the descriptor.
-
-
- void ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 io_control]``(
- IoControlCommand & command);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload1 more...]]``
-
- boost::system::error_code ``[link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 io_control]``(
- IoControlCommand & command,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.io_control.overload2 more...]]``
-
 
-[section:overload1 posix::basic_stream_descriptor::io_control (1 of 2 overloads)]
+[section:native posix::stream_descriptor_service::native]
 
+[indexterm2 native..posix::stream_descriptor_service]
+(Deprecated: Use `native_handle()`.) Get the native descriptor implementation.
 
-['Inherited from posix::basic_descriptor.]
 
+ native_type native(
+ implementation_type & impl);
 
-Perform an IO control command on the descriptor.
 
 
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void io_control(
- IoControlCommand & command);
+[endsect]
 
 
-This function is used to execute an IO control command on the descriptor.
 
+[section:native_handle posix::stream_descriptor_service::native_handle]
 
-[heading Parameters]
-
+[indexterm2 native_handle..posix::stream_descriptor_service]
+Get the native descriptor implementation.
 
-[variablelist
-
-[[command][The IO control command to be performed on the descriptor.]]
 
-]
+ native_handle_type native_handle(
+ implementation_type & impl);
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+[endsect]
 
-]
 
 
+[section:native_handle_type posix::stream_descriptor_service::native_handle_type]
 
-[heading Example]
-
-Getting the number of bytes ready to read:
+[indexterm2 native_handle_type..posix::stream_descriptor_service]
+The native descriptor type.
 
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::posix::stream_descriptor::bytes_readable command;
- descriptor.io_control(command);
- std::size_t bytes_readable = command.get();
+
+ typedef implementation_defined native_handle_type;
 
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/posix/stream_descriptor_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
+[section:native_non_blocking posix::stream_descriptor_service::native_non_blocking]
 
-[section:overload2 posix::basic_stream_descriptor::io_control (2 of 2 overloads)]
+[indexterm2 native_non_blocking..posix::stream_descriptor_service]
+Gets the non-blocking mode of the native descriptor implementation.
 
 
-['Inherited from posix::basic_descriptor.]
+ bool ``[link boost_asio.reference.posix__stream_descriptor_service.native_non_blocking.overload1 native_non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__stream_descriptor_service.native_non_blocking.overload1 more...]]``
 
 
-Perform an IO control command on the descriptor.
+Sets the non-blocking mode of the native descriptor implementation.
 
 
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- IoControlCommand & command,
+ boost::system::error_code ``[link boost_asio.reference.posix__stream_descriptor_service.native_non_blocking.overload2 native_non_blocking]``(
+ implementation_type & impl,
+ bool mode,
       boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__stream_descriptor_service.native_non_blocking.overload2 more...]]``
 
 
-This function is used to execute an IO control command on the descriptor.
+[section:overload1 posix::stream_descriptor_service::native_non_blocking (1 of 2 overloads)]
 
 
-[heading Parameters]
-
+Gets the non-blocking mode of the native descriptor implementation.
 
-[variablelist
-
-[[command][The IO control command to be performed on the descriptor.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+ bool native_non_blocking(
+ const implementation_type & impl) const;
 
-]
 
 
+[endsect]
 
-[heading Example]
-
-Getting the number of bytes ready to read:
 
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::posix::stream_descriptor::bytes_readable command;
- boost::system::error_code ec;
- descriptor.io_control(command, ec);
- if (ec)
- {
- // An error occurred.
- }
- std::size_t bytes_readable = command.get();
+
+[section:overload2 posix::stream_descriptor_service::native_non_blocking (2 of 2 overloads)]
 
 
+Sets the non-blocking mode of the native descriptor implementation.
 
 
+ boost::system::error_code native_non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
 
 
@@ -54391,84 +72838,93 @@
 [endsect]
 
 
-[section:io_service posix::basic_stream_descriptor::io_service]
-
+[section:native_type posix::stream_descriptor_service::native_type]
 
-['Inherited from basic_io_object.]
+[indexterm2 native_type..posix::stream_descriptor_service]
+(Deprecated: Use native\_handle\_type.) The native descriptor type.
 
-[indexterm2 io_service..posix::basic_stream_descriptor]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
 
+ typedef implementation_defined native_type;
 
- boost::asio::io_service & io_service();
 
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
+[heading Requirements]
 
+[*Header: ][^boost/asio/posix/stream_descriptor_service.hpp]
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
-[endsect]
+[section:non_blocking posix::stream_descriptor_service::non_blocking]
 
+[indexterm2 non_blocking..posix::stream_descriptor_service]
+Gets the non-blocking mode of the descriptor.
 
 
-[section:is_open posix::basic_stream_descriptor::is_open]
+ bool ``[link boost_asio.reference.posix__stream_descriptor_service.non_blocking.overload1 non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.posix__stream_descriptor_service.non_blocking.overload1 more...]]``
 
 
-['Inherited from posix::basic_descriptor.]
+Sets the non-blocking mode of the descriptor.
 
-[indexterm2 is_open..posix::basic_stream_descriptor]
-Determine whether the descriptor is open.
 
+ boost::system::error_code ``[link boost_asio.reference.posix__stream_descriptor_service.non_blocking.overload2 non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.posix__stream_descriptor_service.non_blocking.overload2 more...]]``
 
- bool is_open() const;
 
+[section:overload1 posix::stream_descriptor_service::non_blocking (1 of 2 overloads)]
 
 
-[endsect]
+Gets the non-blocking mode of the descriptor.
 
 
-[section:lowest_layer posix::basic_stream_descriptor::lowest_layer]
+ bool non_blocking(
+ const implementation_type & impl) const;
 
-[indexterm2 lowest_layer..posix::basic_stream_descriptor]
-Get a reference to the lowest layer.
 
 
- lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload1 more...]]``
+[endsect]
 
 
-Get a const reference to the lowest layer.
 
+[section:overload2 posix::stream_descriptor_service::non_blocking (2 of 2 overloads)]
 
- const lowest_layer_type & ``[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer.overload2 more...]]``
 
+Sets the non-blocking mode of the descriptor.
 
-[section:overload1 posix::basic_stream_descriptor::lowest_layer (1 of 2 overloads)]
 
+ boost::system::error_code non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
-['Inherited from posix::basic_descriptor.]
 
 
-Get a reference to the lowest layer.
+[endsect]
 
 
- lowest_layer_type & lowest_layer();
+[endsect]
 
 
-This function returns a reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
+[section:read_some posix::stream_descriptor_service::read_some]
 
+[indexterm2 read_some..posix::stream_descriptor_service]
+Read some data from the stream.
 
-[heading Return Value]
-
-A reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
 
 
@@ -54476,44 +72932,67 @@
 
 
 
-[section:overload2 posix::basic_stream_descriptor::lowest_layer (2 of 2 overloads)]
+[section:release posix::stream_descriptor_service::release]
 
+[indexterm2 release..posix::stream_descriptor_service]
+Release ownership of the native descriptor implementation.
 
-['Inherited from posix::basic_descriptor.]
 
+ native_handle_type release(
+ implementation_type & impl);
 
-Get a const reference to the lowest layer.
 
 
- const lowest_layer_type & lowest_layer() const;
+[endsect]
 
 
-This function returns a const reference to the lowest layer in a stack of layers. Since a [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] cannot contain any further layers, it simply returns a reference to itself.
 
+[section:stream_descriptor_service posix::stream_descriptor_service::stream_descriptor_service]
+
+[indexterm2 stream_descriptor_service..posix::stream_descriptor_service]
+Construct a new stream descriptor service for the specified [link boost_asio.reference.io_service `io_service`].
 
-[heading Return Value]
-
-A const reference to the lowest layer in the stack of layers. Ownership is not transferred to the caller.
 
+ stream_descriptor_service(
+ boost::asio::io_service & io_service);
 
 
 
 [endsect]
 
 
+
+[section:write_some posix::stream_descriptor_service::write_some]
+
+[indexterm2 write_some..posix::stream_descriptor_service]
+Write the given data to the stream.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
 [endsect]
 
 
-[section:lowest_layer_type posix::basic_stream_descriptor::lowest_layer_type]
 
+[endsect]
 
-['Inherited from posix::basic_descriptor.]
+[section:raw_socket_service raw_socket_service]
 
-[indexterm2 lowest_layer_type..posix::basic_stream_descriptor]
-A [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] is always the lowest layer.
 
+Default service implementation for a raw socket.
 
- typedef basic_descriptor< StreamDescriptorService > lowest_layer_type;
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``>
+ class raw_socket_service :
+ public io_service::service
 
 
 [heading Types]
@@ -54522,43 +73001,36 @@
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.posix__basic_descriptor.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
+ [[link boost_asio.reference.raw_socket_service.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.lowest_layer_type [*lowest_layer_type]]]
- [A basic_descriptor is always the lowest layer. ]
+ [[link boost_asio.reference.raw_socket_service.implementation_type [*implementation_type]]]
+ [The type of a raw socket. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.native_type [*native_type]]]
- [The native representation of a descriptor. ]
+ [[link boost_asio.reference.raw_socket_service.native_handle_type [*native_handle_type]]]
+ [The native socket type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the descriptor. ]
+ [[link boost_asio.reference.raw_socket_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native socket type. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.posix__basic_descriptor.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
+ [[link boost_asio.reference.raw_socket_service.protocol_type [*protocol_type]]]
+ [The protocol type. ]
   
   ]
 
@@ -54569,266 +73041,498 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.posix__basic_descriptor.assign [*assign]]]
- [Assign an existing native descriptor to the descriptor. ]
+ [[link boost_asio.reference.raw_socket_service.assign [*assign]]]
+ [Assign an existing native socket to a raw socket. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.basic_descriptor [*basic_descriptor]]]
- [Construct a basic_descriptor without opening it.
-
- Construct a basic_descriptor on an existing native descriptor. ]
+ [[link boost_asio.reference.raw_socket_service.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the descriptor. ]
+ [[link boost_asio.reference.raw_socket_service.async_receive [*async_receive]]]
+ [Start an asynchronous receive. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.close [*close]]]
- [Close the descriptor. ]
+ [[link boost_asio.reference.raw_socket_service.async_receive_from [*async_receive_from]]]
+ [Start an asynchronous receive that will get the endpoint of the sender. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
+ [[link boost_asio.reference.raw_socket_service.async_send [*async_send]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.io_control [*io_control]]]
- [Perform an IO control command on the descriptor. ]
+ [[link boost_asio.reference.raw_socket_service.async_send_to [*async_send_to]]]
+ [Start an asynchronous send. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.raw_socket_service.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.is_open [*is_open]]]
- [Determine whether the descriptor is open. ]
+ [[link boost_asio.reference.raw_socket_service.available [*available]]]
+ [Determine the number of bytes available for reading. ]
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
-
- Get a const reference to the lowest layer. ]
+ [[link boost_asio.reference.raw_socket_service.bind [*bind]]]
+ []
   ]
   
   [
- [[link boost_asio.reference.posix__basic_descriptor.native [*native]]]
- [Get the native descriptor representation. ]
+ [[link boost_asio.reference.raw_socket_service.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
   ]
   
-]
+ [
+ [[link boost_asio.reference.raw_socket_service.close [*close]]]
+ [Close a raw socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.connect [*connect]]]
+ [Connect the raw socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.construct [*construct]]]
+ [Construct a new raw socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.destroy [*destroy]]]
+ [Destroy a raw socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.get_option [*get_option]]]
+ [Get a socket option. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.move_assign [*move_assign]]]
+ [Move-assign from another raw socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.move_construct [*move_construct]]]
+ [Move-construct a new raw socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.native_handle [*native_handle]]]
+ [Get the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
+ Sets the non-blocking mode of the socket. ]
+ ]
+
   [
- [[link boost_asio.reference.posix__basic_descriptor._basic_descriptor [*~basic_descriptor]]]
- [Protected destructor to prevent deletion through this type. ]
+ [[link boost_asio.reference.raw_socket_service.open [*open]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.raw_socket_service [*raw_socket_service]]]
+ [Construct a new raw socket service for the specified io_service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.receive [*receive]]]
+ [Receive some data from the peer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.receive_from [*receive_from]]]
+ [Receive raw data with the endpoint of the sender. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.send [*send]]]
+ [Send the given data to the peer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.send_to [*send_to]]]
+ [Send raw data to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.set_option [*set_option]]]
+ [Set a socket option. ]
+ ]
+
+ [
+ [[link boost_asio.reference.raw_socket_service.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
   ]
   
 ]
 
-[heading Protected Data Members]
+[heading Data Members]
 [table
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.posix__basic_descriptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_descriptor.service [*service]]]
- [The service associated with the I/O object. ]
+ [[link boost_asio.reference.raw_socket_service.id [*id]]]
+ [The unique service identifier. ]
   ]
 
 ]
 
-The [link boost_asio.reference.posix__basic_descriptor `posix::basic_descriptor`] class template provides the ability to wrap a POSIX descriptor.
+[heading Requirements]
 
+[*Header: ][^boost/asio/raw_socket_service.hpp]
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+[*Convenience header: ][^boost/asio.hpp]
 
-[*Shared] [*objects:] Unsafe.
 
+[section:assign raw_socket_service::assign]
 
+[indexterm2 assign..raw_socket_service]
+Assign an existing native socket to a raw socket.
 
 
-[heading Requirements]
+ boost::system::error_code assign(
+ implementation_type & impl,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
 
-[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+
+[section:async_connect raw_socket_service::async_connect]
+
+[indexterm2 async_connect..raw_socket_service]
+Start an asynchronous connect.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ implementation_type & impl,
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
+
 
 
 [endsect]
 
 
 
-[section:native posix::basic_stream_descriptor::native]
+[section:async_receive raw_socket_service::async_receive]
 
+[indexterm2 async_receive..raw_socket_service]
+Start an asynchronous receive.
 
-['Inherited from posix::basic_descriptor.]
 
-[indexterm2 native..posix::basic_stream_descriptor]
-Get the native descriptor representation.
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ ReadHandler handler);
+
+
+
+[endsect]
+
+
+
+[section:async_receive_from raw_socket_service::async_receive_from]
+
+[indexterm2 async_receive_from..raw_socket_service]
+Start an asynchronous receive that will get the endpoint of the sender.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive_from(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
+ ReadHandler handler);
+
+
+
+[endsect]
+
+
+
+[section:async_send raw_socket_service::async_send]
+
+[indexterm2 async_send..raw_socket_service]
+Start an asynchronous send.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ WriteHandler handler);
+
+
+
+[endsect]
+
+
+
+[section:async_send_to raw_socket_service::async_send_to]
 
+[indexterm2 async_send_to..raw_socket_service]
+Start an asynchronous send.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send_to(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
+ WriteHandler handler);
+
+
+
+[endsect]
+
+
+
+[section:at_mark raw_socket_service::at_mark]
+
+[indexterm2 at_mark..raw_socket_service]
+Determine whether the socket is at the out-of-band data mark.
+
+
+ bool at_mark(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
+
+
+
+[endsect]
+
+
+
+[section:available raw_socket_service::available]
+
+[indexterm2 available..raw_socket_service]
+Determine the number of bytes available for reading.
+
+
+ std::size_t available(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
+
+
+
+[endsect]
+
+
+
+[section:bind raw_socket_service::bind]
+
+[indexterm2 bind..raw_socket_service]
+
+ boost::system::error_code bind(
+ implementation_type & impl,
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
 
- native_type native();
 
 
-This function may be used to obtain the underlying representation of the descriptor. This is intended to allow access to native descriptor functionality that is not otherwise provided.
+[section:cancel raw_socket_service::cancel]
 
+[indexterm2 cancel..raw_socket_service]
+Cancel all asynchronous operations associated with the socket.
 
-[endsect]
 
+ boost::system::error_code cancel(
+ implementation_type & impl,
+ boost::system::error_code & ec);
 
 
-[section:native_type posix::basic_stream_descriptor::native_type]
 
-[indexterm2 native_type..posix::basic_stream_descriptor]
-The native representation of a descriptor.
+[endsect]
 
 
- typedef StreamDescriptorService::native_type native_type;
 
+[section:close raw_socket_service::close]
 
+[indexterm2 close..raw_socket_service]
+Close a raw socket implementation.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+ boost::system::error_code close(
+ implementation_type & impl,
+ boost::system::error_code & ec);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:non_blocking_io posix::basic_stream_descriptor::non_blocking_io]
-
+[section:connect raw_socket_service::connect]
 
-['Inherited from posix::descriptor_base.]
+[indexterm2 connect..raw_socket_service]
+Connect the raw socket to the specified endpoint.
 
-[indexterm2 non_blocking_io..posix::basic_stream_descriptor]
-IO control command to set the blocking mode of the descriptor.
 
+ boost::system::error_code connect(
+ implementation_type & impl,
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
 
- typedef implementation_defined non_blocking_io;
 
 
+[endsect]
 
-Implements the FIONBIO IO control command.
 
 
-[heading Example]
-
+[section:construct raw_socket_service::construct]
 
+[indexterm2 construct..raw_socket_service]
+Construct a new raw socket implementation.
 
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::descriptor_base::non_blocking_io command(true);
- descriptor.io_control(command);
 
+ void construct(
+ implementation_type & impl);
 
 
 
+[endsect]
 
 
 
-[heading Requirements]
+[section:destroy raw_socket_service::destroy]
 
-[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+[indexterm2 destroy..raw_socket_service]
+Destroy a raw socket implementation.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+ void destroy(
+ implementation_type & impl);
 
-[endsect]
 
 
-[section:read_some posix::basic_stream_descriptor::read_some]
+[endsect]
 
-[indexterm2 read_some..posix::basic_stream_descriptor]
-Read some data from the descriptor.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 read_some]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload1 more...]]``
+[section:endpoint_type raw_socket_service::endpoint_type]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 read_some]``(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.read_some.overload2 more...]]``
+[indexterm2 endpoint_type..raw_socket_service]
+The endpoint type.
 
 
-[section:overload1 posix::basic_stream_descriptor::read_some (1 of 2 overloads)]
+ typedef Protocol::endpoint endpoint_type;
 
 
-Read some data from the descriptor.
 
+[heading Requirements]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers);
+[*Header: ][^boost/asio/raw_socket_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
+[endsect]
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be read.]]
 
-]
+[section:get_io_service raw_socket_service::get_io_service]
 
 
-[heading Return Value]
-
-The number of bytes read.
+['Inherited from io_service.]
 
+[indexterm2 get_io_service..raw_socket_service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+ boost::asio::io_service & get_io_service();
 
-]
 
 
-[heading Remarks]
-
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+[endsect]
 
 
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- descriptor.read_some(boost::asio::buffer(data, size));
+[section:get_option raw_socket_service::get_option]
 
+[indexterm2 get_option..raw_socket_service]
+Get a socket option.
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ const implementation_type & impl,
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
 
 
 
@@ -54836,683 +73540,481 @@
 
 
 
-[section:overload2 posix::basic_stream_descriptor::read_some (2 of 2 overloads)]
+[section:id raw_socket_service::id]
 
+[indexterm2 id..raw_socket_service]
+The unique service identifier.
 
-Read some data from the descriptor.
 
+ static boost::asio::io_service::id id;
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
 
 
-This function is used to read data from the stream descriptor. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
+[endsect]
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[buffers][One or more buffers into which the data will be read.]]
+[section:implementation_type raw_socket_service::implementation_type]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[indexterm2 implementation_type..raw_socket_service]
+The type of a raw socket.
 
-]
 
+ typedef implementation_defined implementation_type;
 
-[heading Return Value]
-
-The number of bytes read. Returns 0 if an error occurred.
 
 
-[heading Remarks]
-
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+[heading Requirements]
 
+[*Header: ][^boost/asio/raw_socket_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[endsect]
 
+[section:io_control raw_socket_service::io_control]
 
-[section:service posix::basic_stream_descriptor::service]
+[indexterm2 io_control..raw_socket_service]
+Perform an IO control command on the socket.
 
 
-['Inherited from basic_io_object.]
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ implementation_type & impl,
+ IoControlCommand & command,
+ boost::system::error_code & ec);
 
-[indexterm2 service..posix::basic_stream_descriptor]
-The service associated with the I/O object.
 
 
- service_type & service;
+[endsect]
 
 
 
-[endsect]
+[section:is_open raw_socket_service::is_open]
 
+[indexterm2 is_open..raw_socket_service]
+Determine whether the socket is open.
 
 
-[section:service_type posix::basic_stream_descriptor::service_type]
+ bool is_open(
+ const implementation_type & impl) const;
 
 
-['Inherited from basic_io_object.]
 
-[indexterm2 service_type..posix::basic_stream_descriptor]
-The type of the service that will be used to provide I/O operations.
+[endsect]
 
 
- typedef StreamDescriptorService service_type;
 
+[section:local_endpoint raw_socket_service::local_endpoint]
 
+[indexterm2 local_endpoint..raw_socket_service]
+Get the local endpoint.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/basic_stream_descriptor.hpp]
+ endpoint_type local_endpoint(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:write_some posix::basic_stream_descriptor::write_some]
-
-[indexterm2 write_some..posix::basic_stream_descriptor]
-Write some data to the descriptor.
 
+[section:move_assign raw_socket_service::move_assign]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 write_some]``(
- const ConstBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload1 more...]]``
+[indexterm2 move_assign..raw_socket_service]
+Move-assign from another raw socket implementation.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t ``[link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 write_some]``(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.posix__basic_stream_descriptor.write_some.overload2 more...]]``
 
+ void move_assign(
+ implementation_type & impl,
+ raw_socket_service & other_service,
+ implementation_type & other_impl);
 
-[section:overload1 posix::basic_stream_descriptor::write_some (1 of 2 overloads)]
 
 
-Write some data to the descriptor.
+[endsect]
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers);
 
+[section:move_construct raw_socket_service::move_construct]
 
-This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
+[indexterm2 move_construct..raw_socket_service]
+Move-construct a new raw socket implementation.
 
 
-[heading Parameters]
-
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
 
-[variablelist
-
-[[buffers][One or more data buffers to be written to the descriptor.]]
 
-]
 
+[endsect]
 
-[heading Return Value]
-
-The number of bytes written.
 
 
-[heading Exceptions]
-
+[section:native raw_socket_service::native]
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. An error code of `boost::asio::error::eof` indicates that the connection was closed by the peer.]]
+[indexterm2 native..raw_socket_service]
+(Deprecated: Use `native_handle()`.) Get the native socket implementation.
 
-]
 
+ native_type native(
+ implementation_type & impl);
 
-[heading Remarks]
-
-The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
 
 
-[heading Example]
-
-To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+[endsect]
 
- descriptor.write_some(boost::asio::buffer(data, size));
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+[section:native_handle raw_socket_service::native_handle]
 
+[indexterm2 native_handle..raw_socket_service]
+Get the native socket implementation.
 
 
+ native_handle_type native_handle(
+ implementation_type & impl);
 
-[endsect]
 
 
+[endsect]
 
-[section:overload2 posix::basic_stream_descriptor::write_some (2 of 2 overloads)]
 
 
-Write some data to the descriptor.
+[section:native_handle_type raw_socket_service::native_handle_type]
 
+[indexterm2 native_handle_type..raw_socket_service]
+The native socket type.
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
 
+ typedef implementation_defined native_handle_type;
 
-This function is used to write data to the stream descriptor. The function call will block until one or more bytes of the data has been written successfully, or until an error occurs.
 
 
-[heading Parameters]
-
+[heading Requirements]
 
-[variablelist
-
-[[buffers][One or more data buffers to be written to the descriptor.]]
+[*Header: ][^boost/asio/raw_socket_service.hpp]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[*Convenience header: ][^boost/asio.hpp]
 
-]
 
+[endsect]
 
-[heading Return Value]
-
-The number of bytes written. Returns 0 if an error occurred.
 
+[section:native_non_blocking raw_socket_service::native_non_blocking]
 
-[heading Remarks]
-
-The write\_some operation may not transmit all of the data to the peer. Consider using the [link boost_asio.reference.write `write`] function if you need to ensure that all data is written before the blocking operation completes.
+[indexterm2 native_non_blocking..raw_socket_service]
+Gets the non-blocking mode of the native socket implementation.
 
 
+ bool ``[link boost_asio.reference.raw_socket_service.native_non_blocking.overload1 native_non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.raw_socket_service.native_non_blocking.overload1 more...]]``
 
 
-[endsect]
+Sets the non-blocking mode of the native socket implementation.
 
 
-[endsect]
+ boost::system::error_code ``[link boost_asio.reference.raw_socket_service.native_non_blocking.overload2 native_non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.raw_socket_service.native_non_blocking.overload2 more...]]``
 
 
-[endsect]
+[section:overload1 raw_socket_service::native_non_blocking (1 of 2 overloads)]
 
-[section:posix__descriptor_base posix::descriptor_base]
 
+Gets the non-blocking mode of the native socket implementation.
 
-The [link boost_asio.reference.posix__descriptor_base `posix::descriptor_base`] class is used as a base for the [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template so that we have a common place to define the associated IO control commands.
 
+ bool native_non_blocking(
+ const implementation_type & impl) const;
 
- class descriptor_base
 
 
-[heading Types]
-[table
- [[Name][Description]]
+[endsect]
 
- [
 
- [[link boost_asio.reference.posix__descriptor_base.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
 
- [
+[section:overload2 raw_socket_service::native_non_blocking (2 of 2 overloads)]
 
- [[link boost_asio.reference.posix__descriptor_base.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the descriptor. ]
-
- ]
 
-]
+Sets the non-blocking mode of the native socket implementation.
 
-[heading Protected Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.posix__descriptor_base._descriptor_base [*~descriptor_base]]]
- [Protected destructor to prevent deletion through this type. ]
- ]
-
-]
+ boost::system::error_code native_non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/descriptor_base.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
-[section:bytes_readable posix::descriptor_base::bytes_readable]
+[endsect]
 
-[indexterm2 bytes_readable..posix::descriptor_base]
-IO control command to get the amount of data that can be read without blocking.
 
+[section:native_type raw_socket_service::native_type]
 
- typedef implementation_defined bytes_readable;
+[indexterm2 native_type..raw_socket_service]
+(Deprecated: Use native\_handle\_type.) The native socket type.
 
 
+ typedef implementation_defined native_type;
 
-Implements the FIONREAD IO control command.
 
 
-[heading Example]
-
+[heading Requirements]
 
+[*Header: ][^boost/asio/raw_socket_service.hpp]
 
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::descriptor_base::bytes_readable command(true);
- descriptor.io_control(command);
- std::size_t bytes_readable = command.get();
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
+[section:non_blocking raw_socket_service::non_blocking]
 
+[indexterm2 non_blocking..raw_socket_service]
+Gets the non-blocking mode of the socket.
 
 
-[heading Requirements]
+ bool ``[link boost_asio.reference.raw_socket_service.non_blocking.overload1 non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.raw_socket_service.non_blocking.overload1 more...]]``
 
-[*Header: ][^boost/asio/posix/descriptor_base.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Sets the non-blocking mode of the socket.
 
 
-[endsect]
+ boost::system::error_code ``[link boost_asio.reference.raw_socket_service.non_blocking.overload2 non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.raw_socket_service.non_blocking.overload2 more...]]``
 
 
+[section:overload1 raw_socket_service::non_blocking (1 of 2 overloads)]
 
-[section:non_blocking_io posix::descriptor_base::non_blocking_io]
 
-[indexterm2 non_blocking_io..posix::descriptor_base]
-IO control command to set the blocking mode of the descriptor.
+Gets the non-blocking mode of the socket.
 
 
- typedef implementation_defined non_blocking_io;
+ bool non_blocking(
+ const implementation_type & impl) const;
 
 
 
-Implements the FIONBIO IO control command.
+[endsect]
 
 
-[heading Example]
-
 
+[section:overload2 raw_socket_service::non_blocking (2 of 2 overloads)]
 
- boost::asio::posix::stream_descriptor descriptor(io_service);
- ...
- boost::asio::descriptor_base::non_blocking_io command(true);
- descriptor.io_control(command);
 
+Sets the non-blocking mode of the socket.
 
 
+ boost::system::error_code non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
 
 
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/descriptor_base.hpp]
+[endsect]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[section:open raw_socket_service::open]
 
-[endsect]
+[indexterm2 open..raw_socket_service]
 
+ boost::system::error_code open(
+ implementation_type & impl,
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
 
 
-[section:_descriptor_base posix::descriptor_base::~descriptor_base]
 
-[indexterm2 ~descriptor_base..posix::descriptor_base]
-Protected destructor to prevent deletion through this type.
+[endsect]
 
 
- ~descriptor_base();
 
+[section:protocol_type raw_socket_service::protocol_type]
 
+[indexterm2 protocol_type..raw_socket_service]
+The protocol type.
 
-[endsect]
 
+ typedef Protocol protocol_type;
 
 
-[endsect]
 
+[heading Requirements]
 
-[section:posix__stream_descriptor posix::stream_descriptor]
+[*Header: ][^boost/asio/raw_socket_service.hpp]
 
-[indexterm1 posix::stream_descriptor]
-Typedef for the typical usage of a stream-oriented descriptor.
+[*Convenience header: ][^boost/asio.hpp]
 
 
- typedef basic_stream_descriptor stream_descriptor;
+[endsect]
 
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+[section:raw_socket_service raw_socket_service::raw_socket_service]
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.bytes_readable [*bytes_readable]]]
- [IO control command to get the amount of data that can be read without blocking. ]
-
- ]
+[indexterm2 raw_socket_service..raw_socket_service]
+Construct a new raw socket service for the specified [link boost_asio.reference.io_service `io_service`].
 
- [
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+ raw_socket_service(
+ boost::asio::io_service & io_service);
 
- [
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer_type [*lowest_layer_type]]]
- [A basic_descriptor is always the lowest layer. ]
-
- ]
 
- [
+[endsect]
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.native_type [*native_type]]]
- [The native representation of a descriptor. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the descriptor. ]
-
- ]
+[section:receive raw_socket_service::receive]
 
- [
+[indexterm2 receive..raw_socket_service]
+Receive some data from the peer.
 
- [[link boost_asio.reference.posix__basic_stream_descriptor.service_type [*service_type]]]
- [The type of the service that will be used to provide I/O operations. ]
-
- ]
 
-]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.assign [*assign]]]
- [Assign an existing native descriptor to the descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.basic_stream_descriptor [*basic_stream_descriptor]]]
- [Construct a basic_stream_descriptor without opening it.
 
- Construct a basic_stream_descriptor on an existing native descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.close [*close]]]
- [Close the descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.get_io_service [*get_io_service]]]
- [Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.io_control [*io_control]]]
- [Perform an IO control command on the descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.is_open [*is_open]]]
- [Determine whether the descriptor is open. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
+[endsect]
 
- Get a const reference to the lowest layer. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.native [*native]]]
- [Get the native descriptor representation. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.read_some [*read_some]]]
- [Read some data from the descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.write_some [*write_some]]]
- [Write some data to the descriptor. ]
- ]
-
-]
 
-[heading Protected Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
- ]
+[section:receive_from raw_socket_service::receive_from]
 
- [
- [[link boost_asio.reference.posix__basic_stream_descriptor.service [*service]]]
- [The service associated with the I/O object. ]
- ]
+[indexterm2 receive_from..raw_socket_service]
+Receive raw data with the endpoint of the sender.
 
-]
 
-The [link boost_asio.reference.posix__basic_stream_descriptor `posix::basic_stream_descriptor`] class template provides asynchronous and blocking stream-oriented descriptor functionality.
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive_from(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
 
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[endsect]
 
 
 
+[section:remote_endpoint raw_socket_service::remote_endpoint]
 
+[indexterm2 remote_endpoint..raw_socket_service]
+Get the remote endpoint.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/stream_descriptor.hpp]
+ endpoint_type remote_endpoint(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
-[section:posix__stream_descriptor_service posix::stream_descriptor_service]
 
+[section:send raw_socket_service::send]
 
-Default service implementation for a stream descriptor.
+[indexterm2 send..raw_socket_service]
+Send the given data to the peer.
 
 
- class stream_descriptor_service :
- public io_service::service
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+[endsect]
 
- [[link boost_asio.reference.posix__stream_descriptor_service.implementation_type [*implementation_type]]]
- [The type of a stream descriptor implementation. ]
-
- ]
 
- [
 
- [[link boost_asio.reference.posix__stream_descriptor_service.native_type [*native_type]]]
- [The native descriptor type. ]
-
- ]
+[section:send_to raw_socket_service::send_to]
 
-]
+[indexterm2 send_to..raw_socket_service]
+Send raw data to the specified endpoint.
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.assign [*assign]]]
- [Assign an existing native descriptor to a stream descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.close [*close]]]
- [Close a stream descriptor implementation. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.construct [*construct]]]
- [Construct a new stream descriptor implementation. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.destroy [*destroy]]]
- [Destroy a stream descriptor implementation. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.io_control [*io_control]]]
- [Perform an IO control command on the descriptor. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.is_open [*is_open]]]
- [Determine whether the descriptor is open. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.native [*native]]]
- [Get the native descriptor implementation. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.read_some [*read_some]]]
- [Read some data from the stream. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined descriptorr objects owned by the service. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.stream_descriptor_service [*stream_descriptor_service]]]
- [Construct a new stream descriptor service for the specified io_service. ]
- ]
-
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.write_some [*write_some]]]
- [Write the given data to the stream. ]
- ]
-
-]
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send_to(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.posix__stream_descriptor_service.id [*id]]]
- [The unique service identifier. ]
- ]
 
-]
+[endsect]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/stream_descriptor_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[section:set_option raw_socket_service::set_option]
 
+[indexterm2 set_option..raw_socket_service]
+Set a socket option.
 
-[section:assign posix::stream_descriptor_service::assign]
 
-[indexterm2 assign..posix::stream_descriptor_service]
-Assign an existing native descriptor to a stream descriptor.
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ implementation_type & impl,
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
 
 
- boost::system::error_code assign(
+
+[endsect]
+
+
+
+[section:shutdown raw_socket_service::shutdown]
+
+[indexterm2 shutdown..raw_socket_service]
+Disable sends or receives on the socket.
+
+
+ boost::system::error_code shutdown(
       implementation_type & impl,
- const native_type & native_descriptor,
+ socket_base::shutdown_type what,
       boost::system::error_code & ec);
 
 
@@ -55521,101 +74023,170 @@
 
 
 
-[section:async_read_some posix::stream_descriptor_service::async_read_some]
+[endsect]
 
-[indexterm2 async_read_some..posix::stream_descriptor_service]
-Start an asynchronous read.
+[section:read read]
 
+[indexterm1 read]
+Attempt to read a certain amount of data from a stream before returning.
 
+
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_read_some(
- implementation_type & impl,
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.read.overload1 read]``(
+ SyncReadStream & s,
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload1 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.read.overload2 read]``(
+ SyncReadStream & s,
       const MutableBufferSequence & buffers,
- ReadHandler descriptorr);
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload2 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read.overload3 read]``(
+ SyncReadStream & s,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload3 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read.overload4 read]``(
+ SyncReadStream & s,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload4 more...]]``
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read.overload5 read]``(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload5 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read.overload6 read]``(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload6 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read.overload7 read]``(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload7 more...]]``
 
-[section:async_write_some posix::stream_descriptor_service::async_write_some]
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read.overload8 read]``(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read.overload8 more...]]``
 
-[indexterm2 async_write_some..posix::stream_descriptor_service]
-Start an asynchronous write.
+[heading Requirements]
 
+[*Header: ][^boost/asio/read.hpp]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- WriteHandler descriptorr);
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[section:overload1 read (1 of 8 overloads)]
 
-[endsect]
 
+Attempt to read a certain amount of data from a stream before returning.
 
 
-[section:cancel posix::stream_descriptor_service::cancel]
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read(
+ SyncReadStream & s,
+ const MutableBufferSequence & buffers);
 
-[indexterm2 cancel..posix::stream_descriptor_service]
-Cancel all asynchronous operations associated with the descriptor.
 
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
- boost::system::error_code cancel(
- implementation_type & impl,
- boost::system::error_code & ec);
 
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
 
-[endsect]
+* An error occurred.
 
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
-[section:close posix::stream_descriptor_service::close]
+[heading Parameters]
+
 
-[indexterm2 close..posix::stream_descriptor_service]
-Close a stream descriptor implementation.
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
 
- boost::system::error_code close(
- implementation_type & impl,
- boost::system::error_code & ec);
+]
 
 
+[heading Return Value]
+
+The number of bytes transferred.
 
-[endsect]
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[section:construct posix::stream_descriptor_service::construct]
+]
 
-[indexterm2 construct..posix::stream_descriptor_service]
-Construct a new stream descriptor implementation.
 
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
- void construct(
- implementation_type & impl);
+ boost::asio::read(s, boost::asio::buffer(data, size));
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
-[endsect]
 
+[heading Remarks]
+
+This overload is equivalent to calling:
 
+ boost::asio::read(
+ s, buffers,
+ boost::asio::transfer_all());
 
-[section:destroy posix::stream_descriptor_service::destroy]
 
-[indexterm2 destroy..posix::stream_descriptor_service]
-Destroy a stream descriptor implementation.
 
 
- void destroy(
- implementation_type & impl);
 
 
 
@@ -55623,157 +74194,220 @@
 
 
 
-[section:get_io_service posix::stream_descriptor_service::get_io_service]
+[section:overload2 read (2 of 8 overloads)]
 
 
-['Inherited from io_service.]
+Attempt to read a certain amount of data from a stream before returning.
 
-[indexterm2 get_io_service..posix::stream_descriptor_service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read(
+ SyncReadStream & s,
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
- boost::asio::io_service & get_io_service();
 
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
 
-[endsect]
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
 
+* An error occurred.
 
-[section:id posix::stream_descriptor_service::id]
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
-[indexterm2 id..posix::stream_descriptor_service]
-The unique service identifier.
 
+[heading Parameters]
+
 
- static boost::asio::io_service::id id;
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
-[endsect]
+]
 
 
+[heading Return Value]
+
+The number of bytes transferred.
 
-[section:implementation_type posix::stream_descriptor_service::implementation_type]
 
-[indexterm2 implementation_type..posix::stream_descriptor_service]
-The type of a stream descriptor implementation.
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ boost::asio::read(s, boost::asio::buffer(data, size), ec);
 
- typedef implementation_defined implementation_type;
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+[heading Remarks]
+
+This overload is equivalent to calling:
+
+ boost::asio::read(
+ s, buffers,
+ boost::asio::transfer_all(), ec);
 
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/stream_descriptor_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:io_control posix::stream_descriptor_service::io_control]
+[section:overload3 read (3 of 8 overloads)]
 
-[indexterm2 io_control..posix::stream_descriptor_service]
-Perform an IO control command on the descriptor.
+
+Attempt to read a certain amount of data from a stream before returning.
 
 
   template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- implementation_type & impl,
- IoControlCommand & command,
- boost::system::error_code & ec);
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t read(
+ SyncReadStream & s,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition);
 
 
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
-[endsect]
 
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
 
-[section:io_service posix::stream_descriptor_service::io_service]
+* The completion\_condition function object returns 0.
 
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..posix::stream_descriptor_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+[heading Parameters]
+
 
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
- boost::asio::io_service & io_service();
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
 
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
 
-[endsect]
+]
 
 
+[heading Return Value]
+
+The number of bytes transferred.
 
-[section:is_open posix::stream_descriptor_service::is_open]
 
-[indexterm2 is_open..posix::stream_descriptor_service]
-Determine whether the descriptor is open.
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
- bool is_open(
- const implementation_type & impl) const;
+]
 
 
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
-[endsect]
+ boost::asio::read(s, boost::asio::buffer(data, size),
+ boost::asio::transfer_at_least(32));
 
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
-[section:native posix::stream_descriptor_service::native]
 
-[indexterm2 native..posix::stream_descriptor_service]
-Get the native descriptor implementation.
 
 
- native_type native(
- implementation_type & impl);
+[endsect]
 
 
 
-[endsect]
+[section:overload4 read (4 of 8 overloads)]
 
 
+Attempt to read a certain amount of data from a stream before returning.
 
-[section:native_type posix::stream_descriptor_service::native_type]
 
-[indexterm2 native_type..posix::stream_descriptor_service]
-The native descriptor type.
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t read(
+ SyncReadStream & s,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ boost::system::error_code & ec);
 
 
- typedef implementation_defined native_type;
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
 
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/posix/stream_descriptor_service.hpp]
+* The completion\_condition function object returns 0.
 
-[*Convenience header: ][^boost/asio.hpp]
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
-[endsect]
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
 
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
-[section:read_some posix::stream_descriptor_service::read_some]
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
 
-[indexterm2 read_some..posix::stream_descriptor_service]
-Read some data from the stream.
 
+[heading Return Value]
+
+The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
 
 
 
@@ -55781,292 +74415,126 @@
 
 
 
-[section:shutdown_service posix::stream_descriptor_service::shutdown_service]
+[section:overload5 read (5 of 8 overloads)]
 
-[indexterm2 shutdown_service..posix::stream_descriptor_service]
-Destroy all user-defined descriptorr objects owned by the service.
 
+Attempt to read a certain amount of data from a stream before returning.
 
- virtual void shutdown_service();
 
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator>
+ std::size_t read(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b);
 
 
-[endsect]
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
 
+* An error occurred.
 
-[section:stream_descriptor_service posix::stream_descriptor_service::stream_descriptor_service]
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
-[indexterm2 stream_descriptor_service..posix::stream_descriptor_service]
-Construct a new stream descriptor service for the specified [link boost_asio.reference.io_service `io_service`].
 
+[heading Parameters]
+
 
- stream_descriptor_service(
- boost::asio::io_service & io_service);
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
+]
 
-[endsect]
 
+[heading Return Value]
+
+The number of bytes transferred.
 
 
-[section:write_some posix::stream_descriptor_service::write_some]
+[heading Exceptions]
+
 
-[indexterm2 write_some..posix::stream_descriptor_service]
-Write the given data to the stream.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
+]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
 
+[heading Remarks]
+
+This overload is equivalent to calling:
 
+ boost::asio::read(
+ s, b,
+ boost::asio::transfer_all());
 
-[endsect]
 
 
 
-[endsect]
 
-[section:raw_socket_service raw_socket_service]
 
 
-Default service implementation for a raw socket.
+[endsect]
 
 
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``>
- class raw_socket_service :
- public io_service::service
 
+[section:overload6 read (6 of 8 overloads)]
 
-[heading Types]
-[table
- [[Name][Description]]
 
- [
+Attempt to read a certain amount of data from a stream before returning.
 
- [[link boost_asio.reference.raw_socket_service.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
-
- ]
 
- [
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator>
+ std::size_t read(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
 
- [[link boost_asio.reference.raw_socket_service.implementation_type [*implementation_type]]]
- [The type of a raw socket. ]
-
- ]
 
- [
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
- [[link boost_asio.reference.raw_socket_service.native_type [*native_type]]]
- [The native socket type. ]
-
- ]
 
- [
+* An error occurred.
 
- [[link boost_asio.reference.raw_socket_service.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
-]
 
-[heading Member Functions]
-[table
- [[Name][Description]]
+[heading Parameters]
+
 
- [
- [[link boost_asio.reference.raw_socket_service.assign [*assign]]]
- [Assign an existing native socket to a raw socket. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.async_connect [*async_connect]]]
- [Start an asynchronous connect. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.async_receive [*async_receive]]]
- [Start an asynchronous receive. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.async_receive_from [*async_receive_from]]]
- [Start an asynchronous receive that will get the endpoint of the sender. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.async_send [*async_send]]]
- [Start an asynchronous send. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.async_send_to [*async_send_to]]]
- [Start an asynchronous send. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.at_mark [*at_mark]]]
- [Determine whether the socket is at the out-of-band data mark. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.available [*available]]]
- [Determine the number of bytes available for reading. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.bind [*bind]]]
- []
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.close [*close]]]
- [Close a raw socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.connect [*connect]]]
- [Connect the raw socket to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.construct [*construct]]]
- [Construct a new raw socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.destroy [*destroy]]]
- [Destroy a raw socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.get_option [*get_option]]]
- [Get a socket option. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.io_control [*io_control]]]
- [Perform an IO control command on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.is_open [*is_open]]]
- [Determine whether the socket is open. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.local_endpoint [*local_endpoint]]]
- [Get the local endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.native [*native]]]
- [Get the native socket implementation. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.open [*open]]]
- []
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.raw_socket_service [*raw_socket_service]]]
- [Construct a new raw socket service for the specified io_service. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.receive [*receive]]]
- [Receive some data from the peer. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.receive_from [*receive_from]]]
- [Receive raw data with the endpoint of the sender. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.send [*send]]]
- [Send the given data to the peer. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.send_to [*send_to]]]
- [Send raw data to the specified endpoint. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.set_option [*set_option]]]
- [Set a socket option. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
- ]
-
- [
- [[link boost_asio.reference.raw_socket_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
+[variablelist
   
-]
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[heading Data Members]
-[table
- [[Name][Description]]
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
- [
- [[link boost_asio.reference.raw_socket_service.id [*id]]]
- [The unique service identifier. ]
- ]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/raw_socket_service.hpp]
+[heading Return Value]
+
+The number of bytes transferred.
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[heading Remarks]
+
+This overload is equivalent to calling:
+
+ boost::asio::read(
+ s, b,
+ boost::asio::transfer_all(), ec);
 
-[section:assign raw_socket_service::assign]
 
-[indexterm2 assign..raw_socket_service]
-Assign an existing native socket to a raw socket.
 
 
- boost::system::error_code assign(
- implementation_type & impl,
- const protocol_type & protocol,
- const native_type & native_socket,
- boost::system::error_code & ec);
 
 
 
@@ -56074,61 +74542,68 @@
 
 
 
-[section:async_connect raw_socket_service::async_connect]
+[section:overload7 read (7 of 8 overloads)]
 
-[indexterm2 async_connect..raw_socket_service]
-Start an asynchronous connect.
+
+Attempt to read a certain amount of data from a stream before returning.
 
 
   template<
- typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
- void async_connect(
- implementation_type & impl,
- const endpoint_type & peer_endpoint,
- ConnectHandler handler);
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t read(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition);
 
 
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
-[endsect]
 
+* The completion\_condition function object returns 0.
+
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
 
-[section:async_receive raw_socket_service::async_receive]
+[heading Parameters]
+
 
-[indexterm2 async_receive..raw_socket_service]
-Start an asynchronous receive.
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_receive(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
- ReadHandler handler);
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
 
+]
 
-[endsect]
 
+[heading Return Value]
+
+The number of bytes transferred.
 
 
-[section:async_receive_from raw_socket_service::async_receive_from]
+[heading Exceptions]
+
 
-[indexterm2 async_receive_from..raw_socket_service]
-Start an asynchronous receive that will get the endpoint of the sender.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_receive_from(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- endpoint_type & sender_endpoint,
- socket_base::message_flags flags,
- ReadHandler handler);
 
 
 
@@ -56136,206 +74611,319 @@
 
 
 
-[section:async_send raw_socket_service::async_send]
+[section:overload8 read (8 of 8 overloads)]
 
-[indexterm2 async_send..raw_socket_service]
-Start an asynchronous send.
+
+Attempt to read a certain amount of data from a stream before returning.
 
 
   template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_send(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
- WriteHandler handler);
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t read(
+ SyncReadStream & s,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
+ boost::system::error_code & ec);
 
 
+This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
 
-[endsect]
 
+* The completion\_condition function object returns 0.
 
+This operation is implemented in terms of zero or more calls to the stream's read\_some function.
 
-[section:async_send_to raw_socket_service::async_send_to]
 
-[indexterm2 async_send_to..raw_socket_service]
-Start an asynchronous send.
+[heading Parameters]
+
 
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_send_to(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- const endpoint_type & destination,
- socket_base::message_flags flags,
- WriteHandler handler);
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some operation.
+ const boost::system::error_code& error,
 
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
 
-[endsect]
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
-[section:at_mark raw_socket_service::at_mark]
+[heading Return Value]
+
+The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
 
-[indexterm2 at_mark..raw_socket_service]
-Determine whether the socket is at the out-of-band data mark.
 
 
- bool at_mark(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
 
+[endsect]
 
 
 [endsect]
 
+[section:read_at read_at]
 
+[indexterm1 read_at]
+Attempt to read a certain amount of data at the specified offset before returning.
 
-[section:available raw_socket_service::available]
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.read_at.overload1 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload1 more...]]``
 
-[indexterm2 available..raw_socket_service]
-Determine the number of bytes available for reading.
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.read_at.overload2 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload2 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read_at.overload3 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload3 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read_at.overload4 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload4 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read_at.overload5 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload5 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read_at.overload6 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload6 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read_at.overload7 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload7 more...]]``
 
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.read_at.overload8 read_at]``(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read_at.overload8 more...]]``
 
- std::size_t available(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
+[heading Requirements]
 
+[*Header: ][^boost/asio/read_at.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
-[endsect]
 
+[section:overload1 read_at (1 of 8 overloads)]
 
 
-[section:bind raw_socket_service::bind]
+Attempt to read a certain amount of data at the specified offset before returning.
 
-[indexterm2 bind..raw_socket_service]
 
- boost::system::error_code bind(
- implementation_type & impl,
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers);
 
 
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
-[endsect]
 
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
 
-[section:cancel raw_socket_service::cancel]
+* An error occurred.
 
-[indexterm2 cancel..raw_socket_service]
-Cancel all asynchronous operations associated with the socket.
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
- boost::system::error_code cancel(
- implementation_type & impl,
- boost::system::error_code & ec);
+[heading Parameters]
+
 
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
+[[offset][The offset at which the data will be read.]]
 
-[endsect]
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
 
+]
 
 
-[section:close raw_socket_service::close]
+[heading Return Value]
+
+The number of bytes transferred.
 
-[indexterm2 close..raw_socket_service]
-Close a raw socket implementation.
 
+[heading Exceptions]
+
 
- boost::system::error_code close(
- implementation_type & impl,
- boost::system::error_code & ec);
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
+]
 
 
-[endsect]
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ boost::asio::read_at(d, 42, boost::asio::buffer(data, size));
 
 
-[section:connect raw_socket_service::connect]
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
-[indexterm2 connect..raw_socket_service]
-Connect the raw socket to the specified endpoint.
 
+[heading Remarks]
+
+This overload is equivalent to calling:
 
- boost::system::error_code connect(
- implementation_type & impl,
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
+ boost::asio::read_at(
+ d, 42, buffers,
+ boost::asio::transfer_all());
 
 
 
-[endsect]
 
 
 
-[section:construct raw_socket_service::construct]
 
-[indexterm2 construct..raw_socket_service]
-Construct a new raw socket implementation.
+[endsect]
 
 
- void construct(
- implementation_type & impl);
 
+[section:overload2 read_at (2 of 8 overloads)]
 
 
-[endsect]
+Attempt to read a certain amount of data at the specified offset before returning.
 
 
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
 
-[section:destroy raw_socket_service::destroy]
 
-[indexterm2 destroy..raw_socket_service]
-Destroy a raw socket implementation.
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
 
- void destroy(
- implementation_type & impl);
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
 
+* An error occurred.
 
-[endsect]
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
+[heading Parameters]
+
 
-[section:endpoint_type raw_socket_service::endpoint_type]
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
-[indexterm2 endpoint_type..raw_socket_service]
-The endpoint type.
+[[offset][The offset at which the data will be read.]]
 
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
 
- typedef Protocol::endpoint endpoint_type;
+[[ec][Set to indicate what error occurred, if any.]]
 
+]
 
 
-[heading Requirements]
+[heading Return Value]
+
+The number of bytes transferred.
 
-[*Header: ][^boost/asio/raw_socket_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
+ boost::asio::read_at(d, 42,
+ boost::asio::buffer(data, size), ec);
 
-[endsect]
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
 
-[section:get_io_service raw_socket_service::get_io_service]
+[heading Remarks]
+
+This overload is equivalent to calling:
 
+ boost::asio::read_at(
+ d, 42, buffers,
+ boost::asio::transfer_all(), ec);
 
-['Inherited from io_service.]
 
-[indexterm2 get_io_service..raw_socket_service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
 
- boost::asio::io_service & get_io_service();
 
 
 
@@ -56343,72 +74931,85 @@
 
 
 
-[section:get_option raw_socket_service::get_option]
-
-[indexterm2 get_option..raw_socket_service]
-Get a socket option.
-
-
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code get_option(
- const implementation_type & impl,
- GettableSocketOption & option,
- boost::system::error_code & ec) const;
+[section:overload3 read_at (3 of 8 overloads)]
 
 
+Attempt to read a certain amount of data at the specified offset before returning.
 
-[endsect]
 
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition);
 
 
-[section:id raw_socket_service::id]
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
-[indexterm2 id..raw_socket_service]
-The unique service identifier.
 
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
- static boost::asio::io_service::id id;
 
+* The completion\_condition function object returns 0.
 
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
-[endsect]
 
+[heading Parameters]
+
 
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
-[section:implementation_type raw_socket_service::implementation_type]
+[[offset][The offset at which the data will be read.]]
 
-[indexterm2 implementation_type..raw_socket_service]
-The type of a raw socket.
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
 
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some_at operation.
+ const boost::system::error_code& error,
 
- typedef implementation_defined implementation_type;
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
+]
 
 
-[heading Requirements]
+[heading Return Value]
+
+The number of bytes transferred.
 
-[*Header: ][^boost/asio/raw_socket_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[endsect]
+]
 
 
+[heading Example]
+
+To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
 
-[section:io_control raw_socket_service::io_control]
+ boost::asio::read_at(d, 42, boost::asio::buffer(data, size),
+ boost::asio::transfer_at_least(32));
 
-[indexterm2 io_control..raw_socket_service]
-Perform an IO control command on the socket.
 
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
 
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code io_control(
- implementation_type & impl,
- IoControlCommand & command,
- boost::system::error_code & ec);
 
 
 
@@ -56416,47 +75017,67 @@
 
 
 
-[section:io_service raw_socket_service::io_service]
+[section:overload4 read_at (4 of 8 overloads)]
 
 
-['Inherited from io_service.]
+Attempt to read a certain amount of data at the specified offset before returning.
 
-[indexterm2 io_service..raw_socket_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ boost::system::error_code & ec);
 
- boost::asio::io_service & io_service();
 
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
 
-[endsect]
+* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
 
 
+* The completion\_condition function object returns 0.
 
-[section:is_open raw_socket_service::is_open]
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
-[indexterm2 is_open..raw_socket_service]
-Determine whether the socket is open.
 
+[heading Parameters]
+
 
- bool is_open(
- const implementation_type & impl) const;
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
+[[offset][The offset at which the data will be read.]]
 
+[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
 
-[endsect]
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some_at operation.
+ const boost::system::error_code& error,
 
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
-[section:local_endpoint raw_socket_service::local_endpoint]
+]
 
-[indexterm2 local_endpoint..raw_socket_service]
-Get the local endpoint.
 
+[heading Return Value]
+
+The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
 
- endpoint_type local_endpoint(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
 
 
 
@@ -56464,184 +75085,204 @@
 
 
 
-[section:native raw_socket_service::native]
-
-[indexterm2 native..raw_socket_service]
-Get the native socket implementation.
-
+[section:overload5 read_at (5 of 8 overloads)]
 
- native_type native(
- implementation_type & impl);
 
+Attempt to read a certain amount of data at the specified offset before returning.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b);
 
 
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
-[section:native_type raw_socket_service::native_type]
 
-[indexterm2 native_type..raw_socket_service]
-The native socket type.
+* An error occurred.
 
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
- typedef implementation_defined native_type;
 
+[heading Parameters]
+
 
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
-[heading Requirements]
+[[offset][The offset at which the data will be read.]]
 
-[*Header: ][^boost/asio/raw_socket_service.hpp]
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
-[*Convenience header: ][^boost/asio.hpp]
+]
 
 
-[endsect]
+[heading Return Value]
+
+The number of bytes transferred.
 
 
+[heading Exceptions]
+
 
-[section:open raw_socket_service::open]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[indexterm2 open..raw_socket_service]
+]
 
- boost::system::error_code open(
- implementation_type & impl,
- const protocol_type & protocol,
- boost::system::error_code & ec);
 
+[heading Remarks]
+
+This overload is equivalent to calling:
 
+ boost::asio::read_at(
+ d, 42, b,
+ boost::asio::transfer_all());
 
-[endsect]
 
 
 
-[section:protocol_type raw_socket_service::protocol_type]
 
-[indexterm2 protocol_type..raw_socket_service]
-The protocol type.
 
 
- typedef Protocol protocol_type;
+[endsect]
 
 
 
-[heading Requirements]
+[section:overload6 read_at (6 of 8 overloads)]
 
-[*Header: ][^boost/asio/raw_socket_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+Attempt to read a certain amount of data at the specified offset before returning.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
 
 
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
-[section:raw_socket_service raw_socket_service::raw_socket_service]
 
-[indexterm2 raw_socket_service..raw_socket_service]
-Construct a new raw socket service for the specified [link boost_asio.reference.io_service `io_service`].
+* An error occurred.
 
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
- raw_socket_service(
- boost::asio::io_service & io_service);
 
+[heading Parameters]
+
 
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
-[endsect]
+[[offset][The offset at which the data will be read.]]
 
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
-[section:receive raw_socket_service::receive]
+]
 
-[indexterm2 receive..raw_socket_service]
-Receive some data from the peer.
 
+[heading Return Value]
+
+The number of bytes transferred.
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
 
+[heading Remarks]
+
+This overload is equivalent to calling:
 
+ boost::asio::read_at(
+ d, 42, b,
+ boost::asio::transfer_all(), ec);
 
-[endsect]
 
 
 
-[section:receive_from raw_socket_service::receive_from]
 
-[indexterm2 receive_from..raw_socket_service]
-Receive raw data with the endpoint of the sender.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive_from(
- implementation_type & impl,
- const MutableBufferSequence & buffers,
- endpoint_type & sender_endpoint,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
+[endsect]
 
 
 
-[endsect]
+[section:overload7 read_at (7 of 8 overloads)]
 
 
+Attempt to read a certain amount of data at the specified offset before returning.
 
-[section:remote_endpoint raw_socket_service::remote_endpoint]
 
-[indexterm2 remote_endpoint..raw_socket_service]
-Get the remote endpoint.
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition);
 
 
- endpoint_type remote_endpoint(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
 
+* The completion\_condition function object returns 0.
 
-[endsect]
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
 
+[heading Parameters]
+
 
-[section:send raw_socket_service::send]
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
-[indexterm2 send..raw_socket_service]
-Send the given data to the peer.
+[[offset][The offset at which the data will be read.]]
 
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t send(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some_at operation.
+ const boost::system::error_code& error,
 
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
+]
 
-[endsect]
 
+[heading Return Value]
+
+The number of bytes transferred.
 
 
-[section:send_to raw_socket_service::send_to]
+[heading Exceptions]
+
 
-[indexterm2 send_to..raw_socket_service]
-Send raw data to the specified endpoint.
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
 
+]
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t send_to(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- const endpoint_type & destination,
- socket_base::message_flags flags,
- boost::system::error_code & ec);
 
 
 
@@ -56649,152 +75290,189 @@
 
 
 
-[section:set_option raw_socket_service::set_option]
+[section:overload8 read_at (8 of 8 overloads)]
 
-[indexterm2 set_option..raw_socket_service]
-Set a socket option.
+
+Attempt to read a certain amount of data at the specified offset before returning.
 
 
   template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code set_option(
- implementation_type & impl,
- const SettableSocketOption & option,
+ typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename CompletionCondition>
+ std::size_t read_at(
+ SyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
       boost::system::error_code & ec);
 
 
-
-[endsect]
+This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
 
+* The completion\_condition function object returns 0.
 
-[section:shutdown raw_socket_service::shutdown]
+This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
-[indexterm2 shutdown..raw_socket_service]
-Disable sends or receives on the socket.
 
+[heading Parameters]
+
 
- boost::system::error_code shutdown(
- implementation_type & impl,
- socket_base::shutdown_type what,
- boost::system::error_code & ec);
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
 
+[[offset][The offset at which the data will be read.]]
 
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
-[endsect]
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ std::size_t completion_condition(
+ // Result of latest read_some_at operation.
+ const boost::system::error_code& error,
 
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
+[[ec][Set to indicate what error occurred, if any.]]
 
-[section:shutdown_service raw_socket_service::shutdown_service]
+]
 
-[indexterm2 shutdown_service..raw_socket_service]
-Destroy all user-defined handler objects owned by the service.
 
+[heading Return Value]
+
+The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
 
- virtual void shutdown_service();
 
 
 
 [endsect]
 
 
-
 [endsect]
 
-[section:read read]
+[section:read_until read_until]
 
-[indexterm1 read]
-Attempt to read a certain amount of data from a stream before returning.
+[indexterm1 read_until]
+Read data into a streambuf until it contains a delimiter, matches a regular expression, or a function object indicates a match.
 
       
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.read.overload1 read]``(
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read_until.overload1 read_until]``(
       SyncReadStream & s,
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.read.overload1 more...]]``
+ boost::asio::basic_streambuf< Allocator > & b,
+ char delim);
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload1 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read.overload2 read]``(
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read_until.overload2 read_until]``(
       SyncReadStream & s,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition);
- `` [''''&raquo;''' [link boost_asio.reference.read.overload2 more...]]``
+ boost::asio::basic_streambuf< Allocator > & b,
+ char delim,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload2 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read.overload3 read]``(
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read_until.overload3 read_until]``(
       SyncReadStream & s,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition,
+ boost::asio::basic_streambuf< Allocator > & b,
+ const std::string & delim);
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload3 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read_until.overload4 read_until]``(
+ SyncReadStream & s,
+ boost::asio::basic_streambuf< Allocator > & b,
+ const std::string & delim,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.read.overload3 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload4 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
       typename Allocator>
- std::size_t ``[link boost_asio.reference.read.overload4 read]``(
+ std::size_t ``[link boost_asio.reference.read_until.overload5 read_until]``(
       SyncReadStream & s,
- basic_streambuf< Allocator > & b);
- `` [''''&raquo;''' [link boost_asio.reference.read.overload4 more...]]``
+ boost::asio::basic_streambuf< Allocator > & b,
+ const boost::regex & expr);
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload5 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.read_until.overload6 read_until]``(
+ SyncReadStream & s,
+ boost::asio::basic_streambuf< Allocator > & b,
+ const boost::regex & expr,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload6 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
       typename Allocator,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read.overload5 read]``(
+ typename MatchCondition>
+ std::size_t ``[link boost_asio.reference.read_until.overload7 read_until]``(
       SyncReadStream & s,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition);
- `` [''''&raquo;''' [link boost_asio.reference.read.overload5 more...]]``
+ boost::asio::basic_streambuf< Allocator > & b,
+ MatchCondition match_condition,
+ typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload7 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
       typename Allocator,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read.overload6 read]``(
+ typename MatchCondition>
+ std::size_t ``[link boost_asio.reference.read_until.overload8 read_until]``(
       SyncReadStream & s,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.read.overload6 more...]]``
+ boost::asio::basic_streambuf< Allocator > & b,
+ MatchCondition match_condition,
+ boost::system::error_code & ec,
+ typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
+ `` [''''&raquo;''' [link boost_asio.reference.read_until.overload8 more...]]``
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/read.hpp]
+[*Header: ][^boost/asio/read_until.hpp]
 
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:overload1 read (1 of 6 overloads)]
+[section:overload1 read_until (1 of 8 overloads)]
 
 
-Attempt to read a certain amount of data from a stream before returning.
+Read data into a streambuf until it contains a specified delimiter.
 
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read(
+ typename Allocator>
+ std::size_t read_until(
       SyncReadStream & s,
- const MutableBufferSequence & buffers);
+ boost::asio::basic_streambuf< Allocator > & b,
+ char delim);
 
 
-This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
+This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
 
 
-* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
+* The get area of the streambuf contains the specified delimiter.
 
 
 * An error occurred.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
 
 
 [heading Parameters]
@@ -56804,14 +75482,16 @@
   
 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
+[[b][A streambuf object into which the data will be read.]]
+
+[[delim][The delimiter character.]]
 
 ]
 
 
 [heading Return Value]
       
-The number of bytes transferred.
+The number of bytes in the streambuf's get area up to and including the delimiter.
 
 
 [heading Exceptions]
@@ -56824,109 +75504,38 @@
 ]
 
 
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
-
- boost::asio::read(s, boost::asio::buffer(data, size));
-
-
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
-
-
 [heading Remarks]
       
-This overload is equivalent to calling:
-
- boost::asio::read(
- s, buffers,
- boost::asio::transfer_all());
-
-
-
-
-
-
-
-[endsect]
-
-
-
-[section:overload2 read (2 of 6 overloads)]
-
-
-Attempt to read a certain amount of data from a stream before returning.
-
-
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t read(
- SyncReadStream & s,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition);
-
-
-This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
-
-
-* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
-
-
-* The completion\_condition function object returns 0.
-
-This operation is implemented in terms of zero or more calls to the stream's read\_some function.
-
+After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
-[heading Parameters]
-
 
-[variablelist
+[heading Example]
   
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
-
-[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
-
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
-``
- std::size_t completion_condition(
- // Result of latest read_some operation.
- const boost::system::error_code& error,
-
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
-``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
+To read data into a streambuf until a newline is encountered:
 
-]
+ boost::asio::streambuf b;
+ boost::asio::read_until(s, b, '\n');
+ std::istream is(&b);
+ std::string line;
+ std::getline(is, line);
 
 
-[heading Return Value]
-
-The number of bytes transferred.
+After the `read_until` operation completes successfully, the buffer `b` contains the delimiter:
 
+ { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+The call to `std::getline` then extracts the data up to and including the delimiter, so that the string `line` contains:
 
-]
+ { 'a', 'b', ..., 'c', '\n' }
 
 
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+The remaining data is left in the buffer `b` as follows:
 
- boost::asio::read(s, boost::asio::buffer(data, size),
- boost::asio::transfer_at_least(32));
+ { 'd', 'e', ... }
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
 
 
 
@@ -56935,32 +75544,31 @@
 
 
 
-[section:overload3 read (3 of 6 overloads)]
+[section:overload2 read_until (2 of 8 overloads)]
 
 
-Attempt to read a certain amount of data from a stream before returning.
+Read data into a streambuf until it contains a specified delimiter.
 
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t read(
+ typename Allocator>
+ std::size_t read_until(
       SyncReadStream & s,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition,
+ boost::asio::basic_streambuf< Allocator > & b,
+ char delim,
       boost::system::error_code & ec);
 
 
-This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
+This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
 
 
-* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
+* The get area of the streambuf contains the specified delimiter.
 
 
-* The completion\_condition function object returns 0.
+* An error occurred.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
 
 
 [heading Parameters]
@@ -56970,19 +75578,9 @@
   
 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the stream.]]
-
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
-``
- std::size_t completion_condition(
- // Result of latest read_some operation.
- const boost::system::error_code& error,
+[[b][A streambuf object into which the data will be read.]]
 
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
-``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
+[[delim][The delimiter character.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -56991,7 +75589,12 @@
 
 [heading Return Value]
       
-The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
+The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
 
 
@@ -57000,26 +75603,30 @@
 
 
 
-[section:overload4 read (4 of 6 overloads)]
+[section:overload3 read_until (3 of 8 overloads)]
 
 
-Attempt to read a certain amount of data from a stream before returning.
+Read data into a streambuf until it contains a specified delimiter.
 
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
       typename Allocator>
- std::size_t read(
+ std::size_t read_until(
       SyncReadStream & s,
- basic_streambuf< Allocator > & b);
+ boost::asio::basic_streambuf< Allocator > & b,
+ const std::string & delim);
 
 
-This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
+This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
+
+
+* The get area of the streambuf contains the specified delimiter.
 
 
 * An error occurred.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
 
 
 [heading Parameters]
@@ -57029,14 +75636,16 @@
   
 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
+[[b][A streambuf object into which the data will be read.]]
+
+[[delim][The delimiter string.]]
 
 ]
 
 
 [heading Return Value]
       
-The number of bytes transferred.
+The number of bytes in the streambuf's get area up to and including the delimiter.
 
 
 [heading Exceptions]
@@ -57051,14 +75660,36 @@
 
 [heading Remarks]
       
-This overload is equivalent to calling:
+After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
- boost::asio::read(
- s, b,
- boost::asio::transfer_all());
+
+[heading Example]
+
+To read data into a streambuf until a newline is encountered:
+
+ boost::asio::streambuf b;
+ boost::asio::read_until(s, b, "\r\n");
+ std::istream is(&b);
+ std::string line;
+ std::getline(is, line);
+
+
+After the `read_until` operation completes successfully, the buffer `b` contains the delimiter:
+
+ { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
+
+
+The call to `std::getline` then extracts the data up to and including the delimiter, so that the string `line` contains:
+
+ { 'a', 'b', ..., 'c', '\r', '\n' }
 
 
+The remaining data is left in the buffer `b` as follows:
+
+ { 'd', 'e', ... }
+
 
+This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
 
 
 
@@ -57067,28 +75698,31 @@
 
 
 
-[section:overload5 read (5 of 6 overloads)]
+[section:overload4 read_until (4 of 8 overloads)]
 
 
-Attempt to read a certain amount of data from a stream before returning.
+Read data into a streambuf until it contains a specified delimiter.
 
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator,
- typename CompletionCondition>
- std::size_t read(
+ typename Allocator>
+ std::size_t read_until(
       SyncReadStream & s,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition);
+ boost::asio::basic_streambuf< Allocator > & b,
+ const std::string & delim,
+ boost::system::error_code & ec);
 
 
-This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
+This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
 
 
-* The completion\_condition function object returns 0.
+* The get area of the streambuf contains the specified delimiter.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function.
+
+* An error occurred.
+
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
 
 
 [heading Parameters]
@@ -57098,36 +75732,23 @@
   
 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
+[[b][A streambuf object into which the data will be read.]]
 
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
-``
- std::size_t completion_condition(
- // Result of latest read_some operation.
- const boost::system::error_code& error,
+[[delim][The delimiter string.]]
 
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
-``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
 [heading Return Value]
       
-The number of bytes transferred.
-
-
-[heading Exceptions]
-
+The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
 
-]
+[heading Remarks]
+
+After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
 
 
@@ -57136,29 +75757,30 @@
 
 
 
-[section:overload6 read (6 of 6 overloads)]
+[section:overload5 read_until (5 of 8 overloads)]
 
 
-Attempt to read a certain amount of data from a stream before returning.
+Read data into a streambuf until some part of the data it contains matches a regular expression.
 
 
   template<
       typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator,
- typename CompletionCondition>
- std::size_t read(
+ typename Allocator>
+ std::size_t read_until(
       SyncReadStream & s,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition,
- boost::system::error_code & ec);
+ boost::asio::basic_streambuf< Allocator > & b,
+ const boost::regex & expr);
 
 
-This function is used to read a certain number of bytes of data from a stream. The call will block until one of the following conditions is true:
+This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
 
 
-* The completion\_condition function object returns 0.
+* A substring of the streambuf's get area matches the regular expression.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function.
+
+* An error occurred.
+
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
 
 
 [heading Parameters]
@@ -57168,189 +75790,119 @@
   
 [[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
-
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
-``
- std::size_t completion_condition(
- // Result of latest read_some operation.
- const boost::system::error_code& error,
-
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
-``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the stream's read\_some function.]]
+[[b][A streambuf object into which the data will be read.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[[expr][The regular expression.]]
 
 ]
 
 
 [heading Return Value]
       
-The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
+The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression.
 
 
+[heading Exceptions]
+
 
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
 
-[endsect]
+]
 
 
-[endsect]
+[heading Remarks]
+
+After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
-[section:read_at read_at]
 
-[indexterm1 read_at]
-Attempt to read a certain amount of data at the specified offset before returning.
+[heading Example]
+
+To read data into a streambuf until a CR-LF sequence is encountered:
 
-
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.read_at.overload1 read_at]``(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.read_at.overload1 more...]]``
+ boost::asio::streambuf b;
+ boost::asio::read_until(s, b, boost::regex("\r\n"));
+ std::istream is(&b);
+ std::string line;
+ std::getline(is, line);
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read_at.overload2 read_at]``(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition);
- `` [''''&raquo;''' [link boost_asio.reference.read_at.overload2 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read_at.overload3 read_at]``(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.read_at.overload3 more...]]``
+After the `read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression:
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename Allocator>
- std::size_t ``[link boost_asio.reference.read_at.overload4 read_at]``(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- basic_streambuf< Allocator > & b);
- `` [''''&raquo;''' [link boost_asio.reference.read_at.overload4 more...]]``
+ { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename Allocator,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read_at.overload5 read_at]``(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition);
- `` [''''&raquo;''' [link boost_asio.reference.read_at.overload5 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename Allocator,
- typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.read_at.overload6 read_at]``(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.read_at.overload6 more...]]``
+The call to `std::getline` then extracts the data up to and including the match, so that the string `line` contains:
 
-[heading Requirements]
+ { 'a', 'b', ..., 'c', '\r', '\n' }
 
-[*Header: ][^boost/asio/read_at.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+The remaining data is left in the buffer `b` as follows:
 
+ { 'd', 'e', ... }
 
-[section:overload1 read_at (1 of 6 overloads)]
 
+This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
 
-Attempt to read a certain amount of data at the specified offset before returning.
 
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_at(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- const MutableBufferSequence & buffers);
 
+[endsect]
 
-This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
 
 
-* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
+[section:overload6 read_until (6 of 8 overloads)]
 
 
-* An error occurred.
+Read data into a streambuf until some part of the data it contains matches a regular expression.
 
-This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
 
+ template<
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator>
+ std::size_t read_until(
+ SyncReadStream & s,
+ boost::asio::basic_streambuf< Allocator > & b,
+ const boost::regex & expr,
+ boost::system::error_code & ec);
 
-[heading Parameters]
-
 
-[variablelist
-
-[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
+This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
 
-[[offset][The offset at which the data will be read.]]
 
-[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
+* A substring of the streambuf's get area matches the regular expression.
 
-]
 
+* An error occurred.
 
-[heading Return Value]
-
-The number of bytes transferred.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
 
 
-[heading Exceptions]
+[heading Parameters]
     
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure.]]
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-]
+[[b][A streambuf object into which the data will be read.]]
 
+[[expr][The regular expression.]]
 
-[heading Example]
-
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+[[ec][Set to indicate what error occurred, if any.]]
 
- boost::asio::read_at(d, 42, boost::asio::buffer(data, size));
+]
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+[heading Return Value]
+
+The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
 
 
 [heading Remarks]
       
-This overload is equivalent to calling:
-
- boost::asio::read_at(
- d, 42, buffers,
- boost::asio::transfer_all());
-
-
-
+After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
 
 
@@ -57359,32 +75911,32 @@
 
 
 
-[section:overload2 read_at (2 of 6 overloads)]
+[section:overload7 read_until (7 of 8 overloads)]
 
 
-Attempt to read a certain amount of data at the specified offset before returning.
+Read data into a streambuf until a function object indicates a match.
 
 
   template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t read_at(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition);
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator,
+ typename MatchCondition>
+ std::size_t read_until(
+ SyncReadStream & s,
+ boost::asio::basic_streambuf< Allocator > & b,
+ MatchCondition match_condition,
+ typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
 
 
-This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
+This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
 
 
-* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
+* The match condition function object returns a std::pair where the second element evaluates to true.
 
 
-* The completion\_condition function object returns 0.
+* An error occurred.
 
-This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
 
 
 [heading Parameters]
@@ -57392,30 +75944,26 @@
 
 [variablelist
   
-[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
-
-[[offset][The offset at which the data will be read.]]
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
+[[b][A streambuf object into which the data will be read.]]
 
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
 ``
- std::size_t completion_condition(
- // Result of latest read_some_at operation.
- const boost::system::error_code& error,
-
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
+ pair<iterator, bool> match_condition(iterator begin, iterator end);
 ``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
+where `iterator` represents the type:
+``
+ buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
+``
+The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
 
 ]
 
 
 [heading Return Value]
       
-The number of bytes transferred.
+The number of bytes in the streambuf's get area that have been fully consumed by the match function.
 
 
 [heading Exceptions]
@@ -57428,15 +75976,66 @@
 ]
 
 
-[heading Example]
+[heading Remarks]
+
+After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent
+
+The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
+
+
+[heading Examples]
   
-To read into a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+To read data into a streambuf until whitespace is encountered:
 
- boost::asio::read_at(d, 42, boost::asio::buffer(data, size),
- boost::asio::transfer_at_least(32));
+ typedef boost::asio::buffers_iterator<
+ boost::asio::streambuf::const_buffers_type> iterator;
+
+ std::pair<iterator, bool>
+ match_whitespace(iterator begin, iterator end)
+ {
+ iterator i = begin;
+ while (i != end)
+ if (std::isspace(*i++))
+ return std::make_pair(i, true);
+ return std::make_pair(i, false);
+ }
+ ...
+ boost::asio::streambuf b;
+ boost::asio::read_until(s, b, match_whitespace);
 
 
-See the [link boost_asio.reference.buffer `buffer`] documentation for information on reading into multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+To read data into a streambuf until a matching character is found:
+
+ class match_char
+ {
+ public:
+ explicit match_char(char c) : c_(c) {}
+
+ template <typename Iterator>
+ std::pair<Iterator, bool> operator()(
+ Iterator begin, Iterator end) const
+ {
+ Iterator i = begin;
+ while (i != end)
+ if (c_ == *i++)
+ return std::make_pair(i, true);
+ return std::make_pair(i, false);
+ }
+
+ private:
+ char c_;
+ };
+
+ namespace asio {
+ template <> struct is_match_condition<match_char>
+ : public boost::true_type {};
+ } // namespace asio
+ ...
+ boost::asio::streambuf b;
+ boost::asio::read_until(s, b, match_char('a'));
+
 
 
 
@@ -57445,33 +76044,33 @@
 
 
 
-[section:overload3 read_at (3 of 6 overloads)]
+[section:overload8 read_until (8 of 8 overloads)]
 
 
-Attempt to read a certain amount of data at the specified offset before returning.
+Read data into a streambuf until a function object indicates a match.
 
 
   template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename CompletionCondition>
- std::size_t read_at(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- const MutableBufferSequence & buffers,
- CompletionCondition completion_condition,
- boost::system::error_code & ec);
+ typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
+ typename Allocator,
+ typename MatchCondition>
+ std::size_t read_until(
+ SyncReadStream & s,
+ boost::asio::basic_streambuf< Allocator > & b,
+ MatchCondition match_condition,
+ boost::system::error_code & ec,
+ typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
 
 
-This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
+This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
 
 
-* The supplied buffers are full. That is, the bytes transferred is equal to the sum of the buffer sizes.
+* The match condition function object returns a std::pair where the second element evaluates to true.
 
 
-* The completion\_condition function object returns 0.
+* An error occurred.
 
-This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
+This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
 
 
 [heading Parameters]
@@ -57479,23 +76078,19 @@
 
 [variablelist
   
-[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
-
-[[offset][The offset at which the data will be read.]]
+[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[buffers][One or more buffers into which the data will be read. The sum of the buffer sizes indicates the maximum number of bytes to read from the device.]]
+[[b][A streambuf object into which the data will be read.]]
 
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
 ``
- std::size_t completion_condition(
- // Result of latest read_some_at operation.
- const boost::system::error_code& error,
-
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
+ pair<iterator, bool> match_condition(iterator begin, iterator end);
 ``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
+where `iterator` represents the type:
+``
+ buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
+``
+The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
@@ -57504,7 +76099,14 @@
 
 [heading Return Value]
       
-The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
+The number of bytes in the streambuf's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent
+
+The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
 
 
 
@@ -57512,142 +76114,312 @@
 [endsect]
 
 
+[endsect]
 
-[section:overload4 read_at (4 of 6 overloads)]
+[section:seq_packet_socket_service seq_packet_socket_service]
 
 
-Attempt to read a certain amount of data at the specified offset before returning.
+Default service implementation for a sequenced packet socket.
 
 
   template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename Allocator>
- std::size_t read_at(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- basic_streambuf< Allocator > & b);
+ typename ``[link boost_asio.reference.Protocol Protocol]``>
+ class seq_packet_socket_service :
+ public io_service::service
 
 
-This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
+[heading Types]
+[table
+ [[Name][Description]]
 
+ [
 
-* An error occurred.
+ [[link boost_asio.reference.seq_packet_socket_service.endpoint_type [*endpoint_type]]]
+ [The endpoint type. ]
+
+ ]
 
-This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
+ [
 
+ [[link boost_asio.reference.seq_packet_socket_service.implementation_type [*implementation_type]]]
+ [The type of a sequenced packet socket implementation. ]
+
+ ]
 
-[heading Parameters]
-
+ [
 
-[variablelist
+ [[link boost_asio.reference.seq_packet_socket_service.native_handle_type [*native_handle_type]]]
+ [The native socket type. ]
   
-[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
+ ]
 
-[[offset][The offset at which the data will be read.]]
+ [
 
-[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
+ [[link boost_asio.reference.seq_packet_socket_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native socket type. ]
+
+ ]
 
-]
+ [
 
+ [[link boost_asio.reference.seq_packet_socket_service.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
 
-[heading Return Value]
-
-The number of bytes transferred.
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[heading Exceptions]
-
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.assign [*assign]]]
+ [Assign an existing native socket to a sequenced packet socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.async_receive [*async_receive]]]
+ [Start an asynchronous receive. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.async_send [*async_send]]]
+ [Start an asynchronous send. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.at_mark [*at_mark]]]
+ [Determine whether the socket is at the out-of-band data mark. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.available [*available]]]
+ [Determine the number of bytes available for reading. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.bind [*bind]]]
+ [Bind the sequenced packet socket to the specified local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.close [*close]]]
+ [Close a sequenced packet socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.connect [*connect]]]
+ [Connect the sequenced packet socket to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.construct [*construct]]]
+ [Construct a new sequenced packet socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.destroy [*destroy]]]
+ [Destroy a sequenced packet socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.get_option [*get_option]]]
+ [Get a socket option. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.io_control [*io_control]]]
+ [Perform an IO control command on the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.is_open [*is_open]]]
+ [Determine whether the socket is open. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.move_assign [*move_assign]]]
+ [Move-assign from another sequenced packet socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.move_construct [*move_construct]]]
+ [Move-construct a new sequenced packet socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.native_handle [*native_handle]]]
+ [Get the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
 
-[variablelist
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
   
-[[boost::system::system_error][Thrown on failure.]]
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
 
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.open [*open]]]
+ [Open a sequenced packet socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.receive [*receive]]]
+ [Receive some data from the peer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.remote_endpoint [*remote_endpoint]]]
+ [Get the remote endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.send [*send]]]
+ [Send the given data to the peer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.seq_packet_socket_service [*seq_packet_socket_service]]]
+ [Construct a new sequenced packet socket service for the specified io_service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.set_option [*set_option]]]
+ [Set a socket option. ]
+ ]
+
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.shutdown [*shutdown]]]
+ [Disable sends or receives on the socket. ]
+ ]
+
 ]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
-[heading Remarks]
-
-This overload is equivalent to calling:
+ [
+ [[link boost_asio.reference.seq_packet_socket_service.id [*id]]]
+ [The unique service identifier. ]
+ ]
 
- boost::asio::read_at(
- d, 42, b,
- boost::asio::transfer_all());
+]
+
+[heading Requirements]
 
+[*Header: ][^boost/asio/seq_packet_socket_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[section:assign seq_packet_socket_service::assign]
 
+[indexterm2 assign..seq_packet_socket_service]
+Assign an existing native socket to a sequenced packet socket.
 
 
-[endsect]
+ boost::system::error_code assign(
+ implementation_type & impl,
+ const protocol_type & protocol,
+ const native_handle_type & native_socket,
+ boost::system::error_code & ec);
 
 
 
-[section:overload5 read_at (5 of 6 overloads)]
+[endsect]
 
 
-Attempt to read a certain amount of data at the specified offset before returning.
 
+[section:async_connect seq_packet_socket_service::async_connect]
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename Allocator,
- typename CompletionCondition>
- std::size_t read_at(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition);
+[indexterm2 async_connect..seq_packet_socket_service]
+Start an asynchronous connect.
 
 
-This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
+ template<
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ implementation_type & impl,
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
 
 
-* The completion\_condition function object returns 0.
 
-This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
+[endsect]
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
+[section:async_receive seq_packet_socket_service::async_receive]
 
-[[offset][The offset at which the data will be read.]]
+[indexterm2 async_receive..seq_packet_socket_service]
+Start an asynchronous receive.
 
-[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
-``
- std::size_t completion_condition(
- // Result of latest read_some_at operation.
- const boost::system::error_code& error,
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags,
+ ReadHandler handler);
 
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
-``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
-]
 
+[endsect]
 
-[heading Return Value]
-
-The number of bytes transferred.
 
 
-[heading Exceptions]
-
+[section:async_send seq_packet_socket_service::async_send]
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+[indexterm2 async_send..seq_packet_socket_service]
+Start an asynchronous send.
 
-]
 
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ WriteHandler handler);
 
 
 
@@ -57655,253 +76427,165 @@
 
 
 
-[section:overload6 read_at (6 of 6 overloads)]
+[section:at_mark seq_packet_socket_service::at_mark]
 
+[indexterm2 at_mark..seq_packet_socket_service]
+Determine whether the socket is at the out-of-band data mark.
 
-Attempt to read a certain amount of data at the specified offset before returning.
 
+ bool at_mark(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
- template<
- typename ``[link boost_asio.reference.SyncRandomAccessReadDevice SyncRandomAccessReadDevice]``,
- typename Allocator,
- typename CompletionCondition>
- std::size_t read_at(
- SyncRandomAccessReadDevice & d,
- boost::uint64_t offset,
- basic_streambuf< Allocator > & b,
- CompletionCondition completion_condition,
- boost::system::error_code & ec);
 
 
-This function is used to read a certain number of bytes of data from a random access device at the specified offset. The call will block until one of the following conditions is true:
+[endsect]
 
 
-* The completion\_condition function object returns 0.
 
-This operation is implemented in terms of zero or more calls to the device's read\_some\_at function.
+[section:available seq_packet_socket_service::available]
 
+[indexterm2 available..seq_packet_socket_service]
+Determine the number of bytes available for reading.
 
-[heading Parameters]
-
 
-[variablelist
-
-[[d][The device from which the data is to be read. The type must support the SyncRandomAccessReadDevice concept.]]
+ std::size_t available(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
-[[offset][The offset at which the data will be read.]]
 
-[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object into which the data will be read.]]
 
-[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
-``
- std::size_t completion_condition(
- // Result of latest read_some_at operation.
- const boost::system::error_code& error,
+[endsect]
 
- // Number of bytes transferred so far.
- std::size_t bytes_transferred
- );
-``
-A return value of 0 indicates that the read operation is complete. A non-zero return value indicates the maximum number of bytes to be read on the next call to the device's read\_some\_at function.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[section:bind seq_packet_socket_service::bind]
+
+[indexterm2 bind..seq_packet_socket_service]
+Bind the sequenced packet socket to the specified local endpoint.
+
+
+ boost::system::error_code bind(
+ implementation_type & impl,
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
 
+[section:cancel seq_packet_socket_service::cancel]
 
-[heading Return Value]
-
-The number of bytes read. If an error occurs, returns the total number of bytes successfully transferred prior to the error.
+[indexterm2 cancel..seq_packet_socket_service]
+Cancel all asynchronous operations associated with the socket.
 
 
+ boost::system::error_code cancel(
+ implementation_type & impl,
+ boost::system::error_code & ec);
+
 
 
 [endsect]
 
 
-[endsect]
 
-[section:read_until read_until]
+[section:close seq_packet_socket_service::close]
 
-[indexterm1 read_until]
-Read data into a streambuf until it contains a delimiter, matches a regular expression, or a function object indicates a match.
+[indexterm2 close..seq_packet_socket_service]
+Close a sequenced packet socket implementation.
 
-
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t ``[link boost_asio.reference.read_until.overload1 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- char delim);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload1 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t ``[link boost_asio.reference.read_until.overload2 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- char delim,
+ boost::system::error_code close(
+ implementation_type & impl,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload2 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t ``[link boost_asio.reference.read_until.overload3 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const std::string & delim);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload3 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t ``[link boost_asio.reference.read_until.overload4 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const std::string & delim,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload4 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t ``[link boost_asio.reference.read_until.overload5 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const boost::regex & expr);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload5 more...]]``
+[endsect]
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t ``[link boost_asio.reference.read_until.overload6 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const boost::regex & expr,
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload6 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator,
- typename MatchCondition>
- std::size_t ``[link boost_asio.reference.read_until.overload7 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- MatchCondition match_condition,
- typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload7 more...]]``
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator,
- typename MatchCondition>
- std::size_t ``[link boost_asio.reference.read_until.overload8 read_until]``(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- MatchCondition match_condition,
- boost::system::error_code & ec,
- typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
- `` [''''&raquo;''' [link boost_asio.reference.read_until.overload8 more...]]``
+[section:connect seq_packet_socket_service::connect]
 
-[heading Requirements]
+[indexterm2 connect..seq_packet_socket_service]
+Connect the sequenced packet socket to the specified endpoint.
 
-[*Header: ][^boost/asio/read_until.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+ boost::system::error_code connect(
+ implementation_type & impl,
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
 
 
-[section:overload1 read_until (1 of 8 overloads)]
 
+[endsect]
 
-Read data into a streambuf until it contains a specified delimiter.
 
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- char delim);
+[section:construct seq_packet_socket_service::construct]
 
+[indexterm2 construct..seq_packet_socket_service]
+Construct a new sequenced packet socket implementation.
 
-This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
 
+ void construct(
+ implementation_type & impl);
 
-* The get area of the streambuf contains the specified delimiter.
 
 
-* An error occurred.
+[endsect]
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
 
 
-[heading Parameters]
-
+[section:destroy seq_packet_socket_service::destroy]
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
+[indexterm2 destroy..seq_packet_socket_service]
+Destroy a sequenced packet socket implementation.
 
-[[b][A streambuf object into which the data will be read.]]
 
-[[delim][The delimiter character.]]
+ void destroy(
+ implementation_type & impl);
 
-]
 
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area up to and including the delimiter.
+[endsect]
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+[section:endpoint_type seq_packet_socket_service::endpoint_type]
 
-]
+[indexterm2 endpoint_type..seq_packet_socket_service]
+The endpoint type.
 
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
+ typedef Protocol::endpoint endpoint_type;
 
 
-[heading Example]
-
-To read data into a streambuf until a newline is encountered:
 
- boost::asio::streambuf b;
- boost::asio::read_until(s, b, '\n');
- std::istream is(&b);
- std::string line;
- std::getline(is, line);
+[heading Requirements]
 
+[*Header: ][^boost/asio/seq_packet_socket_service.hpp]
 
-After the `read_until` operation completes successfully, the buffer `b` contains the delimiter:
+[*Convenience header: ][^boost/asio.hpp]
 
- { 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
 
+[endsect]
 
-The call to `std::getline` then extracts the data up to and including the delimiter, so that the string `line` contains:
 
- { 'a', 'b', ..., 'c', '\n' }
 
+[section:get_io_service seq_packet_socket_service::get_io_service]
 
-The remaining data is left in the buffer `b` as follows:
 
- { 'd', 'e', ... }
+['Inherited from io_service.]
 
+[indexterm2 get_io_service..seq_packet_socket_service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
-This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
 
+ boost::asio::io_service & get_io_service();
 
 
 
@@ -57909,153 +76593,136 @@
 
 
 
-[section:overload2 read_until (2 of 8 overloads)]
-
+[section:get_option seq_packet_socket_service::get_option]
 
-Read data into a streambuf until it contains a specified delimiter.
+[indexterm2 get_option..seq_packet_socket_service]
+Get a socket option.
 
 
   template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- char delim,
- boost::system::error_code & ec);
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ const implementation_type & impl,
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
 
 
-This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
 
+[endsect]
 
-* The get area of the streambuf contains the specified delimiter.
 
 
-* An error occurred.
+[section:id seq_packet_socket_service::id]
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
+[indexterm2 id..seq_packet_socket_service]
+The unique service identifier.
 
 
-[heading Parameters]
-
+ static boost::asio::io_service::id id;
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][A streambuf object into which the data will be read.]]
 
-[[delim][The delimiter character.]]
+[endsect]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
 
+[section:implementation_type seq_packet_socket_service::implementation_type]
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
+[indexterm2 implementation_type..seq_packet_socket_service]
+The type of a sequenced packet socket implementation.
 
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
+ typedef implementation_defined implementation_type;
+
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/seq_packet_socket_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
-[endsect]
 
+[endsect]
 
 
-[section:overload3 read_until (3 of 8 overloads)]
 
+[section:io_control seq_packet_socket_service::io_control]
 
-Read data into a streambuf until it contains a specified delimiter.
+[indexterm2 io_control..seq_packet_socket_service]
+Perform an IO control command on the socket.
 
 
   template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const std::string & delim);
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ boost::system::error_code io_control(
+ implementation_type & impl,
+ IoControlCommand & command,
+ boost::system::error_code & ec);
 
 
-This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
 
+[endsect]
 
-* The get area of the streambuf contains the specified delimiter.
 
 
-* An error occurred.
+[section:is_open seq_packet_socket_service::is_open]
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
+[indexterm2 is_open..seq_packet_socket_service]
+Determine whether the socket is open.
 
 
-[heading Parameters]
-
+ bool is_open(
+ const implementation_type & impl) const;
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][A streambuf object into which the data will be read.]]
 
-[[delim][The delimiter string.]]
+[endsect]
 
-]
 
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area up to and including the delimiter.
+[section:local_endpoint seq_packet_socket_service::local_endpoint]
 
+[indexterm2 local_endpoint..seq_packet_socket_service]
+Get the local endpoint.
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+ endpoint_type local_endpoint(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
-]
 
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
+[endsect]
 
 
-[heading Example]
-
-To read data into a streambuf until a newline is encountered:
 
- boost::asio::streambuf b;
- boost::asio::read_until(s, b, "\r\n");
- std::istream is(&b);
- std::string line;
- std::getline(is, line);
+[section:move_assign seq_packet_socket_service::move_assign]
 
+[indexterm2 move_assign..seq_packet_socket_service]
+Move-assign from another sequenced packet socket implementation.
 
-After the `read_until` operation completes successfully, the buffer `b` contains the delimiter:
 
- { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
+ void move_assign(
+ implementation_type & impl,
+ seq_packet_socket_service & other_service,
+ implementation_type & other_impl);
 
 
-The call to `std::getline` then extracts the data up to and including the delimiter, so that the string `line` contains:
 
- { 'a', 'b', ..., 'c', '\r', '\n' }
+[endsect]
 
 
-The remaining data is left in the buffer `b` as follows:
 
- { 'd', 'e', ... }
+[section:move_construct seq_packet_socket_service::move_construct]
 
+[indexterm2 move_construct..seq_packet_socket_service]
+Move-construct a new sequenced packet socket implementation.
 
-This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
 
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
 
 
 
@@ -58063,422 +76730,332 @@
 
 
 
-[section:overload4 read_until (4 of 8 overloads)]
+[section:native seq_packet_socket_service::native]
 
+[indexterm2 native..seq_packet_socket_service]
+(Deprecated: Use `native_handle()`.) Get the native socket implementation.
 
-Read data into a streambuf until it contains a specified delimiter.
 
+ native_type native(
+ implementation_type & impl);
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const std::string & delim,
- boost::system::error_code & ec);
 
 
-This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:
+[endsect]
 
 
-* The get area of the streambuf contains the specified delimiter.
 
+[section:native_handle seq_packet_socket_service::native_handle]
 
-* An error occurred.
+[indexterm2 native_handle..seq_packet_socket_service]
+Get the native socket implementation.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.
 
+ native_handle_type native_handle(
+ implementation_type & impl);
 
-[heading Parameters]
-
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][A streambuf object into which the data will be read.]]
+[endsect]
 
-[[delim][The delimiter string.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[section:native_handle_type seq_packet_socket_service::native_handle_type]
 
+[indexterm2 native_handle_type..seq_packet_socket_service]
+The native socket type.
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.
 
+ typedef implementation_defined native_handle_type;
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/seq_packet_socket_service.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
-[section:overload5 read_until (5 of 8 overloads)]
 
+[section:native_non_blocking seq_packet_socket_service::native_non_blocking]
 
-Read data into a streambuf until some part of the data it contains matches a regular expression.
+[indexterm2 native_non_blocking..seq_packet_socket_service]
+Gets the non-blocking mode of the native socket implementation.
 
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const boost::regex & expr);
+ bool ``[link boost_asio.reference.seq_packet_socket_service.native_non_blocking.overload1 native_non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.seq_packet_socket_service.native_non_blocking.overload1 more...]]``
 
 
-This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
+Sets the non-blocking mode of the native socket implementation.
 
 
-* A substring of the streambuf's get area matches the regular expression.
+ boost::system::error_code ``[link boost_asio.reference.seq_packet_socket_service.native_non_blocking.overload2 native_non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.seq_packet_socket_service.native_non_blocking.overload2 more...]]``
 
 
-* An error occurred.
+[section:overload1 seq_packet_socket_service::native_non_blocking (1 of 2 overloads)]
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
 
+Gets the non-blocking mode of the native socket implementation.
 
-[heading Parameters]
-
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
+ bool native_non_blocking(
+ const implementation_type & impl) const;
 
-[[b][A streambuf object into which the data will be read.]]
 
-[[expr][The regular expression.]]
 
-]
+[endsect]
 
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression.
 
+[section:overload2 seq_packet_socket_service::native_non_blocking (2 of 2 overloads)]
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+Sets the non-blocking mode of the native socket implementation.
 
-]
 
+ boost::system::error_code native_non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
 
-[heading Example]
-
-To read data into a streambuf until a CR-LF sequence is encountered:
+[endsect]
 
- boost::asio::streambuf b;
- boost::asio::read_until(s, b, boost::regex("\r\n"));
- std::istream is(&b);
- std::string line;
- std::getline(is, line);
 
+[endsect]
 
-After the `read_until` operation completes successfully, the buffer `b` contains the data which matched the regular expression:
 
- { 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
+[section:native_type seq_packet_socket_service::native_type]
 
+[indexterm2 native_type..seq_packet_socket_service]
+(Deprecated: Use native\_handle\_type.) The native socket type.
 
-The call to `std::getline` then extracts the data up to and including the match, so that the string `line` contains:
 
- { 'a', 'b', ..., 'c', '\r', '\n' }
+ typedef implementation_defined native_type;
 
 
-The remaining data is left in the buffer `b` as follows:
 
- { 'd', 'e', ... }
+[heading Requirements]
 
+[*Header: ][^boost/asio/seq_packet_socket_service.hpp]
 
-This data may be the start of a new line, to be extracted by a subsequent `read_until` operation.
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[endsect]
 
 
-[endsect]
+[section:non_blocking seq_packet_socket_service::non_blocking]
 
+[indexterm2 non_blocking..seq_packet_socket_service]
+Gets the non-blocking mode of the socket.
 
 
-[section:overload6 read_until (6 of 8 overloads)]
+ bool ``[link boost_asio.reference.seq_packet_socket_service.non_blocking.overload1 non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.seq_packet_socket_service.non_blocking.overload1 more...]]``
 
 
-Read data into a streambuf until some part of the data it contains matches a regular expression.
+Sets the non-blocking mode of the socket.
 
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- const boost::regex & expr,
+ boost::system::error_code ``[link boost_asio.reference.seq_packet_socket_service.non_blocking.overload2 non_blocking]``(
+ implementation_type & impl,
+ bool mode,
       boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.seq_packet_socket_service.non_blocking.overload2 more...]]``
 
 
-This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:
-
+[section:overload1 seq_packet_socket_service::non_blocking (1 of 2 overloads)]
 
-* A substring of the streambuf's get area matches the regular expression.
 
+Gets the non-blocking mode of the socket.
 
-* An error occurred.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.
+ bool non_blocking(
+ const implementation_type & impl) const;
 
 
-[heading Parameters]
-
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
+[endsect]
 
-[[b][A streambuf object into which the data will be read.]]
 
-[[expr][The regular expression.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
+[section:overload2 seq_packet_socket_service::non_blocking (2 of 2 overloads)]
 
-]
 
+Sets the non-blocking mode of the socket.
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.
 
+ boost::system::error_code non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the regular expression. An application will typically leave that data in the streambuf for a subsequent read\_until operation to examine.
 
 
+[endsect]
 
 
 [endsect]
 
 
+[section:open seq_packet_socket_service::open]
 
-[section:overload7 read_until (7 of 8 overloads)]
-
+[indexterm2 open..seq_packet_socket_service]
+Open a sequenced packet socket.
 
-Read data into a streambuf until a function object indicates a match.
 
+ boost::system::error_code open(
+ implementation_type & impl,
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator,
- typename MatchCondition>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- MatchCondition match_condition,
- typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
 
 
-This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
+[endsect]
 
 
-* The match condition function object returns a std::pair where the second element evaluates to true.
 
+[section:protocol_type seq_packet_socket_service::protocol_type]
 
-* An error occurred.
+[indexterm2 protocol_type..seq_packet_socket_service]
+The protocol type.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
 
+ typedef Protocol protocol_type;
 
-[heading Parameters]
-
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][A streambuf object into which the data will be read.]]
+[heading Requirements]
 
-[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
-``
- pair<iterator, bool> match_condition(iterator begin, iterator end);
-``
-where `iterator` represents the type:
-``
- buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
-``
-The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
+[*Header: ][^boost/asio/seq_packet_socket_service.hpp]
 
-]
+[*Convenience header: ][^boost/asio.hpp]
 
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area that have been fully consumed by the match function.
+[endsect]
 
 
-[heading Exceptions]
-
 
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+[section:receive seq_packet_socket_service::receive]
 
-]
+[indexterm2 receive..seq_packet_socket_service]
+Receive some data from the peer.
 
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags in_flags,
+ socket_base::message_flags & out_flags,
+ boost::system::error_code & ec);
 
-The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
 
 
-[heading Examples]
-
-To read data into a streambuf until whitespace is encountered:
+[endsect]
 
- typedef boost::asio::buffers_iterator<
- boost::asio::streambuf::const_buffers_type> iterator;
 
- std::pair<iterator, bool>
- match_whitespace(iterator begin, iterator end)
- {
- iterator i = begin;
- while (i != end)
- if (std::isspace(*i++))
- return std::make_pair(i, true);
- return std::make_pair(i, false);
- }
- ...
- boost::asio::streambuf b;
- boost::asio::read_until(s, b, match_whitespace);
 
+[section:remote_endpoint seq_packet_socket_service::remote_endpoint]
 
+[indexterm2 remote_endpoint..seq_packet_socket_service]
+Get the remote endpoint.
 
 
-To read data into a streambuf until a matching character is found:
+ endpoint_type remote_endpoint(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
- class match_char
- {
- public:
- explicit match_char(char c) : c_(c) {}
 
- template <typename Iterator>
- std::pair<Iterator, bool> operator()(
- Iterator begin, Iterator end) const
- {
- Iterator i = begin;
- while (i != end)
- if (c_ == *i++)
- return std::make_pair(i, true);
- return std::make_pair(i, false);
- }
 
- private:
- char c_;
- };
+[endsect]
 
- namespace asio {
- template <> struct is_match_condition<match_char>
- : public boost::true_type {};
- } // namespace asio
- ...
- boost::asio::streambuf b;
- boost::asio::read_until(s, b, match_char('a'));
 
 
+[section:send seq_packet_socket_service::send]
 
+[indexterm2 send..seq_packet_socket_service]
+Send the given data to the peer.
 
 
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
 
 
 
-[section:overload8 read_until (8 of 8 overloads)]
+[endsect]
 
 
-Read data into a streambuf until a function object indicates a match.
 
+[section:seq_packet_socket_service seq_packet_socket_service::seq_packet_socket_service]
 
- template<
- typename ``[link boost_asio.reference.SyncReadStream SyncReadStream]``,
- typename Allocator,
- typename MatchCondition>
- std::size_t read_until(
- SyncReadStream & s,
- boost::asio::basic_streambuf< Allocator > & b,
- MatchCondition match_condition,
- boost::system::error_code & ec,
- typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
+[indexterm2 seq_packet_socket_service..seq_packet_socket_service]
+Construct a new sequenced packet socket service for the specified [link boost_asio.reference.io_service `io_service`].
 
 
-This function is used to read data into the specified streambuf until a user-defined match condition function object, when applied to the data contained in the streambuf, indicates a successful match. The call will block until one of the following conditions is true:
+ seq_packet_socket_service(
+ boost::asio::io_service & io_service);
 
 
-* The match condition function object returns a std::pair where the second element evaluates to true.
 
+[endsect]
 
-* An error occurred.
 
-This operation is implemented in terms of zero or more calls to the stream's read\_some function. If the match condition function object already indicates a match, the function returns immediately.
 
+[section:set_option seq_packet_socket_service::set_option]
 
-[heading Parameters]
-
+[indexterm2 set_option..seq_packet_socket_service]
+Set a socket option.
 
-[variablelist
-
-[[s][The stream from which the data is to be read. The type must support the SyncReadStream concept.]]
 
-[[b][A streambuf object into which the data will be read.]]
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ boost::system::error_code set_option(
+ implementation_type & impl,
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
 
-[[match_condition][The function object to be called to determine whether a match exists. The signature of the function object must be:
-``
- pair<iterator, bool> match_condition(iterator begin, iterator end);
-``
-where `iterator` represents the type:
-``
- buffers_iterator<basic_streambuf<Allocator>::const_buffers_type>
-``
-The iterator parameters `begin` and `end` define the range of bytes to be scanned to determine whether there is a match. The `first` member of the return value is an iterator marking one-past-the-end of the bytes that have been consumed by the match function. This iterator is used to calculate the `begin` parameter for any subsequent invocation of the match condition. The `second` member of the return value is true if a match has been found, false otherwise.]]
 
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+[endsect]
 
 
-[heading Return Value]
-
-The number of bytes in the streambuf's get area that have been fully consumed by the match function. Returns 0 if an error occurred.
 
+[section:shutdown seq_packet_socket_service::shutdown]
 
-[heading Remarks]
-
-After a successful read\_until operation, the streambuf may contain additional data beyond that which matched the function object. An application will typically leave that data in the streambuf for a subsequent
+[indexterm2 shutdown..seq_packet_socket_service]
+Disable sends or receives on the socket.
 
-The default implementation of the `is_match_condition` type trait evaluates to true for function pointers and function objects with a `result_type` typedef. It must be specialised for other user-defined function objects.
 
+ boost::system::error_code shutdown(
+ implementation_type & impl,
+ socket_base::shutdown_type what,
+ boost::system::error_code & ec);
 
 
 
 [endsect]
 
 
+
 [endsect]
 
 
@@ -58511,13 +77088,20 @@
 
   [
 
- [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
+ [[link boost_asio.reference.basic_serial_port.native_handle_type [*native_handle_type]]]
     [The native representation of a serial port. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a serial port. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.basic_serial_port.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -58550,7 +77134,9 @@
 
      Construct and open a basic_serial_port.
 
- Construct a basic_serial_port on an existing native serial port. ]
+ Construct a basic_serial_port on an existing native serial port.
+
+ Move-construct a basic_serial_port from another. ]
   ]
   
   [
@@ -58574,11 +77160,6 @@
   ]
   
   [
- [[link boost_asio.reference.basic_serial_port.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.basic_serial_port.is_open [*is_open]]]
     [Determine whether the serial port is open. ]
   ]
@@ -58592,6 +77173,11 @@
   
   [
     [[link boost_asio.reference.basic_serial_port.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native serial port representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.native_handle [*native_handle]]]
     [Get the native serial port representation. ]
   ]
   
@@ -58601,6 +77187,11 @@
   ]
   
   [
+ [[link boost_asio.reference.basic_serial_port.operator_eq_ [*operator=]]]
+ [Move-assign a basic_serial_port from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.basic_serial_port.read_some [*read_some]]]
     [Read some data from the serial port. ]
   ]
@@ -58622,18 +77213,34 @@
   
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
 [heading Protected Data Members]
 [table
   [[Name][Description]]
 
   [
     [[link boost_asio.reference.basic_serial_port.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.basic_serial_port.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -59409,11 +78016,18 @@
 
   [
 
- [[link boost_asio.reference.serial_port_service.native_type [*native_type]]]
+ [[link boost_asio.reference.serial_port_service.native_handle_type [*native_handle_type]]]
     [The native handle type. ]
   
   ]
 
+ [
+
+ [[link boost_asio.reference.serial_port_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native handle type. ]
+
+ ]
+
 ]
 
 [heading Member Functions]
@@ -59466,17 +78080,27 @@
   ]
   
   [
- [[link boost_asio.reference.serial_port_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
+ [[link boost_asio.reference.serial_port_service.is_open [*is_open]]]
+ [Determine whether the handle is open. ]
   ]
   
   [
- [[link boost_asio.reference.serial_port_service.is_open [*is_open]]]
- [Determine whether the handle is open. ]
+ [[link boost_asio.reference.serial_port_service.move_assign [*move_assign]]]
+ [Move-assign from another serial port implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.serial_port_service.move_construct [*move_construct]]]
+ [Move-construct a new serial port implementation. ]
   ]
   
   [
     [[link boost_asio.reference.serial_port_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.serial_port_service.native_handle [*native_handle]]]
     [Get the native handle implementation. ]
   ]
   
@@ -59506,11 +78130,6 @@
   ]
   
   [
- [[link boost_asio.reference.serial_port_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
-
- [
     [[link boost_asio.reference.serial_port_service.write_some [*write_some]]]
     [Write the given data to the stream. ]
   ]
@@ -59543,7 +78162,7 @@
 
   boost::system::error_code assign(
       implementation_type & impl,
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
 
 
@@ -59725,16 +78344,31 @@
 
 
 
-[section:io_service serial_port_service::io_service]
+[section:is_open serial_port_service::is_open]
+
+[indexterm2 is_open..serial_port_service]
+Determine whether the handle is open.
+
+
+ bool is_open(
+ const implementation_type & impl) const;
+
+
+
+[endsect]
 
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..serial_port_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+[section:move_assign serial_port_service::move_assign]
 
+[indexterm2 move_assign..serial_port_service]
+Move-assign from another serial port implementation.
 
- boost::asio::io_service & io_service();
+
+ void move_assign(
+ implementation_type & impl,
+ serial_port_service & other_service,
+ implementation_type & other_impl);
 
 
 
@@ -59742,66 +78376,557 @@
 
 
 
-[section:is_open serial_port_service::is_open]
+[section:move_construct serial_port_service::move_construct]
 
-[indexterm2 is_open..serial_port_service]
-Determine whether the handle is open.
+[indexterm2 move_construct..serial_port_service]
+Move-construct a new serial port implementation.
 
 
- bool is_open(
- const implementation_type & impl) const;
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
+
+
+
+[endsect]
+
+
+
+[section:native serial_port_service::native]
+
+[indexterm2 native..serial_port_service]
+(Deprecated: Use `native_handle()`.) Get the native handle implementation.
+
+
+ native_type native(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:native_handle serial_port_service::native_handle]
+
+[indexterm2 native_handle..serial_port_service]
+Get the native handle implementation.
+
+
+ native_handle_type native_handle(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:native_handle_type serial_port_service::native_handle_type]
+
+[indexterm2 native_handle_type..serial_port_service]
+The native handle type.
+
+
+ typedef implementation_defined native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/serial_port_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:native_type serial_port_service::native_type]
+
+[indexterm2 native_type..serial_port_service]
+(Deprecated: Use native\_handle\_type.) The native handle type.
+
+
+ typedef implementation_defined native_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/serial_port_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:open serial_port_service::open]
+
+[indexterm2 open..serial_port_service]
+Open a serial port.
+
+
+ boost::system::error_code open(
+ implementation_type & impl,
+ const std::string & device,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:read_some serial_port_service::read_some]
+
+[indexterm2 read_some..serial_port_service]
+Read some data from the stream.
+
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ implementation_type & impl,
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:send_break serial_port_service::send_break]
+
+[indexterm2 send_break..serial_port_service]
+Send a break sequence to the serial port.
+
+
+ boost::system::error_code send_break(
+ implementation_type & impl,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:serial_port_service serial_port_service::serial_port_service]
+
+[indexterm2 serial_port_service..serial_port_service]
+Construct a new serial port service for the specified [link boost_asio.reference.io_service `io_service`].
+
+
+ serial_port_service(
+ boost::asio::io_service & io_service);
+
+
+
+[endsect]
+
+
+
+[section:set_option serial_port_service::set_option]
+
+[indexterm2 set_option..serial_port_service]
+Set a serial port option.
+
+
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ boost::system::error_code set_option(
+ implementation_type & impl,
+ const SettableSerialPortOption & option,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:write_some serial_port_service::write_some]
+
+[indexterm2 write_some..serial_port_service]
+Write the given data to the stream.
+
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ implementation_type & impl,
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:service_already_exists service_already_exists]
+
+
+Exception thrown when trying to add a duplicate service to an [link boost_asio.reference.io_service `io_service`].
+
+
+ class service_already_exists
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.service_already_exists.service_already_exists [*service_already_exists]]]
+ []
+ ]
+
+]
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/io_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[section:service_already_exists service_already_exists::service_already_exists]
+
+[indexterm2 service_already_exists..service_already_exists]
+
+ service_already_exists();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+
+[section:signal_set signal_set]
+
+[indexterm1 signal_set]
+Typedef for the typical usage of a signal set.
+
+
+ typedef basic_signal_set signal_set;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.basic_signal_set.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_signal_set.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.add [*add]]]
+ [Add a signal to a signal_set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.async_wait [*async_wait]]]
+ [Start an asynchronous operation to wait for a signal to be delivered. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.basic_signal_set [*basic_signal_set]]]
+ [Construct a signal set without adding any signals.
+
+ Construct a signal set and add one signal.
+
+ Construct a signal set and add two signals.
+
+ Construct a signal set and add three signals. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.cancel [*cancel]]]
+ [Cancel all operations associated with the signal set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.clear [*clear]]]
+ [Remove all signals from a signal_set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.get_io_service [*get_io_service]]]
+ [Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.remove [*remove]]]
+ [Remove a signal from a signal_set. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.implementation [*implementation]]]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_signal_set.service [*service]]]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
+ ]
+
+]
+
+The [link boost_asio.reference.basic_signal_set `basic_signal_set`] class template provides the ability to perform an asynchronous wait for one or more signals to occur.
+
+Most applications will use the [link boost_asio.reference.signal_set `signal_set`] typedef.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+[heading Example]
+
+Performing an asynchronous wait:
+
+ void handler(
+ const boost::system::error_code& error,
+ int signal_number)
+ {
+ if (!error)
+ {
+ // A signal occurred.
+ }
+ }
+
+ ...
+
+ // Construct a signal set registered for process termination.
+ boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
+
+ // Start an asynchronous wait for one of the signals to occur.
+ signals.async_wait(handler);
+
+
+
+
+
+[heading Queueing of signal notifications]
+
+
+
+If a signal is registered with a signal\_set, and the signal occurs when there are no waiting handlers, then the signal notification is queued. The next async\_wait operation on that signal\_set will dequeue the notification. If multiple notifications are queued, subsequent async\_wait operations dequeue them one at a time. Signal notifications are dequeued in order of ascending signal number.
+
+If a signal number is removed from a signal\_set (using the `remove` or `erase` member functions) then any queued notifications for that signal are discarded.
+
+
+[heading Multiple registration of signals]
+
+
+
+The same signal number may be registered with different signal\_set objects. When the signal occurs, one handler is called for each signal\_set object.
+
+Note that multiple registration only works for signals that are registered using Asio. The application must not also register a signal handler using functions such as `signal()` or `sigaction()`.
+
+
+[heading Signal masking on POSIX platforms]
+
+
+
+POSIX allows signals to be blocked using functions such as `sigprocmask()` and `pthread_sigmask()`. For signals to be delivered, programs must ensure that any signals registered using signal\_set objects are unblocked in at least one thread.
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/signal_set.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:signal_set_service signal_set_service]
+
+
+Default service implementation for a signal set.
+
+
+ class signal_set_service :
+ public io_service::service
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.signal_set_service.implementation_type [*implementation_type]]]
+ [The type of a signal set implementation. ]
+
+ ]
 
+]
 
+[heading Member Functions]
+[table
+ [[Name][Description]]
 
-[endsect]
+ [
+ [[link boost_asio.reference.signal_set_service.add [*add]]]
+ [Add a signal to a signal_set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.async_wait [*async_wait]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.cancel [*cancel]]]
+ [Cancel all operations associated with the signal set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.clear [*clear]]]
+ [Remove all signals from a signal_set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.construct [*construct]]]
+ [Construct a new signal set implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.destroy [*destroy]]]
+ [Destroy a signal set implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.get_io_service [*get_io_service]]]
+ [Get the io_service object that owns the service. ]
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.remove [*remove]]]
+ [Remove a signal to a signal_set. ]
+ ]
+
+ [
+ [[link boost_asio.reference.signal_set_service.signal_set_service [*signal_set_service]]]
+ [Construct a new signal set service for the specified io_service. ]
+ ]
+
+]
 
+[heading Data Members]
+[table
+ [[Name][Description]]
 
+ [
+ [[link boost_asio.reference.signal_set_service.id [*id]]]
+ [The unique service identifier. ]
+ ]
 
-[section:native serial_port_service::native]
+]
 
-[indexterm2 native..serial_port_service]
-Get the native handle implementation.
+[heading Requirements]
 
+[*Header: ][^boost/asio/signal_set_service.hpp]
 
- native_type native(
- implementation_type & impl);
+[*Convenience header: ][^boost/asio.hpp]
 
 
+[section:add signal_set_service::add]
 
-[endsect]
+[indexterm2 add..signal_set_service]
+Add a signal to a signal\_set.
 
 
+ boost::system::error_code add(
+ implementation_type & impl,
+ int signal_number,
+ boost::system::error_code & ec);
 
-[section:native_type serial_port_service::native_type]
 
-[indexterm2 native_type..serial_port_service]
-The native handle type.
 
+[endsect]
 
- typedef implementation_defined native_type;
 
 
+[section:async_wait signal_set_service::async_wait]
 
-[heading Requirements]
+[indexterm2 async_wait..signal_set_service]
 
-[*Header: ][^boost/asio/serial_port_service.hpp]
+ template<
+ typename ``[link boost_asio.reference.SignalHandler SignalHandler]``>
+ void async_wait(
+ implementation_type & impl,
+ SignalHandler handler);
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:open serial_port_service::open]
+[section:cancel signal_set_service::cancel]
 
-[indexterm2 open..serial_port_service]
-Open a serial port.
+[indexterm2 cancel..signal_set_service]
+Cancel all operations associated with the signal set.
 
 
- boost::system::error_code open(
+ boost::system::error_code cancel(
       implementation_type & impl,
- const std::string & device,
       boost::system::error_code & ec);
 
 
@@ -59810,17 +78935,14 @@
 
 
 
-[section:read_some serial_port_service::read_some]
+[section:clear signal_set_service::clear]
 
-[indexterm2 read_some..serial_port_service]
-Read some data from the stream.
+[indexterm2 clear..signal_set_service]
+Remove all signals from a signal\_set.
 
 
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
+ boost::system::error_code clear(
       implementation_type & impl,
- const MutableBufferSequence & buffers,
       boost::system::error_code & ec);
 
 
@@ -59829,15 +78951,14 @@
 
 
 
-[section:send_break serial_port_service::send_break]
+[section:construct signal_set_service::construct]
 
-[indexterm2 send_break..serial_port_service]
-Send a break sequence to the serial port.
+[indexterm2 construct..signal_set_service]
+Construct a new signal set implementation.
 
 
- boost::system::error_code send_break(
- implementation_type & impl,
- boost::system::error_code & ec);
+ void construct(
+ implementation_type & impl);
 
 
 
@@ -59845,14 +78966,14 @@
 
 
 
-[section:serial_port_service serial_port_service::serial_port_service]
+[section:destroy signal_set_service::destroy]
 
-[indexterm2 serial_port_service..serial_port_service]
-Construct a new serial port service for the specified [link boost_asio.reference.io_service `io_service`].
+[indexterm2 destroy..signal_set_service]
+Destroy a signal set implementation.
 
 
- serial_port_service(
- boost::asio::io_service & io_service);
+ void destroy(
+ implementation_type & impl);
 
 
 
@@ -59860,18 +78981,16 @@
 
 
 
-[section:set_option serial_port_service::set_option]
+[section:get_io_service signal_set_service::get_io_service]
 
-[indexterm2 set_option..serial_port_service]
-Set a serial port option.
 
+['Inherited from io_service.]
 
- template<
- typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
- boost::system::error_code set_option(
- implementation_type & impl,
- const SettableSerialPortOption & option,
- boost::system::error_code & ec);
+[indexterm2 get_io_service..signal_set_service]
+Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+
+
+ boost::asio::io_service & get_io_service();
 
 
 
@@ -59879,13 +78998,13 @@
 
 
 
-[section:shutdown_service serial_port_service::shutdown_service]
+[section:id signal_set_service::id]
 
-[indexterm2 shutdown_service..serial_port_service]
-Destroy all user-defined handler objects owned by the service.
+[indexterm2 id..signal_set_service]
+The unique service identifier.
 
 
- virtual void shutdown_service();
+ static boost::asio::io_service::id id;
 
 
 
@@ -59893,59 +79012,52 @@
 
 
 
-[section:write_some serial_port_service::write_some]
+[section:implementation_type signal_set_service::implementation_type]
 
-[indexterm2 write_some..serial_port_service]
-Write the given data to the stream.
+[indexterm2 implementation_type..signal_set_service]
+The type of a signal set implementation.
 
 
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- implementation_type & impl,
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
+ typedef implementation_defined implementation_type;
 
 
 
-[endsect]
+[heading Requirements]
 
+[*Header: ][^boost/asio/signal_set_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
-[section:service_already_exists service_already_exists]
 
 
-Exception thrown when trying to add a duplicate service to an [link boost_asio.reference.io_service `io_service`].
+[section:remove signal_set_service::remove]
 
+[indexterm2 remove..signal_set_service]
+Remove a signal to a signal\_set.
 
- class service_already_exists
 
+ boost::system::error_code remove(
+ implementation_type & impl,
+ int signal_number,
+ boost::system::error_code & ec);
 
-[heading Member Functions]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.service_already_exists.service_already_exists [*service_already_exists]]]
- []
- ]
-
-]
 
-[heading Requirements]
+[endsect]
 
-[*Header: ][^boost/asio/io_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
 
+[section:signal_set_service signal_set_service::signal_set_service]
 
-[section:service_already_exists service_already_exists::service_already_exists]
+[indexterm2 signal_set_service..signal_set_service]
+Construct a new signal set service for the specified [link boost_asio.reference.io_service `io_service`].
 
-[indexterm2 service_already_exists..service_already_exists]
 
- service_already_exists();
+ signal_set_service(
+ boost::asio::io_service & io_service);
 
 
 
@@ -59987,13 +79099,20 @@
 
   [
 
- [[link boost_asio.reference.socket_acceptor_service.native_type [*native_type]]]
+ [[link boost_asio.reference.socket_acceptor_service.native_handle_type [*native_handle_type]]]
     [The native acceptor type. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.socket_acceptor_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native acceptor type. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.socket_acceptor_service.protocol_type [*protocol_type]]]
     [The protocol type. ]
   
@@ -60061,11 +79180,6 @@
   ]
   
   [
- [[link boost_asio.reference.socket_acceptor_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
     [[link boost_asio.reference.socket_acceptor_service.is_open [*is_open]]]
     [Determine whether the acceptor is open. ]
   ]
@@ -60081,11 +79195,40 @@
   ]
   
   [
+ [[link boost_asio.reference.socket_acceptor_service.move_assign [*move_assign]]]
+ [Move-assign from another socket acceptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.socket_acceptor_service.move_construct [*move_construct]]]
+ [Move-construct a new socket acceptor implementation. ]
+ ]
+
+ [
     [[link boost_asio.reference.socket_acceptor_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native acceptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.socket_acceptor_service.native_handle [*native_handle]]]
     [Get the native acceptor implementation. ]
   ]
   
   [
+ [[link boost_asio.reference.socket_acceptor_service.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native acceptor implementation.
+
+ Sets the non-blocking mode of the native acceptor implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.socket_acceptor_service.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the acceptor.
+
+ Sets the non-blocking mode of the acceptor. ]
+ ]
+
+ [
     [[link boost_asio.reference.socket_acceptor_service.open [*open]]]
     [Open a new socket acceptor implementation. ]
   ]
@@ -60096,11 +79239,6 @@
   ]
   
   [
- [[link boost_asio.reference.socket_acceptor_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
-
- [
     [[link boost_asio.reference.socket_acceptor_service.socket_acceptor_service [*socket_acceptor_service]]]
     [Construct a new socket acceptor service for the specified io_service. ]
   ]
@@ -60154,7 +79292,7 @@
   boost::system::error_code assign(
       implementation_type & impl,
       const protocol_type & protocol,
- const native_type & native_acceptor,
+ const native_handle_type & native_acceptor,
       boost::system::error_code & ec);
 
 
@@ -60374,23 +79512,6 @@
 
 
 
-[section:io_service socket_acceptor_service::io_service]
-
-
-['Inherited from io_service.]
-
-[indexterm2 io_service..socket_acceptor_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
-
-
- boost::asio::io_service & io_service();
-
-
-
-[endsect]
-
-
-
 [section:is_open socket_acceptor_service::is_open]
 
 [indexterm2 is_open..socket_acceptor_service]
@@ -60439,10 +79560,43 @@
 
 
 
+[section:move_assign socket_acceptor_service::move_assign]
+
+[indexterm2 move_assign..socket_acceptor_service]
+Move-assign from another socket acceptor implementation.
+
+
+ void move_assign(
+ implementation_type & impl,
+ socket_acceptor_service & other_service,
+ implementation_type & other_impl);
+
+
+
+[endsect]
+
+
+
+[section:move_construct socket_acceptor_service::move_construct]
+
+[indexterm2 move_construct..socket_acceptor_service]
+Move-construct a new socket acceptor implementation.
+
+
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
+
+
+
+[endsect]
+
+
+
 [section:native socket_acceptor_service::native]
 
 [indexterm2 native..socket_acceptor_service]
-Get the native acceptor implementation.
+(Deprecated: Use `native_handle()`.) Get the native acceptor implementation.
 
 
   native_type native(
@@ -60454,10 +79608,100 @@
 
 
 
+[section:native_handle socket_acceptor_service::native_handle]
+
+[indexterm2 native_handle..socket_acceptor_service]
+Get the native acceptor implementation.
+
+
+ native_handle_type native_handle(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:native_handle_type socket_acceptor_service::native_handle_type]
+
+[indexterm2 native_handle_type..socket_acceptor_service]
+The native acceptor type.
+
+
+ typedef implementation_defined native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/socket_acceptor_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:native_non_blocking socket_acceptor_service::native_non_blocking]
+
+[indexterm2 native_non_blocking..socket_acceptor_service]
+Gets the non-blocking mode of the native acceptor implementation.
+
+
+ bool ``[link boost_asio.reference.socket_acceptor_service.native_non_blocking.overload1 native_non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.socket_acceptor_service.native_non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the native acceptor implementation.
+
+
+ boost::system::error_code ``[link boost_asio.reference.socket_acceptor_service.native_non_blocking.overload2 native_non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.socket_acceptor_service.native_non_blocking.overload2 more...]]``
+
+
+[section:overload1 socket_acceptor_service::native_non_blocking (1 of 2 overloads)]
+
+
+Gets the non-blocking mode of the native acceptor implementation.
+
+
+ bool native_non_blocking(
+ const implementation_type & impl) const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 socket_acceptor_service::native_non_blocking (2 of 2 overloads)]
+
+
+Sets the non-blocking mode of the native acceptor implementation.
+
+
+ boost::system::error_code native_non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:native_type socket_acceptor_service::native_type]
 
 [indexterm2 native_type..socket_acceptor_service]
-The native acceptor type.
+(Deprecated: Use native\_handle\_type.) The native acceptor type.
 
 
   typedef implementation_defined native_type;
@@ -60474,6 +79718,60 @@
 [endsect]
 
 
+[section:non_blocking socket_acceptor_service::non_blocking]
+
+[indexterm2 non_blocking..socket_acceptor_service]
+Gets the non-blocking mode of the acceptor.
+
+
+ bool ``[link boost_asio.reference.socket_acceptor_service.non_blocking.overload1 non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.socket_acceptor_service.non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the acceptor.
+
+
+ boost::system::error_code ``[link boost_asio.reference.socket_acceptor_service.non_blocking.overload2 non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.socket_acceptor_service.non_blocking.overload2 more...]]``
+
+
+[section:overload1 socket_acceptor_service::non_blocking (1 of 2 overloads)]
+
+
+Gets the non-blocking mode of the acceptor.
+
+
+ bool non_blocking(
+ const implementation_type & impl) const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 socket_acceptor_service::non_blocking (2 of 2 overloads)]
+
+
+Sets the non-blocking mode of the acceptor.
+
+
+ boost::system::error_code non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:open socket_acceptor_service::open]
 
@@ -60532,20 +79830,6 @@
 
 
 
-[section:shutdown_service socket_acceptor_service::shutdown_service]
-
-[indexterm2 shutdown_service..socket_acceptor_service]
-Destroy all user-defined handler objects owned by the service.
-
-
- virtual void shutdown_service();
-
-
-
-[endsect]
-
-
-
 [section:socket_acceptor_service socket_acceptor_service::socket_acceptor_service]
 
 [indexterm2 socket_acceptor_service..socket_acceptor_service]
@@ -60635,7 +79919,7 @@
   [
 
     [[link boost_asio.reference.socket_base.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+ [(Deprecated: Use non_blocking().) IO control command to set the blocking mode of the socket. ]
   
   ]
 
@@ -60709,6 +79993,11 @@
   ]
 
   [
+ [[link boost_asio.reference.socket_base.message_end_of_record [*message_end_of_record]]]
+ [Specifies that the data marks the end of a record. ]
+ ]
+
+ [
     [[link boost_asio.reference.socket_base.message_out_of_band [*message_out_of_band]]]
     [Process out-of-band data. ]
   ]
@@ -61102,6 +80391,20 @@
 
 
 
+[section:message_end_of_record socket_base::message_end_of_record]
+
+[indexterm2 message_end_of_record..socket_base]
+Specifies that the data marks the end of a record.
+
+
+ static const int message_end_of_record = implementation_defined;
+
+
+
+[endsect]
+
+
+
 [section:message_flags socket_base::message_flags]
 
 [indexterm2 message_flags..socket_base]
@@ -61154,7 +80457,7 @@
 [section:non_blocking_io socket_base::non_blocking_io]
 
 [indexterm2 non_blocking_io..socket_base]
-IO control command to set the blocking mode of the socket.
+(Deprecated: Use non\_blocking().) IO control command to set the blocking mode of the socket.
 
 
   typedef implementation_defined non_blocking_io;
@@ -61499,16 +80802,13 @@
 
 [endsect]
 
-[section:ssl__basic_context ssl::basic_context]
-
+[section:ssl__context ssl::context]
 
-SSL context.
 
 
- template<
- typename ``[link boost_asio.reference.Service Service]``>
- class basic_context :
- public ssl::context_base
+ class context :
+ public ssl::context_base,
+ noncopyable
 
 
 [heading Types]
@@ -61517,50 +80817,43 @@
 
   [
 
- [[link boost_asio.reference.ssl__basic_context.file_format [*file_format]]]
+ [[link boost_asio.reference.ssl__context.file_format [*file_format]]]
     [File format types. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ssl__basic_context.impl_type [*impl_type]]]
- [The native implementation type of the locking dispatcher. ]
+ [[link boost_asio.reference.ssl__context.impl_type [*impl_type]]]
+ [(Deprecated: Use native_handle_type.) The native type of the SSL context. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ssl__basic_context.method [*method]]]
+ [[link boost_asio.reference.ssl__context.method [*method]]]
     [Different methods supported by a context. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ssl__basic_context.options [*options]]]
- [Bitmask type for SSL options. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.password_purpose [*password_purpose]]]
- [Purpose of PEM password. ]
+ [[link boost_asio.reference.ssl__context.native_handle_type [*native_handle_type]]]
+ [The native handle type of the SSL context. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ssl__basic_context.service_type [*service_type]]]
- [The type of the service that will be used to provide context operations. ]
+ [[link boost_asio.reference.ssl__context.options [*options]]]
+ [Bitmask type for SSL options. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ssl__basic_context.verify_mode [*verify_mode]]]
- [Bitmask type for peer verification. ]
+ [[link boost_asio.reference.ssl__context.password_purpose [*password_purpose]]]
+ [Purpose of PEM password. ]
   
   ]
 
@@ -61571,67 +80864,91 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ssl__basic_context.add_verify_path [*add_verify_path]]]
+ [[link boost_asio.reference.ssl__context.add_verify_path [*add_verify_path]]]
     [Add a directory containing certificate authority files to be used for performing verification. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.basic_context [*basic_context]]]
- [Constructor. ]
+ [[link boost_asio.reference.ssl__context.context [*context]]]
+ [Constructor.
+
+ Deprecated constructor taking a reference to an io_service object.
+
+ Move-construct a context from another. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.impl [*impl]]]
- [Get the underlying implementation in the native type. ]
+ [[link boost_asio.reference.ssl__context.impl [*impl]]]
+ [(Deprecated: Use native_handle().) Get the underlying implementation in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.load_verify_file [*load_verify_file]]]
+ [[link boost_asio.reference.ssl__context.load_verify_file [*load_verify_file]]]
     [Load a certification authority file for performing verification. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.set_options [*set_options]]]
+ [[link boost_asio.reference.ssl__context.native_handle [*native_handle]]]
+ [Get the underlying implementation in the native type. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ssl__context.operator_eq_ [*operator=]]]
+ [Move-assign a context from another. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ssl__context.set_default_verify_paths [*set_default_verify_paths]]]
+ [Configures the context to use the default directories for finding certification authority certificates. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ssl__context.set_options [*set_options]]]
     [Set options on the context. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.set_password_callback [*set_password_callback]]]
+ [[link boost_asio.reference.ssl__context.set_password_callback [*set_password_callback]]]
     [Set the password callback. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.set_verify_mode [*set_verify_mode]]]
+ [[link boost_asio.reference.ssl__context.set_verify_callback [*set_verify_callback]]]
+ [Set the callback used to verify peer certificates. ]
+ ]
+
+ [
+ [[link boost_asio.reference.ssl__context.set_verify_mode [*set_verify_mode]]]
     [Set the peer verification mode. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.use_certificate_chain_file [*use_certificate_chain_file]]]
+ [[link boost_asio.reference.ssl__context.use_certificate_chain_file [*use_certificate_chain_file]]]
     [Use a certificate chain from a file. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.use_certificate_file [*use_certificate_file]]]
+ [[link boost_asio.reference.ssl__context.use_certificate_file [*use_certificate_file]]]
     [Use a certificate from a file. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.use_private_key_file [*use_private_key_file]]]
+ [[link boost_asio.reference.ssl__context.use_private_key_file [*use_private_key_file]]]
     [Use a private key from a file. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.use_rsa_private_key_file [*use_rsa_private_key_file]]]
+ [[link boost_asio.reference.ssl__context.use_rsa_private_key_file [*use_rsa_private_key_file]]]
     [Use an RSA private key from a file. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context.use_tmp_dh_file [*use_tmp_dh_file]]]
+ [[link boost_asio.reference.ssl__context.use_tmp_dh_file [*use_tmp_dh_file]]]
     [Use the specified file to obtain the temporary Diffie-Hellman parameters. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__basic_context._basic_context [*~basic_context]]]
+ [[link boost_asio.reference.ssl__context._context [*~context]]]
     [Destructor. ]
   ]
   
@@ -61642,75 +80959,55 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ssl__basic_context.default_workarounds [*default_workarounds]]]
+ [[link boost_asio.reference.ssl__context.default_workarounds [*default_workarounds]]]
     [Implement various bug workarounds. ]
   ]
 
   [
- [[link boost_asio.reference.ssl__basic_context.no_sslv2 [*no_sslv2]]]
+ [[link boost_asio.reference.ssl__context.no_sslv2 [*no_sslv2]]]
     [Disable SSL v2. ]
   ]
 
   [
- [[link boost_asio.reference.ssl__basic_context.no_sslv3 [*no_sslv3]]]
+ [[link boost_asio.reference.ssl__context.no_sslv3 [*no_sslv3]]]
     [Disable SSL v3. ]
   ]
 
   [
- [[link boost_asio.reference.ssl__basic_context.no_tlsv1 [*no_tlsv1]]]
+ [[link boost_asio.reference.ssl__context.no_tlsv1 [*no_tlsv1]]]
     [Disable TLS v1. ]
   ]
 
   [
- [[link boost_asio.reference.ssl__basic_context.single_dh_use [*single_dh_use]]]
+ [[link boost_asio.reference.ssl__context.single_dh_use [*single_dh_use]]]
     [Always create a new key when using tmp_dh parameters. ]
   ]
 
- [
- [[link boost_asio.reference.ssl__basic_context.verify_client_once [*verify_client_once]]]
- [Do not request client certificate on renegotiation. Ignored unless verify_peer is set. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.verify_fail_if_no_peer_cert [*verify_fail_if_no_peer_cert]]]
- [Fail verification if the peer has no certificate. Ignored unless verify_peer is set. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.verify_none [*verify_none]]]
- [No verification. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.verify_peer [*verify_peer]]]
- [Verify the peer. ]
- ]
-
 ]
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ssl/basic_context.hpp]
+[*Header: ][^boost/asio/ssl/context.hpp]
 
 [*Convenience header: ][^boost/asio/ssl.hpp]
 
-[section:add_verify_path ssl::basic_context::add_verify_path]
+[section:add_verify_path ssl::context::add_verify_path]
 
-[indexterm2 add_verify_path..ssl::basic_context]
+[indexterm2 add_verify_path..ssl::context]
 Add a directory containing certificate authority files to be used for performing verification.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.add_verify_path.overload1 add_verify_path]``(
+ void ``[link boost_asio.reference.ssl__context.add_verify_path.overload1 add_verify_path]``(
       const std::string & path);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.add_verify_path.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.add_verify_path.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.add_verify_path.overload2 add_verify_path]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.add_verify_path.overload2 add_verify_path]``(
       const std::string & path,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.add_verify_path.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.add_verify_path.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::add_verify_path (1 of 2 overloads)]
+[section:overload1 ssl::context::add_verify_path (1 of 2 overloads)]
 
 
 Add a directory containing certificate authority files to be used for performing verification.
@@ -61738,18 +81035,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_load_verify_locations`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::add_verify_path (2 of 2 overloads)]
+[section:overload2 ssl::context::add_verify_path (2 of 2 overloads)]
 
 
 Add a directory containing certificate authority files to be used for performing verification.
@@ -61770,11 +81072,16 @@
   
 [[path][The name of a directory containing the certificates.]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_load_verify_locations`.
+
+
 
 
 [endsect]
@@ -61782,15 +81089,41 @@
 
 [endsect]
 
+[section:context ssl::context::context]
+
+[indexterm2 context..ssl::context]
+Constructor.
+
+
+ explicit ``[link boost_asio.reference.ssl__context.context.overload1 context]``(
+ method m);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.context.overload1 more...]]``
+
+
+Deprecated constructor taking a reference to an [link boost_asio.reference.io_service `io_service`] object.
+
+
+ ``[link boost_asio.reference.ssl__context.context.overload2 context]``(
+ boost::asio::io_service & ,
+ method m);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.context.overload2 more...]]``
+
+
+Move-construct a context from another.
+
+
+ ``[link boost_asio.reference.ssl__context.context.overload3 context]``(
+ context && other);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.context.overload3 more...]]``
+
+
+[section:overload1 ssl::context::context (1 of 3 overloads)]
 
-[section:basic_context ssl::basic_context::basic_context]
 
-[indexterm2 basic_context..ssl::basic_context]
 Constructor.
 
 
- basic_context(
- boost::asio::io_service & io_service,
+ context(
       method m);
 
 
@@ -61799,36 +81132,87 @@
 
 
 
-[section:default_workarounds ssl::basic_context::default_workarounds]
+[section:overload2 ssl::context::context (2 of 3 overloads)]
 
 
-['Inherited from ssl::context_base.]
+Deprecated constructor taking a reference to an [link boost_asio.reference.io_service `io_service`] object.
+
+
+ context(
+ boost::asio::io_service & ,
+ method m);
+
+
+
+[endsect]
+
+
+
+[section:overload3 ssl::context::context (3 of 3 overloads)]
+
+
+Move-construct a context from another.
+
+
+ context(
+ context && other);
+
+
+This constructor moves an SSL context from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other context object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the following operations only are valid for the moved-from object:
+* Destruction.
+
+* As a target for move-assignment.
 
-[indexterm2 default_workarounds..ssl::basic_context]
-Implement various bug workarounds.
 
 
- static const int default_workarounds = implementation_defined;
 
 
 
 [endsect]
 
 
+[endsect]
+
+
+[section:default_workarounds ssl::context::default_workarounds]
+
+[indexterm2 default_workarounds..ssl::context]
+Implement various bug workarounds.
+
+
+ static const int default_workarounds = implementation_defined;
 
-[section:file_format ssl::basic_context::file_format]
 
 
-['Inherited from ssl::context_base.]
+[endsect]
+
+
+
+[section:file_format ssl::context::file_format]
 
-[indexterm2 file_format..ssl::basic_context]
+[indexterm2 file_format..ssl::context]
 File format types.
 
 
   enum file_format
 
-[indexterm2 asn1..ssl::basic_context]
-[indexterm2 pem..ssl::basic_context]
+[indexterm2 asn1..ssl::context]
+[indexterm2 pem..ssl::context]
 
 [heading Values]
 [variablelist
@@ -61851,10 +81235,10 @@
 
 
 
-[section:impl ssl::basic_context::impl]
+[section:impl ssl::context::impl]
 
-[indexterm2 impl..ssl::basic_context]
-Get the underlying implementation in the native type.
+[indexterm2 impl..ssl::context]
+(Deprecated: Use `native_handle()`.) Get the underlying implementation in the native type.
 
 
   impl_type impl();
@@ -61867,19 +81251,19 @@
 
 
 
-[section:impl_type ssl::basic_context::impl_type]
+[section:impl_type ssl::context::impl_type]
 
-[indexterm2 impl_type..ssl::basic_context]
-The native implementation type of the locking dispatcher.
+[indexterm2 impl_type..ssl::context]
+(Deprecated: Use native\_handle\_type.) The native type of the SSL context.
 
 
- typedef service_type::impl_type impl_type;
+ typedef SSL_CTX * impl_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ssl/basic_context.hpp]
+[*Header: ][^boost/asio/ssl/context.hpp]
 
 [*Convenience header: ][^boost/asio/ssl.hpp]
 
@@ -61887,23 +81271,23 @@
 [endsect]
 
 
-[section:load_verify_file ssl::basic_context::load_verify_file]
+[section:load_verify_file ssl::context::load_verify_file]
 
-[indexterm2 load_verify_file..ssl::basic_context]
+[indexterm2 load_verify_file..ssl::context]
 Load a certification authority file for performing verification.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.load_verify_file.overload1 load_verify_file]``(
+ void ``[link boost_asio.reference.ssl__context.load_verify_file.overload1 load_verify_file]``(
       const std::string & filename);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.load_verify_file.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.load_verify_file.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.load_verify_file.overload2 load_verify_file]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.load_verify_file.overload2 load_verify_file]``(
       const std::string & filename,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.load_verify_file.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.load_verify_file.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::load_verify_file (1 of 2 overloads)]
+[section:overload1 ssl::context::load_verify_file (1 of 2 overloads)]
 
 
 Load a certification authority file for performing verification.
@@ -61931,18 +81315,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_load_verify_locations`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::load_verify_file (2 of 2 overloads)]
+[section:overload2 ssl::context::load_verify_file (2 of 2 overloads)]
 
 
 Load a certification authority file for performing verification.
@@ -61963,42 +81352,44 @@
   
 [[filename][The name of a file containing certification authority certificates in PEM format.]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_load_verify_locations`.
 
 
-[endsect]
 
 
 [endsect]
 
 
-[section:method ssl::basic_context::method]
+[endsect]
 
 
-['Inherited from ssl::context_base.]
+[section:method ssl::context::method]
 
-[indexterm2 method..ssl::basic_context]
+[indexterm2 method..ssl::context]
 Different methods supported by a context.
 
 
   enum method
 
-[indexterm2 sslv2..ssl::basic_context]
-[indexterm2 sslv2_client..ssl::basic_context]
-[indexterm2 sslv2_server..ssl::basic_context]
-[indexterm2 sslv3..ssl::basic_context]
-[indexterm2 sslv3_client..ssl::basic_context]
-[indexterm2 sslv3_server..ssl::basic_context]
-[indexterm2 tlsv1..ssl::basic_context]
-[indexterm2 tlsv1_client..ssl::basic_context]
-[indexterm2 tlsv1_server..ssl::basic_context]
-[indexterm2 sslv23..ssl::basic_context]
-[indexterm2 sslv23_client..ssl::basic_context]
-[indexterm2 sslv23_server..ssl::basic_context]
+[indexterm2 sslv2..ssl::context]
+[indexterm2 sslv2_client..ssl::context]
+[indexterm2 sslv2_server..ssl::context]
+[indexterm2 sslv3..ssl::context]
+[indexterm2 sslv3_client..ssl::context]
+[indexterm2 sslv3_server..ssl::context]
+[indexterm2 tlsv1..ssl::context]
+[indexterm2 tlsv1_client..ssl::context]
+[indexterm2 tlsv1_server..ssl::context]
+[indexterm2 sslv23..ssl::context]
+[indexterm2 sslv23_client..ssl::context]
+[indexterm2 sslv23_server..ssl::context]
 
 [heading Values]
 [variablelist
@@ -62048,35 +81439,69 @@
     [TLS version 1 server. ]
   ]
 
- [
- [sslv23]
- [Generic SSL/TLS. ]
- ]
+ [
+ [sslv23]
+ [Generic SSL/TLS. ]
+ ]
+
+ [
+ [sslv23_client]
+ [SSL/TLS client. ]
+ ]
+
+ [
+ [sslv23_server]
+ [SSL/TLS server. ]
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:native_handle ssl::context::native_handle]
+
+[indexterm2 native_handle..ssl::context]
+Get the underlying implementation in the native type.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type ssl::context::native_handle_type]
+
+[indexterm2 native_handle_type..ssl::context]
+The native handle type of the SSL context.
+
 
- [
- [sslv23_client]
- [SSL/TLS client. ]
- ]
+ typedef SSL_CTX * native_handle_type;
 
- [
- [sslv23_server]
- [SSL/TLS server. ]
- ]
 
-]
 
+[heading Requirements]
 
+[*Header: ][^boost/asio/ssl/context.hpp]
 
-[endsect]
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
+[endsect]
 
-[section:no_sslv2 ssl::basic_context::no_sslv2]
 
 
-['Inherited from ssl::context_base.]
+[section:no_sslv2 ssl::context::no_sslv2]
 
-[indexterm2 no_sslv2..ssl::basic_context]
+[indexterm2 no_sslv2..ssl::context]
 Disable SSL v2.
 
 
@@ -62088,12 +81513,9 @@
 
 
 
-[section:no_sslv3 ssl::basic_context::no_sslv3]
-
-
-['Inherited from ssl::context_base.]
+[section:no_sslv3 ssl::context::no_sslv3]
 
-[indexterm2 no_sslv3..ssl::basic_context]
+[indexterm2 no_sslv3..ssl::context]
 Disable SSL v3.
 
 
@@ -62105,12 +81527,9 @@
 
 
 
-[section:no_tlsv1 ssl::basic_context::no_tlsv1]
+[section:no_tlsv1 ssl::context::no_tlsv1]
 
-
-['Inherited from ssl::context_base.]
-
-[indexterm2 no_tlsv1..ssl::basic_context]
+[indexterm2 no_tlsv1..ssl::context]
 Disable TLS v1.
 
 
@@ -62122,12 +81541,48 @@
 
 
 
-[section:options ssl::basic_context::options]
+[section:operator_eq_ ssl::context::operator=]
+
+[indexterm2 operator=..ssl::context]
+Move-assign a context from another.
+
+
+ context & operator=(
+ context && other);
+
+
+This assignment operator moves an SSL context from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other context object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the following operations only are valid for the moved-from object:
+* Destruction.
+
+* As a target for move-assignment.
+
+
+
+
+
+
+[endsect]
+
 
 
-['Inherited from ssl::context_base.]
+[section:options ssl::context::options]
 
-[indexterm2 options..ssl::basic_context]
+[indexterm2 options..ssl::context]
 Bitmask type for SSL options.
 
 
@@ -62137,7 +81592,7 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ssl/basic_context.hpp]
+[*Header: ][^boost/asio/ssl/context.hpp]
 
 [*Convenience header: ][^boost/asio/ssl.hpp]
 
@@ -62146,19 +81601,16 @@
 
 
 
-[section:password_purpose ssl::basic_context::password_purpose]
-
-
-['Inherited from ssl::context_base.]
+[section:password_purpose ssl::context::password_purpose]
 
-[indexterm2 password_purpose..ssl::basic_context]
+[indexterm2 password_purpose..ssl::context]
 Purpose of PEM password.
 
 
   enum password_purpose
 
-[indexterm2 for_reading..ssl::basic_context]
-[indexterm2 for_writing..ssl::basic_context]
+[indexterm2 for_reading..ssl::context]
+[indexterm2 for_writing..ssl::context]
 
 [heading Values]
 [variablelist
@@ -62180,44 +81632,105 @@
 [endsect]
 
 
+[section:set_default_verify_paths ssl::context::set_default_verify_paths]
 
-[section:service_type ssl::basic_context::service_type]
+[indexterm2 set_default_verify_paths..ssl::context]
+Configures the context to use the default directories for finding certification authority certificates.
 
-[indexterm2 service_type..ssl::basic_context]
-The type of the service that will be used to provide context operations.
 
+ void ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 set_default_verify_paths]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload1 more...]]``
 
- typedef Service service_type;
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 set_default_verify_paths]``(
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_default_verify_paths.overload2 more...]]``
 
 
+[section:overload1 ssl::context::set_default_verify_paths (1 of 2 overloads)]
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ssl/basic_context.hpp]
+Configures the context to use the default directories for finding certification authority certificates.
+
+
+ void set_default_verify_paths();
+
+
+This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates.
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+Calls `SSL_CTX_set_default_verify_paths`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 ssl::context::set_default_verify_paths (2 of 2 overloads)]
+
+
+Configures the context to use the default directories for finding certification authority certificates.
+
+
+ boost::system::error_code set_default_verify_paths(
+ boost::system::error_code & ec);
+
+
+This function specifies that the context should use the default, system-dependent directories for locating certification authority certificates.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+Calls `SSL_CTX_set_default_verify_paths`.
+
 
-[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
-[section:set_options ssl::basic_context::set_options]
+[endsect]
+
+[section:set_options ssl::context::set_options]
 
-[indexterm2 set_options..ssl::basic_context]
+[indexterm2 set_options..ssl::context]
 Set options on the context.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.set_options.overload1 set_options]``(
+ void ``[link boost_asio.reference.ssl__context.set_options.overload1 set_options]``(
       options o);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.set_options.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_options.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.set_options.overload2 set_options]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.set_options.overload2 set_options]``(
       options o,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.set_options.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_options.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::set_options (1 of 2 overloads)]
+[section:overload1 ssl::context::set_options (1 of 2 overloads)]
 
 
 Set options on the context.
@@ -62245,18 +81758,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_set_options`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::set_options (2 of 2 overloads)]
+[section:overload2 ssl::context::set_options (2 of 2 overloads)]
 
 
 Set options on the context.
@@ -62277,11 +81795,16 @@
   
 [[o][A bitmask of options. The available option values are defined in the [link boost_asio.reference.ssl__context_base `ssl::context_base`] class. The options are bitwise-ored with any existing value for the options.]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_set_options`.
+
+
 
 
 [endsect]
@@ -62289,27 +81812,27 @@
 
 [endsect]
 
-[section:set_password_callback ssl::basic_context::set_password_callback]
+[section:set_password_callback ssl::context::set_password_callback]
 
-[indexterm2 set_password_callback..ssl::basic_context]
+[indexterm2 set_password_callback..ssl::context]
 Set the password callback.
 
 
   template<
       typename PasswordCallback>
- void ``[link boost_asio.reference.ssl__basic_context.set_password_callback.overload1 set_password_callback]``(
+ void ``[link boost_asio.reference.ssl__context.set_password_callback.overload1 set_password_callback]``(
       PasswordCallback callback);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.set_password_callback.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_password_callback.overload1 more...]]``
 
   template<
       typename PasswordCallback>
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.set_password_callback.overload2 set_password_callback]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.set_password_callback.overload2 set_password_callback]``(
       PasswordCallback callback,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.set_password_callback.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_password_callback.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::set_password_callback (1 of 2 overloads)]
+[section:overload1 ssl::context::set_password_callback (1 of 2 overloads)]
 
 
 Set the password callback.
@@ -62346,18 +81869,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_set_default_passwd_cb`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::set_password_callback (2 of 2 overloads)]
+[section:overload2 ssl::context::set_password_callback (2 of 2 overloads)]
 
 
 Set the password callback.
@@ -62387,11 +81915,136 @@
 ``
 The return value of the callback is a string containing the password.]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+Calls `SSL_CTX_set_default_passwd_cb`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:set_verify_callback ssl::context::set_verify_callback]
+
+[indexterm2 set_verify_callback..ssl::context]
+Set the callback used to verify peer certificates.
+
+
+ template<
+ typename VerifyCallback>
+ void ``[link boost_asio.reference.ssl__context.set_verify_callback.overload1 set_verify_callback]``(
+ VerifyCallback callback);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_callback.overload1 more...]]``
+
+ template<
+ typename VerifyCallback>
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.set_verify_callback.overload2 set_verify_callback]``(
+ VerifyCallback callback,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_callback.overload2 more...]]``
+
+
+[section:overload1 ssl::context::set_verify_callback (1 of 2 overloads)]
+
+
+Set the callback used to verify peer certificates.
+
+
+ template<
+ typename VerifyCallback>
+ void set_verify_callback(
+ VerifyCallback callback);
+
+
+This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
+``
+ bool verify_callback(
+ bool preverified, // True if the certificate passed pre-verification.
+ verify_context& ctx // The peer certificate and other context.
+ );
+``
+The return value of the callback is true if the certificate has passed verification, false otherwise.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+
+
+[heading Remarks]
+
+Calls `SSL_CTX_set_verify`.
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 ssl::context::set_verify_callback (2 of 2 overloads)]
+
+
+Set the callback used to verify peer certificates.
+
+
+ template<
+ typename VerifyCallback>
+ boost::system::error_code set_verify_callback(
+ VerifyCallback callback,
+ boost::system::error_code & ec);
+
+
+This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
+``
+ bool verify_callback(
+ bool preverified, // True if the certificate passed pre-verification.
+ verify_context& ctx // The peer certificate and other context.
+ );
+``
+The return value of the callback is true if the certificate has passed verification, false otherwise.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_set_verify`.
+
+
 
 
 [endsect]
@@ -62399,23 +82052,23 @@
 
 [endsect]
 
-[section:set_verify_mode ssl::basic_context::set_verify_mode]
+[section:set_verify_mode ssl::context::set_verify_mode]
 
-[indexterm2 set_verify_mode..ssl::basic_context]
+[indexterm2 set_verify_mode..ssl::context]
 Set the peer verification mode.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.set_verify_mode.overload1 set_verify_mode]``(
+ void ``[link boost_asio.reference.ssl__context.set_verify_mode.overload1 set_verify_mode]``(
       verify_mode v);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.set_verify_mode.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_mode.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.set_verify_mode.overload2 set_verify_mode]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.set_verify_mode.overload2 set_verify_mode]``(
       verify_mode v,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.set_verify_mode.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.set_verify_mode.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::set_verify_mode (1 of 2 overloads)]
+[section:overload1 ssl::context::set_verify_mode (1 of 2 overloads)]
 
 
 Set the peer verification mode.
@@ -62433,7 +82086,7 @@
 
 [variablelist
   
-[[v][A bitmask of peer verification modes. The available verify\_mode values are defined in the [link boost_asio.reference.ssl__context_base `ssl::context_base`] class.]]
+[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
 
 ]
 
@@ -62443,18 +82096,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_set_verify`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::set_verify_mode (2 of 2 overloads)]
+[section:overload2 ssl::context::set_verify_mode (2 of 2 overloads)]
 
 
 Set the peer verification mode.
@@ -62473,27 +82131,29 @@
 
 [variablelist
   
-[[v][A bitmask of peer verification modes. The available verify\_mode values are defined in the [link boost_asio.reference.ssl__context_base `ssl::context_base`] class.]]
+[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_set_verify`.
 
 
-[endsect]
 
 
 [endsect]
 
 
-[section:single_dh_use ssl::basic_context::single_dh_use]
+[endsect]
 
 
-['Inherited from ssl::context_base.]
+[section:single_dh_use ssl::context::single_dh_use]
 
-[indexterm2 single_dh_use..ssl::basic_context]
+[indexterm2 single_dh_use..ssl::context]
 Always create a new key when using tmp\_dh parameters.
 
 
@@ -62504,23 +82164,23 @@
 [endsect]
 
 
-[section:use_certificate_chain_file ssl::basic_context::use_certificate_chain_file]
+[section:use_certificate_chain_file ssl::context::use_certificate_chain_file]
 
-[indexterm2 use_certificate_chain_file..ssl::basic_context]
+[indexterm2 use_certificate_chain_file..ssl::context]
 Use a certificate chain from a file.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.use_certificate_chain_file.overload1 use_certificate_chain_file]``(
+ void ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 use_certificate_chain_file]``(
       const std::string & filename);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_certificate_chain_file.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.use_certificate_chain_file.overload2 use_certificate_chain_file]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 use_certificate_chain_file]``(
       const std::string & filename,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_certificate_chain_file.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_chain_file.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::use_certificate_chain_file (1 of 2 overloads)]
+[section:overload1 ssl::context::use_certificate_chain_file (1 of 2 overloads)]
 
 
 Use a certificate chain from a file.
@@ -62548,18 +82208,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_certificate_chain_file`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::use_certificate_chain_file (2 of 2 overloads)]
+[section:overload2 ssl::context::use_certificate_chain_file (2 of 2 overloads)]
 
 
 Use a certificate chain from a file.
@@ -62580,11 +82245,16 @@
   
 [[filename][The name of the file containing the certificate. The file must use the PEM format.]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_certificate_chain_file`.
+
+
 
 
 [endsect]
@@ -62592,25 +82262,25 @@
 
 [endsect]
 
-[section:use_certificate_file ssl::basic_context::use_certificate_file]
+[section:use_certificate_file ssl::context::use_certificate_file]
 
-[indexterm2 use_certificate_file..ssl::basic_context]
+[indexterm2 use_certificate_file..ssl::context]
 Use a certificate from a file.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.use_certificate_file.overload1 use_certificate_file]``(
+ void ``[link boost_asio.reference.ssl__context.use_certificate_file.overload1 use_certificate_file]``(
       const std::string & filename,
       file_format format);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_certificate_file.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_file.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.use_certificate_file.overload2 use_certificate_file]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.use_certificate_file.overload2 use_certificate_file]``(
       const std::string & filename,
       file_format format,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_certificate_file.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_certificate_file.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::use_certificate_file (1 of 2 overloads)]
+[section:overload1 ssl::context::use_certificate_file (1 of 2 overloads)]
 
 
 Use a certificate from a file.
@@ -62641,18 +82311,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_certificate_file`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::use_certificate_file (2 of 2 overloads)]
+[section:overload2 ssl::context::use_certificate_file (2 of 2 overloads)]
 
 
 Use a certificate from a file.
@@ -62676,11 +82351,16 @@
 
 [[format][The file format (ASN.1 or PEM).]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_certificate_file`.
+
+
 
 
 [endsect]
@@ -62688,25 +82368,25 @@
 
 [endsect]
 
-[section:use_private_key_file ssl::basic_context::use_private_key_file]
+[section:use_private_key_file ssl::context::use_private_key_file]
 
-[indexterm2 use_private_key_file..ssl::basic_context]
+[indexterm2 use_private_key_file..ssl::context]
 Use a private key from a file.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.use_private_key_file.overload1 use_private_key_file]``(
+ void ``[link boost_asio.reference.ssl__context.use_private_key_file.overload1 use_private_key_file]``(
       const std::string & filename,
       file_format format);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_private_key_file.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key_file.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.use_private_key_file.overload2 use_private_key_file]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.use_private_key_file.overload2 use_private_key_file]``(
       const std::string & filename,
       file_format format,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_private_key_file.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_private_key_file.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::use_private_key_file (1 of 2 overloads)]
+[section:overload1 ssl::context::use_private_key_file (1 of 2 overloads)]
 
 
 Use a private key from a file.
@@ -62737,18 +82417,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_PrivateKey_file`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::use_private_key_file (2 of 2 overloads)]
+[section:overload2 ssl::context::use_private_key_file (2 of 2 overloads)]
 
 
 Use a private key from a file.
@@ -62772,11 +82457,16 @@
 
 [[format][The file format (ASN.1 or PEM).]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_PrivateKey_file`.
+
+
 
 
 [endsect]
@@ -62784,25 +82474,25 @@
 
 [endsect]
 
-[section:use_rsa_private_key_file ssl::basic_context::use_rsa_private_key_file]
+[section:use_rsa_private_key_file ssl::context::use_rsa_private_key_file]
 
-[indexterm2 use_rsa_private_key_file..ssl::basic_context]
+[indexterm2 use_rsa_private_key_file..ssl::context]
 Use an RSA private key from a file.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.use_rsa_private_key_file.overload1 use_rsa_private_key_file]``(
+ void ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 use_rsa_private_key_file]``(
       const std::string & filename,
       file_format format);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_rsa_private_key_file.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.use_rsa_private_key_file.overload2 use_rsa_private_key_file]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 use_rsa_private_key_file]``(
       const std::string & filename,
       file_format format,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_rsa_private_key_file.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_rsa_private_key_file.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::use_rsa_private_key_file (1 of 2 overloads)]
+[section:overload1 ssl::context::use_rsa_private_key_file (1 of 2 overloads)]
 
 
 Use an RSA private key from a file.
@@ -62833,18 +82523,23 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_RSAPrivateKey_file`.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::basic_context::use_rsa_private_key_file (2 of 2 overloads)]
+[section:overload2 ssl::context::use_rsa_private_key_file (2 of 2 overloads)]
 
 
 Use an RSA private key from a file.
@@ -62868,11 +82563,16 @@
 
 [[format][The file format (ASN.1 or PEM).]]
 
-[[ec][Set to indicate what error occurred, if any. ]]
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
+[heading Remarks]
+
+Calls `SSL_CTX_use_RSAPrivateKey_file`.
+
+
 
 
 [endsect]
@@ -62880,23 +82580,23 @@
 
 [endsect]
 
-[section:use_tmp_dh_file ssl::basic_context::use_tmp_dh_file]
+[section:use_tmp_dh_file ssl::context::use_tmp_dh_file]
 
-[indexterm2 use_tmp_dh_file..ssl::basic_context]
+[indexterm2 use_tmp_dh_file..ssl::context]
 Use the specified file to obtain the temporary Diffie-Hellman parameters.
 
 
- void ``[link boost_asio.reference.ssl__basic_context.use_tmp_dh_file.overload1 use_tmp_dh_file]``(
+ void ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 use_tmp_dh_file]``(
       const std::string & filename);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_tmp_dh_file.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload1 more...]]``
 
- boost::system::error_code ``[link boost_asio.reference.ssl__basic_context.use_tmp_dh_file.overload2 use_tmp_dh_file]``(
+ boost::system::error_code ``[link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 use_tmp_dh_file]``(
       const std::string & filename,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__basic_context.use_tmp_dh_file.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__context.use_tmp_dh_file.overload2 more...]]``
 
 
-[section:overload1 ssl::basic_context::use_tmp_dh_file (1 of 2 overloads)]
+[section:overload1 ssl::context::use_tmp_dh_file (1 of 2 overloads)]
 
 
 Use the specified file to obtain the temporary Diffie-Hellman parameters.
@@ -62920,365 +82620,85 @@
 
 
 [heading Exceptions]
-
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
-
-]
-
-
-
-
-[endsect]
-
-
-
-[section:overload2 ssl::basic_context::use_tmp_dh_file (2 of 2 overloads)]
-
-
-Use the specified file to obtain the temporary Diffie-Hellman parameters.
-
-
- boost::system::error_code use_tmp_dh_file(
- const std::string & filename,
- boost::system::error_code & ec);
-
-
-This function is used to load Diffie-Hellman parameters into the context from a file.
-
-
-[heading Parameters]
-
-
-[variablelist
-
-[[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]]
-
-[[ec][Set to indicate what error occurred, if any. ]]
-
-]
-
-
-
-
-[endsect]
-
-
-[endsect]
-
-
-[section:verify_client_once ssl::basic_context::verify_client_once]
-
-
-['Inherited from ssl::context_base.]
-
-[indexterm2 verify_client_once..ssl::basic_context]
-Do not request client certificate on renegotiation. Ignored unless verify\_peer is set.
-
-
- static const int verify_client_once = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:verify_fail_if_no_peer_cert ssl::basic_context::verify_fail_if_no_peer_cert]
-
-
-['Inherited from ssl::context_base.]
-
-[indexterm2 verify_fail_if_no_peer_cert..ssl::basic_context]
-Fail verification if the peer has no certificate. Ignored unless verify\_peer is set.
-
-
- static const int verify_fail_if_no_peer_cert = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:verify_mode ssl::basic_context::verify_mode]
-
-
-['Inherited from ssl::context_base.]
-
-[indexterm2 verify_mode..ssl::basic_context]
-Bitmask type for peer verification.
-
-
- typedef int verify_mode;
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/ssl/basic_context.hpp]
-
-[*Convenience header: ][^boost/asio/ssl.hpp]
-
-
-[endsect]
-
-
-
-[section:verify_none ssl::basic_context::verify_none]
-
-
-['Inherited from ssl::context_base.]
-
-[indexterm2 verify_none..ssl::basic_context]
-No verification.
-
-
- static const int verify_none = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:verify_peer ssl::basic_context::verify_peer]
-
-
-['Inherited from ssl::context_base.]
-
-[indexterm2 verify_peer..ssl::basic_context]
-Verify the peer.
-
-
- static const int verify_peer = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:_basic_context ssl::basic_context::~basic_context]
-
-[indexterm2 ~basic_context..ssl::basic_context]
-Destructor.
-
-
- ~basic_context();
-
-
-
-[endsect]
-
-
-
-[endsect]
-
-
-[section:ssl__context ssl::context]
-
-[indexterm1 ssl::context]
-Typedef for the typical usage of context.
-
-
- typedef basic_context< context_service > context;
-
-
-[heading Types]
-[table
- [[Name][Description]]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.file_format [*file_format]]]
- [File format types. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.impl_type [*impl_type]]]
- [The native implementation type of the locking dispatcher. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.method [*method]]]
- [Different methods supported by a context. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.options [*options]]]
- [Bitmask type for SSL options. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.password_purpose [*password_purpose]]]
- [Purpose of PEM password. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.service_type [*service_type]]]
- [The type of the service that will be used to provide context operations. ]
-
- ]
-
- [
-
- [[link boost_asio.reference.ssl__basic_context.verify_mode [*verify_mode]]]
- [Bitmask type for peer verification. ]
-
- ]
-
-]
-
-[heading Member Functions]
-[table
- [[Name][Description]]
-
- [
- [[link boost_asio.reference.ssl__basic_context.add_verify_path [*add_verify_path]]]
- [Add a directory containing certificate authority files to be used for performing verification. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.basic_context [*basic_context]]]
- [Constructor. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.impl [*impl]]]
- [Get the underlying implementation in the native type. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.load_verify_file [*load_verify_file]]]
- [Load a certification authority file for performing verification. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.set_options [*set_options]]]
- [Set options on the context. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.set_password_callback [*set_password_callback]]]
- [Set the password callback. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.set_verify_mode [*set_verify_mode]]]
- [Set the peer verification mode. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.use_certificate_chain_file [*use_certificate_chain_file]]]
- [Use a certificate chain from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.use_certificate_file [*use_certificate_file]]]
- [Use a certificate from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.use_private_key_file [*use_private_key_file]]]
- [Use a private key from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.use_rsa_private_key_file [*use_rsa_private_key_file]]]
- [Use an RSA private key from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context.use_tmp_dh_file [*use_tmp_dh_file]]]
- [Use the specified file to obtain the temporary Diffie-Hellman parameters. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__basic_context._basic_context [*~basic_context]]]
- [Destructor. ]
- ]
+
+
+[variablelist
   
+[[boost::system::system_error][Thrown on failure.]]
+
 ]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ssl__basic_context.default_workarounds [*default_workarounds]]]
- [Implement various bug workarounds. ]
- ]
+[heading Remarks]
+
+Calls `SSL_CTX_set_tmp_dh`.
 
- [
- [[link boost_asio.reference.ssl__basic_context.no_sslv2 [*no_sslv2]]]
- [Disable SSL v2. ]
- ]
 
- [
- [[link boost_asio.reference.ssl__basic_context.no_sslv3 [*no_sslv3]]]
- [Disable SSL v3. ]
- ]
 
- [
- [[link boost_asio.reference.ssl__basic_context.no_tlsv1 [*no_tlsv1]]]
- [Disable TLS v1. ]
- ]
 
- [
- [[link boost_asio.reference.ssl__basic_context.single_dh_use [*single_dh_use]]]
- [Always create a new key when using tmp_dh parameters. ]
- ]
+[endsect]
 
- [
- [[link boost_asio.reference.ssl__basic_context.verify_client_once [*verify_client_once]]]
- [Do not request client certificate on renegotiation. Ignored unless verify_peer is set. ]
- ]
 
- [
- [[link boost_asio.reference.ssl__basic_context.verify_fail_if_no_peer_cert [*verify_fail_if_no_peer_cert]]]
- [Fail verification if the peer has no certificate. Ignored unless verify_peer is set. ]
- ]
 
- [
- [[link boost_asio.reference.ssl__basic_context.verify_none [*verify_none]]]
- [No verification. ]
- ]
+[section:overload2 ssl::context::use_tmp_dh_file (2 of 2 overloads)]
 
- [
- [[link boost_asio.reference.ssl__basic_context.verify_peer [*verify_peer]]]
- [Verify the peer. ]
- ]
+
+Use the specified file to obtain the temporary Diffie-Hellman parameters.
+
+
+ boost::system::error_code use_tmp_dh_file(
+ const std::string & filename,
+ boost::system::error_code & ec);
+
+
+This function is used to load Diffie-Hellman parameters into the context from a file.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[filename][The name of the file containing the Diffie-Hellman parameters. The file must use the PEM format.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Requirements]
+[heading Remarks]
+
+Calls `SSL_CTX_set_tmp_dh`.
 
-[*Header: ][^boost/asio/ssl/context.hpp]
 
-[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
+[endsect]
+
+
+[section:_context ssl::context::~context]
+
+[indexterm2 ~context..ssl::context]
+Destructor.
+
+
+ ~context();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
 [section:ssl__context_base ssl::context_base]
 
 
-The [link boost_asio.reference.ssl__context_base `ssl::context_base`] class is used as a base for the [link boost_asio.reference.ssl__basic_context `ssl::basic_context`] class template so that we have a common place to define various enums.
+The [link boost_asio.reference.ssl__context_base `ssl::context_base`] class is used as a base for the basic\_context class template so that we have a common place to define various enums.
 
 
   class context_base
@@ -63316,13 +82736,6 @@
   
   ]
 
- [
-
- [[link boost_asio.reference.ssl__context_base.verify_mode [*verify_mode]]]
- [Bitmask type for peer verification. ]
-
- ]
-
 ]
 
 [heading Protected Member Functions]
@@ -63365,26 +82778,6 @@
     [Always create a new key when using tmp_dh parameters. ]
   ]
 
- [
- [[link boost_asio.reference.ssl__context_base.verify_client_once [*verify_client_once]]]
- [Do not request client certificate on renegotiation. Ignored unless verify_peer is set. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_base.verify_fail_if_no_peer_cert [*verify_fail_if_no_peer_cert]]]
- [Fail verification if the peer has no certificate. Ignored unless verify_peer is set. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_base.verify_none [*verify_none]]]
- [No verification. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_base.verify_peer [*verify_peer]]]
- [Verify the peer. ]
- ]
-
 ]
 
 [heading Requirements]
@@ -63641,83 +83034,6 @@
 
 
 
-[section:verify_client_once ssl::context_base::verify_client_once]
-
-[indexterm2 verify_client_once..ssl::context_base]
-Do not request client certificate on renegotiation. Ignored unless verify\_peer is set.
-
-
- static const int verify_client_once = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:verify_fail_if_no_peer_cert ssl::context_base::verify_fail_if_no_peer_cert]
-
-[indexterm2 verify_fail_if_no_peer_cert..ssl::context_base]
-Fail verification if the peer has no certificate. Ignored unless verify\_peer is set.
-
-
- static const int verify_fail_if_no_peer_cert = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:verify_mode ssl::context_base::verify_mode]
-
-[indexterm2 verify_mode..ssl::context_base]
-Bitmask type for peer verification.
-
-
- typedef int verify_mode;
-
-
-
-[heading Requirements]
-
-[*Header: ][^boost/asio/ssl/context_base.hpp]
-
-[*Convenience header: ][^boost/asio/ssl.hpp]
-
-
-[endsect]
-
-
-
-[section:verify_none ssl::context_base::verify_none]
-
-[indexterm2 verify_none..ssl::context_base]
-No verification.
-
-
- static const int verify_none = implementation_defined;
-
-
-
-[endsect]
-
-
-
-[section:verify_peer ssl::context_base::verify_peer]
-
-[indexterm2 verify_peer..ssl::context_base]
-Verify the peer.
-
-
- static const int verify_peer = implementation_defined;
-
-
-
-[endsect]
-
-
-
 [section:_context_base ssl::context_base::~context_base]
 
 [indexterm2 ~context_base..ssl::context_base]
@@ -63734,14 +83050,13 @@
 
 [endsect]
 
-[section:ssl__context_service ssl::context_service]
+[section:ssl__rfc2818_verification ssl::rfc2818_verification]
 
 
-Default service implementation for a context.
+Verifies a certificate against a hostname according to the rules described in RFC 2818.
 
 
- class context_service :
- public io_service::service
+ class rfc2818_verification
 
 
 [heading Types]
@@ -63750,8 +83065,8 @@
 
   [
 
- [[link boost_asio.reference.ssl__context_service.impl_type [*impl_type]]]
- [The type of the context. ]
+ [[link boost_asio.reference.ssl__rfc2818_verification.result_type [*result_type]]]
+ [The type of the function object's result. ]
   
   ]
 
@@ -63762,368 +83077,66 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ssl__context_service.add_verify_path [*add_verify_path]]]
- [Add a directory containing certification authority files to be used for performing verification. ]
+ [[link boost_asio.reference.ssl__rfc2818_verification.operator_lp__rp_ [*operator()]]]
+ [Perform certificate verification. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__context_service.context_service [*context_service]]]
+ [[link boost_asio.reference.ssl__rfc2818_verification.rfc2818_verification [*rfc2818_verification]]]
     [Constructor. ]
   ]
   
- [
- [[link boost_asio.reference.ssl__context_service.create [*create]]]
- [Create a new context implementation. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.destroy [*destroy]]]
- [Destroy a context implementation. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.load_verify_file [*load_verify_file]]]
- [Load a certification authority file for performing verification. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.null [*null]]]
- [Return a null context implementation. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.set_options [*set_options]]]
- [Set options on the context. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.set_password_callback [*set_password_callback]]]
- [Set the password callback. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.set_verify_mode [*set_verify_mode]]]
- [Set peer verification mode. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.use_certificate_chain_file [*use_certificate_chain_file]]]
- [Use a certificate chain from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.use_certificate_file [*use_certificate_file]]]
- [Use a certificate from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.use_private_key_file [*use_private_key_file]]]
- [Use a private key from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.use_rsa_private_key_file [*use_rsa_private_key_file]]]
- [Use an RSA private key from a file. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__context_service.use_tmp_dh_file [*use_tmp_dh_file]]]
- [Use the specified file to obtain the temporary Diffie-Hellman parameters. ]
- ]
-
-]
-
-[heading Data Members]
-[table
- [[Name][Description]]
-
- [
- [[link boost_asio.reference.ssl__context_service.id [*id]]]
- [The unique service identifier. ]
- ]
-
 ]
 
-[heading Requirements]
-
-[*Header: ][^boost/asio/ssl/context_service.hpp]
-
-[*Convenience header: ][^boost/asio/ssl.hpp]
-
-
-[section:add_verify_path ssl::context_service::add_verify_path]
-
-[indexterm2 add_verify_path..ssl::context_service]
-Add a directory containing certification authority files to be used for performing verification.
-
-
- boost::system::error_code add_verify_path(
- impl_type & impl,
- const std::string & path,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
-
-
-[section:context_service ssl::context_service::context_service]
-
-[indexterm2 context_service..ssl::context_service]
-Constructor.
-
-
- context_service(
- boost::asio::io_service & io_service);
-
-
-
-[endsect]
-
-
-
-[section:create ssl::context_service::create]
-
-[indexterm2 create..ssl::context_service]
-Create a new context implementation.
-
-
- void create(
- impl_type & impl,
- context_base::method m);
-
-
-
-[endsect]
-
-
-
-[section:destroy ssl::context_service::destroy]
-
-[indexterm2 destroy..ssl::context_service]
-Destroy a context implementation.
-
-
- void destroy(
- impl_type & impl);
-
-
-
-[endsect]
-
-
-
-[section:get_io_service ssl::context_service::get_io_service]
-
-
-['Inherited from io_service.]
-
-[indexterm2 get_io_service..ssl::context_service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
-
-
- boost::asio::io_service & get_io_service();
-
-
-
-[endsect]
-
-
-
-[section:id ssl::context_service::id]
-
-[indexterm2 id..ssl::context_service]
-The unique service identifier.
-
-
- static boost::asio::io_service::id id;
 
+[heading Example]
+
+The following example shows how to synchronously open a secure connection to a given host name:
 
+ using boost::asio::ip::tcp;
+ namespace ssl = boost::asio::ssl;
+ typedef ssl::stream<tcp::socket> ssl_socket;
 
-[endsect]
+ // Create a context that uses the default paths for finding CA certificates.
+ ssl::context ctx(ssl::context::sslv23);
+ ctx.set_default_verify_paths();
 
+ // Open a socket and connect it to the remote host.
+ boost::asio::io_service io_service;
+ ssl_socket sock(io_service, ctx);
+ tcp::resolver resolver(io_service);
+ tcp::resolver::query query("host.name", "https");
+ boost::asio::connect(sock.lowest_layer(), resolver.resolve(query));
+ sock.lowest_layer().set_option(tcp::no_delay(true));
 
+ // Perform SSL handshake and verify the remote host's certificate.
+ sock.set_verify_mode(ssl::verify_peer);
+ sock.set_verify_callback(ssl::rfc2818_verification("host.name"));
+ sock.handshake(ssl_socket::client);
 
-[section:impl_type ssl::context_service::impl_type]
+ // ... read and write as normal ...
 
-[indexterm2 impl_type..ssl::context_service]
-The type of the context.
 
 
- typedef implementation_defined impl_type;
 
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ssl/context_service.hpp]
+[*Header: ][^boost/asio/ssl/rfc2818_verification.hpp]
 
 [*Convenience header: ][^boost/asio/ssl.hpp]
 
 
-[endsect]
-
-
-
-[section:io_service ssl::context_service::io_service]
-
-
-['Inherited from io_service.]
-
-[indexterm2 io_service..ssl::context_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
-
-
- boost::asio::io_service & io_service();
-
-
-
-[endsect]
-
-
-
-[section:load_verify_file ssl::context_service::load_verify_file]
-
-[indexterm2 load_verify_file..ssl::context_service]
-Load a certification authority file for performing verification.
-
-
- boost::system::error_code load_verify_file(
- impl_type & impl,
- const std::string & filename,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
-
-
-[section:null ssl::context_service::null]
-
-[indexterm2 null..ssl::context_service]
-Return a null context implementation.
-
-
- impl_type null() const;
-
-
-
-[endsect]
-
-
-
-[section:set_options ssl::context_service::set_options]
-
-[indexterm2 set_options..ssl::context_service]
-Set options on the context.
-
-
- boost::system::error_code set_options(
- impl_type & impl,
- context_base::options o,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
-
-
-[section:set_password_callback ssl::context_service::set_password_callback]
-
-[indexterm2 set_password_callback..ssl::context_service]
-Set the password callback.
-
-
- template<
- typename PasswordCallback>
- boost::system::error_code set_password_callback(
- impl_type & impl,
- PasswordCallback callback,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
-
-
-[section:set_verify_mode ssl::context_service::set_verify_mode]
-
-[indexterm2 set_verify_mode..ssl::context_service]
-Set peer verification mode.
-
-
- boost::system::error_code set_verify_mode(
- impl_type & impl,
- context_base::verify_mode v,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
-
-
-[section:shutdown_service ssl::context_service::shutdown_service]
-
-[indexterm2 shutdown_service..ssl::context_service]
-Destroy all user-defined handler objects owned by the service.
-
-
- virtual void shutdown_service();
-
-
-
-[endsect]
-
-
-
-[section:use_certificate_chain_file ssl::context_service::use_certificate_chain_file]
-
-[indexterm2 use_certificate_chain_file..ssl::context_service]
-Use a certificate chain from a file.
-
-
- boost::system::error_code use_certificate_chain_file(
- impl_type & impl,
- const std::string & filename,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
+[section:operator_lp__rp_ ssl::rfc2818_verification::operator()]
 
+[indexterm2 operator()..ssl::rfc2818_verification]
+Perform certificate verification.
 
-[section:use_certificate_file ssl::context_service::use_certificate_file]
 
-[indexterm2 use_certificate_file..ssl::context_service]
-Use a certificate from a file.
-
-
- boost::system::error_code use_certificate_file(
- impl_type & impl,
- const std::string & filename,
- context_base::file_format format,
- boost::system::error_code & ec);
+ bool operator()(
+ bool preverified,
+ verify_context & ctx) const;
 
 
 
@@ -64131,52 +83144,35 @@
 
 
 
-[section:use_private_key_file ssl::context_service::use_private_key_file]
-
-[indexterm2 use_private_key_file..ssl::context_service]
-Use a private key from a file.
-
-
- boost::system::error_code use_private_key_file(
- impl_type & impl,
- const std::string & filename,
- context_base::file_format format,
- boost::system::error_code & ec);
-
+[section:result_type ssl::rfc2818_verification::result_type]
 
-
-[endsect]
+[indexterm2 result_type..ssl::rfc2818_verification]
+The type of the function object's result.
 
 
+ typedef bool result_type;
 
-[section:use_rsa_private_key_file ssl::context_service::use_rsa_private_key_file]
 
-[indexterm2 use_rsa_private_key_file..ssl::context_service]
-Use an RSA private key from a file.
 
+[heading Requirements]
 
- boost::system::error_code use_rsa_private_key_file(
- impl_type & impl,
- const std::string & filename,
- context_base::file_format format,
- boost::system::error_code & ec);
+[*Header: ][^boost/asio/ssl/rfc2818_verification.hpp]
 
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:use_tmp_dh_file ssl::context_service::use_tmp_dh_file]
+[section:rfc2818_verification ssl::rfc2818_verification::rfc2818_verification]
 
-[indexterm2 use_tmp_dh_file..ssl::context_service]
-Use the specified file to obtain the temporary Diffie-Hellman parameters.
+[indexterm2 rfc2818_verification..ssl::rfc2818_verification]
+Constructor.
 
 
- boost::system::error_code use_tmp_dh_file(
- impl_type & impl,
- const std::string & filename,
- boost::system::error_code & ec);
+ rfc2818_verification(
+ const std::string & host);
 
 
 
@@ -64193,10 +83189,10 @@
 
 
   template<
- typename Stream,
- typename ``[link boost_asio.reference.Service Service]`` = stream_service>
+ typename Stream>
   class stream :
- public ssl::stream_base
+ public ssl::stream_base,
+ noncopyable
 
 
 [heading Types]
@@ -64205,6 +83201,13 @@
 
   [
 
+ [[link boost_asio.reference.ssl__stream__impl_struct [*impl_struct]]]
+ [Structure for use with deprecated impl_type. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.ssl__stream.handshake_type [*handshake_type]]]
     [Different handshake types. ]
   
@@ -64213,7 +83216,7 @@
   [
 
     [[link boost_asio.reference.ssl__stream.impl_type [*impl_type]]]
- [The native implementation type of the stream. ]
+ [(Deprecated: Use native_handle_type.) The underlying implementation type. ]
   
   ]
 
@@ -64226,15 +83229,15 @@
 
   [
 
- [[link boost_asio.reference.ssl__stream.next_layer_type [*next_layer_type]]]
- [The type of the next layer. ]
+ [[link boost_asio.reference.ssl__stream.native_handle_type [*native_handle_type]]]
+ [The native handle type of the SSL stream. ]
   
   ]
 
   [
 
- [[link boost_asio.reference.ssl__stream.service_type [*service_type]]]
- [The type of the service that will be used to provide stream operations. ]
+ [[link boost_asio.reference.ssl__stream.next_layer_type [*next_layer_type]]]
+ [The type of the next layer. ]
   
   ]
 
@@ -64276,39 +83279,37 @@
   
   [
     [[link boost_asio.reference.ssl__stream.impl [*impl]]]
- [Get the underlying implementation in the native type. ]
+ [(Deprecated: Use native_handle().) Get the underlying implementation in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__stream.in_avail [*in_avail]]]
- [Determine the amount of data that may be read without blocking. ]
+ [[link boost_asio.reference.ssl__stream.lowest_layer [*lowest_layer]]]
+ [Get a reference to the lowest layer. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__stream.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ [[link boost_asio.reference.ssl__stream.native_handle [*native_handle]]]
+ [Get the underlying implementation in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__stream.lowest_layer [*lowest_layer]]]
- [Get a reference to the lowest layer.
-
- Get a const reference to the lowest layer. ]
+ [[link boost_asio.reference.ssl__stream.next_layer [*next_layer]]]
+ [Get a reference to the next layer. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__stream.next_layer [*next_layer]]]
- [Get a reference to the next layer. ]
+ [[link boost_asio.reference.ssl__stream.read_some [*read_some]]]
+ [Read some data from the stream. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__stream.peek [*peek]]]
- [Peek at the incoming data on the stream. ]
+ [[link boost_asio.reference.ssl__stream.set_verify_callback [*set_verify_callback]]]
+ [Set the callback used to verify peer certificates. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__stream.read_some [*read_some]]]
- [Read some data from the stream. ]
+ [[link boost_asio.reference.ssl__stream.set_verify_mode [*set_verify_mode]]]
+ [Set the peer verification mode. ]
   ]
   
   [
@@ -64340,7 +83341,7 @@
   
 [*Distinct] [*objects:] Safe.
 
-[*Shared] [*objects:] Unsafe.
+[*Shared] [*objects:] Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
 
 
 [heading Example]
@@ -64348,8 +83349,8 @@
 To use the SSL stream template with an `ip::tcp::socket`, you would write:
 
    boost::asio::io_service io_service;
- boost::asio::ssl::context context(io_service, boost::asio::ssl::context::sslv23);
- boost::asio::ssl::stream<boost::asio::ip::tcp::socket> sock(io_service, context);
+ boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23);
+ boost::asio::ssl::stream<asio:ip::tcp::socket> sock(io_service, ctx);
 
 
 
@@ -64371,7 +83372,7 @@
 
 
   template<
- typename HandshakeHandler>
+ typename ``[link boost_asio.reference.HandshakeHandler HandshakeHandler]``>
   void async_handshake(
       handshake_type type,
       HandshakeHandler handler);
@@ -64458,7 +83459,7 @@
 
 
   template<
- typename ShutdownHandler>
+ typename ``[link boost_asio.reference.ShutdownHandler ShutdownHandler]``>
   void async_shutdown(
       ShutdownHandler handler);
 
@@ -64681,7 +83682,7 @@
 [section:impl ssl::stream::impl]
 
 [indexterm2 impl..ssl::stream]
-Get the underlying implementation in the native type.
+(Deprecated: Use `native_handle()`.) Get the underlying implementation in the native type.
 
 
   impl_type impl();
@@ -64697,10 +83698,10 @@
 [section:impl_type ssl::stream::impl_type]
 
 [indexterm2 impl_type..ssl::stream]
-The native implementation type of the stream.
+(Deprecated: Use native\_handle\_type.) The underlying implementation type.
 
 
- typedef service_type::impl_type impl_type;
+ typedef impl_struct * impl_type;
 
 
 
@@ -64714,45 +83715,34 @@
 [endsect]
 
 
-[section:in_avail ssl::stream::in_avail]
+[section:lowest_layer ssl::stream::lowest_layer]
 
-[indexterm2 in_avail..ssl::stream]
-Determine the amount of data that may be read without blocking.
+[indexterm2 lowest_layer..ssl::stream]
+Get a reference to the lowest layer.
 
 
- std::size_t ``[link boost_asio.reference.ssl__stream.in_avail.overload1 in_avail]``();
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.in_avail.overload1 more...]]``
+ lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload1 lowest_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload1 more...]]``
 
- std::size_t ``[link boost_asio.reference.ssl__stream.in_avail.overload2 in_avail]``(
- boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.in_avail.overload2 more...]]``
+ const lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload2 lowest_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload2 more...]]``
 
 
-[section:overload1 ssl::stream::in_avail (1 of 2 overloads)]
+[section:overload1 ssl::stream::lowest_layer (1 of 2 overloads)]
 
 
-Determine the amount of data that may be read without blocking.
+Get a reference to the lowest layer.
 
 
- std::size_t in_avail();
+ lowest_layer_type & lowest_layer();
 
 
-This function is used to determine the amount of data, in bytes, that may be read from the stream without blocking.
+This function returns a reference to the lowest layer in a stack of stream layers.
 
 
 [heading Return Value]
       
-The number of bytes of data that can be read without blocking.
-
-
-[heading Exceptions]
-
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
-
-]
+A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller.
 
 
 
@@ -64761,32 +83751,21 @@
 
 
 
-[section:overload2 ssl::stream::in_avail (2 of 2 overloads)]
-
-
-Determine the amount of data that may be read without blocking.
-
-
- std::size_t in_avail(
- boost::system::error_code & ec);
+[section:overload2 ssl::stream::lowest_layer (2 of 2 overloads)]
 
 
-This function is used to determine the amount of data, in bytes, that may be read from the stream without blocking.
+Get a reference to the lowest layer.
 
 
-[heading Parameters]
-
+ const lowest_layer_type & lowest_layer() const;
 
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
 
-]
+This function returns a reference to the lowest layer in a stack of stream layers.
 
 
 [heading Return Value]
       
-The number of bytes of data that can be read without blocking.
+A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller.
 
 
 
@@ -64797,117 +83776,124 @@
 [endsect]
 
 
-[section:io_service ssl::stream::io_service]
-
-[indexterm2 io_service..ssl::stream]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
+[section:lowest_layer_type ssl::stream::lowest_layer_type]
 
+[indexterm2 lowest_layer_type..ssl::stream]
+The type of the lowest layer.
 
- boost::asio::io_service & io_service();
 
+ typedef next_layer_type::lowest_layer_type lowest_layer_type;
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the stream uses to dispatch handlers for asynchronous operations.
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that stream will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Requirements]
 
+[*Header: ][^boost/asio/ssl/stream.hpp]
 
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
-[section:lowest_layer ssl::stream::lowest_layer]
 
-[indexterm2 lowest_layer..ssl::stream]
-Get a reference to the lowest layer.
+[section:native_handle ssl::stream::native_handle]
 
+[indexterm2 native_handle..ssl::stream]
+Get the underlying implementation in the native type.
 
- lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload1 lowest_layer]``();
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload1 more...]]``
 
+ native_handle_type native_handle();
 
-Get a const reference to the lowest layer.
 
+This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
 
- const lowest_layer_type & ``[link boost_asio.reference.ssl__stream.lowest_layer.overload2 lowest_layer]``() const;
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.lowest_layer.overload2 more...]]``
 
+[heading Example]
+
+The `native_handle()` function returns a pointer of type `SSL*` that is suitable for passing to functions such as `SSL_get_verify_result` and `SSL_get_peer_certificate:`
 
-[section:overload1 ssl::stream::lowest_layer (1 of 2 overloads)]
+ boost::asio::ssl::stream<asio:ip::tcp::socket> sock(io_service, ctx);
 
+ // ... establish connection and perform handshake ...
 
-Get a reference to the lowest layer.
+ if (X509* cert = SSL_get_peer_certificate(sock.native_handle()))
+ {
+ if (SSL_get_verify_result(sock.native_handle()) == X509_V_OK)
+ {
+ // ...
+ }
+ }
 
 
- lowest_layer_type & lowest_layer();
 
 
-This function returns a reference to the lowest layer in a stack of stream layers.
 
 
-[heading Return Value]
-
-A reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller.
+
+[endsect]
 
 
 
+[section:native_handle_type ssl::stream::native_handle_type]
 
-[endsect]
+[indexterm2 native_handle_type..ssl::stream]
+The native handle type of the SSL stream.
 
 
+ typedef SSL * native_handle_type;
 
-[section:overload2 ssl::stream::lowest_layer (2 of 2 overloads)]
 
 
-Get a const reference to the lowest layer.
+[heading Requirements]
 
+[*Header: ][^boost/asio/ssl/stream.hpp]
 
- const lowest_layer_type & lowest_layer() const;
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
-This function returns a const reference to the lowest layer in a stack of stream layers.
+[endsect]
 
 
-[heading Return Value]
-
-A const reference to the lowest layer in the stack of stream layers. Ownership is not transferred to the caller.
+[section:next_layer ssl::stream::next_layer]
 
+[indexterm2 next_layer..ssl::stream]
+Get a reference to the next layer.
 
 
+ const next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload1 next_layer]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.next_layer.overload1 more...]]``
 
-[endsect]
+ next_layer_type & ``[link boost_asio.reference.ssl__stream.next_layer.overload2 next_layer]``();
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.next_layer.overload2 more...]]``
 
 
-[endsect]
+[section:overload1 ssl::stream::next_layer (1 of 2 overloads)]
 
 
-[section:lowest_layer_type ssl::stream::lowest_layer_type]
+Get a reference to the next layer.
 
-[indexterm2 lowest_layer_type..ssl::stream]
-The type of the lowest layer.
 
+ const next_layer_type & next_layer() const;
 
- typedef next_layer_type::lowest_layer_type lowest_layer_type;
 
+This function returns a reference to the next layer in a stack of stream layers.
 
 
-[heading Requirements]
+[heading Return Value]
+
+A reference to the next layer in the stack of stream layers. Ownership is not transferred to the caller.
 
-[*Header: ][^boost/asio/ssl/stream.hpp]
 
-[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:next_layer ssl::stream::next_layer]
+[section:overload2 ssl::stream::next_layer (2 of 2 overloads)]
+
 
-[indexterm2 next_layer..ssl::stream]
 Get a reference to the next layer.
 
 
@@ -64927,6 +83913,8 @@
 [endsect]
 
 
+[endsect]
+
 
 [section:next_layer_type ssl::stream::next_layer_type]
 
@@ -64948,39 +83936,39 @@
 [endsect]
 
 
-[section:peek ssl::stream::peek]
+[section:read_some ssl::stream::read_some]
 
-[indexterm2 peek..ssl::stream]
-Peek at the incoming data on the stream.
+[indexterm2 read_some..ssl::stream]
+Read some data from the stream.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.ssl__stream.peek.overload1 peek]``(
+ std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload1 read_some]``(
       const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.peek.overload1 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload1 more...]]``
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.ssl__stream.peek.overload2 peek]``(
+ std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload2 read_some]``(
       const MutableBufferSequence & buffers,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.peek.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload2 more...]]``
 
 
-[section:overload1 ssl::stream::peek (1 of 2 overloads)]
+[section:overload1 ssl::stream::read_some (1 of 2 overloads)]
 
 
-Peek at the incoming data on the stream.
+Read some data from the stream.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
+ std::size_t read_some(
       const MutableBufferSequence & buffers);
 
 
-This function is used to peek at the incoming data on the stream, without removing it from the input queue. The function call will block until data has been read successfully or an error occurs.
+This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -65003,31 +83991,36 @@
 
 [variablelist
   
-[[boost::system::system_error][Thrown on failure. ]]
+[[boost::system::system_error][Thrown on failure.]]
 
 ]
 
 
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+
+
 
 
 [endsect]
 
 
 
-[section:overload2 ssl::stream::peek (2 of 2 overloads)]
+[section:overload2 ssl::stream::read_some (2 of 2 overloads)]
 
 
-Peek at the incoming data on the stream.
+Read some data from the stream.
 
 
   template<
       typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
+ std::size_t read_some(
       const MutableBufferSequence & buffers,
       boost::system::error_code & ec);
 
 
-This function is used to peek at the incoming data on the stream, withoutxi removing it from the input queue. The function call will block until data has been read successfully or an error occurs.
+This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
 
 
 [heading Parameters]
@@ -65044,7 +84037,12 @@
 
 [heading Return Value]
       
-The number of bytes read. Returns 0 if an error occurred.
+The number of bytes read. Returns 0 if an error occurred.
+
+
+[heading Remarks]
+
+The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
 
 
 
@@ -65054,39 +84052,39 @@
 
 [endsect]
 
-[section:read_some ssl::stream::read_some]
+[section:set_verify_callback ssl::stream::set_verify_callback]
 
-[indexterm2 read_some..ssl::stream]
-Read some data from the stream.
+[indexterm2 set_verify_callback..ssl::stream]
+Set the callback used to verify peer certificates.
 
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload1 read_some]``(
- const MutableBufferSequence & buffers);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload1 more...]]``
+ typename VerifyCallback>
+ void ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload1 set_verify_callback]``(
+ VerifyCallback callback);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload1 more...]]``
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t ``[link boost_asio.reference.ssl__stream.read_some.overload2 read_some]``(
- const MutableBufferSequence & buffers,
+ typename VerifyCallback>
+ boost::system::error_code ``[link boost_asio.reference.ssl__stream.set_verify_callback.overload2 set_verify_callback]``(
+ VerifyCallback callback,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.read_some.overload2 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_callback.overload2 more...]]``
 
 
-[section:overload1 ssl::stream::read_some (1 of 2 overloads)]
+[section:overload1 ssl::stream::set_verify_callback (1 of 2 overloads)]
 
 
-Read some data from the stream.
+Set the callback used to verify peer certificates.
 
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers);
+ typename VerifyCallback>
+ void set_verify_callback(
+ VerifyCallback callback);
 
 
-This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
+This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
 
 
 [heading Parameters]
@@ -65094,16 +84092,18 @@
 
 [variablelist
   
-[[buffers][The buffers into which the data will be read.]]
+[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
+``
+ bool verify_callback(
+ bool preverified, // True if the certificate passed pre-verification.
+ verify_context& ctx // The peer certificate and other context.
+ );
+``
+The return value of the callback is true if the certificate has passed verification, false otherwise.]]
 
 ]
 
 
-[heading Return Value]
-
-The number of bytes read.
-
-
 [heading Exceptions]
     
 
@@ -65116,7 +84116,7 @@
 
 [heading Remarks]
       
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+Calls `SSL_set_verify`.
 
 
 
@@ -65125,20 +84125,20 @@
 
 
 
-[section:overload2 ssl::stream::read_some (2 of 2 overloads)]
+[section:overload2 ssl::stream::set_verify_callback (2 of 2 overloads)]
 
 
-Read some data from the stream.
+Set the callback used to verify peer certificates.
 
 
   template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- const MutableBufferSequence & buffers,
+ typename VerifyCallback>
+ boost::system::error_code set_verify_callback(
+ VerifyCallback callback,
       boost::system::error_code & ec);
 
 
-This function is used to read data from the stream. The function call will block until one or more bytes of data has been read successfully, or until an error occurs.
+This function is used to specify a callback function that will be called by the implementation when it needs to verify a peer certificate.
 
 
 [heading Parameters]
@@ -65146,21 +84146,84 @@
 
 [variablelist
   
-[[buffers][The buffers into which the data will be read.]]
+[[callback][The function object to be used for verifying a certificate. The function signature of the handler must be:
+``
+ bool verify_callback(
+ bool preverified, // True if the certificate passed pre-verification.
+ verify_context& ctx // The peer certificate and other context.
+ );
+``
+The return value of the callback is true if the certificate has passed verification, false otherwise.]]
 
 [[ec][Set to indicate what error occurred, if any.]]
 
 ]
 
 
-[heading Return Value]
+[heading Remarks]
       
-The number of bytes read. Returns 0 if an error occurred.
+Calls `SSL_set_verify`.
+
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:set_verify_mode ssl::stream::set_verify_mode]
+
+[indexterm2 set_verify_mode..ssl::stream]
+Set the peer verification mode.
+
+
+ void ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload1 set_verify_mode]``(
+ verify_mode v);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload1 more...]]``
+
+ boost::system::error_code ``[link boost_asio.reference.ssl__stream.set_verify_mode.overload2 set_verify_mode]``(
+ verify_mode v,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.ssl__stream.set_verify_mode.overload2 more...]]``
+
+
+[section:overload1 ssl::stream::set_verify_mode (1 of 2 overloads)]
+
+
+Set the peer verification mode.
+
+
+ void set_verify_mode(
+ verify_mode v);
+
+
+This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
 
 
 [heading Remarks]
       
-The read\_some operation may not read all of the requested number of bytes. Consider using the [link boost_asio.reference.read `read`] function if you need to ensure that the requested amount of data is read before the blocking operation completes.
+Calls `SSL_set_verify`.
 
 
 
@@ -65168,29 +84231,45 @@
 [endsect]
 
 
-[endsect]
 
+[section:overload2 ssl::stream::set_verify_mode (2 of 2 overloads)]
 
-[section:service_type ssl::stream::service_type]
 
-[indexterm2 service_type..ssl::stream]
-The type of the service that will be used to provide stream operations.
+Set the peer verification mode.
 
 
- typedef Service service_type;
+ boost::system::error_code set_verify_mode(
+ verify_mode v,
+ boost::system::error_code & ec);
 
 
+This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context.
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/ssl/stream.hpp]
+[heading Parameters]
+
+
+[variablelist
+
+[[v][A bitmask of peer verification modes. See [link boost_asio.reference.ssl__verify_mode `ssl::verify_mode`] for available values.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Remarks]
+
+Calls `SSL_set_verify`.
+
 
-[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
+[endsect]
+
 [section:shutdown ssl::stream::shutdown]
 
 [indexterm2 shutdown..ssl::stream]
@@ -65271,11 +84350,10 @@
 
 
   template<
- typename Arg,
- typename Context_Service>
+ typename Arg>
   stream(
       Arg & arg,
- basic_context< Context_Service > & context);
+ context & ctx);
 
 
 This constructor creates a stream and initialises the underlying stream object.
@@ -65288,7 +84366,7 @@
   
 [[arg][The argument to be passed to initialise the underlying stream.]]
 
-[[context][The SSL context to be used for the stream. ]]
+[[ctx][The SSL context to be used for the stream. ]]
 
 ]
 
@@ -65431,6 +84509,47 @@
 
 [endsect]
 
+[section:ssl__stream__impl_struct ssl::stream::impl_struct]
+
+
+Structure for use with deprecated impl\_type.
+
+
+ struct impl_struct
+
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.ssl__stream__impl_struct.ssl [*ssl]]]
+ []
+ ]
+
+]
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/ssl/stream.hpp]
+
+[*Convenience header: ][^boost/asio/ssl.hpp]
+
+
+[section:ssl ssl::stream::impl_struct::ssl]
+
+[indexterm2 ssl..ssl::stream::impl_struct]
+
+ SSL * ssl;
+
+
+
+[endsect]
+
+
+
+[endsect]
+
 [section:ssl__stream_base ssl::stream_base]
 
 
@@ -65519,14 +84638,34 @@
 
 [endsect]
 
-[section:ssl__stream_service ssl::stream_service]
 
+[section:ssl__verify_client_once ssl::verify_client_once]
 
-Default service implementation for an SSL stream.
+[indexterm1 ssl::verify_client_once]
+Do not request client certificate on renegotiation. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`] is set.
 
 
- class stream_service :
- public io_service::service
+ const int verify_client_once = implementation_defined;
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/ssl/verify_mode.hpp]
+
+[*Convenience header: ][^boost/asio/ssl.hpp]
+
+
+[endsect]
+
+
+[section:ssl__verify_context ssl::verify_context]
+
+
+A simple wrapper around the X509\_STORE\_CTX type, used during verification of a peer certificate.
+
+
+ class verify_context :
+ noncopyable
 
 
 [heading Types]
@@ -65535,8 +84674,8 @@
 
   [
 
- [[link boost_asio.reference.ssl__stream_service.impl_type [*impl_type]]]
- [The type of a stream implementation. ]
+ [[link boost_asio.reference.ssl__verify_context.native_handle_type [*native_handle_type]]]
+ [The native handle type of the verification context. ]
   
   ]
 
@@ -65547,263 +84686,76 @@
   [[Name][Description]]
 
   [
- [[link boost_asio.reference.ssl__stream_service.async_handshake [*async_handshake]]]
- [Start an asynchronous SSL handshake. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.async_read_some [*async_read_some]]]
- [Start an asynchronous read. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.async_shutdown [*async_shutdown]]]
- [Asynchronously shut down SSL on the stream. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.async_write_some [*async_write_some]]]
- [Start an asynchronous write. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.create [*create]]]
- [Create a new stream implementation. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.destroy [*destroy]]]
- [Destroy a stream implementation. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.get_io_service [*get_io_service]]]
- [Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.handshake [*handshake]]]
- [Perform SSL handshaking. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.in_avail [*in_avail]]]
- [Determine the amount of data that may be read without blocking. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.null [*null]]]
- [Return a null stream implementation. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.peek [*peek]]]
- [Peek at the incoming data on the stream. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.read_some [*read_some]]]
- [Read some data from the stream. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.shutdown [*shutdown]]]
- [Shut down SSL on the stream. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
-
- [
- [[link boost_asio.reference.ssl__stream_service.stream_service [*stream_service]]]
- [Construct a new stream service for the specified io_service. ]
+ [[link boost_asio.reference.ssl__verify_context.native_handle [*native_handle]]]
+ [Get the underlying implementation in the native type. ]
   ]
   
   [
- [[link boost_asio.reference.ssl__stream_service.write_some [*write_some]]]
- [Write some data to the stream. ]
+ [[link boost_asio.reference.ssl__verify_context.verify_context [*verify_context]]]
+ [Constructor. ]
   ]
   
 ]
 
-[heading Data Members]
-[table
- [[Name][Description]]
 
- [
- [[link boost_asio.reference.ssl__stream_service.id [*id]]]
- [The unique service identifier. ]
- ]
+[heading Remarks]
+
+The [link boost_asio.reference.ssl__verify_context `ssl::verify_context`] does not own the underlying X509\_STORE\_CTX object.
+
 
-]
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ssl/stream_service.hpp]
+[*Header: ][^boost/asio/ssl/verify_context.hpp]
 
 [*Convenience header: ][^boost/asio/ssl.hpp]
 
 
-[section:async_handshake ssl::stream_service::async_handshake]
-
-[indexterm2 async_handshake..ssl::stream_service]
-Start an asynchronous SSL handshake.
-
-
- template<
- typename Stream,
- typename HandshakeHandler>
- void async_handshake(
- impl_type & impl,
- Stream & next_layer,
- stream_base::handshake_type type,
- HandshakeHandler handler);
-
-
-
-[endsect]
-
-
-
-[section:async_read_some ssl::stream_service::async_read_some]
-
-[indexterm2 async_read_some..ssl::stream_service]
-Start an asynchronous read.
-
-
- template<
- typename Stream,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
- typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
- void async_read_some(
- impl_type & impl,
- Stream & next_layer,
- const MutableBufferSequence & buffers,
- ReadHandler handler);
-
-
-
-[endsect]
-
-
-
-[section:async_shutdown ssl::stream_service::async_shutdown]
-
-[indexterm2 async_shutdown..ssl::stream_service]
-Asynchronously shut down SSL on the stream.
+[section:native_handle ssl::verify_context::native_handle]
 
+[indexterm2 native_handle..ssl::verify_context]
+Get the underlying implementation in the native type.
 
- template<
- typename Stream,
- typename ShutdownHandler>
- void async_shutdown(
- impl_type & impl,
- Stream & next_layer,
- ShutdownHandler handler);
-
-
-
-[endsect]
-
-
-
-[section:async_write_some ssl::stream_service::async_write_some]
-
-[indexterm2 async_write_some..ssl::stream_service]
-Start an asynchronous write.
-
-
- template<
- typename Stream,
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
- impl_type & impl,
- Stream & next_layer,
- const ConstBufferSequence & buffers,
- WriteHandler handler);
-
-
-
-[endsect]
-
-
-
-[section:create ssl::stream_service::create]
-
-[indexterm2 create..ssl::stream_service]
-Create a new stream implementation.
 
+ native_handle_type native_handle();
 
- template<
- typename Stream,
- typename Context_Service>
- void create(
- impl_type & impl,
- Stream & next_layer,
- basic_context< Context_Service > & context);
 
+This function may be used to obtain the underlying implementation of the context. This is intended to allow access to context functionality that is not otherwise provided.
 
 
 [endsect]
 
 
 
-[section:destroy ssl::stream_service::destroy]
-
-[indexterm2 destroy..ssl::stream_service]
-Destroy a stream implementation.
+[section:native_handle_type ssl::verify_context::native_handle_type]
 
-
- template<
- typename Stream>
- void destroy(
- impl_type & impl,
- Stream & next_layer);
-
-
-
-[endsect]
+[indexterm2 native_handle_type..ssl::verify_context]
+The native handle type of the verification context.
 
 
+ typedef X509_STORE_CTX * native_handle_type;
 
-[section:get_io_service ssl::stream_service::get_io_service]
 
 
-['Inherited from io_service.]
-
-[indexterm2 get_io_service..ssl::stream_service]
-Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
-
+[heading Requirements]
 
- boost::asio::io_service & get_io_service();
+[*Header: ][^boost/asio/ssl/verify_context.hpp]
 
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:handshake ssl::stream_service::handshake]
+[section:verify_context ssl::verify_context::verify_context]
 
-[indexterm2 handshake..ssl::stream_service]
-Perform SSL handshaking.
+[indexterm2 verify_context..ssl::verify_context]
+Constructor.
 
 
- template<
- typename Stream>
- boost::system::error_code handshake(
- impl_type & impl,
- Stream & next_layer,
- stream_base::handshake_type type,
- boost::system::error_code & ec);
+ verify_context(
+ native_handle_type handle);
 
 
 
@@ -65811,33 +84763,21 @@
 
 
 
-[section:id ssl::stream_service::id]
-
-[indexterm2 id..ssl::stream_service]
-The unique service identifier.
-
-
- static boost::asio::io_service::id id;
-
-
-
 [endsect]
 
 
+[section:ssl__verify_fail_if_no_peer_cert ssl::verify_fail_if_no_peer_cert]
 
-[section:impl_type ssl::stream_service::impl_type]
-
-[indexterm2 impl_type..ssl::stream_service]
-The type of a stream implementation.
+[indexterm1 ssl::verify_fail_if_no_peer_cert]
+Fail verification if the peer has no certificate. Ignored unless [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`] is set.
 
 
- typedef implementation_defined impl_type;
-
+ const int verify_fail_if_no_peer_cert = implementation_defined;
 
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/ssl/stream_service.hpp]
+[*Header: ][^boost/asio/ssl/verify_mode.hpp]
 
 [*Convenience header: ][^boost/asio/ssl.hpp]
 
@@ -65846,170 +84786,80 @@
 
 
 
-[section:in_avail ssl::stream_service::in_avail]
-
-[indexterm2 in_avail..ssl::stream_service]
-Determine the amount of data that may be read without blocking.
-
-
- template<
- typename Stream>
- std::size_t in_avail(
- impl_type & impl,
- Stream & next_layer,
- boost::system::error_code & ec);
-
-
-
-[endsect]
-
-
-
-[section:io_service ssl::stream_service::io_service]
-
-
-['Inherited from io_service.]
-
-[indexterm2 io_service..ssl::stream_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
-
-
- boost::asio::io_service & io_service();
-
-
-
-[endsect]
-
-
-
-[section:null ssl::stream_service::null]
-
-[indexterm2 null..ssl::stream_service]
-Return a null stream implementation.
-
-
- impl_type null() const;
-
-
-
-[endsect]
+[section:ssl__verify_mode ssl::verify_mode]
 
+[indexterm1 ssl::verify_mode]
+Bitmask type for peer verification.
 
 
-[section:peek ssl::stream_service::peek]
+ typedef int verify_mode;
 
-[indexterm2 peek..ssl::stream_service]
-Peek at the incoming data on the stream.
 
 
- template<
- typename Stream,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t peek(
- impl_type & impl,
- Stream & next_layer,
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
+Possible values are:
 
 
+* [link boost_asio.reference.ssl__verify_none `ssl::verify_none`]
 
-[endsect]
+* [link boost_asio.reference.ssl__verify_peer `ssl::verify_peer`]
 
+* [link boost_asio.reference.ssl__verify_fail_if_no_peer_cert `ssl::verify_fail_if_no_peer_cert`]
 
+* [link boost_asio.reference.ssl__verify_client_once `ssl::verify_client_once`]
 
-[section:read_some ssl::stream_service::read_some]
 
-[indexterm2 read_some..ssl::stream_service]
-Read some data from the stream.
 
+[heading Requirements]
 
- template<
- typename Stream,
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t read_some(
- impl_type & impl,
- Stream & next_layer,
- const MutableBufferSequence & buffers,
- boost::system::error_code & ec);
+[*Header: ][^boost/asio/ssl/verify_mode.hpp]
 
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:shutdown ssl::stream_service::shutdown]
-
-[indexterm2 shutdown..ssl::stream_service]
-Shut down SSL on the stream.
-
-
- template<
- typename Stream>
- boost::system::error_code shutdown(
- impl_type & impl,
- Stream & next_layer,
- boost::system::error_code & ec);
-
-
-
-[endsect]
+[section:ssl__verify_none ssl::verify_none]
 
+[indexterm1 ssl::verify_none]
+No verification.
 
 
-[section:shutdown_service ssl::stream_service::shutdown_service]
+ const int verify_none = implementation_defined;
 
-[indexterm2 shutdown_service..ssl::stream_service]
-Destroy all user-defined handler objects owned by the service.
 
+[heading Requirements]
 
- virtual void shutdown_service();
+[*Header: ][^boost/asio/ssl/verify_mode.hpp]
 
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[section:stream_service ssl::stream_service::stream_service]
-
-[indexterm2 stream_service..ssl::stream_service]
-Construct a new stream service for the specified [link boost_asio.reference.io_service `io_service`].
-
-
- stream_service(
- boost::asio::io_service & io_service);
-
-
-
-[endsect]
+[section:ssl__verify_peer ssl::verify_peer]
 
+[indexterm1 ssl::verify_peer]
+Verify the peer.
 
 
-[section:write_some ssl::stream_service::write_some]
+ const int verify_peer = implementation_defined;
 
-[indexterm2 write_some..ssl::stream_service]
-Write some data to the stream.
 
+[heading Requirements]
 
- template<
- typename Stream,
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
- std::size_t write_some(
- impl_type & impl,
- Stream & next_layer,
- const ConstBufferSequence & buffers,
- boost::system::error_code & ec);
+[*Header: ][^boost/asio/ssl/verify_mode.hpp]
 
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [endsect]
 
 
 
-[endsect]
-
-
 [section:strand strand]
 
 [indexterm1 strand]
@@ -66034,11 +84884,6 @@
   ]
   
   [
- [[link boost_asio.reference.io_service__strand.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the strand. ]
- ]
-
- [
     [[link boost_asio.reference.io_service__strand.post [*post]]]
     [Request the strand to invoke the given handler and return immediately. ]
   ]
@@ -66152,15 +84997,22 @@
 
   [
 
- [[link boost_asio.reference.stream_socket_service.implementation_type [*implementation_type]]]
- [The type of a stream socket implementation. ]
+ [[link boost_asio.reference.stream_socket_service.implementation_type [*implementation_type]]]
+ [The type of a stream socket implementation. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.stream_socket_service.native_handle_type [*native_handle_type]]]
+ [The native socket type. ]
   
   ]
 
   [
 
     [[link boost_asio.reference.stream_socket_service.native_type [*native_type]]]
- [The native socket type. ]
+ [(Deprecated: Use native_handle_type.) The native socket type. ]
   
   ]
 
@@ -66253,11 +85105,6 @@
   ]
   
   [
- [[link boost_asio.reference.stream_socket_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
- ]
-
- [
     [[link boost_asio.reference.stream_socket_service.is_open [*is_open]]]
     [Determine whether the socket is open. ]
   ]
@@ -66268,11 +85115,40 @@
   ]
   
   [
+ [[link boost_asio.reference.stream_socket_service.move_assign [*move_assign]]]
+ [Move-assign from another stream socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.stream_socket_service.move_construct [*move_construct]]]
+ [Move-construct a new stream socket implementation. ]
+ ]
+
+ [
     [[link boost_asio.reference.stream_socket_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.stream_socket_service.native_handle [*native_handle]]]
     [Get the native socket implementation. ]
   ]
   
   [
+ [[link boost_asio.reference.stream_socket_service.native_non_blocking [*native_non_blocking]]]
+ [Gets the non-blocking mode of the native socket implementation.
+
+ Sets the non-blocking mode of the native socket implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.stream_socket_service.non_blocking [*non_blocking]]]
+ [Gets the non-blocking mode of the socket.
+
+ Sets the non-blocking mode of the socket. ]
+ ]
+
+ [
     [[link boost_asio.reference.stream_socket_service.open [*open]]]
     [Open a stream socket. ]
   ]
@@ -66303,11 +85179,6 @@
   ]
   
   [
- [[link boost_asio.reference.stream_socket_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
-
- [
     [[link boost_asio.reference.stream_socket_service.stream_socket_service [*stream_socket_service]]]
     [Construct a new stream socket service for the specified io_service. ]
   ]
@@ -66341,7 +85212,7 @@
   boost::system::error_code assign(
       implementation_type & impl,
       const protocol_type & protocol,
- const native_type & native_socket,
+ const native_handle_type & native_socket,
       boost::system::error_code & ec);
 
 
@@ -66650,16 +85521,30 @@
 
 
 
-[section:io_service stream_socket_service::io_service]
+[section:is_open stream_socket_service::is_open]
 
+[indexterm2 is_open..stream_socket_service]
+Determine whether the socket is open.
+
+
+ bool is_open(
+ const implementation_type & impl) const;
+
+
+
+[endsect]
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..stream_socket_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
+[section:local_endpoint stream_socket_service::local_endpoint]
+
+[indexterm2 local_endpoint..stream_socket_service]
+Get the local endpoint.
 
- boost::asio::io_service & io_service();
+
+ endpoint_type local_endpoint(
+ const implementation_type & impl,
+ boost::system::error_code & ec) const;
 
 
 
@@ -66667,14 +85552,16 @@
 
 
 
-[section:is_open stream_socket_service::is_open]
+[section:move_assign stream_socket_service::move_assign]
 
-[indexterm2 is_open..stream_socket_service]
-Determine whether the socket is open.
+[indexterm2 move_assign..stream_socket_service]
+Move-assign from another stream socket implementation.
 
 
- bool is_open(
- const implementation_type & impl) const;
+ void move_assign(
+ implementation_type & impl,
+ stream_socket_service & other_service,
+ implementation_type & other_impl);
 
 
 
@@ -66682,15 +85569,15 @@
 
 
 
-[section:local_endpoint stream_socket_service::local_endpoint]
+[section:move_construct stream_socket_service::move_construct]
 
-[indexterm2 local_endpoint..stream_socket_service]
-Get the local endpoint.
+[indexterm2 move_construct..stream_socket_service]
+Move-construct a new stream socket implementation.
 
 
- endpoint_type local_endpoint(
- const implementation_type & impl,
- boost::system::error_code & ec) const;
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
 
 
 
@@ -66701,7 +85588,7 @@
 [section:native stream_socket_service::native]
 
 [indexterm2 native..stream_socket_service]
-Get the native socket implementation.
+(Deprecated: Use `native_handle()`.) Get the native socket implementation.
 
 
   native_type native(
@@ -66713,10 +85600,100 @@
 
 
 
+[section:native_handle stream_socket_service::native_handle]
+
+[indexterm2 native_handle..stream_socket_service]
+Get the native socket implementation.
+
+
+ native_handle_type native_handle(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:native_handle_type stream_socket_service::native_handle_type]
+
+[indexterm2 native_handle_type..stream_socket_service]
+The native socket type.
+
+
+ typedef implementation_defined native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/stream_socket_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+[section:native_non_blocking stream_socket_service::native_non_blocking]
+
+[indexterm2 native_non_blocking..stream_socket_service]
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool ``[link boost_asio.reference.stream_socket_service.native_non_blocking.overload1 native_non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.stream_socket_service.native_non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ boost::system::error_code ``[link boost_asio.reference.stream_socket_service.native_non_blocking.overload2 native_non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.stream_socket_service.native_non_blocking.overload2 more...]]``
+
+
+[section:overload1 stream_socket_service::native_non_blocking (1 of 2 overloads)]
+
+
+Gets the non-blocking mode of the native socket implementation.
+
+
+ bool native_non_blocking(
+ const implementation_type & impl) const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 stream_socket_service::native_non_blocking (2 of 2 overloads)]
+
+
+Sets the non-blocking mode of the native socket implementation.
+
+
+ boost::system::error_code native_non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
 [section:native_type stream_socket_service::native_type]
 
 [indexterm2 native_type..stream_socket_service]
-The native socket type.
+(Deprecated: Use native\_handle\_type.) The native socket type.
 
 
   typedef implementation_defined native_type;
@@ -66733,6 +85710,60 @@
 [endsect]
 
 
+[section:non_blocking stream_socket_service::non_blocking]
+
+[indexterm2 non_blocking..stream_socket_service]
+Gets the non-blocking mode of the socket.
+
+
+ bool ``[link boost_asio.reference.stream_socket_service.non_blocking.overload1 non_blocking]``(
+ const implementation_type & impl) const;
+ `` [''''&raquo;''' [link boost_asio.reference.stream_socket_service.non_blocking.overload1 more...]]``
+
+
+Sets the non-blocking mode of the socket.
+
+
+ boost::system::error_code ``[link boost_asio.reference.stream_socket_service.non_blocking.overload2 non_blocking]``(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.stream_socket_service.non_blocking.overload2 more...]]``
+
+
+[section:overload1 stream_socket_service::non_blocking (1 of 2 overloads)]
+
+
+Gets the non-blocking mode of the socket.
+
+
+ bool non_blocking(
+ const implementation_type & impl) const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 stream_socket_service::non_blocking (2 of 2 overloads)]
+
+
+Sets the non-blocking mode of the socket.
+
+
+ boost::system::error_code non_blocking(
+ implementation_type & impl,
+ bool mode,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:open stream_socket_service::open]
 
@@ -66864,20 +85895,6 @@
 
 
 
-[section:shutdown_service stream_socket_service::shutdown_service]
-
-[indexterm2 shutdown_service..stream_socket_service]
-Destroy all user-defined handler objects owned by the service.
-
-
- virtual void shutdown_service();
-
-
-
-[endsect]
-
-
-
 [section:stream_socket_service stream_socket_service::stream_socket_service]
 
 [indexterm2 stream_socket_service..stream_socket_service]
@@ -67339,6 +86356,53 @@
 
 
 
+[section:transfer_exactly transfer_exactly]
+
+[indexterm1 transfer_exactly]
+Return a completion condition function object that indicates that a read or write operation should continue until an exact number of bytes has been transferred, or until an error occurs.
+
+
+ unspecified transfer_exactly(
+ std::size_t size);
+
+
+This function is used to create an object, of unspecified type, that meets CompletionCondition requirements.
+
+
+[heading Example]
+
+Reading until a buffer is full or contains exactly 64 bytes:
+
+ boost::array<char, 128> buf;
+ boost::system::error_code ec;
+ std::size_t n = boost::asio::read(
+ sock, boost::asio::buffer(buf),
+ boost::asio::transfer_exactly(64), ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
+ else
+ {
+ // n == 64
+ }
+
+
+
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/completion_condition.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
 [section:use_service use_service]
 
 [indexterm1 use_service]
@@ -67410,13 +86474,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -67437,7 +86508,9 @@
     [[link boost_asio.reference.windows__basic_handle.basic_handle [*basic_handle]]]
     [Construct a basic_handle without opening it.
 
- Construct a basic_handle on an existing native handle. ]
+ Construct a basic_handle on an existing native handle.
+
+ Move-construct a basic_handle from another. ]
   ]
   
   [
@@ -67456,11 +86529,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -67474,9 +86542,19 @@
   
   [
     [[link boost_asio.reference.windows__basic_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
+ [
+ [[link boost_asio.reference.windows__basic_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_handle from another. ]
+ ]
+
 ]
 
 [heading Protected Member Functions]
@@ -67484,6 +86562,16 @@
   [[Name][Description]]
 
   [
+ [[link boost_asio.reference.windows__basic_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_handle._basic_handle [*~basic_handle]]]
     [Protected destructor to prevent deletion through this type. ]
   ]
@@ -67496,12 +86584,12 @@
 
   [
     [[link boost_asio.reference.windows__basic_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -67530,11 +86618,11 @@
 
 
   void ``[link boost_asio.reference.windows__basic_handle.assign.overload1 assign]``(
- const native_type & native_handle);
+ const native_handle_type & handle);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.assign.overload1 more...]]``
 
   boost::system::error_code ``[link boost_asio.reference.windows__basic_handle.assign.overload2 assign]``(
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.assign.overload2 more...]]``
 
@@ -67546,7 +86634,7 @@
 
 
   void assign(
- const native_type & native_handle);
+ const native_handle_type & handle);
 
 
 
@@ -67561,7 +86649,7 @@
 
 
   boost::system::error_code assign(
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
 
 
@@ -67587,11 +86675,19 @@
 
   ``[link boost_asio.reference.windows__basic_handle.basic_handle.overload2 basic_handle]``(
       boost::asio::io_service & io_service,
- const native_type & native_handle);
+ const native_handle_type & handle);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.basic_handle.overload2 more...]]``
 
 
-[section:overload1 windows::basic_handle::basic_handle (1 of 2 overloads)]
+Move-construct a [link boost_asio.reference.windows__basic_handle `windows::basic_handle`] from another.
+
+
+ ``[link boost_asio.reference.windows__basic_handle.basic_handle.overload3 basic_handle]``(
+ basic_handle && other);
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.basic_handle.overload3 more...]]``
+
+
+[section:overload1 windows::basic_handle::basic_handle (1 of 3 overloads)]
 
 
 Construct a [link boost_asio.reference.windows__basic_handle `windows::basic_handle`] without opening it.
@@ -67620,7 +86716,7 @@
 
 
 
-[section:overload2 windows::basic_handle::basic_handle (2 of 2 overloads)]
+[section:overload2 windows::basic_handle::basic_handle (2 of 3 overloads)]
 
 
 Construct a [link boost_asio.reference.windows__basic_handle `windows::basic_handle`] on an existing native handle.
@@ -67628,7 +86724,7 @@
 
   basic_handle(
       boost::asio::io_service & io_service,
- const native_type & native_handle);
+ const native_handle_type & handle);
 
 
 This constructor creates a handle object to hold an existing native handle.
@@ -67641,7 +86737,7 @@
   
 [[io_service][The [link boost_asio.reference.io_service `io_service`] object that the handle will use to dispatch handlers for any asynchronous operations performed on the handle.]]
 
-[[native_handle][A native handle.]]
+[[handle][A native handle.]]
 
 ]
 
@@ -67661,6 +86757,40 @@
 [endsect]
 
 
+
+[section:overload3 windows::basic_handle::basic_handle (3 of 3 overloads)]
+
+
+Move-construct a [link boost_asio.reference.windows__basic_handle `windows::basic_handle`] from another.
+
+
+ basic_handle(
+ basic_handle && other);
+
+
+This constructor moves a handle from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.windows__basic_handle `windows::basic_handle`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_handle(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
 [endsect]
 
 [section:cancel windows::basic_handle::cancel]
@@ -67807,6 +86937,54 @@
 
 [endsect]
 
+[section:get_implementation windows::basic_handle::get_implementation]
+
+[indexterm2 get_implementation..windows::basic_handle]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.windows__basic_handle.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.windows__basic_handle.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.get_implementation.overload2 more...]]``
+
+
+[section:overload1 windows::basic_handle::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 windows::basic_handle::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:get_io_service windows::basic_handle::get_io_service]
 
@@ -67833,17 +87011,29 @@
 [endsect]
 
 
+[section:get_service windows::basic_handle::get_service]
+
+[indexterm2 get_service..windows::basic_handle]
+Get the service associated with the I/O object.
 
-[section:implementation windows::basic_handle::implementation]
+
+ service_type & ``[link boost_asio.reference.windows__basic_handle.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.windows__basic_handle.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_handle.get_service.overload2 more...]]``
+
+
+[section:overload1 windows::basic_handle::get_service (1 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation..windows::basic_handle]
-The underlying implementation of the I/O object.
 
+Get the service associated with the I/O object.
 
- implementation_type implementation;
+
+ service_type & get_service();
 
 
 
@@ -67851,50 +87041,60 @@
 
 
 
-[section:implementation_type windows::basic_handle::implementation_type]
+[section:overload2 windows::basic_handle::get_service (2 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..windows::basic_handle]
-The underlying implementation type of I/O object.
 
+Get the service associated with the I/O object.
 
- typedef service_type::implementation_type implementation_type;
 
+ const service_type & get_service() const;
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/windows/basic_handle.hpp]
+[endsect]
+
+
+[endsect]
+
+
+[section:implementation windows::basic_handle::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..windows::basic_handle]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:io_service windows::basic_handle::io_service]
+[section:implementation_type windows::basic_handle::implementation_type]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 io_service..windows::basic_handle]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
+[indexterm2 implementation_type..windows::basic_handle]
+The underlying implementation type of I/O object.
 
- boost::asio::io_service & io_service();
 
+ typedef service_type::implementation_type implementation_type;
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Requirements]
 
+[*Header: ][^boost/asio/windows/basic_handle.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
@@ -68008,13 +87208,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -68035,7 +87242,9 @@
     [[link boost_asio.reference.windows__basic_handle.basic_handle [*basic_handle]]]
     [Construct a basic_handle without opening it.
 
- Construct a basic_handle on an existing native handle. ]
+ Construct a basic_handle on an existing native handle.
+
+ Move-construct a basic_handle from another. ]
   ]
   
   [
@@ -68054,11 +87263,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -68072,9 +87276,19 @@
   
   [
     [[link boost_asio.reference.windows__basic_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
+ [
+ [[link boost_asio.reference.windows__basic_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_handle from another. ]
+ ]
+
 ]
 
 [heading Protected Member Functions]
@@ -68082,6 +87296,16 @@
   [[Name][Description]]
 
   [
+ [[link boost_asio.reference.windows__basic_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_handle._basic_handle [*~basic_handle]]]
     [Protected destructor to prevent deletion through this type. ]
   ]
@@ -68094,12 +87318,12 @@
 
   [
     [[link boost_asio.reference.windows__basic_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -68130,7 +87354,7 @@
 [section:native windows::basic_handle::native]
 
 [indexterm2 native..windows::basic_handle]
-Get the native handle representation.
+(Deprecated: Use `native_handle()`.) Get the native handle representation.
 
 
   native_type native();
@@ -68143,13 +87367,50 @@
 
 
 
+[section:native_handle windows::basic_handle::native_handle]
+
+[indexterm2 native_handle..windows::basic_handle]
+Get the native handle representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type windows::basic_handle::native_handle_type]
+
+[indexterm2 native_handle_type..windows::basic_handle]
+The native representation of a handle.
+
+
+ typedef HandleService::native_handle_type native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/windows/basic_handle.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
 [section:native_type windows::basic_handle::native_type]
 
 [indexterm2 native_type..windows::basic_handle]
-The native representation of a handle.
+(Deprecated: Use native\_handle\_type.) The native representation of a handle.
 
 
- typedef HandleService::native_type native_type;
+ typedef HandleService::native_handle_type native_type;
 
 
 
@@ -68164,19 +87425,60 @@
 
 
 
+[section:operator_eq_ windows::basic_handle::operator=]
+
+[indexterm2 operator=..windows::basic_handle]
+Move-assign a [link boost_asio.reference.windows__basic_handle `windows::basic_handle`] from another.
+
+
+ basic_handle & operator=(
+ basic_handle && other);
+
+
+This assignment operator moves a handle from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.windows__basic_handle `windows::basic_handle`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_handle(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
+
 [section:service windows::basic_handle::service]
 
 
 ['Inherited from basic_io_object.]
 
 [indexterm2 service..windows::basic_handle]
-The service associated with the I/O object.
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
   service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
 [endsect]
 
 
@@ -68253,13 +87555,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_random_access_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_random_access_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_random_access_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -68290,7 +87599,9 @@
     [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
     [Construct a basic_random_access_handle without opening it.
 
- Construct a basic_random_access_handle on an existing native handle. ]
+ Construct a basic_random_access_handle on an existing native handle.
+
+ Move-construct a basic_random_access_handle from another. ]
   ]
   
   [
@@ -68309,11 +87620,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_random_access_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -68327,10 +87633,20 @@
   
   [
     [[link boost_asio.reference.windows__basic_random_access_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
   [
+ [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_random_access_handle from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
     [Read some data from the handle at the specified offset. ]
   ]
@@ -68342,18 +87658,34 @@
   
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.windows__basic_random_access_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_random_access_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
 [heading Protected Data Members]
 [table
   [[Name][Description]]
 
   [
     [[link boost_asio.reference.windows__basic_random_access_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_random_access_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -68382,11 +87714,11 @@
 
 
   void ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 assign]``(
- const native_type & native_handle);
+ const native_handle_type & handle);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload1 more...]]``
 
   boost::system::error_code ``[link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 assign]``(
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.assign.overload2 more...]]``
 
@@ -68401,7 +87733,7 @@
 
 
   void assign(
- const native_type & native_handle);
+ const native_handle_type & handle);
 
 
 
@@ -68419,7 +87751,7 @@
 
 
   boost::system::error_code assign(
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
 
 
@@ -68565,11 +87897,19 @@
 
   ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 basic_random_access_handle]``(
       boost::asio::io_service & io_service,
- const native_type & native_handle);
+ const native_handle_type & handle);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload2 more...]]``
 
 
-[section:overload1 windows::basic_random_access_handle::basic_random_access_handle (1 of 2 overloads)]
+Move-construct a [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] from another.
+
+
+ ``[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 basic_random_access_handle]``(
+ basic_random_access_handle && other);
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle.overload3 more...]]``
+
+
+[section:overload1 windows::basic_random_access_handle::basic_random_access_handle (1 of 3 overloads)]
 
 
 Construct a [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] without opening it.
@@ -68598,18 +87938,59 @@
 
 
 
-[section:overload2 windows::basic_random_access_handle::basic_random_access_handle (2 of 2 overloads)]
+[section:overload2 windows::basic_random_access_handle::basic_random_access_handle (2 of 3 overloads)]
 
 
 Construct a [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] on an existing native handle.
 
 
   basic_random_access_handle(
- boost::asio::io_service & io_service,
- const native_type & native_handle);
+ boost::asio::io_service & io_service,
+ const native_handle_type & handle);
+
+
+This constructor creates a random-access handle object to hold an existing native handle.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the random-access handle will use to dispatch handlers for any asynchronous operations performed on the handle.]]
+
+[[handle][The new underlying handle implementation.]]
+
+]
+
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 windows::basic_random_access_handle::basic_random_access_handle (3 of 3 overloads)]
+
+
+Move-construct a [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] from another.
+
+
+ basic_random_access_handle(
+ basic_random_access_handle && other);
 
 
-This constructor creates a random-access handle object to hold an existing native handle.
+This constructor moves a random-access handle from one object to another.
 
 
 [heading Parameters]
@@ -68617,21 +87998,14 @@
 
 [variablelist
   
-[[io_service][The [link boost_asio.reference.io_service `io_service`] object that the random-access handle will use to dispatch handlers for any asynchronous operations performed on the handle.]]
-
-[[native_handle][The new underlying handle implementation.]]
+[[other][The other [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] object from which the move will occur.]]
 
 ]
 
 
-[heading Exceptions]
-
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
-
-]
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(io_service&)` constructor.
 
 
 
@@ -68797,6 +88171,54 @@
 
 [endsect]
 
+[section:get_implementation windows::basic_random_access_handle::get_implementation]
+
+[indexterm2 get_implementation..windows::basic_random_access_handle]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.windows__basic_random_access_handle.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.windows__basic_random_access_handle.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.get_implementation.overload2 more...]]``
+
+
+[section:overload1 windows::basic_random_access_handle::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 windows::basic_random_access_handle::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:get_io_service windows::basic_random_access_handle::get_io_service]
 
@@ -68823,17 +88245,29 @@
 [endsect]
 
 
+[section:get_service windows::basic_random_access_handle::get_service]
 
-[section:implementation windows::basic_random_access_handle::implementation]
+[indexterm2 get_service..windows::basic_random_access_handle]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.windows__basic_random_access_handle.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.windows__basic_random_access_handle.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_random_access_handle.get_service.overload2 more...]]``
+
+
+[section:overload1 windows::basic_random_access_handle::get_service (1 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation..windows::basic_random_access_handle]
-The underlying implementation of the I/O object.
 
+Get the service associated with the I/O object.
 
- implementation_type implementation;
+
+ service_type & get_service();
 
 
 
@@ -68841,50 +88275,60 @@
 
 
 
-[section:implementation_type windows::basic_random_access_handle::implementation_type]
+[section:overload2 windows::basic_random_access_handle::get_service (2 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..windows::basic_random_access_handle]
-The underlying implementation type of I/O object.
 
+Get the service associated with the I/O object.
 
- typedef service_type::implementation_type implementation_type;
 
+ const service_type & get_service() const;
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
+[endsect]
+
+
+[endsect]
+
+
+[section:implementation windows::basic_random_access_handle::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..windows::basic_random_access_handle]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:io_service windows::basic_random_access_handle::io_service]
+[section:implementation_type windows::basic_random_access_handle::implementation_type]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 io_service..windows::basic_random_access_handle]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
+[indexterm2 implementation_type..windows::basic_random_access_handle]
+The underlying implementation type of I/O object.
 
- boost::asio::io_service & io_service();
 
+ typedef service_type::implementation_type implementation_type;
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Requirements]
 
+[*Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
@@ -69010,13 +88454,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -69037,7 +88488,9 @@
     [[link boost_asio.reference.windows__basic_handle.basic_handle [*basic_handle]]]
     [Construct a basic_handle without opening it.
 
- Construct a basic_handle on an existing native handle. ]
+ Construct a basic_handle on an existing native handle.
+
+ Move-construct a basic_handle from another. ]
   ]
   
   [
@@ -69056,11 +88509,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -69074,9 +88522,19 @@
   
   [
     [[link boost_asio.reference.windows__basic_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
+ [
+ [[link boost_asio.reference.windows__basic_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_handle from another. ]
+ ]
+
 ]
 
 [heading Protected Member Functions]
@@ -69084,6 +88542,16 @@
   [[Name][Description]]
 
   [
+ [[link boost_asio.reference.windows__basic_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_handle._basic_handle [*~basic_handle]]]
     [Protected destructor to prevent deletion through this type. ]
   ]
@@ -69096,12 +88564,12 @@
 
   [
     [[link boost_asio.reference.windows__basic_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -69135,7 +88603,7 @@
 ['Inherited from windows::basic_handle.]
 
 [indexterm2 native..windows::basic_random_access_handle]
-Get the native handle representation.
+(Deprecated: Use `native_handle()`.) Get the native handle representation.
 
 
   native_type native();
@@ -69148,13 +88616,53 @@
 
 
 
+[section:native_handle windows::basic_random_access_handle::native_handle]
+
+
+['Inherited from windows::basic_handle.]
+
+[indexterm2 native_handle..windows::basic_random_access_handle]
+Get the native handle representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type windows::basic_random_access_handle::native_handle_type]
+
+[indexterm2 native_handle_type..windows::basic_random_access_handle]
+The native representation of a handle.
+
+
+ typedef RandomAccessHandleService::native_handle_type native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/windows/basic_random_access_handle.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
 [section:native_type windows::basic_random_access_handle::native_type]
 
 [indexterm2 native_type..windows::basic_random_access_handle]
-The native representation of a handle.
+(Deprecated: Use native\_handle\_type.) The native representation of a handle.
 
 
- typedef RandomAccessHandleService::native_type native_type;
+ typedef RandomAccessHandleService::native_handle_type native_type;
 
 
 
@@ -69168,6 +88676,40 @@
 [endsect]
 
 
+
+[section:operator_eq_ windows::basic_random_access_handle::operator=]
+
+[indexterm2 operator=..windows::basic_random_access_handle]
+Move-assign a [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] from another.
+
+
+ basic_random_access_handle & operator=(
+ basic_random_access_handle && other);
+
+
+This assignment operator moves a random-access handle from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.windows__basic_random_access_handle `windows::basic_random_access_handle`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_random_access_handle(io_service&)` constructor.
+
+
+
+
+[endsect]
+
+
 [section:read_some_at windows::basic_random_access_handle::read_some_at]
 
 [indexterm2 read_some_at..windows::basic_random_access_handle]
@@ -69309,13 +88851,20 @@
 ['Inherited from basic_io_object.]
 
 [indexterm2 service..windows::basic_random_access_handle]
-The service associated with the I/O object.
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
   service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
 [endsect]
 
 
@@ -69512,13 +89061,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_stream_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_stream_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_stream_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -69549,7 +89105,9 @@
     [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
     [Construct a basic_stream_handle without opening it.
 
- Construct a basic_stream_handle on an existing native handle. ]
+ Construct a basic_stream_handle on an existing native handle.
+
+ Move-construct a basic_stream_handle from another. ]
   ]
   
   [
@@ -69568,11 +89126,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_stream_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -69586,10 +89139,20 @@
   
   [
     [[link boost_asio.reference.windows__basic_stream_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
   [
+ [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_stream_handle from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
     [Read some data from the handle. ]
   ]
@@ -69601,18 +89164,34 @@
   
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.windows__basic_stream_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_stream_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
 [heading Protected Data Members]
 [table
   [[Name][Description]]
 
   [
     [[link boost_asio.reference.windows__basic_stream_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_stream_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -69642,11 +89221,11 @@
 
 
   void ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload1 assign]``(
- const native_type & native_handle);
+ const native_handle_type & handle);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload1 more...]]``
 
   boost::system::error_code ``[link boost_asio.reference.windows__basic_stream_handle.assign.overload2 assign]``(
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.assign.overload2 more...]]``
 
@@ -69661,7 +89240,7 @@
 
 
   void assign(
- const native_type & native_handle);
+ const native_handle_type & handle);
 
 
 
@@ -69679,7 +89258,7 @@
 
 
   boost::system::error_code assign(
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
 
 
@@ -69819,11 +89398,19 @@
 
   ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 basic_stream_handle]``(
       boost::asio::io_service & io_service,
- const native_type & native_handle);
+ const native_handle_type & handle);
   `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload2 more...]]``
 
 
-[section:overload1 windows::basic_stream_handle::basic_stream_handle (1 of 2 overloads)]
+Move-construct a [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] from another.
+
+
+ ``[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 basic_stream_handle]``(
+ basic_stream_handle && other);
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle.overload3 more...]]``
+
+
+[section:overload1 windows::basic_stream_handle::basic_stream_handle (1 of 3 overloads)]
 
 
 Construct a [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] without opening it.
@@ -69852,7 +89439,7 @@
 
 
 
-[section:overload2 windows::basic_stream_handle::basic_stream_handle (2 of 2 overloads)]
+[section:overload2 windows::basic_stream_handle::basic_stream_handle (2 of 3 overloads)]
 
 
 Construct a [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] on an existing native handle.
@@ -69860,7 +89447,7 @@
 
   basic_stream_handle(
       boost::asio::io_service & io_service,
- const native_type & native_handle);
+ const native_handle_type & handle);
 
 
 This constructor creates a stream handle object to hold an existing native handle.
@@ -69873,7 +89460,7 @@
   
 [[io_service][The [link boost_asio.reference.io_service `io_service`] object that the stream handle will use to dispatch handlers for any asynchronous operations performed on the handle.]]
 
-[[native_handle][The new underlying handle implementation.]]
+[[handle][The new underlying handle implementation.]]
 
 ]
 
@@ -69893,6 +89480,40 @@
 [endsect]
 
 
+
+[section:overload3 windows::basic_stream_handle::basic_stream_handle (3 of 3 overloads)]
+
+
+Move-construct a [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] from another.
+
+
+ basic_stream_handle(
+ basic_stream_handle && other);
+
+
+This constructor moves a stream handle from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
 [endsect]
 
 [section:cancel windows::basic_stream_handle::cancel]
@@ -70051,6 +89672,54 @@
 
 [endsect]
 
+[section:get_implementation windows::basic_stream_handle::get_implementation]
+
+[indexterm2 get_implementation..windows::basic_stream_handle]
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & ``[link boost_asio.reference.windows__basic_stream_handle.get_implementation.overload1 get_implementation]``();
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.get_implementation.overload1 more...]]``
+
+ const implementation_type & ``[link boost_asio.reference.windows__basic_stream_handle.get_implementation.overload2 get_implementation]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.get_implementation.overload2 more...]]``
+
+
+[section:overload1 windows::basic_stream_handle::get_implementation (1 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ implementation_type & get_implementation();
+
+
+
+[endsect]
+
+
+
+[section:overload2 windows::basic_stream_handle::get_implementation (2 of 2 overloads)]
+
+
+['Inherited from basic_io_object.]
+
+
+Get the underlying implementation of the I/O object.
+
+
+ const implementation_type & get_implementation() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
 
 [section:get_io_service windows::basic_stream_handle::get_io_service]
 
@@ -70077,17 +89746,29 @@
 [endsect]
 
 
+[section:get_service windows::basic_stream_handle::get_service]
 
-[section:implementation windows::basic_stream_handle::implementation]
+[indexterm2 get_service..windows::basic_stream_handle]
+Get the service associated with the I/O object.
+
+
+ service_type & ``[link boost_asio.reference.windows__basic_stream_handle.get_service.overload1 get_service]``();
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.get_service.overload1 more...]]``
+
+ const service_type & ``[link boost_asio.reference.windows__basic_stream_handle.get_service.overload2 get_service]``() const;
+ `` [''''&raquo;''' [link boost_asio.reference.windows__basic_stream_handle.get_service.overload2 more...]]``
+
+
+[section:overload1 windows::basic_stream_handle::get_service (1 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation..windows::basic_stream_handle]
-The underlying implementation of the I/O object.
 
+Get the service associated with the I/O object.
 
- implementation_type implementation;
+
+ service_type & get_service();
 
 
 
@@ -70095,50 +89776,60 @@
 
 
 
-[section:implementation_type windows::basic_stream_handle::implementation_type]
+[section:overload2 windows::basic_stream_handle::get_service (2 of 2 overloads)]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 implementation_type..windows::basic_stream_handle]
-The underlying implementation type of I/O object.
 
+Get the service associated with the I/O object.
 
- typedef service_type::implementation_type implementation_type;
 
+ const service_type & get_service() const;
 
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/windows/basic_stream_handle.hpp]
+[endsect]
+
+
+[endsect]
+
+
+[section:implementation windows::basic_stream_handle::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..windows::basic_stream_handle]
+(Deprecated: Use `get_implementation()`.) The underlying implementation of the I/O object.
+
+
+ implementation_type implementation;
 
-[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
 
 
 
-[section:io_service windows::basic_stream_handle::io_service]
+[section:implementation_type windows::basic_stream_handle::implementation_type]
 
 
 ['Inherited from basic_io_object.]
 
-[indexterm2 io_service..windows::basic_stream_handle]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] associated with the object.
-
+[indexterm2 implementation_type..windows::basic_stream_handle]
+The underlying implementation type of I/O object.
 
- boost::asio::io_service & io_service();
 
+ typedef service_type::implementation_type implementation_type;
 
-This function may be used to obtain the [link boost_asio.reference.io_service `io_service`] object that the I/O object uses to dispatch handlers for asynchronous operations.
 
 
-[heading Return Value]
-
-A reference to the [link boost_asio.reference.io_service `io_service`] object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[heading Requirements]
 
+[*Header: ][^boost/asio/windows/basic_stream_handle.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
@@ -70264,13 +89955,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -70291,7 +89989,9 @@
     [[link boost_asio.reference.windows__basic_handle.basic_handle [*basic_handle]]]
     [Construct a basic_handle without opening it.
 
- Construct a basic_handle on an existing native handle. ]
+ Construct a basic_handle on an existing native handle.
+
+ Move-construct a basic_handle from another. ]
   ]
   
   [
@@ -70310,11 +90010,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -70328,9 +90023,19 @@
   
   [
     [[link boost_asio.reference.windows__basic_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
+ [
+ [[link boost_asio.reference.windows__basic_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_handle from another. ]
+ ]
+
 ]
 
 [heading Protected Member Functions]
@@ -70338,6 +90043,16 @@
   [[Name][Description]]
 
   [
+ [[link boost_asio.reference.windows__basic_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_handle._basic_handle [*~basic_handle]]]
     [Protected destructor to prevent deletion through this type. ]
   ]
@@ -70350,12 +90065,12 @@
 
   [
     [[link boost_asio.reference.windows__basic_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -70389,7 +90104,7 @@
 ['Inherited from windows::basic_handle.]
 
 [indexterm2 native..windows::basic_stream_handle]
-Get the native handle representation.
+(Deprecated: Use `native_handle()`.) Get the native handle representation.
 
 
   native_type native();
@@ -70402,13 +90117,53 @@
 
 
 
+[section:native_handle windows::basic_stream_handle::native_handle]
+
+
+['Inherited from windows::basic_handle.]
+
+[indexterm2 native_handle..windows::basic_stream_handle]
+Get the native handle representation.
+
+
+ native_handle_type native_handle();
+
+
+This function may be used to obtain the underlying representation of the handle. This is intended to allow access to native handle functionality that is not otherwise provided.
+
+
+[endsect]
+
+
+
+[section:native_handle_type windows::basic_stream_handle::native_handle_type]
+
+[indexterm2 native_handle_type..windows::basic_stream_handle]
+The native representation of a handle.
+
+
+ typedef StreamHandleService::native_handle_type native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/windows/basic_stream_handle.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
 [section:native_type windows::basic_stream_handle::native_type]
 
 [indexterm2 native_type..windows::basic_stream_handle]
-The native representation of a handle.
+(Deprecated: Use native\_handle\_type.) The native representation of a handle.
 
 
- typedef StreamHandleService::native_type native_type;
+ typedef StreamHandleService::native_handle_type native_type;
 
 
 
@@ -70422,6 +90177,40 @@
 [endsect]
 
 
+
+[section:operator_eq_ windows::basic_stream_handle::operator=]
+
+[indexterm2 operator=..windows::basic_stream_handle]
+Move-assign a [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] from another.
+
+
+ basic_stream_handle & operator=(
+ basic_stream_handle && other);
+
+
+This assignment operator moves a stream handle from one object to another.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[other][The other [link boost_asio.reference.windows__basic_stream_handle `windows::basic_stream_handle`] object from which the move will occur.]]
+
+]
+
+
+[heading Remarks]
+
+Following the move, the moved-from object is in the same state as if constructed using the `basic_stream_handle(io_service&) constructor`.
+
+
+
+
+[endsect]
+
+
 [section:read_some windows::basic_stream_handle::read_some]
 
 [indexterm2 read_some..windows::basic_stream_handle]
@@ -70555,13 +90344,20 @@
 ['Inherited from basic_io_object.]
 
 [indexterm2 service..windows::basic_stream_handle]
-The service associated with the I/O object.
+(Deprecated: Use `get_service()`.) The service associated with the I/O object.
 
 
   service_type & service;
 
 
 
+[heading Remarks]
+
+Available only for services that do not support movability.
+
+
+
+
 [endsect]
 
 
@@ -71012,13 +90808,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_random_access_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_random_access_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_random_access_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_random_access_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -71049,7 +90852,9 @@
     [[link boost_asio.reference.windows__basic_random_access_handle.basic_random_access_handle [*basic_random_access_handle]]]
     [Construct a basic_random_access_handle without opening it.
 
- Construct a basic_random_access_handle on an existing native handle. ]
+ Construct a basic_random_access_handle on an existing native handle.
+
+ Move-construct a basic_random_access_handle from another. ]
   ]
   
   [
@@ -71068,11 +90873,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_random_access_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_random_access_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -71086,10 +90886,20 @@
   
   [
     [[link boost_asio.reference.windows__basic_random_access_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_random_access_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
   [
+ [[link boost_asio.reference.windows__basic_random_access_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_random_access_handle from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_random_access_handle.read_some_at [*read_some_at]]]
     [Read some data from the handle at the specified offset. ]
   ]
@@ -71101,18 +90911,34 @@
   
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.windows__basic_random_access_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_random_access_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
 [heading Protected Data Members]
 [table
   [[Name][Description]]
 
   [
     [[link boost_asio.reference.windows__basic_random_access_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_random_access_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -71162,11 +90988,18 @@
 
   [
 
- [[link boost_asio.reference.windows__random_access_handle_service.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__random_access_handle_service.native_handle_type [*native_handle_type]]]
     [The native handle type. ]
   
   ]
 
+ [
+
+ [[link boost_asio.reference.windows__random_access_handle_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native handle type. ]
+
+ ]
+
 ]
 
 [heading Member Functions]
@@ -71214,17 +91047,27 @@
   ]
   
   [
- [[link boost_asio.reference.windows__random_access_handle_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
+ [[link boost_asio.reference.windows__random_access_handle_service.is_open [*is_open]]]
+ [Determine whether the handle is open. ]
   ]
   
   [
- [[link boost_asio.reference.windows__random_access_handle_service.is_open [*is_open]]]
- [Determine whether the handle is open. ]
+ [[link boost_asio.reference.windows__random_access_handle_service.move_assign [*move_assign]]]
+ [Move-assign from another random-access handle implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__random_access_handle_service.move_construct [*move_construct]]]
+ [Move-construct a new random-access handle implementation. ]
   ]
   
   [
     [[link boost_asio.reference.windows__random_access_handle_service.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__random_access_handle_service.native_handle [*native_handle]]]
     [Get the native handle implementation. ]
   ]
   
@@ -71239,11 +91082,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__random_access_handle_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
- ]
-
- [
     [[link boost_asio.reference.windows__random_access_handle_service.write_some_at [*write_some_at]]]
     [Write the given data at the specified offset. ]
   ]
@@ -71276,7 +91114,7 @@
 
   boost::system::error_code assign(
       implementation_type & impl,
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
 
 
@@ -71398,7 +91236,57 @@
 Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
 
- boost::asio::io_service & get_io_service();
+ boost::asio::io_service & get_io_service();
+
+
+
+[endsect]
+
+
+
+[section:id windows::random_access_handle_service::id]
+
+[indexterm2 id..windows::random_access_handle_service]
+The unique service identifier.
+
+
+ static boost::asio::io_service::id id;
+
+
+
+[endsect]
+
+
+
+[section:implementation_type windows::random_access_handle_service::implementation_type]
+
+[indexterm2 implementation_type..windows::random_access_handle_service]
+The type of a random-access handle implementation.
+
+
+ typedef implementation_defined implementation_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/windows/random_access_handle_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
+[section:is_open windows::random_access_handle_service::is_open]
+
+[indexterm2 is_open..windows::random_access_handle_service]
+Determine whether the handle is open.
+
+
+ bool is_open(
+ const implementation_type & impl) const;
 
 
 
@@ -71406,13 +91294,16 @@
 
 
 
-[section:id windows::random_access_handle_service::id]
+[section:move_assign windows::random_access_handle_service::move_assign]
 
-[indexterm2 id..windows::random_access_handle_service]
-The unique service identifier.
+[indexterm2 move_assign..windows::random_access_handle_service]
+Move-assign from another random-access handle implementation.
 
 
- static boost::asio::io_service::id id;
+ void move_assign(
+ implementation_type & impl,
+ random_access_handle_service & other_service,
+ implementation_type & other_impl);
 
 
 
@@ -71420,68 +91311,67 @@
 
 
 
-[section:implementation_type windows::random_access_handle_service::implementation_type]
-
-[indexterm2 implementation_type..windows::random_access_handle_service]
-The type of a random-access handle implementation.
+[section:move_construct windows::random_access_handle_service::move_construct]
 
-
- typedef implementation_defined implementation_type;
+[indexterm2 move_construct..windows::random_access_handle_service]
+Move-construct a new random-access handle implementation.
 
 
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
 
-[heading Requirements]
 
-[*Header: ][^boost/asio/windows/random_access_handle_service.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[endsect]
 
 
-[endsect]
 
+[section:native windows::random_access_handle_service::native]
 
+[indexterm2 native..windows::random_access_handle_service]
+(Deprecated: Use `native_handle()`.) Get the native handle implementation.
 
-[section:io_service windows::random_access_handle_service::io_service]
 
+ native_type native(
+ implementation_type & impl);
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..windows::random_access_handle_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
 
+[endsect]
 
- boost::asio::io_service & io_service();
 
 
+[section:native_handle windows::random_access_handle_service::native_handle]
 
-[endsect]
+[indexterm2 native_handle..windows::random_access_handle_service]
+Get the native handle implementation.
 
 
+ native_handle_type native_handle(
+ implementation_type & impl);
 
-[section:is_open windows::random_access_handle_service::is_open]
 
-[indexterm2 is_open..windows::random_access_handle_service]
-Determine whether the handle is open.
 
+[endsect]
 
- bool is_open(
- const implementation_type & impl) const;
 
 
+[section:native_handle_type windows::random_access_handle_service::native_handle_type]
 
-[endsect]
+[indexterm2 native_handle_type..windows::random_access_handle_service]
+The native handle type.
 
 
+ typedef implementation_defined native_handle_type;
 
-[section:native windows::random_access_handle_service::native]
 
-[indexterm2 native..windows::random_access_handle_service]
-Get the native handle implementation.
 
+[heading Requirements]
 
- native_type native(
- implementation_type & impl);
+[*Header: ][^boost/asio/windows/random_access_handle_service.hpp]
 
+[*Convenience header: ][^boost/asio.hpp]
 
 
 [endsect]
@@ -71491,7 +91381,7 @@
 [section:native_type windows::random_access_handle_service::native_type]
 
 [indexterm2 native_type..windows::random_access_handle_service]
-The native handle type.
+(Deprecated: Use native\_handle\_type.) The native handle type.
 
 
   typedef implementation_defined native_type;
@@ -71544,20 +91434,6 @@
 
 
 
-[section:shutdown_service windows::random_access_handle_service::shutdown_service]
-
-[indexterm2 shutdown_service..windows::random_access_handle_service]
-Destroy all user-defined handler objects owned by the service.
-
-
- virtual void shutdown_service();
-
-
-
-[endsect]
-
-
-
 [section:write_some_at windows::random_access_handle_service::write_some_at]
 
 [indexterm2 write_some_at..windows::random_access_handle_service]
@@ -71610,13 +91486,20 @@
 
   [
 
- [[link boost_asio.reference.windows__basic_stream_handle.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__basic_stream_handle.native_handle_type [*native_handle_type]]]
     [The native representation of a handle. ]
   
   ]
 
   [
 
+ [[link boost_asio.reference.windows__basic_stream_handle.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native representation of a handle. ]
+
+ ]
+
+ [
+
     [[link boost_asio.reference.windows__basic_stream_handle.service_type [*service_type]]]
     [The type of the service that will be used to provide I/O operations. ]
   
@@ -71647,7 +91530,9 @@
     [[link boost_asio.reference.windows__basic_stream_handle.basic_stream_handle [*basic_stream_handle]]]
     [Construct a basic_stream_handle without opening it.
 
- Construct a basic_stream_handle on an existing native handle. ]
+ Construct a basic_stream_handle on an existing native handle.
+
+ Move-construct a basic_stream_handle from another. ]
   ]
   
   [
@@ -71666,11 +91551,6 @@
   ]
   
   [
- [[link boost_asio.reference.windows__basic_stream_handle.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
- ]
-
- [
     [[link boost_asio.reference.windows__basic_stream_handle.is_open [*is_open]]]
     [Determine whether the handle is open. ]
   ]
@@ -71684,10 +91564,20 @@
   
   [
     [[link boost_asio.reference.windows__basic_stream_handle.native [*native]]]
+ [(Deprecated: Use native_handle().) Get the native handle representation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_stream_handle.native_handle [*native_handle]]]
     [Get the native handle representation. ]
   ]
   
   [
+ [[link boost_asio.reference.windows__basic_stream_handle.operator_eq_ [*operator=]]]
+ [Move-assign a basic_stream_handle from another. ]
+ ]
+
+ [
     [[link boost_asio.reference.windows__basic_stream_handle.read_some [*read_some]]]
     [Read some data from the handle. ]
   ]
@@ -71699,18 +91589,34 @@
   
 ]
 
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.windows__basic_stream_handle.get_implementation [*get_implementation]]]
+ [Get the underlying implementation of the I/O object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__basic_stream_handle.get_service [*get_service]]]
+ [Get the service associated with the I/O object. ]
+ ]
+
+]
+
 [heading Protected Data Members]
 [table
   [[Name][Description]]
 
   [
     [[link boost_asio.reference.windows__basic_stream_handle.implementation [*implementation]]]
- [The underlying implementation of the I/O object. ]
+ [(Deprecated: Use get_implementation().) The underlying implementation of the I/O object. ]
   ]
 
   [
     [[link boost_asio.reference.windows__basic_stream_handle.service [*service]]]
- [The service associated with the I/O object. ]
+ [(Deprecated: Use get_service().) The service associated with the I/O object. ]
   ]
 
 ]
@@ -71761,11 +91667,18 @@
 
   [
 
- [[link boost_asio.reference.windows__stream_handle_service.native_type [*native_type]]]
+ [[link boost_asio.reference.windows__stream_handle_service.native_handle_type [*native_handle_type]]]
     [The native handle type. ]
   
   ]
 
+ [
+
+ [[link boost_asio.reference.windows__stream_handle_service.native_type [*native_type]]]
+ [(Deprecated: Use native_handle_type.) The native handle type. ]
+
+ ]
+
 ]
 
 [heading Member Functions]
@@ -71813,28 +91726,33 @@
   ]
   
   [
- [[link boost_asio.reference.windows__stream_handle_service.io_service [*io_service]]]
- [(Deprecated: use get_io_service().) Get the io_service object that owns the service. ]
+ [[link boost_asio.reference.windows__stream_handle_service.is_open [*is_open]]]
+ [Determine whether the handle is open. ]
   ]
   
   [
- [[link boost_asio.reference.windows__stream_handle_service.is_open [*is_open]]]
- [Determine whether the handle is open. ]
+ [[link boost_asio.reference.windows__stream_handle_service.move_assign [*move_assign]]]
+ [Move-assign from another stream handle implementation. ]
+ ]
+
+ [
+ [[link boost_asio.reference.windows__stream_handle_service.move_construct [*move_construct]]]
+ [Move-construct a new stream handle implementation. ]
   ]
   
   [
     [[link boost_asio.reference.windows__stream_handle_service.native [*native]]]
- [Get the native handle implementation. ]
+ [(Deprecated: Use native_handle().) Get the native handle implementation. ]
   ]
   
   [
- [[link boost_asio.reference.windows__stream_handle_service.read_some [*read_some]]]
- [Read some data from the stream. ]
+ [[link boost_asio.reference.windows__stream_handle_service.native_handle [*native_handle]]]
+ [Get the native handle implementation. ]
   ]
   
   [
- [[link boost_asio.reference.windows__stream_handle_service.shutdown_service [*shutdown_service]]]
- [Destroy all user-defined handler objects owned by the service. ]
+ [[link boost_asio.reference.windows__stream_handle_service.read_some [*read_some]]]
+ [Read some data from the stream. ]
   ]
   
   [
@@ -71875,7 +91793,7 @@
 
   boost::system::error_code assign(
       implementation_type & impl,
- const native_type & native_handle,
+ const native_handle_type & handle,
       boost::system::error_code & ec);
 
 
@@ -72038,16 +91956,31 @@
 
 
 
-[section:io_service windows::stream_handle_service::io_service]
+[section:is_open windows::stream_handle_service::is_open]
+
+[indexterm2 is_open..windows::stream_handle_service]
+Determine whether the handle is open.
+
+
+ bool is_open(
+ const implementation_type & impl) const;
+
+
+
+[endsect]
 
 
-['Inherited from io_service.]
 
-[indexterm2 io_service..windows::stream_handle_service]
-(Deprecated: use `get_io_service()`.) Get the [link boost_asio.reference.io_service `io_service`] object that owns the service.
+[section:move_assign windows::stream_handle_service::move_assign]
 
+[indexterm2 move_assign..windows::stream_handle_service]
+Move-assign from another stream handle implementation.
 
- boost::asio::io_service & io_service();
+
+ void move_assign(
+ implementation_type & impl,
+ stream_handle_service & other_service,
+ implementation_type & other_impl);
 
 
 
@@ -72055,14 +91988,15 @@
 
 
 
-[section:is_open windows::stream_handle_service::is_open]
+[section:move_construct windows::stream_handle_service::move_construct]
 
-[indexterm2 is_open..windows::stream_handle_service]
-Determine whether the handle is open.
+[indexterm2 move_construct..windows::stream_handle_service]
+Move-construct a new stream handle implementation.
 
 
- bool is_open(
- const implementation_type & impl) const;
+ void move_construct(
+ implementation_type & impl,
+ implementation_type & other_impl);
 
 
 
@@ -72073,7 +92007,7 @@
 [section:native windows::stream_handle_service::native]
 
 [indexterm2 native..windows::stream_handle_service]
-Get the native handle implementation.
+(Deprecated: Use `native_handle()`.) Get the native handle implementation.
 
 
   native_type native(
@@ -72085,10 +92019,46 @@
 
 
 
+[section:native_handle windows::stream_handle_service::native_handle]
+
+[indexterm2 native_handle..windows::stream_handle_service]
+Get the native handle implementation.
+
+
+ native_handle_type native_handle(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:native_handle_type windows::stream_handle_service::native_handle_type]
+
+[indexterm2 native_handle_type..windows::stream_handle_service]
+The native handle type.
+
+
+ typedef implementation_defined native_handle_type;
+
+
+
+[heading Requirements]
+
+[*Header: ][^boost/asio/windows/stream_handle_service.hpp]
+
+[*Convenience header: ][^boost/asio.hpp]
+
+
+[endsect]
+
+
+
 [section:native_type windows::stream_handle_service::native_type]
 
 [indexterm2 native_type..windows::stream_handle_service]
-The native handle type.
+(Deprecated: Use native\_handle\_type.) The native handle type.
 
 
   typedef implementation_defined native_type;
@@ -72125,20 +92095,6 @@
 
 
 
-[section:shutdown_service windows::stream_handle_service::shutdown_service]
-
-[indexterm2 shutdown_service..windows::stream_handle_service]
-Destroy all user-defined handler objects owned by the service.
-
-
- virtual void shutdown_service();
-
-
-
-[endsect]
-
-
-
 [section:stream_handle_service windows::stream_handle_service::stream_handle_service]
 
 [indexterm2 stream_handle_service..windows::stream_handle_service]
@@ -72191,12 +92147,11 @@
 
   template<
       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename CompletionCondition>
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
   std::size_t ``[link boost_asio.reference.write.overload2 write]``(
       SyncWriteStream & s,
       const ConstBufferSequence & buffers,
- CompletionCondition completion_condition);
+ boost::system::error_code & ec);
   `` [''''&raquo;''' [link boost_asio.reference.write.overload2 more...]]``
 
   template<
@@ -72206,38 +92161,57 @@
   std::size_t ``[link boost_asio.reference.write.overload3 write]``(
       SyncWriteStream & s,
       const ConstBufferSequence & buffers,
+ CompletionCondition completion_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.write.overload3 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.write.overload4 write]``(
+ SyncWriteStream & s,
+ const ConstBufferSequence & buffers,
       CompletionCondition completion_condition,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.write.overload3 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write.overload4 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
       typename Allocator>
- std::size_t ``[link boost_asio.reference.write.overload4 write]``(
+ std::size_t ``[link boost_asio.reference.write.overload5 write]``(
       SyncWriteStream & s,
       basic_streambuf< Allocator > & b);
- `` [''''&raquo;''' [link boost_asio.reference.write.overload4 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write.overload5 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.write.overload6 write]``(
+ SyncWriteStream & s,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.write.overload6 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
       typename Allocator,
       typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.write.overload5 write]``(
+ std::size_t ``[link boost_asio.reference.write.overload7 write]``(
       SyncWriteStream & s,
       basic_streambuf< Allocator > & b,
       CompletionCondition completion_condition);
- `` [''''&raquo;''' [link boost_asio.reference.write.overload5 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write.overload7 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
       typename Allocator,
       typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.write.overload6 write]``(
+ std::size_t ``[link boost_asio.reference.write.overload8 write]``(
       SyncWriteStream & s,
       basic_streambuf< Allocator > & b,
       CompletionCondition completion_condition,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.write.overload6 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write.overload8 more...]]``
 
 [heading Requirements]
 
@@ -72246,7 +92220,7 @@
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:overload1 write (1 of 6 overloads)]
+[section:overload1 write (1 of 8 overloads)]
 
 
 Write all of the supplied data to a stream before returning.
@@ -72326,7 +92300,80 @@
 
 
 
-[section:overload2 write (2 of 6 overloads)]
+[section:overload2 write (2 of 8 overloads)]
+
+
+Write all of the supplied data to a stream before returning.
+
+
+ template<
+ typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write(
+ SyncWriteStream & s,
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
+
+
+* All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
+
+
+* An error occurred.
+
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
+
+[[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the stream.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes transferred.
+
+
+[heading Example]
+
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ boost::asio::write(s, boost::asio::buffer(data, size), ec);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+[heading Remarks]
+
+This overload is equivalent to calling:
+
+ boost::asio::write(
+ s, buffers,
+ boost::asio::transfer_all(), ec);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 write (3 of 8 overloads)]
 
 
 Write a certain amount of data to a stream before returning.
@@ -72409,7 +92456,7 @@
 
 
 
-[section:overload3 write (3 of 6 overloads)]
+[section:overload4 write (4 of 8 overloads)]
 
 
 Write a certain amount of data to a stream before returning.
@@ -72474,7 +92521,7 @@
 
 
 
-[section:overload4 write (4 of 6 overloads)]
+[section:overload5 write (5 of 8 overloads)]
 
 
 Write all of the supplied data to a stream before returning.
@@ -72544,7 +92591,70 @@
 
 
 
-[section:overload5 write (5 of 6 overloads)]
+[section:overload6 write (6 of 8 overloads)]
+
+
+Write all of the supplied data to a stream before returning.
+
+
+ template<
+ typename ``[link boost_asio.reference.SyncWriteStream SyncWriteStream]``,
+ typename Allocator>
+ std::size_t write(
+ SyncWriteStream & s,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
+
+
+This function is used to write a certain number of bytes of data to a stream. The call will block until one of the following conditions is true:
+
+
+* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
+
+
+* An error occurred.
+
+This operation is implemented in terms of zero or more calls to the stream's write\_some function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The stream to which the data is to be written. The type must support the SyncWriteStream concept.]]
+
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes transferred.
+
+
+[heading Remarks]
+
+This overload is equivalent to calling:
+
+ boost::asio::write(
+ s, b,
+ boost::asio::transfer_all(), ec);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload7 write (7 of 8 overloads)]
 
 
 Write a certain amount of data to a stream before returning.
@@ -72616,7 +92726,7 @@
 
 
 
-[section:overload6 write (6 of 6 overloads)]
+[section:overload8 write (8 of 8 overloads)]
 
 
 Write a certain amount of data to a stream before returning.
@@ -72699,13 +92809,12 @@
 
   template<
       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename CompletionCondition>
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
   std::size_t ``[link boost_asio.reference.write_at.overload2 write_at]``(
       SyncRandomAccessWriteDevice & d,
       boost::uint64_t offset,
       const ConstBufferSequence & buffers,
- CompletionCondition completion_condition);
+ boost::system::error_code & ec);
   `` [''''&raquo;''' [link boost_asio.reference.write_at.overload2 more...]]``
 
   template<
@@ -72716,41 +92825,62 @@
       SyncRandomAccessWriteDevice & d,
       boost::uint64_t offset,
       const ConstBufferSequence & buffers,
+ CompletionCondition completion_condition);
+ `` [''''&raquo;''' [link boost_asio.reference.write_at.overload3 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename CompletionCondition>
+ std::size_t ``[link boost_asio.reference.write_at.overload4 write_at]``(
+ SyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ const ConstBufferSequence & buffers,
       CompletionCondition completion_condition,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.write_at.overload3 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write_at.overload4 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
       typename Allocator>
- std::size_t ``[link boost_asio.reference.write_at.overload4 write_at]``(
+ std::size_t ``[link boost_asio.reference.write_at.overload5 write_at]``(
       SyncRandomAccessWriteDevice & d,
       boost::uint64_t offset,
       basic_streambuf< Allocator > & b);
- `` [''''&raquo;''' [link boost_asio.reference.write_at.overload4 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write_at.overload5 more...]]``
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
+ typename Allocator>
+ std::size_t ``[link boost_asio.reference.write_at.overload6 write_at]``(
+ SyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
+ `` [''''&raquo;''' [link boost_asio.reference.write_at.overload6 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
       typename Allocator,
       typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.write_at.overload5 write_at]``(
+ std::size_t ``[link boost_asio.reference.write_at.overload7 write_at]``(
       SyncRandomAccessWriteDevice & d,
       boost::uint64_t offset,
       basic_streambuf< Allocator > & b,
       CompletionCondition completion_condition);
- `` [''''&raquo;''' [link boost_asio.reference.write_at.overload5 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write_at.overload7 more...]]``
 
   template<
       typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
       typename Allocator,
       typename CompletionCondition>
- std::size_t ``[link boost_asio.reference.write_at.overload6 write_at]``(
+ std::size_t ``[link boost_asio.reference.write_at.overload8 write_at]``(
       SyncRandomAccessWriteDevice & d,
       boost::uint64_t offset,
       basic_streambuf< Allocator > & b,
       CompletionCondition completion_condition,
       boost::system::error_code & ec);
- `` [''''&raquo;''' [link boost_asio.reference.write_at.overload6 more...]]``
+ `` [''''&raquo;''' [link boost_asio.reference.write_at.overload8 more...]]``
 
 [heading Requirements]
 
@@ -72759,7 +92889,7 @@
 [*Convenience header: ][^boost/asio.hpp]
 
 
-[section:overload1 write_at (1 of 6 overloads)]
+[section:overload1 write_at (1 of 8 overloads)]
 
 
 Write all of the supplied data at the specified offset before returning.
@@ -72842,7 +92972,84 @@
 
 
 
-[section:overload2 write_at (2 of 6 overloads)]
+[section:overload2 write_at (2 of 8 overloads)]
+
+
+Write all of the supplied data at the specified offset before returning.
+
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_at(
+ SyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
+
+
+* All of the data in the supplied buffers has been written. That is, the bytes transferred is equal to the sum of the buffer sizes.
+
+
+* An error occurred.
+
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
+
+[[offset][The offset at which the data will be written.]]
+
+[[buffers][One or more buffers containing the data to be written. The sum of the buffer sizes indicates the maximum number of bytes to write to the device.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes transferred.
+
+
+[heading Example]
+
+To write a single data buffer use the [link boost_asio.reference.buffer `buffer`] function as follows:
+
+ boost::asio::write_at(d, 42,
+ boost::asio::buffer(data, size), ec);
+
+
+See the [link boost_asio.reference.buffer `buffer`] documentation for information on writing multiple buffers in one go, and how to use it with arrays, boost::array or std::vector.
+
+
+[heading Remarks]
+
+This overload is equivalent to calling:
+
+ boost::asio::write_at(
+ d, offset, buffers,
+ boost::asio::transfer_all(), ec);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload3 write_at (3 of 8 overloads)]
 
 
 Write a certain amount of data at a specified offset before returning.
@@ -72928,7 +93135,7 @@
 
 
 
-[section:overload3 write_at (3 of 6 overloads)]
+[section:overload4 write_at (4 of 8 overloads)]
 
 
 Write a certain amount of data at a specified offset before returning.
@@ -72996,7 +93203,7 @@
 
 
 
-[section:overload4 write_at (4 of 6 overloads)]
+[section:overload5 write_at (5 of 8 overloads)]
 
 
 Write all of the supplied data at the specified offset before returning.
@@ -73069,7 +93276,73 @@
 
 
 
-[section:overload5 write_at (5 of 6 overloads)]
+[section:overload6 write_at (6 of 8 overloads)]
+
+
+Write all of the supplied data at the specified offset before returning.
+
+
+ template<
+ typename ``[link boost_asio.reference.SyncRandomAccessWriteDevice SyncRandomAccessWriteDevice]``,
+ typename Allocator>
+ std::size_t write_at(
+ SyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ boost::system::error_code & ec);
+
+
+This function is used to write a certain number of bytes of data to a random access device at a specified offset. The call will block until one of the following conditions is true:
+
+
+* All of the data in the supplied [link boost_asio.reference.basic_streambuf `basic_streambuf`] has been written.
+
+
+* An error occurred.
+
+This operation is implemented in terms of zero or more calls to the device's write\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device to which the data is to be written. The type must support the SyncRandomAccessWriteDevice concept.]]
+
+[[offset][The offset at which the data will be written.]]
+
+[[b][The [link boost_asio.reference.basic_streambuf `basic_streambuf`] object from which data will be written.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
+
+
+[heading Return Value]
+
+The number of bytes transferred.
+
+
+[heading Remarks]
+
+This overload is equivalent to calling:
+
+ boost::asio::write_at(
+ d, 42, b,
+ boost::asio::transfer_all(), ec);
+
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload7 write_at (7 of 8 overloads)]
 
 
 Write a certain amount of data at a specified offset before returning.
@@ -73144,7 +93417,7 @@
 
 
 
-[section:overload6 write_at (6 of 6 overloads)]
+[section:overload8 write_at (8 of 8 overloads)]
 
 
 Write a certain amount of data at a specified offset before returning.
@@ -73394,9 +93667,9 @@
 
 [heading Requirements]
 
-[*Header: ][^boost/asio/error.hpp]
+[*Header: ][^boost/asio/ssl/error.hpp]
 
-[*Convenience header: ][^boost/asio.hpp]
+[*Convenience header: ][^boost/asio/ssl.hpp]
 
 
 [section:value boost::system::is_error_code_enum< boost::asio::error::ssl_errors >::value]

Modified: branches/release/libs/asio/doc/reference.xsl
==============================================================================
--- branches/release/libs/asio/doc/reference.xsl (original)
+++ branches/release/libs/asio/doc/reference.xsl 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -43,6 +43,7 @@
 [include requirements/AsyncReadStream.qbk]
 [include requirements/AsyncWriteStream.qbk]
 [include requirements/CompletionHandler.qbk]
+[include requirements/ComposedConnectHandler.qbk]
 [include requirements/ConnectHandler.qbk]
 [include requirements/ConstBufferSequence.qbk]
 [include requirements/ConvertibleToConstBuffer.qbk]
@@ -54,6 +55,7 @@
 [include requirements/GettableSocketOption.qbk]
 [include requirements/Handler.qbk]
 [include requirements/HandleService.qbk]
+[include requirements/HandshakeHandler.qbk]
 [include requirements/InternetProtocol.qbk]
 [include requirements/IoControlCommand.qbk]
 [include requirements/IoObjectService.qbk]
@@ -64,10 +66,14 @@
 [include requirements/ReadHandler.qbk]
 [include requirements/ResolveHandler.qbk]
 [include requirements/ResolverService.qbk]
+[include requirements/SeqPacketSocketService.qbk]
 [include requirements/SerialPortService.qbk]
 [include requirements/Service.qbk]
 [include requirements/SettableSerialPortOption.qbk]
 [include requirements/SettableSocketOption.qbk]
+[include requirements/ShutdownHandler.qbk]
+[include requirements/SignalHandler.qbk]
+[include requirements/SignalSetService.qbk]
 [include requirements/SocketAcceptorService.qbk]
 [include requirements/SocketService.qbk]
 [include requirements/StreamDescriptorService.qbk]
@@ -245,6 +251,18 @@
          select="concat(substring-before($name, ']'), '_rb_', substring-after($name, ']'))"/>
       </xsl:call-template>
     </xsl:when>
+ <xsl:when test="contains($name, '(')">
+ <xsl:call-template name="make-id">
+ <xsl:with-param name="name"
+ select="concat(substring-before($name, '('), '_lp_', substring-after($name, '('))"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="contains($name, ')')">
+ <xsl:call-template name="make-id">
+ <xsl:with-param name="name"
+ select="concat(substring-before($name, ')'), '_rp_', substring-after($name, ')'))"/>
+ </xsl:call-template>
+ </xsl:when>
     <xsl:when test="contains($name, '+')">
       <xsl:call-template name="make-id">
         <xsl:with-param name="name"
@@ -633,16 +651,66 @@
 
 
 <xsl:template match="ref[@kindref='member']" mode="markup">
- <xsl:text>`</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>`</xsl:text>
+ <xsl:variable name="dox-ref-id" select="@refid"/>
+ <xsl:variable name="memberdefs" select="/doxygen//compounddef/sectiondef/memberdef[@id=$dox-ref-id]"/>
+ <xsl:choose>
+ <xsl:when test="contains(@refid, 'namespaceboost_1_1asio') and count($memberdefs) &gt; 0">
+ <xsl:variable name="dox-compound-name" select="($memberdefs)[1]/../../compoundname"/>
+ <xsl:variable name="dox-name" select="($memberdefs)[1]/name"/>
+ <xsl:variable name="ref-name">
+ <xsl:call-template name="strip-asio-ns">
+ <xsl:with-param name="name" select="concat($dox-compound-name,'::',$dox-name)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ref-id">
+ <xsl:call-template name="make-id">
+ <xsl:with-param name="name" select="$ref-name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:text>[link boost_asio.reference.</xsl:text>
+ <xsl:value-of select="$ref-id"/>
+ <xsl:text> `</xsl:text>
+ <xsl:value-of name="text" select="$ref-name"/>
+ <xsl:text>`]</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>`</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>`</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
 </xsl:template>
 
 
 <xsl:template match="ref[@kindref='member']" mode="markup-nested">
- <xsl:text>`</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>`</xsl:text>
+ <xsl:variable name="dox-ref-id" select="@refid"/>
+ <xsl:variable name="memberdefs" select="/doxygen//compounddef/sectiondef/memberdef[@id=$dox-ref-id]"/>
+ <xsl:choose>
+ <xsl:when test="contains(@refid, 'namespaceboost_1_1asio') and count($memberdefs) &gt; 0">
+ <xsl:variable name="dox-compound-name" select="($memberdefs)[1]/../../compoundname"/>
+ <xsl:variable name="dox-name" select="($memberdefs)[1]/name"/>
+ <xsl:variable name="ref-name">
+ <xsl:call-template name="strip-asio-ns">
+ <xsl:with-param name="name" select="concat($dox-compound-name,'::',$dox-name)"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="ref-id">
+ <xsl:call-template name="make-id">
+ <xsl:with-param name="name" select="$ref-name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:text>[link boost_asio.reference.</xsl:text>
+ <xsl:value-of select="$ref-id"/>
+ <xsl:text> `</xsl:text>
+ <xsl:value-of name="text" select="$ref-name"/>
+ <xsl:text>`]</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>`</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>`</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
 </xsl:template>
 
 
@@ -876,6 +944,56 @@
 ]
 </xsl:if>
 
+<xsl:if test="$class-name = 'io_service::service'">
+<xsl:if test="count(sectiondef[@kind='private-func']) > 0">
+[heading Private Member Functions]
+[table
+ [[Name][Description]]
+<xsl:for-each select="sectiondef[@kind='private-func']/memberdef" mode="class-table">
+ <xsl:sort select="name"/>
+ <xsl:variable name="name">
+ <xsl:value-of select="name"/>
+ </xsl:variable>
+ <xsl:variable name="id">
+ <xsl:call-template name="make-id">
+ <xsl:with-param name="name" select="$name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="doxygen-id">
+ <xsl:value-of select="@id"/>
+ </xsl:variable>
+ <xsl:variable name="overload-count">
+ <xsl:value-of select="count(../memberdef[name = $name])"/>
+ </xsl:variable>
+ <xsl:variable name="overload-position">
+ <xsl:for-each select="../memberdef[name = $name]">
+ <xsl:if test="@id = $doxygen-id">
+ <xsl:value-of select="position()"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:if test="$overload-position = 1">
+ [
+ [[link boost_asio.reference.<xsl:value-of select="$class-id"/>.<xsl:value-of select="$id"/>
+ <xsl:text> </xsl:text>[*<xsl:value-of select="$name"/><xsl:text>]]]
+ [</xsl:text><xsl:value-of select="briefdescription"/>
+ </xsl:if>
+ <xsl:if test="not($overload-position = 1) and not(briefdescription = preceding-sibling::*/briefdescription)">
+ <xsl:value-of select="$newline"/>
+ <xsl:value-of select="$newline"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="briefdescription"/>
+ </xsl:if>
+ <xsl:if test="$overload-position = $overload-count">
+ <xsl:text>]
+ ]
+ </xsl:text>
+ </xsl:if>
+</xsl:for-each>
+]
+</xsl:if>
+</xsl:if>
+
 <xsl:if test="count(sectiondef[@kind='public-attrib' or @kind='public-static-attrib']) > 0">
 [heading Data Members]
 [table
@@ -1015,6 +1133,14 @@
   <xsl:with-param name="class-id" select="$class-id"/>
   <xsl:with-param name="class-file" select="$class-file"/>
 </xsl:apply-templates>
+<xsl:if test="$class-name = 'io_service::service'">
+ <xsl:apply-templates select="sectiondef[@kind='private-func']/memberdef[not(type = 'friend class') and not(contains(name, '_helper'))]" mode="class-detail">
+ <xsl:sort select="name"/>
+ <xsl:with-param name="class-name" select="$class-name"/>
+ <xsl:with-param name="class-id" select="$class-id"/>
+ <xsl:with-param name="class-file" select="$class-file"/>
+ </xsl:apply-templates>
+</xsl:if>
 </xsl:template>
 
 
@@ -1281,6 +1407,9 @@
         <xsl:when test="declname = 'CompletionCondition'">
           <xsl:value-of select="declname"/>
         </xsl:when>
+ <xsl:when test="declname = 'ConnectCondition'">
+ <xsl:value-of select="declname"/>
+ </xsl:when>
         <xsl:when test="declname = 'Context_Service'">
           <xsl:value-of select="declname"/>
         </xsl:when>
@@ -1293,7 +1422,7 @@
         <xsl:when test="declname = 'Function'">
           <xsl:value-of select="declname"/>
         </xsl:when>
- <xsl:when test="declname = 'HandshakeHandler'">
+ <xsl:when test="declname = 'Iterator'">
           <xsl:value-of select="declname"/>
         </xsl:when>
         <xsl:when test="declname = 'MatchCondition'">
@@ -1311,9 +1440,6 @@
         <xsl:when test="declname = 'PointerToPodType'">
           <xsl:value-of select="declname"/>
         </xsl:when>
- <xsl:when test="declname = 'ShutdownHandler'">
- <xsl:value-of select="declname"/>
- </xsl:when>
         <xsl:when test="declname = 'SocketService1' or declname = 'SocketService2'">
           <xsl:value-of select="concat('``[link boost_asio.reference.SocketService ', declname, ']``')"/>
         </xsl:when>
@@ -1338,6 +1464,9 @@
         <xsl:when test="declname = 'Traits'">
           <xsl:value-of select="declname"/>
         </xsl:when>
+ <xsl:when test="declname = 'VerifyCallback'">
+ <xsl:value-of select="declname"/>
+ </xsl:when>
         <xsl:when test="count(declname) = 0">
         </xsl:when>
         <xsl:otherwise>

Modified: branches/release/libs/asio/doc/requirements/AsyncReadStream.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/AsyncReadStream.qbk (original)
+++ branches/release/libs/asio/doc/requirements/AsyncReadStream.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,7 +16,7 @@
 [table Buffer-oriented asynchronous read stream requirements
   [[operation] [type] [semantics, pre/post-conditions]]
   [
- [`a.io_service();`]
+ [`a.get_io_service();`]
     [`io_service&`]
     [Returns the `io_service` object through which the `async_read_some`
     handler `h` will be invoked.]
@@ -27,7 +27,7 @@
     [
       Initiates an asynchronous operation to read one or more bytes of data
       from the stream `a`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Modified: branches/release/libs/asio/doc/requirements/AsyncWriteStream.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/AsyncWriteStream.qbk (original)
+++ branches/release/libs/asio/doc/requirements/AsyncWriteStream.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -15,7 +15,7 @@
 [table Buffer-oriented asynchronous write stream requirements
   [[operation] [type] [semantics, pre/post-conditions]]
   [
- [`a.io_service();`]
+ [`a.get_io_service();`]
     [`io_service&`]
     [Returns the `io_service` object through which the `async_write_some`
     handler `h` will be invoked.]
@@ -26,7 +26,7 @@
     [
       Initiates an asynchronous operation to write one or more bytes of data to
       the stream `a`. The operation is performed via the `io_service` object
- `a.io_service()` and behaves according to [link
+ `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Added: branches/release/libs/asio/doc/requirements/ComposedConnectHandler.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/requirements/ComposedConnectHandler.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,56 @@
+[/
+ / Copyright (c) 2003-2011 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:ComposedConnectHandler Composed connect handler requirements]
+
+A composed connect handler must meet the requirements for a [link
+boost_asio.reference.Handler handler]. A value `h` of a composed connect handler
+class should work correctly in the expression `h(ec, i)`, where `ec` is an
+lvalue of type `const error_code` and `i` is an lvalue of the type `Iterator`
+used in the corresponding `connect()` or async_connect()` function.
+
+[heading Examples]
+
+A free function as a composed connect handler:
+
+ void connect_handler(
+ const boost::system::error_code& ec,
+ boost::asio::ip::tcp::resolver::iterator iterator)
+ {
+ ...
+ }
+
+A composed connect handler function object:
+
+ struct connect_handler
+ {
+ ...
+ template <typename Iterator>
+ void operator()(
+ const boost::system::error_code& ec,
+ Iterator iterator)
+ {
+ ...
+ }
+ ...
+ };
+
+A non-static class member function adapted to a composed connect handler using `bind()`:
+
+ void my_class::connect_handler(
+ const boost::system::error_code& ec,
+ boost::asio::ip::tcp::resolver::iterator iterator)
+ {
+ ...
+ }
+ ...
+ boost::asio::async_connect(...,
+ boost::bind(&my_class::connect_handler,
+ this, boost::asio::placeholders::error,
+ boost::asio::placeholders::iterator));
+
+[endsect]

Modified: branches/release/libs/asio/doc/requirements/DatagramSocketService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/DatagramSocketService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/DatagramSocketService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -48,7 +48,7 @@
       \n
       Initiates an asynchronous operation to read one or more bytes of data
       from a connected socket `b`. The operation is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -95,7 +95,7 @@
       \n
       Initiates an asynchronous operation to read one or more bytes of data
       from an unconnected socket `b`. The operation is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -145,7 +145,7 @@
       \n
       Initiates an asynchronous operation to write one or more bytes of data to
       a connected socket `b`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -198,7 +198,7 @@
       \n
       Initiates an asynchronous operation to write one or more bytes of data to
       an unconnected socket `b`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Modified: branches/release/libs/asio/doc/requirements/DescriptorService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/DescriptorService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/DescriptorService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -8,19 +8,19 @@
 [section:DescriptorService Descriptor service requirements]
 
 A descriptor service must meet the requirements for an [link
-boost_asio.reference.IoObjectService I/O object service], as well as the
-additional requirements listed below.
+boost_asio.reference.IoObjectService I/O object service] with support for movability,
+as well as the additional requirements listed below.
 
-In the table below, `X` denotes a descriptor service class, `a` denotes a value
-of type `X`, `b` denotes a value of type `X::implementation_type`, `n` denotes
-a value of type `X::native_type`, `ec` denotes a value of type `error_code`,
-`i` denotes a value meeting [link boost_asio.reference.IoControlCommand
+In the table below, `X` denotes a descriptor service class, `a` and `ao` denote
+values of type `X`, `b` and `c` denote values of type `X::implementation_type`,
+`n` denotes a value of type `X::native_handle_type`, `ec` denotes a value of type
+`error_code`, `i` denotes a value meeting [link boost_asio.reference.IoControlCommand
 `IoControlCommand`] requirements, and `u` and `v` denote identifiers.
 
 [table DescriptorService requirements
   [[expression] [return type] [assertion/note\npre/post-condition]]
   [
- [`X::native_type`]
+ [`X::native_handle_type`]
     []
     [
       The implementation-defined native representation of a descriptor. Must
@@ -48,6 +48,28 @@
   ]
   [
     [``
+ a.move_construct(b, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ The underlying native representation is moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
+ a.move_assign(b, ao, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ Implicitly cancels asynchronous operations associated with `b`, as if by
+ calling `a.close(b, ec)`. Then the underlying native representation is
+ moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
       a.assign(b, n, ec);
     ``]
     [`error_code`]
@@ -88,9 +110,9 @@
   ]
   [
     [``
- a.native(b);
+ a.native_handle(b);
     ``]
- [`X::native_type`]
+ [`X::native_handle_type`]
     [
     ]
   ]

Modified: branches/release/libs/asio/doc/requirements/HandleService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/HandleService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/HandleService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -8,18 +8,18 @@
 [section:HandleService Handle service requirements]
 
 A handle service must meet the requirements for an [link
-boost_asio.reference.IoObjectService I/O object service], as well as the
-additional requirements listed below.
+boost_asio.reference.IoObjectService I/O object service] with support for movability,
+as well as the additional requirements listed below.
 
-In the table below, `X` denotes a handle service class, `a` denotes a value of
-type `X`, `b` denotes a value of type `X::implementation_type`, `n` denotes a
-value of type `X::native_type`, `ec` denotes a value of type `error_code`, and
-`u` and `v` denote identifiers.
+In the table below, `X` denotes a handle service class, `a` and `ao` denote
+values of type `X`, `b` and `c` denote values of type `X::implementation_type`,
+`n` denotes a value of type `X::native_handle_type`, `ec` denotes a value of
+type `error_code`, and `u` and `v` denote identifiers.
 
 [table HandleService requirements
   [[expression] [return type] [assertion/note\npre/post-condition]]
   [
- [`X::native_type`]
+ [`X::native_handle_type`]
     []
     [
       The implementation-defined native representation of a handle. Must
@@ -47,6 +47,28 @@
   ]
   [
     [``
+ a.move_construct(b, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ The underlying native representation is moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
+ a.move_assign(b, ao, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ Implicitly cancels asynchronous operations associated with `b`, as if by
+ calling `a.close(b, ec)`. Then the underlying native representation is
+ moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
       a.assign(b, n, ec);
     ``]
     [`error_code`]
@@ -87,9 +109,9 @@
   ]
   [
     [``
- a.native(b);
+ a.native_handle(b);
     ``]
- [`X::native_type`]
+ [`X::native_handle_type`]
     [
     ]
   ]

Modified: branches/release/libs/asio/doc/requirements/Handler.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/Handler.qbk (original)
+++ branches/release/libs/asio/doc/requirements/Handler.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,7 +19,7 @@
   [[expression] [return type] [assertion/note\npre/post-conditions]]
   [
     [``
- using namespace boost::asio;
+ using boost::asio::asio_handler_allocate;
       asio_handler_allocate(s, &h);
     ``]
     [`void*`]
@@ -34,7 +34,7 @@
   ]
   [
     [``
- using namespace boost::asio;
+ using boost::asio::asio_handler_deallocate;
       asio_handler_deallocate(p, s, &h);
     ``]
     []
@@ -48,7 +48,7 @@
   ]
   [
     [``
- using namespace boost::asio;
+ using boost::asio::asio_handler_invoke;
       asio_handler_invoke(f, &h);
     ``]
     []

Added: branches/release/libs/asio/doc/requirements/HandshakeHandler.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/requirements/HandshakeHandler.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,50 @@
+[/
+ / Copyright (c) 2003-2011 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:HandshakeHandler SSL handshake handler requirements]
+
+A handshake handler must meet the requirements for a [link
+boost_asio.reference.Handler handler]. A value `h` of a handshake handler
+class should work correctly in the expression `h(ec)`, where `ec` is an lvalue
+of type `const error_code`.
+
+[heading Examples]
+
+A free function as a handshake handler:
+
+ void handshake_handler(
+ const boost::system::error_code& ec)
+ {
+ ...
+ }
+
+A handshake handler function object:
+
+ struct handshake_handler
+ {
+ ...
+ void operator()(
+ const boost::system::error_code& ec)
+ {
+ ...
+ }
+ ...
+ };
+
+A non-static class member function adapted to a handshake handler using `bind()`:
+
+ void my_class::handshake_handler(
+ const boost::system::error_code& ec)
+ {
+ ...
+ }
+ ...
+ ssl_stream.async_handshake(...,
+ boost::bind(&my_class::handshake_handler,
+ this, boost::asio::placeholders::error));
+
+[endsect]

Modified: branches/release/libs/asio/doc/requirements/IoObjectService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/IoObjectService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/IoObjectService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -11,9 +11,9 @@
 boost_asio.reference.Service service], as well as the requirements listed
 below.
 
-In the table below, `X` denotes an I/O object service class, `a` denotes a
-value of type `X`, `b` denotes a value of type `X::implementation_type`, and
-`u` denotes an identifier.
+In the table below, `X` denotes an I/O object service class, `a` and `ao` denote
+values of type `X`, `b` and `c` denote values of type `X::implementation_type`,
+and `u` denotes an identifier.
 
 [table IoObjectService requirements
   [[expression] [return type] [assertion/note\npre/post-condition]]
@@ -41,7 +41,21 @@
     ``]
     []
     [note: `destroy()` will only be called on a value that has previously been
- initialised with `construct()`.]
+ initialised with `construct()` or `move_construct()`.]
+ ]
+ [
+ [``
+ a.move_construct(b, c);
+ ``]
+ []
+ [note: only required for I/O objects that support movability.]
+ ]
+ [
+ [``
+ a.move_assign(b, ao, c);
+ ``]
+ []
+ [note: only required for I/O objects that support movability.]
   ]
 ]
 

Modified: branches/release/libs/asio/doc/requirements/RawSocketService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/RawSocketService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/RawSocketService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -48,7 +48,7 @@
       \n
       Initiates an asynchronous operation to read one or more bytes of data
       from a connected socket `b`. The operation is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -95,7 +95,7 @@
       \n
       Initiates an asynchronous operation to read one or more bytes of data
       from an unconnected socket `b`. The operation is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -145,7 +145,7 @@
       \n
       Initiates an asynchronous operation to write one or more bytes of data to
       a connected socket `b`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -198,7 +198,7 @@
       \n
       Initiates an asynchronous operation to write one or more bytes of data to
       an unconnected socket `b`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Modified: branches/release/libs/asio/doc/requirements/ResolverService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/ResolverService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/ResolverService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -62,7 +62,7 @@
     []
     [
       Initiates an asynchronous resolve operation that is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -93,7 +93,7 @@
     []
     [
       Initiates an asynchronous resolve operation that is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Added: branches/release/libs/asio/doc/requirements/SeqPacketSocketService.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/requirements/SeqPacketSocketService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,127 @@
+[/
+ / Copyright (c) 2003-2011 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:SeqPacketSocketService Sequenced packet socket service requirements]
+
+A sequenced packet socket service must meet the requirements for a [link
+boost_asio.reference.SocketService socket service], as well as the additional
+requirements listed below.
+
+In the table below, `X` denotes a stream socket service class, `a` denotes a
+value of type `X`, `b` denotes a value of type `X::implementation_type`, `ec`
+denotes a value of type `error_code`, `f` denotes a value of type
+`socket_base::message_flags`, `g` denotes an lvalue of type
+`socket_base::message_flags`, `mb` denotes a value satisfying [link
+boost_asio.reference.MutableBufferSequence mutable buffer sequence] requirements,
+`rh` denotes a value meeting [link boost_asio.reference.ReadHandler `ReadHandler`]
+requirements, `cb` denotes a value satisfying [link
+boost_asio.reference.ConstBufferSequence constant buffer sequence] requirements, and
+`wh` denotes a value meeting [link boost_asio.reference.WriteHandler `WriteHandler`]
+requirements.
+
+[table StreamSocketService requirements
+ [[expression] [return type] [assertion/note\npre/post-condition]]
+ [
+ [`a.receive(b, mb, f, g, ec);`]
+ [`size_t`]
+ [
+ pre: `a.is_open(b)`.\n
+ \n
+ Reads one or more bytes of data from a connected socket `b`.\n
+ \n
+ The mutable buffer sequence `mb` specifies memory where the data should
+ be placed. The operation shall always fill a buffer in the sequence
+ completely before proceeding to the next.\n
+ \n
+ If successful, sets `g` to the flags associated with the received data,
+ and returns the number of bytes read. Otherwise, sets `g` to `0` and
+ returns `0`.
+ ]
+ ]
+ [
+ [`a.async_receive(b, mb, f, g, rh);`]
+ [`void`]
+ [
+ pre: `a.is_open(b)`.\n
+ \n
+ Initiates an asynchronous operation to read one or more bytes of data
+ from a connected socket `b`. The operation is performed via the
+ `io_service` object `a.get_io_service()` and behaves according to [link
+ boost_asio.reference.asynchronous_operations asynchronous operation]
+ requirements.\n
+ \n
+ The mutable buffer sequence `mb` specifies memory where the data should
+ be placed. The operation shall always fill a buffer in the sequence
+ completely before proceeding to the next.\n
+ \n
+ The implementation shall maintain one or more copies of `mb` until such
+ time as the read operation no longer requires access to the memory
+ specified by the buffers in the sequence. The program must ensure the
+ memory is valid until:\n
+ \n
+ [mdash] the last copy of `mb` is destroyed, or\n
+ \n
+ [mdash] the handler for the asynchronous operation is invoked,\n
+ \n
+ whichever comes first.\n
+ \n
+ If the operation completes successfully, sets `g` to the flags associated
+ with the received data, then invokes the `ReadHandler` object `rh` with
+ the number of bytes transferred. Otherwise, sets `g` to `0` and invokes
+ `rh` with `0` bytes transferred.
+ ]
+ ]
+ [
+ [`a.send(b, cb, f, ec);`]
+ [`size_t`]
+ [
+ pre: `a.is_open(b)`.\n
+ \n
+ Writes one or more bytes of data to a connected socket `b`.\n
+ \n
+ The constant buffer sequence `cb` specifies memory where the data to be
+ written is located. The operation shall always write a buffer in the
+ sequence completely before proceeding to the next.\n
+ \n
+ If successful, returns the number of bytes written. Otherwise returns `0`.
+ ]
+ ]
+ [
+ [`a.async_send(b, cb, f, wh);`]
+ [`void`]
+ [
+ pre: `a.is_open(b)`.\n
+ \n
+ Initiates an asynchronous operation to write one or more bytes of data to
+ a connected socket `b`. The operation is performed via the `io_service`
+ object `a.get_io_service()` and behaves according to [link
+ boost_asio.reference.asynchronous_operations asynchronous operation]
+ requirements.\n
+ \n
+ The constant buffer sequence `cb` specifies memory where the data to be
+ written is located. The operation shall always write a buffer in the
+ sequence completely before proceeding to the next.\n
+ \n
+ The implementation shall maintain one or more copies of `cb` until such
+ time as the write operation no longer requires access to the memory
+ specified by the buffers in the sequence. The program must ensure the
+ memory is valid until:\n
+ \n
+ [mdash] the last copy of `cb` is destroyed, or\n
+ \n
+ [mdash] the handler for the asynchronous operation is invoked,\n
+ \n
+ whichever comes first.\n
+ \n
+ If the operation completes successfully, the `WriteHandler` object `wh`
+ is invoked with the number of bytes transferred. Otherwise it is invoked
+ with `0`.
+ ]
+ ]
+]
+
+[endsect]

Modified: branches/release/libs/asio/doc/requirements/SerialPortService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/SerialPortService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/SerialPortService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -8,14 +8,14 @@
 [section:SerialPortService Serial port service requirements]
 
 A serial port service must meet the requirements for an [link
-boost_asio.reference.IoObjectService I/O object service], as well as the
-additional requirements listed below.
+boost_asio.reference.IoObjectService I/O object service] with support for movability,
+as well as the additional requirements listed below.
 
-In the table below, `X` denotes a serial port service class, `a` denotes a
-value of type `X`, `d` denotes a serial port device name of type `std::string`,
-`b` denotes a value of type `X::implementation_type`, `n` denotes a value of
-type `X::native_type`, `ec` denotes a value of type `error_code`, `s` denotes a
-value meeting [link boost_asio.reference.SettableSerialPortOption
+In the table below, `X` denotes a serial port service class, `a` and `ao` denote
+values of type `X`, `d` denotes a serial port device name of type `std::string`,
+`b` and `c` denote values of type `X::implementation_type`, `n` denotes a value
+of type `X::native_handle_type`, `ec` denotes a value of type `error_code`, `s`
+denotes a value meeting [link boost_asio.reference.SettableSerialPortOption
 `SettableSerialPortOption`] requirements, `g` denotes a value meeting [link
 boost_asio.reference.GettableSerialPortOption `GettableSerialPortOption`]
 requirements, `mb` denotes a value satisfying [link
@@ -29,7 +29,7 @@
 [table SerialPortService requirements
   [[expression] [return type] [assertion/note\npre/post-condition]]
   [
- [`X::native_type`]
+ [`X::native_handle_type`]
     []
     [
       The implementation-defined native representation of a serial port. Must
@@ -57,6 +57,28 @@
   ]
   [
     [``
+ a.move_construct(b, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ The underlying native representation is moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
+ a.move_assign(b, ao, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ Implicitly cancels asynchronous operations associated with `b`, as if by
+ calling `a.close(b, ec)`. Then the underlying native representation is
+ moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
       const std::string& u = d;
       a.open(b, u, ec);
     ``]
@@ -108,9 +130,9 @@
   ]
   [
     [``
- a.native(b);
+ a.native_handle(b);
     ``]
- [`X::native_type`]
+ [`X::native_handle_type`]
     [
     ]
   ]

Added: branches/release/libs/asio/doc/requirements/ShutdownHandler.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/requirements/ShutdownHandler.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,50 @@
+[/
+ / Copyright (c) 2003-2011 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:ShutdownHandler SSL shutdown handler requirements]
+
+A shutdown handler must meet the requirements for a [link
+boost_asio.reference.Handler handler]. A value `h` of a shutdown handler
+class should work correctly in the expression `h(ec)`, where `ec` is an lvalue
+of type `const error_code`.
+
+[heading Examples]
+
+A free function as a shutdown handler:
+
+ void shutdown_handler(
+ const boost::system::error_code& ec)
+ {
+ ...
+ }
+
+A shutdown handler function object:
+
+ struct shutdown_handler
+ {
+ ...
+ void operator()(
+ const boost::system::error_code& ec)
+ {
+ ...
+ }
+ ...
+ };
+
+A non-static class member function adapted to a shutdown handler using `bind()`:
+
+ void my_class::shutdown_handler(
+ const boost::system::error_code& ec)
+ {
+ ...
+ }
+ ...
+ ssl_stream.async_shutdown(
+ boost::bind(&my_class::shutdown_handler,
+ this, boost::asio::placeholders::error));
+
+[endsect]

Added: branches/release/libs/asio/doc/requirements/SignalHandler.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/requirements/SignalHandler.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,54 @@
+[/
+ / Copyright (c) 2003-2011 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:SignalHandler Signal handler requirements]
+
+A signal handler must meet the requirements for a [link
+boost_asio.reference.Handler handler]. A value `h` of a signal handler class
+should work correctly in the expression `h(ec, n)`, where `ec` is an lvalue of
+type `const error_code` and `n` is an lvalue of type `const int`.
+
+[heading Examples]
+
+A free function as a signal handler:
+
+ void signal_handler(
+ const boost::system::error_code& ec,
+ int signal_number)
+ {
+ ...
+ }
+
+A signal handler function object:
+
+ struct signal_handler
+ {
+ ...
+ void operator()(
+ const boost::system::error_code& ec,
+ int signal_number)
+ {
+ ...
+ }
+ ...
+ };
+
+A non-static class member function adapted to a signal handler using `bind()`:
+
+ void my_class::signal_handler(
+ const boost::system::error_code& ec,
+ int signal_number)
+ {
+ ...
+ }
+ ...
+ my_signal_set.async_wait(
+ boost::bind(&my_class::signal_handler,
+ this, boost::asio::placeholders::error,
+ boost::asio::placeholders::signal_number));
+
+[endsect]

Added: branches/release/libs/asio/doc/requirements/SignalSetService.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/doc/requirements/SignalSetService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,91 @@
+[/
+ / Copyright (c) 2003-2011 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:SignalSetService Signal set service requirements]
+
+A signal set service must meet the requirements for an [link
+boost_asio.reference.IoObjectService I/O object service], as well as the
+additional requirements listed below.
+
+In the table below, `X` denotes a signal set service class, `a` denotes a value
+of type `X`, `b` denotes a value of type `X::implementation_type`, `ec` denotes
+a value of type `error_code`, `n` denotes a value of type `int`, and `sh`
+denotes a value meeting [link boost_asio.reference.SignalHandler `SignalHandler`]
+requirements.
+
+[table SignalSetService requirements
+ [[expression] [return type] [assertion/note\npre/post-condition]]
+ [
+ [`a.construct(b);`]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService]
+ requirements.\n
+ ]
+ ]
+ [
+ [`a.destroy(b);`]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService]
+ requirements. Implicitly clears the registered signals as if by calling
+ `a.clear(b, ec)`, then implicitly cancels outstanding asynchronous
+ operations as if by calling `a.cancel(b, ec)`.
+ ]
+ ]
+ [
+ [``
+ a.add(b, n, ec);
+ ``]
+ [`error_code`]
+ [
+ ]
+ ]
+ [
+ [``
+ a.remove(b, n, ec);
+ ``]
+ [`error_code`]
+ [
+ ]
+ ]
+ [
+ [``
+ a.clear(b, ec);
+ ``]
+ [`error_code`]
+ [
+ ]
+ ]
+ [
+ [``
+ a.cancel(b, ec);
+ ``]
+ [`error_code`]
+ [
+ ]
+ ]
+ [
+ [`a.async_wait(b, sh);`]
+ [`void`]
+ [
+ pre: `a.is_open(b)`.\n
+ \n
+ Initiates an asynchronous operation to wait for the delivery of one of the
+ signals registered for the signal set `b`. The operation is performed via
+ the `io_service` object `a.get_io_service()` and behaves according to
+ [link boost_asio.reference.asynchronous_operations asynchronous operation]
+ requirements.\n
+ \n
+ If the operation completes successfully, the `SignalHandler` object
+ `sh` is invoked with the number identifying the delivered signal. Otherwise
+ it is invoked with `0`.
+ ]
+ ]
+]
+
+[endsect]

Modified: branches/release/libs/asio/doc/requirements/SocketAcceptorService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/SocketAcceptorService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/SocketAcceptorService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -12,25 +12,24 @@
 additional requirements listed below.
 
 In the table below, `X` denotes a socket acceptor service class for protocol
-[link boost_asio.reference.Protocol `Protocol`], `a` denotes a value of type
-`X`, `b` denotes a value of type `X::implementation_type`, `p` denotes a value
-of type `Protocol`, `n` denotes a value of type `X::native_type`, `e` denotes a
-value of type `Protocol::endpoint`, `ec` denotes a value of type `error_code`,
-`s` denotes a value meeting [link boost_asio.reference.SettableSocketOption
-`SettableSocketOption`] requirements, `g` denotes a value meeting [link
-boost_asio.reference.GettableSocketOption `GettableSocketOption`]
-requirements, `i` denotes a value meeting [link
-boost_asio.reference.IoControlCommand `IoControlCommand`] requirements, `k`
-denotes a value of type `basic_socket<Protocol, SocketService>` where
-`SocketService` is a type meeting [link boost_asio.reference.SocketService
-socket service] requirements, `ah` denotes a value meeting [link
-boost_asio.reference.AcceptHandler `AcceptHandler`] requirements, and `u`
-and `v` denote identifiers.
+[link boost_asio.reference.Protocol `Protocol`], `a` and `ao` denote values of type
+`X`, `b` and `c` denote values of type `X::implementation_type`, `p` denotes a
+value of type `Protocol`, `n` denotes a value of type `X::native_handle_type`,
+`e` denotes a value of type `Protocol::endpoint`, `ec` denotes a value of type
+`error_code`, `s` denotes a value meeting [link
+boost_asio.reference.SettableSocketOption `SettableSocketOption`] requirements, `g`
+denotes a value meeting [link boost_asio.reference.GettableSocketOption
+`GettableSocketOption`] requirements, `i` denotes a value meeting [link
+boost_asio.reference.IoControlCommand `IoControlCommand`] requirements, `k` denotes a
+value of type `basic_socket<Protocol, SocketService>` where `SocketService` is
+a type meeting [link boost_asio.reference.SocketService socket service] requirements,
+`ah` denotes a value meeting [link boost_asio.reference.AcceptHandler
+`AcceptHandler`] requirements, and `u` and `v` denote identifiers.
 
 [table SocketAcceptorService requirements
   [[expression] [return type] [assertion/note\npre/post-condition]]
   [
- [`X::native_type`]
+ [`X::native_handle_type`]
     []
     [
       The implementation-defined native representation of a socket acceptor.
@@ -58,6 +57,28 @@
   ]
   [
     [``
+ a.move_construct(b, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ The underlying native representation is moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
+ a.move_assign(b, ao, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ Implicitly cancels asynchronous operations associated with `b`, as if by
+ calling `a.close(b, ec)`. Then the underlying native representation is
+ moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
       a.open(b, p, ec);
     ``]
     [`error_code`]
@@ -108,9 +129,9 @@
   ]
   [
     [``
- a.native(b);
+ a.native_handle(b);
     ``]
- [`X::native_type`]
+ [`X::native_handle_type`]
     [
     ]
   ]
@@ -222,7 +243,7 @@
     [
       pre: `a.is_open(b) && !k.is_open()`.\n
       Initiates an asynchronous accept operation that is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n\n
       The program must ensure the objects `k` and `e` are valid until the
@@ -237,7 +258,7 @@
     [
       pre: `a.is_open(b) && !k.is_open()`.\n
       Initiates an asynchronous accept operation that is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n\n
       The program must ensure the object `k` is valid until the handler for the

Modified: branches/release/libs/asio/doc/requirements/SocketService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/SocketService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/SocketService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -8,18 +8,18 @@
 [section:SocketService Socket service requirements]
 
 A socket service must meet the requirements for an [link
-boost_asio.reference.IoObjectService I/O object service], as well as the
-additional requirements listed below.
+boost_asio.reference.IoObjectService I/O object service] with support for movability,
+as well as the additional requirements listed below.
 
 In the table below, `X` denotes a socket service class for protocol [link
-boost_asio.reference.Protocol `Protocol`], `a` denotes a value of type `X`,
-`b` denotes a value of type `X::implementation_type`, `p` denotes a value of
-type `Protocol`, `n` denotes a value of type `X::native_type`, `e` denotes a
-value of type `Protocol::endpoint`, `ec` denotes a value of type `error_code`,
-`s` denotes a value meeting [link boost_asio.reference.SettableSocketOption
-`SettableSocketOption`] requirements, `g` denotes a value meeting [link
-boost_asio.reference.GettableSocketOption `GettableSocketOption`]
-requirements, `i` denotes a value meeting [link
+boost_asio.reference.Protocol `Protocol`], `a` and `ao` denote values of type `X`,
+`b` and `c` denote values of type `X::implementation_type`, `p` denotes a value
+of type `Protocol`, `n` denotes a value of type `X::native_handle_type`, `e`
+denotes a value of type `Protocol::endpoint`, `ec` denotes a value of type
+`error_code`, `s` denotes a value meeting [link
+boost_asio.reference.SettableSocketOption `SettableSocketOption`] requirements, `g`
+denotes a value meeting [link boost_asio.reference.GettableSocketOption
+`GettableSocketOption`] requirements, `i` denotes a value meeting [link
 boost_asio.reference.IoControlCommand `IoControlCommand`] requirements, `h`
 denotes a value of type `socket_base::shutdown_type`, `ch` denotes a value
 meeting [link boost_asio.reference.ConnectHandler `ConnectHandler`]
@@ -28,7 +28,7 @@
 [table SocketService requirements
   [[expression] [return type] [assertion/note\npre/post-condition]]
   [
- [`X::native_type`]
+ [`X::native_handle_type`]
     []
     [
       The implementation-defined native representation of a socket. Must
@@ -56,6 +56,28 @@
   ]
   [
     [``
+ a.move_construct(b, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ The underlying native representation is moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
+ a.move_assign(b, ao, c);
+ ``]
+ []
+ [
+ From [link boost_asio.reference.IoObjectService IoObjectService] requirements.
+ Implicitly cancels asynchronous operations associated with `b`, as if by
+ calling `a.close(b, ec)`. Then the underlying native representation is
+ moved from `c` to `b`.
+ ]
+ ]
+ [
+ [``
       a.open(b, p, ec);
     ``]
     [`error_code`]
@@ -106,9 +128,9 @@
   ]
   [
     [``
- a.native(b);
+ a.native_handle(b);
     ``]
- [`X::native_type`]
+ [`X::native_handle_type`]
     [
     ]
   ]
@@ -280,7 +302,7 @@
     [
       pre: `a.is_open(b)`.\n
       Initiates an asynchronous connect operation that is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.
     ]

Modified: branches/release/libs/asio/doc/requirements/StreamDescriptorService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/StreamDescriptorService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/StreamDescriptorService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -51,7 +51,7 @@
       \n
       Initiates an asynchronous operation to read one or more bytes of data
       from a descriptor `b`. The operation is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -106,7 +106,7 @@
       \n
       Initiates an asynchronous operation to write one or more bytes of data to
       a descriptor `b`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Modified: branches/release/libs/asio/doc/requirements/StreamHandleService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/StreamHandleService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/StreamHandleService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -51,7 +51,7 @@
       \n
       Initiates an asynchronous operation to read one or more bytes of data
       from a handle `b`. The operation is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -106,7 +106,7 @@
       \n
       Initiates an asynchronous operation to write one or more bytes of data to
       a handle `b`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Modified: branches/release/libs/asio/doc/requirements/StreamSocketService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/StreamSocketService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/StreamSocketService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -52,7 +52,7 @@
       \n
       Initiates an asynchronous operation to read one or more bytes of data
       from a connected socket `b`. The operation is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n
@@ -107,7 +107,7 @@
       \n
       Initiates an asynchronous operation to write one or more bytes of data to
       a connected socket `b`. The operation is performed via the `io_service`
- object `a.io_service()` and behaves according to [link
+ object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Modified: branches/release/libs/asio/doc/requirements/TimerService.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/TimerService.qbk (original)
+++ branches/release/libs/asio/doc/requirements/TimerService.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -91,7 +91,7 @@
     []
     [
       Initiates an asynchronous wait operation that is performed via the
- `io_service` object `a.io_service()` and behaves according to [link
+ `io_service` object `a.get_io_service()` and behaves according to [link
       boost_asio.reference.asynchronous_operations asynchronous operation]
       requirements.\n
       \n

Modified: branches/release/libs/asio/doc/requirements/asynchronous_operations.qbk
==============================================================================
--- branches/release/libs/asio/doc/requirements/asynchronous_operations.qbk (original)
+++ branches/release/libs/asio/doc/requirements/asynchronous_operations.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -38,9 +38,9 @@
 
 All asynchronous operations have an associated `io_service` object. Where the
 initiating function is a member function, the associated `io_service` is that
-returned by the `io_service()` member function on the same object. Where the
+returned by the `get_io_service()` member function on the same object. Where the
 initiating function is not a member function, the associated `io_service` is
-that returned by the `io_service()` member function of the first argument to
+that returned by the `get_io_service()` member function of the first argument to
 the initiating function.
 
 Arguments to initiating functions will be treated as follows:
@@ -71,11 +71,11 @@
 
 [mdash] The thread is executing any member function, constructor or destructor
 of an object of a class defined in this clause, where the object's
-`io_service()` member function returns the associated `io_service` object.
+`get_io_service()` member function returns the associated `io_service` object.
 
 [mdash] The thread is executing any function defined in this clause, where any
-argument to the function has an `io_service()` member function that returns the
-associated `io_service` object.
+argument to the function has an `get_io_service()` member function that returns
+the associated `io_service` object.
 
 [blurb Boost.Asio may use one or more hidden threads to emulate asynchronous
 functionality. The above requirements are intended to prevent these hidden
@@ -137,7 +137,7 @@
   void* asio_handler_allocate(size_t size,
                               bound_read_handler<ReadHandler>* this_handler)
   {
- using namespace boost::asio;
+ using boost::asio::asio_handler_allocate;
     return asio_handler_allocate(size, &this_handler->handler_);
   }
 
@@ -145,7 +145,7 @@
   void asio_handler_deallocate(void* pointer, std::size_t size,
                                bound_read_handler<ReadHandler>* this_handler)
   {
- using namespace boost::asio;
+ using boost::asio::asio_handler_deallocate;
     asio_handler_deallocate(pointer, size, &this_handler->handler_);
   }
 
@@ -153,7 +153,7 @@
   void asio_handler_invoke(const F& f,
                            bound_read_handler<ReadHandler>* this_handler)
   {
- using namespace boost::asio;
+ using boost::asio::asio_handler_invoke;
     asio_handler_invoke(f, &this_handler->handler_);
   }
 

Modified: branches/release/libs/asio/doc/tutorial.qbk
==============================================================================
--- branches/release/libs/asio/doc/tutorial.qbk (original)
+++ branches/release/libs/asio/doc/tutorial.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -205,7 +205,7 @@
 Next, instead of doing a blocking wait as in tutorial Timer.1, we call the [link boost_asio.reference.basic_deadline_timer.async_wait deadline_timer::async_wait()] function to perform an asynchronous wait. When calling this function we pass the `print` callback handler that was defined above.
 
 
- ``''''''`` t.async_wait(print);
+ ``''''''`` t.async_wait(&print);
 
 
 
@@ -262,7 +262,7 @@
   ``''''''`` boost::asio::io_service io;
 
   ``''''''`` boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
- ``''''''`` t.async_wait(print);
+ ``''''''`` t.async_wait(&print);
 
   ``''''''`` io.run();
 
@@ -634,7 +634,7 @@
 
   ``''''''``#include <iostream>
   ``''''''``#include <boost/asio.hpp>
- ``''''''``#include <boost/thread.hpp>
+ ``''''''``#include <boost/thread/thread.hpp>
   ``''''''``#include <boost/bind.hpp>
   ``''''''``#include <boost/date_time/posix_time/posix_time.hpp>
 
@@ -759,7 +759,7 @@
 
   ``''''''``#include <iostream>
   ``''''''``#include <boost/asio.hpp>
- ``''''''``#include <boost/thread.hpp>
+ ``''''''``#include <boost/thread/thread.hpp>
   ``''''''``#include <boost/bind.hpp>
   ``''''''``#include <boost/date_time/posix_time/posix_time.hpp>
 
@@ -888,27 +888,19 @@
 
 
 
-The list of endpoints is returned using an iterator of type [link boost_asio.reference.ip__basic_resolver.iterator ip::tcp::resolver::iterator]. A default constructed [link boost_asio.reference.ip__basic_resolver.iterator ip::tcp::resolver::iterator] object is used as the end iterator.
+The list of endpoints is returned using an iterator of type [link boost_asio.reference.ip__basic_resolver.iterator ip::tcp::resolver::iterator]. (Note that a default constructed [link boost_asio.reference.ip__basic_resolver.iterator ip::tcp::resolver::iterator] object can be used as an end iterator.)
 
 
   ``''''''`` tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
- ``''''''`` tcp::resolver::iterator end;
 
 
 
-Now we create and connect the socket. The list of endpoints obtained above may contain both IPv4 and IPv6 endpoints, so we need to try each of them until we find one that works. This keeps the client program independent of a specific IP version.
+Now we create and connect the socket. The list of endpoints obtained above may contain both IPv4 and IPv6 endpoints, so we need to try each of them until we find one that works. This keeps the client program independent of a specific IP version. The boost::asio::connect() function does this for us automatically.
 
 
 
   ``''''''`` tcp::socket socket(io_service);
- ``''''''`` boost::system::error_code error = boost::asio::error::host_not_found;
- ``''''''`` while (error && endpoint_iterator != end)
- ``''''''`` {
- ``''''''`` socket.close();
- ``''''''`` socket.connect(*endpoint_iterator++, error);
- ``''''''`` }
- ``''''''`` if (error)
- ``''''''`` throw boost::system::system_error(error);
+ ``''''''`` boost::asio::connect(socket, endpoint_iterator);
 
 
 
@@ -994,17 +986,9 @@
   ``''''''`` tcp::resolver resolver(io_service);
   ``''''''`` tcp::resolver::query query(argv[1], "daytime");
   ``''''''`` tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
- ``''''''`` tcp::resolver::iterator end;
 
   ``''''''`` tcp::socket socket(io_service);
- ``''''''`` boost::system::error_code error = boost::asio::error::host_not_found;
- ``''''''`` while (error && endpoint_iterator != end)
- ``''''''`` {
- ``''''''`` socket.close();
- ``''''''`` socket.connect(*endpoint_iterator++, error);
- ``''''''`` }
- ``''''''`` if (error)
- ``''''''`` throw boost::system::system_error(error);
+ ``''''''`` boost::asio::connect(socket, endpoint_iterator);
 
   ``''''''`` for (;;)
   ``''''''`` {
@@ -1098,8 +1082,7 @@
   ``''''''`` std::string message = make_daytime_string();
 
   ``''''''`` boost::system::error_code ignored_error;
- ``''''''`` boost::asio::write(socket, boost::asio::buffer(message),
- ``''''''`` boost::asio::transfer_all(), ignored_error);
+ ``''''''`` boost::asio::write(socket, boost::asio::buffer(message), ignored_error);
   ``''''''`` }
   ``''''''`` }
 
@@ -1171,8 +1154,7 @@
   ``''''''`` std::string message = make_daytime_string();
 
   ``''''''`` boost::system::error_code ignored_error;
- ``''''''`` boost::asio::write(socket, boost::asio::buffer(message),
- ``''''''`` boost::asio::transfer_all(), ignored_error);
+ ``''''''`` boost::asio::write(socket, boost::asio::buffer(message), ignored_error);
   ``''''''`` }
   ``''''''`` }
   ``''''''`` catch (std::exception& e)
@@ -1254,7 +1236,7 @@
   ``''''''`` void start_accept()
   ``''''''`` {
   ``''''''`` tcp_connection::pointer new_connection =
- ``''''''`` tcp_connection::create(acceptor_.io_service());
+ ``''''''`` tcp_connection::create(acceptor_.get_io_service());
 
   ``''''''`` acceptor_.async_accept(new_connection->socket(),
   ``''''''`` boost::bind(&tcp_server::handle_accept, this, new_connection,
@@ -1273,8 +1255,9 @@
   ``''''''`` if (!error)
   ``''''''`` {
   ``''''''`` new_connection->start();
- ``''''''`` start_accept();
   ``''''''`` }
+
+ ``''''''`` start_accept();
   ``''''''`` }
 
 
@@ -1464,7 +1447,7 @@
   ``''''''`` void start_accept()
   ``''''''`` {
   ``''''''`` tcp_connection::pointer new_connection =
- ``''''''`` tcp_connection::create(acceptor_.io_service());
+ ``''''''`` tcp_connection::create(acceptor_.get_io_service());
 
   ``''''''`` acceptor_.async_accept(new_connection->socket(),
   ``''''''`` boost::bind(&tcp_server::handle_accept, this, new_connection,
@@ -1477,8 +1460,9 @@
   ``''''''`` if (!error)
   ``''''''`` {
   ``''''''`` new_connection->start();
- ``''''''`` start_accept();
   ``''''''`` }
+
+ ``''''''`` start_accept();
   ``''''''`` }
 
   ``''''''`` tcp::acceptor acceptor_;
@@ -1560,7 +1544,7 @@
   ``''''''`` udp::socket socket(io_service);
   ``''''''`` socket.open(udp::v4());
 
- ``''''''`` boost::array<char, 1> send_buf = { 0 };
+ ``''''''`` boost::array<char, 1> send_buf = {{ 0 }};
   ``''''''`` socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);
 
 
@@ -1638,7 +1622,7 @@
   ``''''''`` udp::socket socket(io_service);
   ``''''''`` socket.open(udp::v4());
 
- ``''''''`` boost::array<char, 1> send_buf = { 0 };
+ ``''''''`` boost::array<char, 1> send_buf = {{ 0 }};
   ``''''''`` socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);
 
   ``''''''`` boost::array<char, 128> recv_buf;
@@ -2161,7 +2145,7 @@
   ``''''''`` void start_accept()
   ``''''''`` {
   ``''''''`` tcp_connection::pointer new_connection =
- ``''''''`` tcp_connection::create(acceptor_.io_service());
+ ``''''''`` tcp_connection::create(acceptor_.get_io_service());
 
   ``''''''`` acceptor_.async_accept(new_connection->socket(),
   ``''''''`` boost::bind(&tcp_server::handle_accept, this, new_connection,
@@ -2174,8 +2158,9 @@
   ``''''''`` if (!error)
   ``''''''`` {
   ``''''''`` new_connection->start();
- ``''''''`` start_accept();
   ``''''''`` }
+
+ ``''''''`` start_accept();
   ``''''''`` }
 
   ``''''''`` tcp::acceptor acceptor_;
@@ -2322,7 +2307,7 @@
   ``''''''`` void start_accept()
   ``''''''`` {
   ``''''''`` tcp_connection::pointer new_connection =
- ``''''''`` tcp_connection::create(acceptor_.io_service());
+ ``''''''`` tcp_connection::create(acceptor_.get_io_service());
 
   ``''''''`` acceptor_.async_accept(new_connection->socket(),
   ``''''''`` boost::bind(&tcp_server::handle_accept, this, new_connection,
@@ -2335,8 +2320,9 @@
   ``''''''`` if (!error)
   ``''''''`` {
   ``''''''`` new_connection->start();
- ``''''''`` start_accept();
   ``''''''`` }
+
+ ``''''''`` start_accept();
   ``''''''`` }
 
   ``''''''`` tcp::acceptor acceptor_;

Modified: branches/release/libs/asio/doc/using.qbk
==============================================================================
--- branches/release/libs/asio/doc/using.qbk (original)
+++ branches/release/libs/asio/doc/using.qbk 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -139,6 +139,9 @@
 in the project\/compiler settings. Alternatively, `BOOST_ASIO_DYN_LINK` may be
 defined to build a separately-compiled Boost.Asio as part of a shared library.
 
+If using Boost.Asio's SSL support, you will also need to add `#include
+<boost/asio/ssl/impl/src.hpp>`.
+
 [heading Macros]
 
 The macros listed in the table below may be used to control the behaviour of

Modified: branches/release/libs/asio/example/allocation/server.cpp
==============================================================================
--- branches/release/libs/asio/example/allocation/server.cpp (original)
+++ branches/release/libs/asio/example/allocation/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -199,11 +199,12 @@
     if (!error)
     {
       new_session->start();
- new_session.reset(new session(io_service_));
- acceptor_.async_accept(new_session->socket(),
- boost::bind(&server::handle_accept, this, new_session,
- boost::asio::placeholders::error));
     }
+
+ new_session.reset(new session(io_service_));
+ acceptor_.async_accept(new_session->socket(),
+ boost::bind(&server::handle_accept, this, new_session,
+ boost::asio::placeholders::error));
   }
 
 private:

Modified: branches/release/libs/asio/example/buffers/reference_counted.cpp
==============================================================================
--- branches/release/libs/asio/example/buffers/reference_counted.cpp (original)
+++ branches/release/libs/asio/example/buffers/reference_counted.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -92,11 +92,12 @@
     if (!error)
     {
       new_session->start();
- new_session.reset(new session(io_service_));
- acceptor_.async_accept(new_session->socket(),
- boost::bind(&server::handle_accept, this, new_session,
- boost::asio::placeholders::error));
     }
+
+ new_session.reset(new session(io_service_));
+ acceptor_.async_accept(new_session->socket(),
+ boost::bind(&server::handle_accept, this, new_session,
+ boost::asio::placeholders::error));
   }
 
 private:

Modified: branches/release/libs/asio/example/chat/chat_client.cpp
==============================================================================
--- branches/release/libs/asio/example/chat/chat_client.cpp (original)
+++ branches/release/libs/asio/example/chat/chat_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -13,7 +13,7 @@
 #include <iostream>
 #include <boost/bind.hpp>
 #include <boost/asio.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include "chat_message.hpp"
 
 using boost::asio::ip::tcp;
@@ -28,10 +28,9 @@
     : io_service_(io_service),
       socket_(io_service)
   {
- tcp::endpoint endpoint = *endpoint_iterator;
- socket_.async_connect(endpoint,
+ boost::asio::async_connect(socket_, endpoint_iterator,
         boost::bind(&chat_client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
+ boost::asio::placeholders::error));
   }
 
   void write(const chat_message& msg)
@@ -46,8 +45,7 @@
 
 private:
 
- void handle_connect(const boost::system::error_code& error,
- tcp::resolver::iterator endpoint_iterator)
+ void handle_connect(const boost::system::error_code& error)
   {
     if (!error)
     {
@@ -56,14 +54,6 @@
           boost::bind(&chat_client::handle_read_header, this,
             boost::asio::placeholders::error));
     }
- else if (endpoint_iterator != tcp::resolver::iterator())
- {
- socket_.close();
- tcp::endpoint endpoint = *endpoint_iterator;
- socket_.async_connect(endpoint,
- boost::bind(&chat_client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
- }
   }
 
   void handle_read_header(const boost::system::error_code& error)

Modified: branches/release/libs/asio/example/chat/chat_message.hpp
==============================================================================
--- branches/release/libs/asio/example/chat/chat_message.hpp (original)
+++ branches/release/libs/asio/example/chat/chat_message.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -56,9 +56,9 @@
     return body_length_;
   }
 
- void body_length(size_t length)
+ void body_length(size_t new_length)
   {
- body_length_ = length;
+ body_length_ = new_length;
     if (body_length_ > max_body_length)
       body_length_ = max_body_length;
   }

Modified: branches/release/libs/asio/example/chat/chat_server.cpp
==============================================================================
--- branches/release/libs/asio/example/chat/chat_server.cpp (original)
+++ branches/release/libs/asio/example/chat/chat_server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -182,6 +182,11 @@
     : io_service_(io_service),
       acceptor_(io_service, endpoint)
   {
+ start_accept();
+ }
+
+ void start_accept()
+ {
     chat_session_ptr new_session(new chat_session(io_service_, room_));
     acceptor_.async_accept(new_session->socket(),
         boost::bind(&chat_server::handle_accept, this, new_session,
@@ -194,11 +199,9 @@
     if (!error)
     {
       session->start();
- chat_session_ptr new_session(new chat_session(io_service_, room_));
- acceptor_.async_accept(new_session->socket(),
- boost::bind(&chat_server::handle_accept, this, new_session,
- boost::asio::placeholders::error));
     }
+
+ start_accept();
   }
 
 private:

Modified: branches/release/libs/asio/example/chat/posix_chat_client.cpp
==============================================================================
--- branches/release/libs/asio/example/chat/posix_chat_client.cpp (original)
+++ branches/release/libs/asio/example/chat/posix_chat_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -31,17 +31,14 @@
       output_(io_service, ::dup(STDOUT_FILENO)),
       input_buffer_(chat_message::max_body_length)
   {
- // Try connecting to the first endpoint.
- tcp::endpoint endpoint = *endpoint_iterator;
- socket_.async_connect(endpoint,
+ boost::asio::async_connect(socket_, endpoint_iterator,
         boost::bind(&posix_chat_client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
+ boost::asio::placeholders::error));
   }
 
 private:
 
- void handle_connect(const boost::system::error_code& error,
- tcp::resolver::iterator endpoint_iterator)
+ void handle_connect(const boost::system::error_code& error)
   {
     if (!error)
     {
@@ -57,15 +54,6 @@
             boost::asio::placeholders::error,
             boost::asio::placeholders::bytes_transferred));
     }
- else if (endpoint_iterator != tcp::resolver::iterator())
- {
- // That endpoint didn't work, try the next one.
- socket_.close();
- tcp::endpoint endpoint = *endpoint_iterator;
- socket_.async_connect(endpoint,
- boost::bind(&posix_chat_client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
- }
   }
 
   void handle_read_header(const boost::system::error_code& error)

Modified: branches/release/libs/asio/example/echo/async_tcp_echo_server.cpp
==============================================================================
--- branches/release/libs/asio/example/echo/async_tcp_echo_server.cpp (original)
+++ branches/release/libs/asio/example/echo/async_tcp_echo_server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -36,6 +36,7 @@
           boost::asio::placeholders::bytes_transferred));
   }
 
+private:
   void handle_read(const boost::system::error_code& error,
       size_t bytes_transferred)
   {
@@ -67,7 +68,6 @@
     }
   }
 
-private:
   tcp::socket socket_;
   enum { max_length = 1024 };
   char data_[max_length];
@@ -80,6 +80,12 @@
     : io_service_(io_service),
       acceptor_(io_service, tcp::endpoint(tcp::v4(), port))
   {
+ start_accept();
+ }
+
+private:
+ void start_accept()
+ {
     session* new_session = new session(io_service_);
     acceptor_.async_accept(new_session->socket(),
         boost::bind(&server::handle_accept, this, new_session,
@@ -92,18 +98,15 @@
     if (!error)
     {
       new_session->start();
- new_session = new session(io_service_);
- acceptor_.async_accept(new_session->socket(),
- boost::bind(&server::handle_accept, this, new_session,
- boost::asio::placeholders::error));
     }
     else
     {
       delete new_session;
     }
+
+ start_accept();
   }
 
-private:
   boost::asio::io_service& io_service_;
   tcp::acceptor acceptor_;
 };

Modified: branches/release/libs/asio/example/echo/blocking_tcp_echo_client.cpp
==============================================================================
--- branches/release/libs/asio/example/echo/blocking_tcp_echo_client.cpp (original)
+++ branches/release/libs/asio/example/echo/blocking_tcp_echo_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -34,7 +34,7 @@
     tcp::resolver::iterator iterator = resolver.resolve(query);
 
     tcp::socket s(io_service);
- s.connect(*iterator);
+ boost::asio::connect(s, iterator);
 
     using namespace std; // For strlen.
     std::cout << "Enter message: ";

Modified: branches/release/libs/asio/example/echo/blocking_tcp_echo_server.cpp
==============================================================================
--- branches/release/libs/asio/example/echo/blocking_tcp_echo_server.cpp (original)
+++ branches/release/libs/asio/example/echo/blocking_tcp_echo_server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -13,7 +13,7 @@
 #include <boost/bind.hpp>
 #include <boost/smart_ptr.hpp>
 #include <boost/asio.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 
 using boost::asio::ip::tcp;
 

Added: branches/release/libs/asio/example/fork/Jamfile
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/fork/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2003-2011 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)
+#
+
+subproject libs/asio/example/fork ;
+
+project boost : $(BOOST_ROOT) ;
+
+if $(UNIX)
+{
+ switch $(JAMUNAME)
+ {
+ case SunOS* :
+ {
+ SOCKET_LIBS = <find-library>socket <find-library>nsl ;
+ }
+ }
+}
+
+exe daemon
+ : <lib>@boost/libs/system/build/boost_system
+ daemon.cpp
+ : <include>$(BOOST_ROOT)
+ <include>../../../..
+ <define>BOOST_ALL_NO_LIB=1
+ <threading>multi
+ <mingw><*><find-library>ws2_32
+ <mingw><*><find-library>mswsock
+ $(SOCKET_LIBS)
+ ;
+
+exe process_per_connection
+ : <lib>@boost/libs/system/build/boost_system
+ process_per_connection.cpp
+ : <include>$(BOOST_ROOT)
+ <include>../../../..
+ <define>BOOST_ALL_NO_LIB=1
+ <threading>multi
+ <mingw><*><find-library>ws2_32
+ <mingw><*><find-library>mswsock
+ $(SOCKET_LIBS)
+ ;

Added: branches/release/libs/asio/example/fork/Jamfile.v2
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/fork/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2003-2011 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)
+#
+
+import os ;
+
+if [ os.name ] = SOLARIS
+{
+ lib socket ;
+ lib nsl ;
+}
+else if [ os.name ] = NT
+{
+ lib ws2_32 ;
+ lib mswsock ;
+}
+else if [ os.name ] = HPUX
+{
+ lib ipv6 ;
+}
+
+exe daemon
+ : daemon.cpp
+ /boost/system//boost_system
+ : <define>BOOST_ALL_NO_LIB=1
+ <threading>multi
+ <os>SOLARIS:<library>socket
+ <os>SOLARIS:<library>nsl
+ <os>NT:<define>_WIN32_WINNT=0x0501
+ <os>NT,<toolset>gcc:<library>ws2_32
+ <os>NT,<toolset>gcc:<library>mswsock
+ <os>NT,<toolset>gcc-cygwin:<define>__USE_W32_SOCKETS
+ <os>HPUX,<toolset>gcc:<define>_XOPEN_SOURCE_EXTENDED
+ <os>HPUX:<library>ipv6
+ ;
+
+exe process_per_connection
+ : process_per_connection.cpp
+ /boost/system//boost_system
+ : <define>BOOST_ALL_NO_LIB=1
+ <threading>multi
+ <os>SOLARIS:<library>socket
+ <os>SOLARIS:<library>nsl
+ <os>NT:<define>_WIN32_WINNT=0x0501
+ <os>NT,<toolset>gcc:<library>ws2_32
+ <os>NT,<toolset>gcc:<library>mswsock
+ <os>NT,<toolset>gcc-cygwin:<define>__USE_W32_SOCKETS
+ <os>HPUX,<toolset>gcc:<define>_XOPEN_SOURCE_EXTENDED
+ <os>HPUX:<library>ipv6
+ ;

Added: branches/release/libs/asio/example/fork/daemon.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/fork/daemon.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,189 @@
+//
+// daemon.cpp
+// ~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/ip/udp.hpp>
+#include <boost/asio/signal_set.hpp>
+#include <boost/array.hpp>
+#include <boost/bind.hpp>
+#include <ctime>
+#include <iostream>
+#include <syslog.h>
+#include <unistd.h>
+
+using boost::asio::ip::udp;
+
+class udp_daytime_server
+{
+public:
+ udp_daytime_server(boost::asio::io_service& io_service)
+ : socket_(io_service, udp::endpoint(udp::v4(), 13))
+ {
+ start_receive();
+ }
+
+private:
+ void start_receive()
+ {
+ socket_.async_receive_from(
+ boost::asio::buffer(recv_buffer_), remote_endpoint_,
+ boost::bind(&udp_daytime_server::handle_receive, this, _1));
+ }
+
+ void handle_receive(const boost::system::error_code& ec)
+ {
+ if (!ec || ec == boost::asio::error::message_size)
+ {
+ using namespace std; // For time_t, time and ctime;
+ time_t now = time(0);
+ std::string message = ctime(&now);
+
+ boost::system::error_code ignored_ec;
+ socket_.send_to(boost::asio::buffer(message),
+ remote_endpoint_, 0, ignored_ec);
+ }
+
+ start_receive();
+ }
+
+ udp::socket socket_;
+ udp::endpoint remote_endpoint_;
+ boost::array<char, 1> recv_buffer_;
+};
+
+int main()
+{
+ try
+ {
+ boost::asio::io_service io_service;
+
+ // Initialise the server before becoming a daemon. If the process is
+ // started from a shell, this means any errors will be reported back to the
+ // user.
+ udp_daytime_server server(io_service);
+
+ // Register signal handlers so that the daemon may be shut down. You may
+ // also want to register for other signals, such as SIGHUP to trigger a
+ // re-read of a configuration file.
+ boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
+ signals.async_wait(
+ boost::bind(&boost::asio::io_service::stop, &io_service));
+
+ // Inform the io_service that we are about to become a daemon. The
+ // io_service cleans up any internal resources, such as threads, that may
+ // interfere with forking.
+ io_service.notify_fork(boost::asio::io_service::fork_prepare);
+
+ // Fork the process and have the parent exit. If the process was started
+ // from a shell, this returns control to the user. Forking a new process is
+ // also a prerequisite for the subsequent call to setsid().
+ if (pid_t pid = fork())
+ {
+ if (pid > 0)
+ {
+ // We're in the parent process and need to exit.
+ //
+ // When the exit() function is used, the program terminates without
+ // invoking local variables' destructors. Only global variables are
+ // destroyed. As the io_service object is a local variable, this means
+ // we do not have to call:
+ //
+ // io_service.notify_fork(boost::asio::io_service::fork_parent);
+ //
+ // However, this line should be added before each call to exit() if
+ // using a global io_service object. An additional call:
+ //
+ // io_service.notify_fork(boost::asio::io_service::fork_prepare);
+ //
+ // should also precede the second fork().
+ exit(0);
+ }
+ else
+ {
+ syslog(LOG_ERR | LOG_USER, "First fork failed: %m");
+ return 1;
+ }
+ }
+
+ // Make the process a new session leader. This detaches it from the
+ // terminal.
+ setsid();
+
+ // A process inherits its working directory from its parent. This could be
+ // on a mounted filesystem, which means that the running daemon would
+ // prevent this filesystem from being unmounted. Changing to the root
+ // directory avoids this problem.
+ chdir("/");
+
+ // The file mode creation mask is also inherited from the parent process.
+ // We don't want to restrict the permissions on files created by the
+ // daemon, so the mask is cleared.
+ umask(0);
+
+ // A second fork ensures the process cannot acquire a controlling terminal.
+ if (pid_t pid = fork())
+ {
+ if (pid > 0)
+ {
+ exit(0);
+ }
+ else
+ {
+ syslog(LOG_ERR | LOG_USER, "Second fork failed: %m");
+ return 1;
+ }
+ }
+
+ // Close the standard streams. This decouples the daemon from the terminal
+ // that started it.
+ close(0);
+ close(1);
+ close(2);
+
+ // We don't want the daemon to have any standard input.
+ if (open("/dev/null", O_RDONLY) < 0)
+ {
+ syslog(LOG_ERR | LOG_USER, "Unable to open /dev/null: %m");
+ return 1;
+ }
+
+ // Send standard output to a log file.
+ const char* output = "/tmp/asio.daemon.out";
+ const int flags = O_WRONLY | O_CREAT | O_APPEND;
+ const mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
+ if (open(output, flags, mode) < 0)
+ {
+ syslog(LOG_ERR | LOG_USER, "Unable to open output file %s: %m", output);
+ return 1;
+ }
+
+ // Also send standard error to the same log file.
+ if (dup(1) < 0)
+ {
+ syslog(LOG_ERR | LOG_USER, "Unable to dup output descriptor: %m");
+ return 1;
+ }
+
+ // Inform the io_service that we have finished becoming a daemon. The
+ // io_service uses this opportunity to create any internal file descriptors
+ // that need to be private to the new process.
+ io_service.notify_fork(boost::asio::io_service::fork_child);
+
+ // The io_service can now be used normally.
+ syslog(LOG_INFO | LOG_USER, "Daemon started");
+ io_service.run();
+ syslog(LOG_INFO | LOG_USER, "Daemon stopped");
+ }
+ catch (std::exception& e)
+ {
+ syslog(LOG_ERR | LOG_USER, "Exception: %s", e.what());
+ std::cerr << "Exception: " << e.what() << std::endl;
+ }
+}

Added: branches/release/libs/asio/example/fork/process_per_connection.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/fork/process_per_connection.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,160 @@
+//
+// process_per_connection.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#include <boost/asio/io_service.hpp>
+#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/signal_set.hpp>
+#include <boost/asio/write.hpp>
+#include <boost/array.hpp>
+#include <boost/bind.hpp>
+#include <cstdlib>
+#include <iostream>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+using boost::asio::ip::tcp;
+
+class server
+{
+public:
+ server(boost::asio::io_service& io_service, unsigned short port)
+ : io_service_(io_service),
+ signal_(io_service, SIGCHLD),
+ acceptor_(io_service, tcp::endpoint(tcp::v4(), port)),
+ socket_(io_service)
+ {
+ start_signal_wait();
+ start_accept();
+ }
+
+private:
+ void start_signal_wait()
+ {
+ signal_.async_wait(boost::bind(&server::handle_signal_wait, this));
+ }
+
+ void handle_signal_wait()
+ {
+ // Only the parent process should check for this signal. We can determine
+ // whether we are in the parent by checking if the acceptor is still open.
+ if (acceptor_.is_open())
+ {
+ // Reap completed child processes so that we don't end up with zombies.
+ int status = 0;
+ while (waitpid(-1, &status, WNOHANG) > 0) {}
+
+ start_signal_wait();
+ }
+ }
+
+ void start_accept()
+ {
+ acceptor_.async_accept(socket_,
+ boost::bind(&server::handle_accept, this, _1));
+ }
+
+ void handle_accept(const boost::system::error_code& ec)
+ {
+ if (!ec)
+ {
+ // Inform the io_service that we are about to fork. The io_service cleans
+ // up any internal resources, such as threads, that may interfere with
+ // forking.
+ io_service_.notify_fork(boost::asio::io_service::fork_prepare);
+
+ if (fork() == 0)
+ {
+ // Inform the io_service that the fork is finished and that this is the
+ // child process. The io_service uses this opportunity to create any
+ // internal file descriptors that must be private to the new process.
+ io_service_.notify_fork(boost::asio::io_service::fork_child);
+
+ // The child won't be accepting new connections, so we can close the
+ // acceptor. It remains open in the parent.
+ acceptor_.close();
+
+ // The child process is not interested in processing the SIGCHLD signal.
+ signal_.cancel();
+
+ start_read();
+ }
+ else
+ {
+ // Inform the io_service that the fork is finished (or failed) and that
+ // this is the parent process. The io_service uses this opportunity to
+ // recreate any internal resources that were cleaned up during
+ // preparation for the fork.
+ io_service_.notify_fork(boost::asio::io_service::fork_parent);
+
+ socket_.close();
+ start_accept();
+ }
+ }
+ else
+ {
+ std::cerr << "Accept error: " << ec.message() << std::endl;
+ start_accept();
+ }
+ }
+
+ void start_read()
+ {
+ socket_.async_read_some(boost::asio::buffer(data_),
+ boost::bind(&server::handle_read, this, _1, _2));
+ }
+
+ void handle_read(const boost::system::error_code& ec, std::size_t length)
+ {
+ if (!ec)
+ start_write(length);
+ }
+
+ void start_write(std::size_t length)
+ {
+ boost::asio::async_write(socket_, boost::asio::buffer(data_, length),
+ boost::bind(&server::handle_write, this, _1));
+ }
+
+ void handle_write(const boost::system::error_code& ec)
+ {
+ if (!ec)
+ start_read();
+ }
+
+ boost::asio::io_service& io_service_;
+ boost::asio::signal_set signal_;
+ tcp::acceptor acceptor_;
+ tcp::socket socket_;
+ boost::array<char, 1024> data_;
+};
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ if (argc != 2)
+ {
+ std::cerr << "Usage: process_per_connection <port>\n";
+ return 1;
+ }
+
+ boost::asio::io_service io_service;
+
+ using namespace std; // For atoi.
+ server s(io_service, atoi(argv[1]));
+
+ io_service.run();
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "Exception: " << e.what() << std::endl;
+ }
+}

Modified: branches/release/libs/asio/example/http/client/async_client.cpp
==============================================================================
--- branches/release/libs/asio/example/http/client/async_client.cpp (original)
+++ branches/release/libs/asio/example/http/client/async_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -49,12 +49,11 @@
   {
     if (!err)
     {
- // Attempt a connection to the first endpoint in the list. Each endpoint
- // will be tried until we successfully establish a connection.
- tcp::endpoint endpoint = *endpoint_iterator;
- socket_.async_connect(endpoint,
+ // Attempt a connection to each endpoint in the list until we
+ // successfully establish a connection.
+ boost::asio::async_connect(socket_, endpoint_iterator,
           boost::bind(&client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
+ boost::asio::placeholders::error));
     }
     else
     {
@@ -62,8 +61,7 @@
     }
   }
 
- void handle_connect(const boost::system::error_code& err,
- tcp::resolver::iterator endpoint_iterator)
+ void handle_connect(const boost::system::error_code& err)
   {
     if (!err)
     {
@@ -72,15 +70,6 @@
           boost::bind(&client::handle_write_request, this,
             boost::asio::placeholders::error));
     }
- else if (endpoint_iterator != tcp::resolver::iterator())
- {
- // The connection failed. Try the next endpoint in the list.
- socket_.close();
- tcp::endpoint endpoint = *endpoint_iterator;
- socket_.async_connect(endpoint,
- boost::bind(&client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
- }
     else
     {
       std::cout << "Error: " << err.message() << "\n";

Modified: branches/release/libs/asio/example/http/client/sync_client.cpp
==============================================================================
--- branches/release/libs/asio/example/http/client/sync_client.cpp (original)
+++ branches/release/libs/asio/example/http/client/sync_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -34,18 +34,10 @@
     tcp::resolver resolver(io_service);
     tcp::resolver::query query(argv[1], "http");
     tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
- tcp::resolver::iterator end;
 
     // Try each endpoint until we successfully establish a connection.
     tcp::socket socket(io_service);
- boost::system::error_code error = boost::asio::error::host_not_found;
- while (error && endpoint_iterator != end)
- {
- socket.close();
- socket.connect(*endpoint_iterator++, error);
- }
- if (error)
- throw boost::system::system_error(error);
+ boost::asio::connect(socket, endpoint_iterator);
 
     // Form the request. We specify the "Connection: close" header so that the
     // server will close the socket after transmitting the response. This will
@@ -99,6 +91,7 @@
       std::cout << &response;
 
     // Read until EOF, writing data to output as we go.
+ boost::system::error_code error;
     while (boost::asio::read(socket, response,
           boost::asio::transfer_at_least(1), error))
       std::cout << &response;

Modified: branches/release/libs/asio/example/http/server/Jamfile
==============================================================================
--- branches/release/libs/asio/example/http/server/Jamfile (original)
+++ branches/release/libs/asio/example/http/server/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -25,13 +25,12 @@
     <lib>@boost/libs/system/build/boost_system
     connection.cpp
     connection_manager.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_handler.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
   : <include>$(BOOST_ROOT)
     <include>../../../../..
     <define>BOOST_ALL_NO_LIB=1

Modified: branches/release/libs/asio/example/http/server/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/example/http/server/Jamfile.v2 (original)
+++ branches/release/libs/asio/example/http/server/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -25,13 +25,12 @@
 exe server
   : connection.cpp
     connection_manager.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_handler.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
     /boost/system//boost_system
     /boost/thread//boost_thread
   : <define>BOOST_ALL_NO_LIB=1

Added: branches/release/libs/asio/example/http/server/main.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/http/server/main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,44 @@
+//
+// main.cpp
+// ~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#include <iostream>
+#include <string>
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include "server.hpp"
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ // Check command line arguments.
+ if (argc != 4)
+ {
+ std::cerr << "Usage: http_server <address> <port> <doc_root>\n";
+ std::cerr << " For IPv4, try:\n";
+ std::cerr << " receiver 0.0.0.0 80 .\n";
+ std::cerr << " For IPv6, try:\n";
+ std::cerr << " receiver 0::0 80 .\n";
+ return 1;
+ }
+
+ // Initialise the server.
+ http::server::server s(argv[1], argv[2], argv[3]);
+
+ // Run the server until stopped.
+ s.run();
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "exception: " << e.what() << "\n";
+ }
+
+ return 0;
+}

Deleted: branches/release/libs/asio/example/http/server/posix_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server/posix_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,73 +0,0 @@
-//
-// posix_main.cpp
-// ~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <string>
-#include <boost/asio.hpp>
-#include <boost/thread.hpp>
-#include <boost/bind.hpp>
-#include "server.hpp"
-
-#if !defined(_WIN32)
-
-#include <pthread.h>
-#include <signal.h>
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 4)
- {
- std::cerr << "Usage: http_server <address> <port> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " receiver 0.0.0.0 80 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " receiver 0::0 80 .\n";
- return 1;
- }
-
- // Block all signals for background thread.
- sigset_t new_mask;
- sigfillset(&new_mask);
- sigset_t old_mask;
- pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
- // Run server in background thread.
- http::server::server s(argv[1], argv[2], argv[3]);
- boost::thread t(boost::bind(&http::server::server::run, &s));
-
- // Restore previous signals.
- pthread_sigmask(SIG_SETMASK, &old_mask, 0);
-
- // Wait for signal indicating time to shut down.
- sigset_t wait_mask;
- sigemptyset(&wait_mask);
- sigaddset(&wait_mask, SIGINT);
- sigaddset(&wait_mask, SIGQUIT);
- sigaddset(&wait_mask, SIGTERM);
- pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
- int sig = 0;
- sigwait(&wait_mask, &sig);
-
- // Stop the server.
- s.stop();
- t.join();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // !defined(_WIN32)

Modified: branches/release/libs/asio/example/http/server/server.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server/server.cpp (original)
+++ branches/release/libs/asio/example/http/server/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -10,6 +10,7 @@
 
 #include "server.hpp"
 #include <boost/bind.hpp>
+#include <signal.h>
 
 namespace http {
 namespace server {
@@ -17,12 +18,22 @@
 server::server(const std::string& address, const std::string& port,
     const std::string& doc_root)
   : io_service_(),
+ signals_(io_service_),
     acceptor_(io_service_),
     connection_manager_(),
- new_connection_(new connection(io_service_,
- connection_manager_, request_handler_)),
+ new_connection_(),
     request_handler_(doc_root)
 {
+ // Register to handle the signals that indicate when the server should exit.
+ // It is safe to register for the same signal multiple times in a program,
+ // provided all registration for the specified signal is made through Asio.
+ signals_.add(SIGINT);
+ signals_.add(SIGTERM);
+#if defined(SIGQUIT)
+ signals_.add(SIGQUIT);
+#endif // defined(SIGQUIT)
+ signals_.async_wait(boost::bind(&server::handle_stop, this));
+
   // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
   boost::asio::ip::tcp::resolver resolver(io_service_);
   boost::asio::ip::tcp::resolver::query query(address, port);
@@ -31,9 +42,8 @@
   acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
   acceptor_.bind(endpoint);
   acceptor_.listen();
- acceptor_.async_accept(new_connection_->socket(),
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error));
+
+ start_accept();
 }
 
 void server::run()
@@ -45,24 +55,30 @@
   io_service_.run();
 }
 
-void server::stop()
+void server::start_accept()
 {
- // Post a call to the stop function so that server::stop() is safe to call
- // from any thread.
- io_service_.post(boost::bind(&server::handle_stop, this));
+ new_connection_.reset(new connection(io_service_,
+ connection_manager_, request_handler_));
+ acceptor_.async_accept(new_connection_->socket(),
+ boost::bind(&server::handle_accept, this,
+ boost::asio::placeholders::error));
 }
 
 void server::handle_accept(const boost::system::error_code& e)
 {
+ // Check whether the server was stopped by a signal before this completion
+ // handler had a chance to run.
+ if (!acceptor_.is_open())
+ {
+ return;
+ }
+
   if (!e)
   {
     connection_manager_.start(new_connection_);
- new_connection_.reset(new connection(io_service_,
- connection_manager_, request_handler_));
- acceptor_.async_accept(new_connection_->socket(),
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error));
   }
+
+ start_accept();
 }
 
 void server::handle_stop()

Modified: branches/release/libs/asio/example/http/server/server.hpp
==============================================================================
--- branches/release/libs/asio/example/http/server/server.hpp (original)
+++ branches/release/libs/asio/example/http/server/server.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -34,10 +34,10 @@
   /// Run the server's io_service loop.
   void run();
 
- /// Stop the server.
- void stop();
-
 private:
+ /// Initiate an asynchronous accept operation.
+ void start_accept();
+
   /// Handle completion of an asynchronous accept operation.
   void handle_accept(const boost::system::error_code& e);
 
@@ -47,6 +47,9 @@
   /// The io_service used to perform asynchronous operations.
   boost::asio::io_service io_service_;
 
+ /// The signal_set is used to register for process termination notifications.
+ boost::asio::signal_set signals_;
+
   /// Acceptor used to listen for incoming connections.
   boost::asio::ip::tcp::acceptor acceptor_;
 

Deleted: branches/release/libs/asio/example/http/server/win_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server/win_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,70 +0,0 @@
-//
-// win_main.cpp
-// ~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <string>
-#include <boost/asio.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include "server.hpp"
-
-#if defined(_WIN32)
-
-boost::function0<void> console_ctrl_function;
-
-BOOL WINAPI console_ctrl_handler(DWORD ctrl_type)
-{
- switch (ctrl_type)
- {
- case CTRL_C_EVENT:
- case CTRL_BREAK_EVENT:
- case CTRL_CLOSE_EVENT:
- case CTRL_SHUTDOWN_EVENT:
- console_ctrl_function();
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 4)
- {
- std::cerr << "Usage: http_server <address> <port> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " http_server 0.0.0.0 80 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " http_server 0::0 80 .\n";
- return 1;
- }
-
- // Initialise server.
- http::server::server s(argv[1], argv[2], argv[3]);
-
- // Set console control handler to allow server to be stopped.
- console_ctrl_function = boost::bind(&http::server::server::stop, &s);
- SetConsoleCtrlHandler(console_ctrl_handler, TRUE);
-
- // Run the server until stopped.
- s.run();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // defined(_WIN32)

Modified: branches/release/libs/asio/example/http/server2/Jamfile
==============================================================================
--- branches/release/libs/asio/example/http/server2/Jamfile (original)
+++ branches/release/libs/asio/example/http/server2/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -25,13 +25,12 @@
     <lib>@boost/libs/system/build/boost_system
     connection.cpp
     io_service_pool.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_handler.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
   : <include>$(BOOST_ROOT)
     <include>../../../../..
     <define>BOOST_ALL_NO_LIB=1

Modified: branches/release/libs/asio/example/http/server2/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/example/http/server2/Jamfile.v2 (original)
+++ branches/release/libs/asio/example/http/server2/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -25,13 +25,12 @@
 exe server
   : connection.cpp
     io_service_pool.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_handler.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
     /boost/system//boost_system
     /boost/thread//boost_thread
   : <define>BOOST_ALL_NO_LIB=1

Modified: branches/release/libs/asio/example/http/server2/io_service_pool.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server2/io_service_pool.cpp (original)
+++ branches/release/libs/asio/example/http/server2/io_service_pool.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -10,7 +10,7 @@
 
 #include "server.hpp"
 #include <stdexcept>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 #include <boost/shared_ptr.hpp>
 

Added: branches/release/libs/asio/example/http/server2/main.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/http/server2/main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,46 @@
+//
+// main.cpp
+// ~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#include <iostream>
+#include <string>
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include "server.hpp"
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ // Check command line arguments.
+ if (argc != 5)
+ {
+ std::cerr << "Usage: http_server <address> <port> <threads> <doc_root>\n";
+ std::cerr << " For IPv4, try:\n";
+ std::cerr << " receiver 0.0.0.0 80 1 .\n";
+ std::cerr << " For IPv6, try:\n";
+ std::cerr << " receiver 0::0 80 1 .\n";
+ return 1;
+ }
+
+ // Initialise the server.
+ std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
+ http::server2::server s(argv[1], argv[2], argv[4], num_threads);
+
+ // Run the server until stopped.
+ s.run();
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "exception: " << e.what() << "\n";
+ }
+
+ return 0;
+}

Deleted: branches/release/libs/asio/example/http/server2/posix_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server2/posix_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,75 +0,0 @@
-//
-// posix_main.cpp
-// ~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <string>
-#include <boost/asio.hpp>
-#include <boost/thread.hpp>
-#include <boost/bind.hpp>
-#include <boost/lexical_cast.hpp>
-#include "server.hpp"
-
-#if !defined(_WIN32)
-
-#include <pthread.h>
-#include <signal.h>
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 5)
- {
- std::cerr << "Usage: http_server <address> <port> <threads> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " receiver 0.0.0.0 80 1 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " receiver 0::0 80 1 .\n";
- return 1;
- }
-
- // Block all signals for background thread.
- sigset_t new_mask;
- sigfillset(&new_mask);
- sigset_t old_mask;
- pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
- // Run server in background thread.
- std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
- http::server2::server s(argv[1], argv[2], argv[4], num_threads);
- boost::thread t(boost::bind(&http::server2::server::run, &s));
-
- // Restore previous signals.
- pthread_sigmask(SIG_SETMASK, &old_mask, 0);
-
- // Wait for signal indicating time to shut down.
- sigset_t wait_mask;
- sigemptyset(&wait_mask);
- sigaddset(&wait_mask, SIGINT);
- sigaddset(&wait_mask, SIGQUIT);
- sigaddset(&wait_mask, SIGTERM);
- pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
- int sig = 0;
- sigwait(&wait_mask, &sig);
-
- // Stop the server.
- s.stop();
- t.join();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // !defined(_WIN32)

Modified: branches/release/libs/asio/example/http/server2/server.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server2/server.cpp (original)
+++ branches/release/libs/asio/example/http/server2/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,22 +17,31 @@
 server::server(const std::string& address, const std::string& port,
     const std::string& doc_root, std::size_t io_service_pool_size)
   : io_service_pool_(io_service_pool_size),
+ signals_(io_service_pool_.get_io_service()),
     acceptor_(io_service_pool_.get_io_service()),
- new_connection_(new connection(
- io_service_pool_.get_io_service(), request_handler_)),
+ new_connection_(),
     request_handler_(doc_root)
 {
+ // Register to handle the signals that indicate when the server should exit.
+ // It is safe to register for the same signal multiple times in a program,
+ // provided all registration for the specified signal is made through Asio.
+ signals_.add(SIGINT);
+ signals_.add(SIGTERM);
+#if defined(SIGQUIT)
+ signals_.add(SIGQUIT);
+#endif // defined(SIGQUIT)
+ signals_.async_wait(boost::bind(&server::handle_stop, this));
+
   // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
- boost::asio::ip::tcp::resolver resolver(acceptor_.io_service());
+ boost::asio::ip::tcp::resolver resolver(acceptor_.get_io_service());
   boost::asio::ip::tcp::resolver::query query(address, port);
   boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
   acceptor_.open(endpoint.protocol());
   acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
   acceptor_.bind(endpoint);
   acceptor_.listen();
- acceptor_.async_accept(new_connection_->socket(),
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error));
+
+ start_accept();
 }
 
 void server::run()
@@ -40,9 +49,13 @@
   io_service_pool_.run();
 }
 
-void server::stop()
+void server::start_accept()
 {
- io_service_pool_.stop();
+ new_connection_.reset(new connection(
+ io_service_pool_.get_io_service(), request_handler_));
+ acceptor_.async_accept(new_connection_->socket(),
+ boost::bind(&server::handle_accept, this,
+ boost::asio::placeholders::error));
 }
 
 void server::handle_accept(const boost::system::error_code& e)
@@ -50,12 +63,14 @@
   if (!e)
   {
     new_connection_->start();
- new_connection_.reset(new connection(
- io_service_pool_.get_io_service(), request_handler_));
- acceptor_.async_accept(new_connection_->socket(),
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error));
   }
+
+ start_accept();
+}
+
+void server::handle_stop()
+{
+ io_service_pool_.stop();
 }
 
 } // namespace server2

Modified: branches/release/libs/asio/example/http/server2/server.hpp
==============================================================================
--- branches/release/libs/asio/example/http/server2/server.hpp (original)
+++ branches/release/libs/asio/example/http/server2/server.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -36,16 +36,22 @@
   /// Run the server's io_service loop.
   void run();
 
- /// Stop the server.
- void stop();
-
 private:
+ /// Initiate an asynchronous accept operation.
+ void start_accept();
+
   /// Handle completion of an asynchronous accept operation.
   void handle_accept(const boost::system::error_code& e);
 
+ /// Handle a request to stop the server.
+ void handle_stop();
+
   /// The pool of io_service objects used to perform asynchronous operations.
   io_service_pool io_service_pool_;
 
+ /// The signal_set is used to register for process termination notifications.
+ boost::asio::signal_set signals_;
+
   /// Acceptor used to listen for incoming connections.
   boost::asio::ip::tcp::acceptor acceptor_;
 

Deleted: branches/release/libs/asio/example/http/server2/win_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server2/win_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,72 +0,0 @@
-//
-// win_main.cpp
-// ~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <string>
-#include <boost/asio.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/lexical_cast.hpp>
-#include "server.hpp"
-
-#if defined(_WIN32)
-
-boost::function0<void> console_ctrl_function;
-
-BOOL WINAPI console_ctrl_handler(DWORD ctrl_type)
-{
- switch (ctrl_type)
- {
- case CTRL_C_EVENT:
- case CTRL_BREAK_EVENT:
- case CTRL_CLOSE_EVENT:
- case CTRL_SHUTDOWN_EVENT:
- console_ctrl_function();
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 5)
- {
- std::cerr << "Usage: http_server <address> <port> <threads> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " http_server 0.0.0.0 80 1 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " http_server 0::0 80 1 .\n";
- return 1;
- }
-
- // Initialise server.
- std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
- http::server2::server s(argv[1], argv[2], argv[4], num_threads);
-
- // Set console control handler to allow server to be stopped.
- console_ctrl_function = boost::bind(&http::server2::server::stop, &s);
- SetConsoleCtrlHandler(console_ctrl_handler, TRUE);
-
- // Run the server until stopped.
- s.run();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // defined(_WIN32)

Modified: branches/release/libs/asio/example/http/server3/Jamfile
==============================================================================
--- branches/release/libs/asio/example/http/server3/Jamfile (original)
+++ branches/release/libs/asio/example/http/server3/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -24,13 +24,12 @@
   : <lib>@boost/libs/thread/build/boost_thread
     <lib>@boost/libs/system/build/boost_system
     connection.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_handler.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
   : <include>$(BOOST_ROOT)
     <include>../../../../..
     <define>BOOST_ALL_NO_LIB=1

Modified: branches/release/libs/asio/example/http/server3/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/example/http/server3/Jamfile.v2 (original)
+++ branches/release/libs/asio/example/http/server3/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -24,13 +24,12 @@
 
 exe server
   : connection.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_handler.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
     /boost/system//boost_system
     /boost/thread//boost_thread
   : <define>BOOST_ALL_NO_LIB=1

Added: branches/release/libs/asio/example/http/server3/main.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/http/server3/main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,46 @@
+//
+// main.cpp
+// ~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#include <iostream>
+#include <string>
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include "server.hpp"
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ // Check command line arguments.
+ if (argc != 5)
+ {
+ std::cerr << "Usage: http_server <address> <port> <threads> <doc_root>\n";
+ std::cerr << " For IPv4, try:\n";
+ std::cerr << " receiver 0.0.0.0 80 1 .\n";
+ std::cerr << " For IPv6, try:\n";
+ std::cerr << " receiver 0::0 80 1 .\n";
+ return 1;
+ }
+
+ // Initialise the server.
+ std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
+ http::server3::server s(argv[1], argv[2], argv[4], num_threads);
+
+ // Run the server until stopped.
+ s.run();
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "exception: " << e.what() << "\n";
+ }
+
+ return 0;
+}

Deleted: branches/release/libs/asio/example/http/server3/posix_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server3/posix_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,75 +0,0 @@
-//
-// posix_main.cpp
-// ~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <string>
-#include <boost/asio.hpp>
-#include <boost/thread.hpp>
-#include <boost/bind.hpp>
-#include <boost/lexical_cast.hpp>
-#include "server.hpp"
-
-#if !defined(_WIN32)
-
-#include <pthread.h>
-#include <signal.h>
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 5)
- {
- std::cerr << "Usage: http_server <address> <port> <threads> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " receiver 0.0.0.0 80 1 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " receiver 0::0 80 1 .\n";
- return 1;
- }
-
- // Block all signals for background thread.
- sigset_t new_mask;
- sigfillset(&new_mask);
- sigset_t old_mask;
- pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
- // Run server in background thread.
- std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
- http::server3::server s(argv[1], argv[2], argv[4], num_threads);
- boost::thread t(boost::bind(&http::server3::server::run, &s));
-
- // Restore previous signals.
- pthread_sigmask(SIG_SETMASK, &old_mask, 0);
-
- // Wait for signal indicating time to shut down.
- sigset_t wait_mask;
- sigemptyset(&wait_mask);
- sigaddset(&wait_mask, SIGINT);
- sigaddset(&wait_mask, SIGQUIT);
- sigaddset(&wait_mask, SIGTERM);
- pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
- int sig = 0;
- sigwait(&wait_mask, &sig);
-
- // Stop the server.
- s.stop();
- t.join();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // !defined(_WIN32)

Modified: branches/release/libs/asio/example/http/server3/server.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server3/server.cpp (original)
+++ branches/release/libs/asio/example/http/server3/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -9,7 +9,7 @@
 //
 
 #include "server.hpp"
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 #include <boost/shared_ptr.hpp>
 #include <vector>
@@ -20,10 +20,21 @@
 server::server(const std::string& address, const std::string& port,
     const std::string& doc_root, std::size_t thread_pool_size)
   : thread_pool_size_(thread_pool_size),
+ signals_(io_service_),
     acceptor_(io_service_),
- new_connection_(new connection(io_service_, request_handler_)),
+ new_connection_(),
     request_handler_(doc_root)
 {
+ // Register to handle the signals that indicate when the server should exit.
+ // It is safe to register for the same signal multiple times in a program,
+ // provided all registration for the specified signal is made through Asio.
+ signals_.add(SIGINT);
+ signals_.add(SIGTERM);
+#if defined(SIGQUIT)
+ signals_.add(SIGQUIT);
+#endif // defined(SIGQUIT)
+ signals_.async_wait(boost::bind(&server::handle_stop, this));
+
   // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
   boost::asio::ip::tcp::resolver resolver(io_service_);
   boost::asio::ip::tcp::resolver::query query(address, port);
@@ -32,9 +43,8 @@
   acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
   acceptor_.bind(endpoint);
   acceptor_.listen();
- acceptor_.async_accept(new_connection_->socket(),
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error));
+
+ start_accept();
 }
 
 void server::run()
@@ -53,9 +63,12 @@
     threads[i]->join();
 }
 
-void server::stop()
+void server::start_accept()
 {
- io_service_.stop();
+ new_connection_.reset(new connection(io_service_, request_handler_));
+ acceptor_.async_accept(new_connection_->socket(),
+ boost::bind(&server::handle_accept, this,
+ boost::asio::placeholders::error));
 }
 
 void server::handle_accept(const boost::system::error_code& e)
@@ -63,11 +76,14 @@
   if (!e)
   {
     new_connection_->start();
- new_connection_.reset(new connection(io_service_, request_handler_));
- acceptor_.async_accept(new_connection_->socket(),
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error));
   }
+
+ start_accept();
+}
+
+void server::handle_stop()
+{
+ io_service_.stop();
 }
 
 } // namespace server3

Modified: branches/release/libs/asio/example/http/server3/server.hpp
==============================================================================
--- branches/release/libs/asio/example/http/server3/server.hpp (original)
+++ branches/release/libs/asio/example/http/server3/server.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -35,19 +35,25 @@
   /// Run the server's io_service loop.
   void run();
 
- /// Stop the server.
- void stop();
-
 private:
+ /// Initiate an asynchronous accept operation.
+ void start_accept();
+
   /// Handle completion of an asynchronous accept operation.
   void handle_accept(const boost::system::error_code& e);
 
+ /// Handle a request to stop the server.
+ void handle_stop();
+
   /// The number of threads that will call io_service::run().
   std::size_t thread_pool_size_;
 
   /// The io_service used to perform asynchronous operations.
   boost::asio::io_service io_service_;
 
+ /// The signal_set is used to register for process termination notifications.
+ boost::asio::signal_set signals_;
+
   /// Acceptor used to listen for incoming connections.
   boost::asio::ip::tcp::acceptor acceptor_;
 

Deleted: branches/release/libs/asio/example/http/server3/win_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server3/win_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,72 +0,0 @@
-//
-// win_main.cpp
-// ~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <string>
-#include <boost/asio.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/lexical_cast.hpp>
-#include "server.hpp"
-
-#if defined(_WIN32)
-
-boost::function0<void> console_ctrl_function;
-
-BOOL WINAPI console_ctrl_handler(DWORD ctrl_type)
-{
- switch (ctrl_type)
- {
- case CTRL_C_EVENT:
- case CTRL_BREAK_EVENT:
- case CTRL_CLOSE_EVENT:
- case CTRL_SHUTDOWN_EVENT:
- console_ctrl_function();
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 5)
- {
- std::cerr << "Usage: http_server <address> <port> <threads> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " http_server 0.0.0.0 80 1 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " http_server 0::0 80 1 .\n";
- return 1;
- }
-
- // Initialise server.
- std::size_t num_threads = boost::lexical_cast<std::size_t>(argv[3]);
- http::server3::server s(argv[1], argv[2], argv[4], num_threads);
-
- // Set console control handler to allow server to be stopped.
- console_ctrl_function = boost::bind(&http::server3::server::stop, &s);
- SetConsoleCtrlHandler(console_ctrl_handler, TRUE);
-
- // Run the server until stopped.
- s.run();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // defined(_WIN32)

Modified: branches/release/libs/asio/example/http/server4/Jamfile
==============================================================================
--- branches/release/libs/asio/example/http/server4/Jamfile (original)
+++ branches/release/libs/asio/example/http/server4/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -24,12 +24,11 @@
   : <lib>@boost/libs/thread/build/boost_thread
     <lib>@boost/libs/system/build/boost_system
     file_handler.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
   : <include>$(BOOST_ROOT)
     <include>../../../../..
     <define>BOOST_ALL_NO_LIB=1

Modified: branches/release/libs/asio/example/http/server4/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/example/http/server4/Jamfile.v2 (original)
+++ branches/release/libs/asio/example/http/server4/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -24,12 +24,11 @@
 
 exe server
   : file_handler.cpp
+ main.cpp
     mime_types.cpp
- posix_main.cpp
     reply.cpp
     request_parser.cpp
     server.cpp
- win_main.cpp
     /boost/system//boost_system
     /boost/thread//boost_thread
   : <define>BOOST_ALL_NO_LIB=1

Added: branches/release/libs/asio/example/http/server4/main.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/http/server4/main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,58 @@
+//
+// main.cpp
+// ~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#include <iostream>
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include <signal.h>
+#include "server.hpp"
+#include "file_handler.hpp"
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ // Check command line arguments.
+ if (argc != 4)
+ {
+ std::cerr << "Usage: http_server <address> <port> <doc_root>\n";
+ std::cerr << " For IPv4, try:\n";
+ std::cerr << " receiver 0.0.0.0 80 .\n";
+ std::cerr << " For IPv6, try:\n";
+ std::cerr << " receiver 0::0 80 .\n";
+ return 1;
+ }
+
+ boost::asio::io_service io_service;
+
+ // Launch the initial server coroutine.
+ http::server4::server(io_service, argv[1], argv[2],
+ http::server4::file_handler(argv[3]))();
+
+ // Wait for signals indicating time to shut down.
+ boost::asio::signal_set signals(io_service);
+ signals.add(SIGINT);
+ signals.add(SIGTERM);
+#if defined(SIGQUIT)
+ signals.add(SIGQUIT);
+#endif // defined(SIGQUIT)
+ signals.async_wait(boost::bind(
+ &boost::asio::io_service::stop, &io_service));
+
+ // Run the server.
+ io_service.run();
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "exception: " << e.what() << "\n";
+ }
+
+ return 0;
+}

Deleted: branches/release/libs/asio/example/http/server4/posix_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server4/posix_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,78 +0,0 @@
-//
-// posix_main.cpp
-// ~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <boost/asio.hpp>
-#include <boost/thread.hpp>
-#include <boost/bind.hpp>
-#include "server.hpp"
-#include "file_handler.hpp"
-
-#if !defined(_WIN32)
-
-#include <pthread.h>
-#include <signal.h>
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 4)
- {
- std::cerr << "Usage: http_server <address> <port> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " receiver 0.0.0.0 80 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " receiver 0::0 80 .\n";
- return 1;
- }
-
- boost::asio::io_service io_service;
-
- // Launch the initial server coroutine.
- http::server4::server(io_service, argv[1], argv[2],
- http::server4::file_handler(argv[3]))();
-
- // Block all signals for background thread.
- sigset_t new_mask;
- sigfillset(&new_mask);
- sigset_t old_mask;
- pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
-
- // Run server in background thread.
- boost::thread t(boost::bind(&boost::asio::io_service::run, &io_service));
-
- // Restore previous signals.
- pthread_sigmask(SIG_SETMASK, &old_mask, 0);
-
- // Wait for signal indicating time to shut down.
- sigset_t wait_mask;
- sigemptyset(&wait_mask);
- sigaddset(&wait_mask, SIGINT);
- sigaddset(&wait_mask, SIGQUIT);
- sigaddset(&wait_mask, SIGTERM);
- pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
- int sig = 0;
- sigwait(&wait_mask, &sig);
-
- // Stop the server and wait for the background thread to exit.
- io_service.stop();
- t.join();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // !defined(_WIN32)

Deleted: branches/release/libs/asio/example/http/server4/win_main.cpp
==============================================================================
--- branches/release/libs/asio/example/http/server4/win_main.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
+++ (empty file)
@@ -1,74 +0,0 @@
-//
-// win_main.cpp
-// ~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2011 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)
-//
-
-#include <iostream>
-#include <boost/asio.hpp>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include "server.hpp"
-#include "file_handler.hpp"
-
-#if defined(_WIN32)
-
-boost::function0<void> console_ctrl_function;
-
-BOOL WINAPI console_ctrl_handler(DWORD ctrl_type)
-{
- switch (ctrl_type)
- {
- case CTRL_C_EVENT:
- case CTRL_BREAK_EVENT:
- case CTRL_CLOSE_EVENT:
- case CTRL_SHUTDOWN_EVENT:
- console_ctrl_function();
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-int main(int argc, char* argv[])
-{
- try
- {
- // Check command line arguments.
- if (argc != 4)
- {
- std::cerr << "Usage: http_server <address> <port> <doc_root>\n";
- std::cerr << " For IPv4, try:\n";
- std::cerr << " http_server 0.0.0.0 80 .\n";
- std::cerr << " For IPv6, try:\n";
- std::cerr << " http_server 0::0 80 .\n";
- return 1;
- }
-
- boost::asio::io_service io_service;
-
- // Launch the initial server coroutine.
- http::server4::server(io_service, argv[1], argv[2],
- http::server4::file_handler(argv[3]))();
-
- // Set console control handler to allow server to be stopped.
- console_ctrl_function = boost::bind(
- &boost::asio::io_service::stop, &io_service);
- SetConsoleCtrlHandler(console_ctrl_handler, TRUE);
-
- // Run the server until stopped.
- io_service.run();
- }
- catch (std::exception& e)
- {
- std::cerr << "exception: " << e.what() << "\n";
- }
-
- return 0;
-}
-
-#endif // defined(_WIN32)

Modified: branches/release/libs/asio/example/iostreams/Jamfile
==============================================================================
--- branches/release/libs/asio/example/iostreams/Jamfile (original)
+++ branches/release/libs/asio/example/iostreams/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -43,3 +43,15 @@
     <mingw><*><find-library>mswsock
     $(SOCKET_LIBS)
   ;
+
+exe http_client
+ : <lib>@boost/libs/system/build/boost_system
+ http_client.cpp
+ : <include>$(BOOST_ROOT)
+ <include>../../../..
+ <define>BOOST_ALL_NO_LIB=1
+ <threading>multi
+ <mingw><*><find-library>ws2_32
+ <mingw><*><find-library>mswsock
+ $(SOCKET_LIBS)
+ ;

Modified: branches/release/libs/asio/example/iostreams/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/example/iostreams/Jamfile.v2 (original)
+++ branches/release/libs/asio/example/iostreams/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -39,3 +39,4 @@
 
 exe daytime_client : daytime_client.cpp ;
 exe daytime_server : daytime_server.cpp ;
+exe http_client : http_client.cpp ;

Modified: branches/release/libs/asio/example/iostreams/daytime_client.cpp
==============================================================================
--- branches/release/libs/asio/example/iostreams/daytime_client.cpp (original)
+++ branches/release/libs/asio/example/iostreams/daytime_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -25,6 +25,12 @@
     }
 
     tcp::iostream s(argv[1], "daytime");
+ if (!s)
+ {
+ std::cout << "Unable to connect: " << s.error().message() << std::endl;
+ return 1;
+ }
+
     std::string line;
     std::getline(s, line);
     std::cout << line << std::endl;

Modified: branches/release/libs/asio/example/iostreams/daytime_server.cpp
==============================================================================
--- branches/release/libs/asio/example/iostreams/daytime_server.cpp (original)
+++ branches/release/libs/asio/example/iostreams/daytime_server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -34,8 +34,12 @@
     for (;;)
     {
       tcp::iostream stream;
- acceptor.accept(*stream.rdbuf());
- stream << make_daytime_string();
+ boost::system::error_code ec;
+ acceptor.accept(*stream.rdbuf(), ec);
+ if (!ec)
+ {
+ stream << make_daytime_string();
+ }
     }
   }
   catch (std::exception& e)

Added: branches/release/libs/asio/example/iostreams/http_client.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/example/iostreams/http_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,91 @@
+//
+// sync_client.cpp
+// ~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#include <iostream>
+#include <istream>
+#include <ostream>
+#include <string>
+#include <boost/asio/ip/tcp.hpp>
+
+using boost::asio::ip::tcp;
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ if (argc != 3)
+ {
+ std::cout << "Usage: http_client <server> <path>\n";
+ std::cout << "Example:\n";
+ std::cout << " http_client www.boost.org /LICENSE_1_0.txt\n";
+ return 1;
+ }
+
+ boost::asio::ip::tcp::iostream s;
+
+ // The entire sequence of I/O operations must complete within 60 seconds.
+ // If an expiry occurs, the socket is automatically closed and the stream
+ // becomes bad.
+ s.expires_from_now(boost::posix_time::seconds(60));
+
+ // Establish a connection to the server.
+ s.connect(argv[1], "http");
+ if (!s)
+ {
+ std::cout << "Unable to connect: " << s.error().message() << "\n";
+ return 1;
+ }
+
+ // Send the request. We specify the "Connection: close" header so that the
+ // server will close the socket after transmitting the response. This will
+ // allow us to treat all data up until the EOF as the content.
+ s << "GET " << argv[2] << " HTTP/1.0\r\n";
+ s << "Host: " << argv[1] << "\r\n";
+ s << "Accept: */*\r\n";
+ s << "Connection: close\r\n\r\n";
+
+ // By default, the stream is tied with itself. This means that the stream
+ // automatically flush the buffered output before attempting a read. It is
+ // not necessary not explicitly flush the stream at this point.
+
+ // Check that response is OK.
+ std::string http_version;
+ s >> http_version;
+ unsigned int status_code;
+ s >> status_code;
+ std::string status_message;
+ std::getline(s, status_message);
+ if (!s || http_version.substr(0, 5) != "HTTP/")
+ {
+ std::cout << "Invalid response\n";
+ return 1;
+ }
+ if (status_code != 200)
+ {
+ std::cout << "Response returned with status code " << status_code << "\n";
+ return 1;
+ }
+
+ // Process the response headers, which are terminated by a blank line.
+ std::string header;
+ while (std::getline(s, header) && header != "\r")
+ std::cout << header << "\n";
+ std::cout << "\n";
+
+ // Write the remaining data to output.
+ std::cout << s.rdbuf();
+ }
+ catch (std::exception& e)
+ {
+ std::cout << "Exception: " << e.what() << "\n";
+ }
+
+ return 0;
+}

Modified: branches/release/libs/asio/example/local/connect_pair.cpp
==============================================================================
--- branches/release/libs/asio/example/local/connect_pair.cpp (original)
+++ branches/release/libs/asio/example/local/connect_pair.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -12,7 +12,7 @@
 #include <string>
 #include <cctype>
 #include <boost/asio.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/array.hpp>
 #include <boost/bind.hpp>
 

Modified: branches/release/libs/asio/example/local/iostream_client.cpp
==============================================================================
--- branches/release/libs/asio/example/local/iostream_client.cpp (original)
+++ branches/release/libs/asio/example/local/iostream_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -32,7 +32,7 @@
     stream_protocol::iostream s(ep);
     if (!s)
     {
- std::cerr << "Unable to connect\n";
+ std::cerr << "Unable to connect: " << s.error().message() << std::endl;
       return 1;
     }
 

Modified: branches/release/libs/asio/example/nonblocking/third_party_lib.cpp
==============================================================================
--- branches/release/libs/asio/example/nonblocking/third_party_lib.cpp (original)
+++ branches/release/libs/asio/example/nonblocking/third_party_lib.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -96,8 +96,7 @@
   void start()
   {
     // Put the socket into non-blocking mode.
- tcp::socket::non_blocking_io non_blocking_io(true);
- socket_.io_control(non_blocking_io);
+ socket_.non_blocking(true);
 
     start_operations();
   }
@@ -196,7 +195,7 @@
   void start_accept()
   {
     connection::pointer new_connection =
- connection::create(acceptor_.io_service());
+ connection::create(acceptor_.get_io_service());
 
     acceptor_.async_accept(new_connection->socket(),
         boost::bind(&server::handle_accept, this, new_connection,
@@ -209,8 +208,9 @@
     if (!error)
     {
       new_connection->start();
- start_accept();
     }
+
+ start_accept();
   }
 
   tcp::acceptor acceptor_;

Modified: branches/release/libs/asio/example/porthopper/protocol.hpp
==============================================================================
--- branches/release/libs/asio/example/porthopper/protocol.hpp (original)
+++ branches/release/libs/asio/example/porthopper/protocol.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -78,11 +78,12 @@
 
 private:
   // Construct with specified old and new ports.
- control_request(unsigned short old_port, unsigned short new_port)
+ control_request(unsigned short old_port_number,
+ unsigned short new_port_number)
   {
     std::ostrstream os(data_, control_request_size);
- os << std::setw(encoded_port_size) << std::hex << old_port;
- os << std::setw(encoded_port_size) << std::hex << new_port;
+ os << std::setw(encoded_port_size) << std::hex << old_port_number;
+ os << std::setw(encoded_port_size) << std::hex << new_port_number;
   }
 
   // The length in bytes of a control_request and its components.
@@ -109,21 +110,21 @@
   }
 
   // Construct a frame with specified frame number and payload.
- frame(unsigned long number, const std::string& payload)
+ frame(unsigned long frame_number, const std::string& payload_data)
   {
     std::ostrstream os(data_, frame_size);
- os << std::setw(encoded_number_size) << std::hex << number;
+ os << std::setw(encoded_number_size) << std::hex << frame_number;
     os << std::setw(payload_size)
- << std::setfill(' ') << payload.substr(0, payload_size);
+ << std::setfill(' ') << payload_data.substr(0, payload_size);
   }
 
   // Get the frame number.
   unsigned long number() const
   {
     std::istrstream is(data_, encoded_number_size);
- unsigned long number = 0;
- is >> std::setw(encoded_number_size) >> std::hex >> number;
- return number;
+ unsigned long frame_number = 0;
+ is >> std::setw(encoded_number_size) >> std::hex >> frame_number;
+ return frame_number;
   }
 
   // Get the payload data.

Modified: branches/release/libs/asio/example/porthopper/server.cpp
==============================================================================
--- branches/release/libs/asio/example/porthopper/server.cpp (original)
+++ branches/release/libs/asio/example/porthopper/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -56,13 +56,13 @@
       boost::asio::async_read(*socket, request->to_buffers(),
           boost::bind(&server::handle_control_request, this,
             boost::asio::placeholders::error, socket, request));
-
- // Start waiting for a new control connection.
- tcp_socket_ptr new_socket(new tcp::socket(acceptor_.get_io_service()));
- acceptor_.async_accept(*new_socket,
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error, new_socket));
     }
+
+ // Start waiting for a new control connection.
+ tcp_socket_ptr new_socket(new tcp::socket(acceptor_.get_io_service()));
+ acceptor_.async_accept(*new_socket,
+ boost::bind(&server::handle_accept, this,
+ boost::asio::placeholders::error, new_socket));
   }
 
   // Handle a new control request.

Modified: branches/release/libs/asio/example/serialization/client.cpp
==============================================================================
--- branches/release/libs/asio/example/serialization/client.cpp (original)
+++ branches/release/libs/asio/example/serialization/client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -32,17 +32,15 @@
     boost::asio::ip::tcp::resolver::query query(host, service);
     boost::asio::ip::tcp::resolver::iterator endpoint_iterator =
       resolver.resolve(query);
- boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
 
     // Start an asynchronous connect operation.
- connection_.socket().async_connect(endpoint,
+ boost::asio::async_connect(connection_.socket(), endpoint_iterator,
         boost::bind(&client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
+ boost::asio::placeholders::error));
   }
 
   /// Handle completion of a connect operation.
- void handle_connect(const boost::system::error_code& e,
- boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+ void handle_connect(const boost::system::error_code& e)
   {
     if (!e)
     {
@@ -53,15 +51,6 @@
           boost::bind(&client::handle_read, this,
             boost::asio::placeholders::error));
     }
- else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator())
- {
- // Try the next endpoint.
- connection_.socket().close();
- boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
- connection_.socket().async_connect(endpoint,
- boost::bind(&client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
- }
     else
     {
       // An error occurred. Log it and return. Since we are not starting a new

Modified: branches/release/libs/asio/example/serialization/connection.hpp
==============================================================================
--- branches/release/libs/asio/example/serialization/connection.hpp (original)
+++ branches/release/libs/asio/example/serialization/connection.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -65,7 +65,7 @@
     {
       // Something went wrong, inform the caller.
       boost::system::error_code error(boost::asio::error::invalid_argument);
- socket_.io_service().post(boost::bind(handler, error));
+ socket_.get_io_service().post(boost::bind(handler, error));
       return;
     }
     outbound_header_ = header_stream.str();

Modified: branches/release/libs/asio/example/serialization/server.cpp
==============================================================================
--- branches/release/libs/asio/example/serialization/server.cpp (original)
+++ branches/release/libs/asio/example/serialization/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -55,7 +55,7 @@
     stocks_.push_back(s);
 
     // Start an accept operation for a new connection.
- connection_ptr new_conn(new connection(acceptor_.io_service()));
+ connection_ptr new_conn(new connection(acceptor_.get_io_service()));
     acceptor_.async_accept(new_conn->socket(),
         boost::bind(&server::handle_accept, this,
           boost::asio::placeholders::error, new_conn));
@@ -72,20 +72,13 @@
       conn->async_write(stocks_,
           boost::bind(&server::handle_write, this,
             boost::asio::placeholders::error, conn));
-
- // Start an accept operation for a new connection.
- connection_ptr new_conn(new connection(acceptor_.io_service()));
- acceptor_.async_accept(new_conn->socket(),
- boost::bind(&server::handle_accept, this,
- boost::asio::placeholders::error, new_conn));
- }
- else
- {
- // An error occurred. Log it and return. Since we are not starting a new
- // accept operation the io_service will run out of work to do and the
- // server will exit.
- std::cerr << e.message() << std::endl;
     }
+
+ // Start an accept operation for a new connection.
+ connection_ptr new_conn(new connection(acceptor_.get_io_service()));
+ acceptor_.async_accept(new_conn->socket(),
+ boost::bind(&server::handle_accept, this,
+ boost::asio::placeholders::error, new_conn));
   }
 
   /// Handle completion of a write operation.

Modified: branches/release/libs/asio/example/services/daytime_client.cpp
==============================================================================
--- branches/release/libs/asio/example/services/daytime_client.cpp (original)
+++ branches/release/libs/asio/example/services/daytime_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -32,8 +32,7 @@
   }
 }
 
-void connect_handler(const boost::system::error_code& e, debug_stream_socket* s,
- boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+void connect_handler(const boost::system::error_code& e, debug_stream_socket* s)
 {
   if (!e)
   {
@@ -41,14 +40,6 @@
         boost::bind(read_handler, boost::asio::placeholders::error,
           boost::asio::placeholders::bytes_transferred, s));
   }
- else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator())
- {
- s->close();
- boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
- s->async_connect(endpoint,
- boost::bind(connect_handler,
- boost::asio::placeholders::error, s, ++endpoint_iterator));
- }
   else
   {
     std::cerr << e.message() << std::endl;
@@ -75,13 +66,12 @@
     boost::asio::ip::tcp::resolver resolver(io_service);
     boost::asio::ip::tcp::resolver::query query(argv[1], "daytime");
     boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
- boost::asio::ip::tcp::endpoint endpoint = *iterator;
 
     // Start an asynchronous connect.
     debug_stream_socket socket(io_service);
- socket.async_connect(endpoint,
+ boost::asio::async_connect(socket, iterator,
         boost::bind(connect_handler,
- boost::asio::placeholders::error, &socket, ++iterator));
+ boost::asio::placeholders::error, &socket));
 
     // Run the io_service until all operations have finished.
     io_service.run();

Modified: branches/release/libs/asio/example/services/logger_service.hpp
==============================================================================
--- branches/release/libs/asio/example/services/logger_service.hpp (original)
+++ branches/release/libs/asio/example/services/logger_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -12,7 +12,7 @@
 #define SERVICES_LOGGER_SERVICE_HPP
 
 #include <boost/asio.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/noncopyable.hpp>
@@ -34,7 +34,7 @@
   /// The backend implementation of a logger.
   struct logger_impl
   {
- explicit logger_impl(const std::string& id) : identifier(id) {}
+ explicit logger_impl(const std::string& ident) : identifier(ident) {}
     std::string identifier;
   };
 

Modified: branches/release/libs/asio/example/services/stream_socket_service.hpp
==============================================================================
--- branches/release/libs/asio/example/services/stream_socket_service.hpp (original)
+++ branches/release/libs/asio/example/services/stream_socket_service.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -41,7 +41,7 @@
   typedef typename service_impl_type::implementation_type implementation_type;
 
   /// The native type of a stream socket.
- typedef typename service_impl_type::native_type native_type;
+ typedef typename service_impl_type::native_handle_type native_handle_type;
 
   /// Construct a new stream socket service for the specified io_service.
   explicit stream_socket_service(boost::asio::io_service& io_service)
@@ -78,7 +78,7 @@
 
   /// Open a stream socket from an existing native socket.
   boost::system::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_type& native_socket,
+ const protocol_type& protocol, const native_handle_type& native_socket,
       boost::system::error_code& ec)
   {
     logger_.log("Assigning from a native socket");

Modified: branches/release/libs/asio/example/socks4/sync_client.cpp
==============================================================================
--- branches/release/libs/asio/example/socks4/sync_client.cpp (original)
+++ branches/release/libs/asio/example/socks4/sync_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -37,19 +37,11 @@
     tcp::resolver resolver(io_service);
     tcp::resolver::query socks_query(argv[1], argv[2]);
     tcp::resolver::iterator endpoint_iterator = resolver.resolve(socks_query);
- tcp::resolver::iterator end;
 
     // Try each endpoint until we successfully establish a connection to the
     // SOCKS 4 server.
     tcp::socket socket(io_service);
- boost::system::error_code error = boost::asio::error::host_not_found;
- while (error && endpoint_iterator != end)
- {
- socket.close();
- socket.connect(*endpoint_iterator++, error);
- }
- if (error)
- throw boost::system::system_error(error);
+ boost::asio::connect(socket, endpoint_iterator);
 
     // Get an endpoint for the Boost website. This will be passed to the SOCKS
     // 4 server. Explicitly specify IPv4 since SOCKS 4 does not support IPv6.
@@ -87,6 +79,7 @@
 
     // Read until EOF, writing data to output as we go.
     boost::array<char, 512> response;
+ boost::system::error_code error;
     while (std::size_t s = socket.read_some(
           boost::asio::buffer(response), error))
       std::cout.write(response.data(), s);

Modified: branches/release/libs/asio/example/ssl/client.cpp
==============================================================================
--- branches/release/libs/asio/example/ssl/client.cpp (original)
+++ branches/release/libs/asio/example/ssl/client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,18 +19,40 @@
 class client
 {
 public:
- client(boost::asio::io_service& io_service, boost::asio::ssl::context& context,
+ client(boost::asio::io_service& io_service,
+ boost::asio::ssl::context& context,
       boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
     : socket_(io_service, context)
   {
- boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
- socket_.lowest_layer().async_connect(endpoint,
+ socket_.set_verify_mode(boost::asio::ssl::verify_peer);
+ socket_.set_verify_callback(
+ boost::bind(&client::verify_certificate, this, _1, _2));
+
+ boost::asio::async_connect(socket_.lowest_layer(), endpoint_iterator,
         boost::bind(&client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
+ boost::asio::placeholders::error));
   }
 
- void handle_connect(const boost::system::error_code& error,
- boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+ bool verify_certificate(bool preverified,
+ boost::asio::ssl::verify_context& ctx)
+ {
+ // The verify callback can be used to check whether the certificate that is
+ // being presented is valid for the peer. For example, RFC 2818 describes
+ // the steps involved in doing this for HTTPS. Consult the OpenSSL
+ // documentation for more details. Note that the callback is called once
+ // for each certificate in the certificate chain, starting from the root
+ // certificate authority.
+
+ // In this example we will simply print the certificate's subject name.
+ char subject_name[256];
+ X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
+ X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 256);
+ std::cout << "Verifying " << subject_name << "\n";
+
+ return preverified;
+ }
+
+ void handle_connect(const boost::system::error_code& error)
   {
     if (!error)
     {
@@ -38,17 +60,9 @@
           boost::bind(&client::handle_handshake, this,
             boost::asio::placeholders::error));
     }
- else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator())
- {
- socket_.lowest_layer().close();
- boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
- socket_.lowest_layer().async_connect(endpoint,
- boost::bind(&client::handle_connect, this,
- boost::asio::placeholders::error, ++endpoint_iterator));
- }
     else
     {
- std::cout << "Connect failed: " << error << "\n";
+ std::cout << "Connect failed: " << error.message() << "\n";
     }
   }
 
@@ -68,7 +82,7 @@
     }
     else
     {
- std::cout << "Handshake failed: " << error << "\n";
+ std::cout << "Handshake failed: " << error.message() << "\n";
     }
   }
 
@@ -85,7 +99,7 @@
     }
     else
     {
- std::cout << "Write failed: " << error << "\n";
+ std::cout << "Write failed: " << error.message() << "\n";
     }
   }
 
@@ -100,7 +114,7 @@
     }
     else
     {
- std::cout << "Read failed: " << error << "\n";
+ std::cout << "Read failed: " << error.message() << "\n";
     }
   }
 
@@ -126,8 +140,7 @@
     boost::asio::ip::tcp::resolver::query query(argv[1], argv[2]);
     boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
 
- boost::asio::ssl::context ctx(io_service, boost::asio::ssl::context::sslv23);
- ctx.set_verify_mode(boost::asio::ssl::context::verify_peer);
+ boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23);
     ctx.load_verify_file("ca.pem");
 
     client c(io_service, ctx, iterator);

Modified: branches/release/libs/asio/example/ssl/server.cpp
==============================================================================
--- branches/release/libs/asio/example/ssl/server.cpp (original)
+++ branches/release/libs/asio/example/ssl/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -19,7 +19,8 @@
 class session
 {
 public:
- session(boost::asio::io_service& io_service, boost::asio::ssl::context& context)
+ session(boost::asio::io_service& io_service,
+ boost::asio::ssl::context& context)
     : socket_(io_service, context)
   {
   }
@@ -95,7 +96,7 @@
     : io_service_(io_service),
       acceptor_(io_service,
           boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)),
- context_(io_service, boost::asio::ssl::context::sslv23)
+ context_(boost::asio::ssl::context::sslv23)
   {
     context_.set_options(
         boost::asio::ssl::context::default_workarounds
@@ -106,10 +107,7 @@
     context_.use_private_key_file("server.pem", boost::asio::ssl::context::pem);
     context_.use_tmp_dh_file("dh512.pem");
 
- session* new_session = new session(io_service_, context_);
- acceptor_.async_accept(new_session->socket(),
- boost::bind(&server::handle_accept, this, new_session,
- boost::asio::placeholders::error));
+ start_accept();
   }
 
   std::string get_password() const
@@ -117,21 +115,27 @@
     return "test";
   }
 
+ void start_accept()
+ {
+ session* new_session = new session(io_service_, context_);
+ acceptor_.async_accept(new_session->socket(),
+ boost::bind(&server::handle_accept, this, new_session,
+ boost::asio::placeholders::error));
+ }
+
   void handle_accept(session* new_session,
       const boost::system::error_code& error)
   {
     if (!error)
     {
       new_session->start();
- new_session = new session(io_service_, context_);
- acceptor_.async_accept(new_session->socket(),
- boost::bind(&server::handle_accept, this, new_session,
- boost::asio::placeholders::error));
     }
     else
     {
       delete new_session;
     }
+
+ start_accept();
   }
 
 private:

Modified: branches/release/libs/asio/example/timeouts/async_tcp_client.cpp
==============================================================================
--- branches/release/libs/asio/example/timeouts/async_tcp_client.cpp (original)
+++ branches/release/libs/asio/example/timeouts/async_tcp_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -110,7 +110,8 @@
   void stop()
   {
     stopped_ = true;
- socket_.close();
+ boost::system::error_code ignored_ec;
+ socket_.close(ignored_ec);
     deadline_.cancel();
     heartbeat_timer_.cancel();
   }

Modified: branches/release/libs/asio/example/timeouts/blocking_tcp_client.cpp
==============================================================================
--- branches/release/libs/asio/example/timeouts/blocking_tcp_client.cpp (original)
+++ branches/release/libs/asio/example/timeouts/blocking_tcp_client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -8,6 +8,7 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
 
+#include <boost/asio/connect.hpp>
 #include <boost/asio/deadline_timer.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/ip/tcp.hpp>
@@ -72,47 +73,36 @@
     tcp::resolver::query query(host, service);
     tcp::resolver::iterator iter = tcp::resolver(io_service_).resolve(query);
 
- // Set a deadline for the asynchronous operation. The host name may resolve
- // to multiple endpoints, and this function tries to connect to each one in
- // turn. Setting the deadline here means it applies to the entire sequence.
+ // Set a deadline for the asynchronous operation. As a host name may
+ // resolve to multiple endpoints, this function uses the composed operation
+ // async_connect. The deadline applies to the entire operation, rather than
+ // individual connection attempts.
     deadline_.expires_from_now(timeout);
 
- boost::system::error_code ec;
+ // Set up the variable that receives the result of the asynchronous
+ // operation. The error code is set to would_block to signal that the
+ // operation is incomplete. Asio guarantees that its asynchronous
+ // operations will never fail with would_block, so any other value in
+ // ec indicates completion.
+ boost::system::error_code ec = boost::asio::error::would_block;
 
- for (; iter != tcp::resolver::iterator(); ++iter)
- {
- // We may have an open socket from a previous connection attempt. This
- // socket cannot be reused, so we must close it before trying to connect
- // again.
- socket_.close();
-
- // Set up the variable that receives the result of the asynchronous
- // operation. The error code is set to would_block to signal that the
- // operation is incomplete. Asio guarantees that its asynchronous
- // operations will never fail with would_block, so any other value in
- // ec indicates completion.
- ec = boost::asio::error::would_block;
-
- // Start the asynchronous operation itself. The boost::lambda function
- // object is used as a callback and will update the ec variable when the
- // operation completes. The blocking_udp_client.cpp example shows how you
- // can use boost::bind rather than boost::lambda.
- socket_.async_connect(iter->endpoint(), var(ec) = _1);
-
- // Block until the asynchronous operation has completed.
- do io_service_.run_one(); while (ec == boost::asio::error::would_block);
-
- // Determine whether a connection was successfully established. The
- // deadline actor may have had a chance to run and close our socket, even
- // though the connect operation notionally succeeded. Therefore we must
- // check whether the socket is still open before deciding that the we
- // were successful.
- if (!ec && socket_.is_open())
- return;
- }
+ // Start the asynchronous operation itself. The boost::lambda function
+ // object is used as a callback and will update the ec variable when the
+ // operation completes. The blocking_udp_client.cpp example shows how you
+ // can use boost::bind rather than boost::lambda.
+ boost::asio::async_connect(socket_, iter, var(ec) = _1);
+
+ // Block until the asynchronous operation has completed.
+ do io_service_.run_one(); while (ec == boost::asio::error::would_block);
 
- throw boost::system::system_error(
- ec ? ec : boost::asio::error::host_not_found);
+ // Determine whether a connection was successfully established. The
+ // deadline actor may have had a chance to run and close our socket, even
+ // though the connect operation notionally succeeded. Therefore we must
+ // check whether the socket is still open before deciding if we succeeded
+ // or failed.
+ if (ec || !socket_.is_open())
+ throw boost::system::system_error(
+ ec ? ec : boost::asio::error::operation_aborted);
   }
 
   std::string read_line(boost::posix_time::time_duration timeout)
@@ -188,7 +178,8 @@
       // The deadline has passed. The socket is closed so that any outstanding
       // asynchronous operations are cancelled. This allows the blocked
       // connect(), read_line() or write_line() functions to return.
- socket_.close();
+ boost::system::error_code ignored_ec;
+ socket_.close(ignored_ec);
 
       // There is no longer an active deadline. The expiry is set to positive
       // infinity so that the actor takes no action until a new deadline is set.

Modified: branches/release/libs/asio/example/timeouts/server.cpp
==============================================================================
--- branches/release/libs/asio/example/timeouts/server.cpp (original)
+++ branches/release/libs/asio/example/timeouts/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -177,7 +177,8 @@
   {
     channel_.leave(shared_from_this());
 
- socket_.close();
+ boost::system::error_code ignored_ec;
+ socket_.close(ignored_ec);
     input_deadline_.cancel();
     non_empty_output_queue_.cancel();
     output_deadline_.cancel();
@@ -364,6 +365,11 @@
     subscriber_ptr bc(new udp_broadcaster(io_service_, broadcast_endpoint));
     channel_.join(bc);
 
+ start_accept();
+ }
+
+ void start_accept()
+ {
     tcp_session_ptr new_session(new tcp_session(io_service_, channel_));
 
     acceptor_.async_accept(new_session->socket(),
@@ -376,12 +382,9 @@
     if (!ec)
     {
       session->start();
-
- tcp_session_ptr new_session(new tcp_session(io_service_, channel_));
-
- acceptor_.async_accept(new_session->socket(),
- boost::bind(&server::handle_accept, this, new_session, _1));
     }
+
+ start_accept();
   }
 
 private:

Modified: branches/release/libs/asio/example/timers/tick_count_timer.cpp
==============================================================================
--- branches/release/libs/asio/example/timers/tick_count_timer.cpp (original)
+++ branches/release/libs/asio/example/timers/tick_count_timer.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -31,15 +31,17 @@
     DWORD ticks_;
   };
 
- // The duration type.
+ // The duration type. According to the TimeTraits requirements, the duration
+ // must be a signed type. This means we can't handle durations larger than
+ // 2^31.
   class duration_type
   {
   public:
     duration_type() : ticks_(0) {}
- duration_type(DWORD ticks) : ticks_(ticks) {}
+ duration_type(LONG ticks) : ticks_(ticks) {}
   private:
     friend struct tick_count_traits;
- DWORD ticks_;
+ LONG ticks_;
   };
 
   // Get the current time.
@@ -61,7 +63,12 @@
   // Subtract one time from another.
   static duration_type subtract(const time_type& t1, const time_type& t2)
   {
- return duration_type(t1.ticks_ - t2.ticks_);
+ // DWORD tick count values can wrap (see less_than() below). We'll convert
+ // to a duration by taking the absolute difference and adding the sign
+ // based on which is the "lesser" absolute time.
+ return duration_type(less_than(t1, t2)
+ ? -static_cast<LONG>(t2.ticks_ - t1.ticks_)
+ : static_cast<LONG>(t1.ticks_ - t2.ticks_));
   }
 
   // Test whether one time is less than another.
@@ -103,7 +110,7 @@
 
     timer.expires_from_now(5000);
     std::cout << "Starting asynchronous wait\n";
- timer.async_wait(handle_timeout);
+ timer.async_wait(&handle_timeout);
     io_service.run();
     std::cout << "Finished asynchronous wait\n";
   }

Modified: branches/release/libs/asio/example/timers/time_t_timer.cpp
==============================================================================
--- branches/release/libs/asio/example/timers/time_t_timer.cpp (original)
+++ branches/release/libs/asio/example/timers/time_t_timer.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -80,7 +80,7 @@
 
     timer.expires_from_now(5);
     std::cout << "Starting asynchronous wait\n";
- timer.async_wait(handle_timeout);
+ timer.async_wait(&handle_timeout);
     io_service.run();
     std::cout << "Finished asynchronous wait\n";
   }

Modified: branches/release/libs/asio/example/tutorial/daytime1/client.cpp
==============================================================================
--- branches/release/libs/asio/example/tutorial/daytime1/client.cpp (original)
+++ branches/release/libs/asio/example/tutorial/daytime1/client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -29,17 +29,9 @@
     tcp::resolver resolver(io_service);
     tcp::resolver::query query(argv[1], "daytime");
     tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
- tcp::resolver::iterator end;
 
     tcp::socket socket(io_service);
- boost::system::error_code error = boost::asio::error::host_not_found;
- while (error && endpoint_iterator != end)
- {
- socket.close();
- socket.connect(*endpoint_iterator++, error);
- }
- if (error)
- throw boost::system::system_error(error);
+ boost::asio::connect(socket, endpoint_iterator);
 
     for (;;)
     {

Modified: branches/release/libs/asio/example/tutorial/daytime2/server.cpp
==============================================================================
--- branches/release/libs/asio/example/tutorial/daytime2/server.cpp (original)
+++ branches/release/libs/asio/example/tutorial/daytime2/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -38,8 +38,7 @@
       std::string message = make_daytime_string();
 
       boost::system::error_code ignored_error;
- boost::asio::write(socket, boost::asio::buffer(message),
- boost::asio::transfer_all(), ignored_error);
+ boost::asio::write(socket, boost::asio::buffer(message), ignored_error);
     }
   }
   catch (std::exception& e)

Modified: branches/release/libs/asio/example/tutorial/daytime3/server.cpp
==============================================================================
--- branches/release/libs/asio/example/tutorial/daytime3/server.cpp (original)
+++ branches/release/libs/asio/example/tutorial/daytime3/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -79,7 +79,7 @@
   void start_accept()
   {
     tcp_connection::pointer new_connection =
- tcp_connection::create(acceptor_.io_service());
+ tcp_connection::create(acceptor_.get_io_service());
 
     acceptor_.async_accept(new_connection->socket(),
         boost::bind(&tcp_server::handle_accept, this, new_connection,
@@ -92,8 +92,9 @@
     if (!error)
     {
       new_connection->start();
- start_accept();
     }
+
+ start_accept();
   }
 
   tcp::acceptor acceptor_;

Modified: branches/release/libs/asio/example/tutorial/daytime4/client.cpp
==============================================================================
--- branches/release/libs/asio/example/tutorial/daytime4/client.cpp (original)
+++ branches/release/libs/asio/example/tutorial/daytime4/client.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -33,7 +33,7 @@
     udp::socket socket(io_service);
     socket.open(udp::v4());
 
- boost::array<char, 1> send_buf = { 0 };
+ boost::array<char, 1> send_buf = {{ 0 }};
     socket.send_to(boost::asio::buffer(send_buf), receiver_endpoint);
 
     boost::array<char, 128> recv_buf;

Modified: branches/release/libs/asio/example/tutorial/daytime7/server.cpp
==============================================================================
--- branches/release/libs/asio/example/tutorial/daytime7/server.cpp (original)
+++ branches/release/libs/asio/example/tutorial/daytime7/server.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -78,7 +78,7 @@
   void start_accept()
   {
     tcp_connection::pointer new_connection =
- tcp_connection::create(acceptor_.io_service());
+ tcp_connection::create(acceptor_.get_io_service());
 
     acceptor_.async_accept(new_connection->socket(),
         boost::bind(&tcp_server::handle_accept, this, new_connection,
@@ -91,8 +91,9 @@
     if (!error)
     {
       new_connection->start();
- start_accept();
     }
+
+ start_accept();
   }
 
   tcp::acceptor acceptor_;

Modified: branches/release/libs/asio/example/tutorial/timer2/timer.cpp
==============================================================================
--- branches/release/libs/asio/example/tutorial/timer2/timer.cpp (original)
+++ branches/release/libs/asio/example/tutorial/timer2/timer.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -22,7 +22,7 @@
   boost::asio::io_service io;
 
   boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
- t.async_wait(print);
+ t.async_wait(&print);
 
   io.run();
 

Modified: branches/release/libs/asio/example/tutorial/timer5/timer.cpp
==============================================================================
--- branches/release/libs/asio/example/tutorial/timer5/timer.cpp (original)
+++ branches/release/libs/asio/example/tutorial/timer5/timer.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -10,7 +10,7 @@
 
 #include <iostream>
 #include <boost/asio.hpp>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 

Modified: branches/release/libs/asio/example/windows/transmit_file.cpp
==============================================================================
--- branches/release/libs/asio/example/windows/transmit_file.cpp (original)
+++ branches/release/libs/asio/example/windows/transmit_file.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -31,8 +31,8 @@
   overlapped_ptr overlapped(socket.get_io_service(), handler);
 
   // Initiate the TransmitFile operation.
- BOOL ok = ::TransmitFile(socket.native(),
- file.native(), 0, 0, overlapped.get(), 0, 0);
+ BOOL ok = ::TransmitFile(socket.native_handle(),
+ file.native_handle(), 0, 0, overlapped.get(), 0, 0);
   DWORD last_error = ::GetLastError();
 
   // Check if the operation completed immediately.
@@ -119,7 +119,7 @@
   void start_accept()
   {
     connection::pointer new_connection =
- connection::create(acceptor_.io_service(), filename_);
+ connection::create(acceptor_.get_io_service(), filename_);
 
     acceptor_.async_accept(new_connection->socket(),
         boost::bind(&server::handle_accept, this, new_connection,
@@ -132,8 +132,9 @@
     if (!error)
     {
       new_connection->start();
- start_accept();
     }
+
+ start_accept();
   }
 
   tcp::acceptor acceptor_;

Modified: branches/release/libs/asio/test/Jamfile
==============================================================================
--- branches/release/libs/asio/test/Jamfile (original)
+++ branches/release/libs/asio/test/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -41,14 +41,19 @@
   :
   [ run basic_datagram_socket.cpp <template>asio_unit_test ]
   [ run basic_deadline_timer.cpp <template>asio_unit_test ]
+ [ run basic_raw_socket.cpp <template>asio_unit_test ]
+ [ run basic_seq_packet_socket.cpp <template>asio_unit_test ]
+ [ run basic_signal_set.cpp <template>asio_unit_test ]
   [ run basic_socket_acceptor.cpp <template>asio_unit_test ]
   [ run basic_stream_socket.cpp <template>asio_unit_test ]
+ [ run basic_streambuf.cpp <template>asio_unit_test ]
   [ run buffer.cpp <template>asio_unit_test ]
   [ run buffered_read_stream.cpp <template>asio_unit_test ]
   [ run buffered_stream.cpp <template>asio_unit_test ]
   [ run buffered_write_stream.cpp <template>asio_unit_test ]
   [ run buffers_iterator.cpp <template>asio_unit_test ]
   [ run completion_condition.cpp <template>asio_unit_test ]
+ [ run connect.cpp <template>asio_unit_test ]
   [ run datagram_socket_service.cpp <template>asio_unit_test ]
   [ run deadline_timer_service.cpp <template>asio_unit_test ]
   [ run deadline_timer.cpp <template>asio_unit_test ]
@@ -82,13 +87,18 @@
   [ run posix/descriptor_base.cpp <template>asio_unit_test ]
   [ run posix/stream_descriptor.cpp <template>asio_unit_test ]
   [ run posix/stream_descriptor_service.cpp <template>asio_unit_test ]
+ [ run raw_socket_service.cpp <template>asio_unit_test ]
   [ run read.cpp <template>asio_unit_test ]
   [ run read_at.cpp <template>asio_unit_test ]
   [ run read_until.cpp <template>asio_unit_test ]
+ [ run seq_packet_socket_service.cpp <template>asio_unit_test ]
+ [ run signal_set.cpp <template>asio_unit_test ]
+ [ run signal_set_service.cpp <template>asio_unit_test ]
   [ run socket_acceptor_service.cpp <template>asio_unit_test ]
   [ run socket_base.cpp <template>asio_unit_test ]
   [ run strand.cpp <template>asio_unit_test ]
   [ run stream_socket_service.cpp <template>asio_unit_test ]
+ [ run streambuf.cpp <template>asio_unit_test ]
   [ run time_traits.cpp <template>asio_unit_test ]
   [ run windows/basic_handle.cpp <template>asio_unit_test ]
   [ run windows/basic_random_access_handle.cpp <template>asio_unit_test ]

Modified: branches/release/libs/asio/test/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/test/Jamfile.v2 (original)
+++ branches/release/libs/asio/test/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -65,10 +65,18 @@
   [ link basic_datagram_socket.cpp : $(USE_SELECT) : basic_datagram_socket_select ]
   [ link basic_deadline_timer.cpp ]
   [ link basic_deadline_timer.cpp : $(USE_SELECT) : basic_deadline_timer_select ]
+ [ link basic_raw_socket.cpp ]
+ [ link basic_raw_socket.cpp : $(USE_SELECT) : basic_raw_socket_select ]
+ [ link basic_seq_packet_socket.cpp ]
+ [ link basic_seq_packet_socket.cpp : $(USE_SELECT) : basic_seq_packet_socket_select ]
+ [ link basic_signal_set.cpp ]
+ [ link basic_signal_set.cpp : $(USE_SELECT) : basic_signal_set_select ]
   [ link basic_socket_acceptor.cpp ]
   [ link basic_socket_acceptor.cpp : $(USE_SELECT) : basic_socket_acceptor_select ]
   [ link basic_stream_socket.cpp ]
   [ link basic_stream_socket.cpp : $(USE_SELECT) : basic_stream_socket_select ]
+ [ link basic_streambuf.cpp ]
+ [ link basic_streambuf.cpp : $(USE_SELECT) : basic_streambuf_select ]
   [ run buffer.cpp ]
   [ run buffer.cpp : : : $(USE_SELECT) : buffer_select ]
   [ run buffered_read_stream.cpp ]
@@ -81,6 +89,8 @@
   [ run buffers_iterator.cpp : : : $(USE_SELECT) : buffers_iterator_select ]
   [ link completion_condition.cpp ]
   [ link completion_condition.cpp : $(USE_SELECT) : completion_condition_select ]
+ [ link connect.cpp ]
+ [ link connect.cpp : $(USE_SELECT) : connect_select ]
   [ link datagram_socket_service.cpp ]
   [ link datagram_socket_service.cpp : $(USE_SELECT) : datagram_socket_service_select ]
   [ link deadline_timer_service.cpp ]
@@ -147,12 +157,20 @@
   [ link posix/stream_descriptor.cpp : $(USE_SELECT) : posix_stream_descriptor_select ]
   [ link posix/stream_descriptor_service.cpp : : posix_stream_descriptor_service ]
   [ link posix/stream_descriptor_service.cpp : $(USE_SELECT) : posix_stream_descriptor_service_select ]
+ [ link raw_socket_service.cpp ]
+ [ link raw_socket_service.cpp : $(USE_SELECT) : raw_socket_service_select ]
   [ run read.cpp ]
   [ run read.cpp : : : $(USE_SELECT) : read_select ]
   [ run read_at.cpp ]
   [ run read_at.cpp : : : $(USE_SELECT) : read_at_select ]
   [ run read_until.cpp ]
   [ run read_until.cpp : : : $(USE_SELECT) : read_until_select ]
+ [ link seq_packet_socket_service.cpp ]
+ [ link seq_packet_socket_service.cpp : $(USE_SELECT) : seq_packet_socket_service_select ]
+ [ run signal_set.cpp ]
+ [ run signal_set.cpp : : : $(USE_SELECT) : signal_set_select ]
+ [ link signal_set_service.cpp ]
+ [ link signal_set_service.cpp : $(USE_SELECT) : signal_set_service_select ]
   [ link socket_acceptor_service.cpp ]
   [ link socket_acceptor_service.cpp : $(USE_SELECT) : socket_acceptor_service_select ]
   [ run socket_base.cpp ]
@@ -161,6 +179,8 @@
   [ run strand.cpp : : : $(USE_SELECT) : strand_select ]
   [ link stream_socket_service.cpp ]
   [ link stream_socket_service.cpp : $(USE_SELECT) : stream_socket_service_select ]
+ [ run streambuf.cpp ]
+ [ run streambuf.cpp : : : $(USE_SELECT) : streambuf_select ]
   [ link time_traits.cpp ]
   [ link time_traits.cpp : $(USE_SELECT) : time_traits_select ]
   [ link windows/basic_handle.cpp : : windows_basic_handle ]

Added: branches/release/libs/asio/test/archetypes/gettable_socket_option.hpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/archetypes/gettable_socket_option.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,54 @@
+//
+// gettable_socket_option.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef ARCHETYPES_GETTABLE_SOCKET_OPTION_HPP
+#define ARCHETYPES_GETTABLE_SOCKET_OPTION_HPP
+
+#include <cstddef>
+
+namespace archetypes {
+
+template <typename PointerType>
+class gettable_socket_option
+{
+public:
+ template <typename Protocol>
+ int level(const Protocol&) const
+ {
+ return 0;
+ }
+
+ template <typename Protocol>
+ int name(const Protocol&) const
+ {
+ return 0;
+ }
+
+ template <typename Protocol>
+ PointerType* data(const Protocol&)
+ {
+ return 0;
+ }
+
+ template <typename Protocol>
+ std::size_t size(const Protocol&) const
+ {
+ return 0;
+ }
+
+ template <typename Protocol>
+ void resize(const Protocol&, std::size_t)
+ {
+ }
+};
+
+} // namespace archetypes
+
+#endif // ARCHETYPES_GETTABLE_SOCKET_OPTION_HPP

Added: branches/release/libs/asio/test/archetypes/settable_socket_option.hpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/archetypes/settable_socket_option.hpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,49 @@
+//
+// settable_socket_option.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+#ifndef ARCHETYPES_SETTABLE_SOCKET_OPTION_HPP
+#define ARCHETYPES_SETTABLE_SOCKET_OPTION_HPP
+
+#include <cstddef>
+
+namespace archetypes {
+
+template <typename PointerType>
+class settable_socket_option
+{
+public:
+ template <typename Protocol>
+ int level(const Protocol&) const
+ {
+ return 0;
+ }
+
+ template <typename Protocol>
+ int name(const Protocol&) const
+ {
+ return 0;
+ }
+
+ template <typename Protocol>
+ const PointerType* data(const Protocol&) const
+ {
+ return 0;
+ }
+
+ template <typename Protocol>
+ std::size_t size(const Protocol&) const
+ {
+ return 0;
+ }
+};
+
+} // namespace archetypes
+
+#endif // ARCHETYPES_SETTABLE_SOCKET_OPTION_HPP

Added: branches/release/libs/asio/test/basic_raw_socket.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/basic_raw_socket.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// basic_raw_socket.cpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/basic_raw_socket.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("basic_raw_socket");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: branches/release/libs/asio/test/basic_seq_packet_socket.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/basic_seq_packet_socket.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// basic_seq_packet_socket.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/basic_seq_packet_socket.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("basic_seq_packet_socket");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: branches/release/libs/asio/test/basic_signal_set.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/basic_signal_set.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// basic_signal_set.cpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/basic_signal_set.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("basic_signal_set");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Added: branches/release/libs/asio/test/basic_streambuf.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/basic_streambuf.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// basic_streambuf.cpp
+// ~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/basic_streambuf.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("basic_streambuf");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Modified: branches/release/libs/asio/test/buffer.cpp
==============================================================================
--- branches/release/libs/asio/test/buffer.cpp (original)
+++ branches/release/libs/asio/test/buffer.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -41,9 +41,16 @@
     boost::array<char, 1024> array_data;
     const boost::array<char, 1024>& const_array_data_1 = array_data;
     boost::array<const char, 1024> const_array_data_2 = { { 0 } };
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+ std::array<char, 1024> std_array_data;
+ const std::array<char, 1024>& const_std_array_data_1 = std_array_data;
+ std::array<const char, 1024> const_std_array_data_2 = { { 0 } };
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
     std::vector<char> vector_data(1024);
     const std::vector<char>& const_vector_data = vector_data;
     const std::string string_data(1024, ' ');
+ std::vector<mutable_buffer> mutable_buffer_sequence;
+ std::vector<const_buffer> const_buffer_sequence;
 
     // mutable_buffer constructors.
 
@@ -51,13 +58,6 @@
     mutable_buffer mb2(void_ptr_data, 1024);
     mutable_buffer mb3(mb1);
 
- // mutable_buffer functions.
-
- void* ptr1 = buffer_cast<void*>(mb1);
- (void)ptr1;
- std::size_t size1 = buffer_size(mb1);
- (void)size1;
-
     // mutable_buffer operators.
 
     mb1 = mb2 + 128;
@@ -82,13 +82,6 @@
     const_buffer cb3(cb1);
     const_buffer cb4(mb1);
 
- // const_buffer functions.
-
- const void* ptr2 = buffer_cast<const void*>(cb1);
- (void)ptr2;
- std::size_t size2 = buffer_size(cb1);
- (void)size2;
-
     // const_buffer operators.
 
     cb1 = cb2 + 128;
@@ -106,6 +99,28 @@
     const_buffers_1::const_iterator iter4 = cbc1.end();
     (void)iter4;
 
+ // buffer_size function overloads.
+
+ std::size_t size1 = buffer_size(mb1);
+ (void)size1;
+ std::size_t size2 = buffer_size(cb1);
+ (void)size2;
+ std::size_t size3 = buffer_size(mbc1);
+ (void)size3;
+ std::size_t size4 = buffer_size(cbc1);
+ (void)size4;
+ std::size_t size5 = buffer_size(mutable_buffer_sequence);
+ (void)size5;
+ std::size_t size6 = buffer_size(const_buffer_sequence);
+ (void)size6;
+
+ // buffer_cast function overloads.
+
+ void* ptr1 = buffer_cast<void*>(mb1);
+ (void)ptr1;
+ const void* ptr2 = buffer_cast<const void*>(cb1);
+ (void)ptr2;
+
     // buffer function overloads.
 
     mb1 = buffer(mb2);
@@ -124,12 +139,85 @@
     cb1 = buffer(const_array_data_1, 1024);
     cb1 = buffer(const_array_data_2);
     cb1 = buffer(const_array_data_2, 1024);
+#if defined(BOOST_ASIO_HAS_STD_ARRAY)
+ mb1 = buffer(std_array_data);
+ mb1 = buffer(std_array_data, 1024);
+ cb1 = buffer(const_std_array_data_1);
+ cb1 = buffer(const_std_array_data_1, 1024);
+ cb1 = buffer(const_std_array_data_2);
+ cb1 = buffer(const_std_array_data_2, 1024);
+#endif // defined(BOOST_ASIO_HAS_STD_ARRAY)
     mb1 = buffer(vector_data);
     mb1 = buffer(vector_data, 1024);
     cb1 = buffer(const_vector_data);
     cb1 = buffer(const_vector_data, 1024);
     cb1 = buffer(string_data);
     cb1 = buffer(string_data, 1024);
+
+ // buffer_copy function overloads.
+
+ std::size_t size7 = buffer_copy(mb1, cb2);
+ (void)size7;
+ std::size_t size8 = buffer_copy(mb1, cbc2);
+ (void)size8;
+ std::size_t size9 = buffer_copy(mb1, mb2);
+ (void)size9;
+ std::size_t size10 = buffer_copy(mb1, mbc2);
+ (void)size10;
+ std::size_t size11 = buffer_copy(mb1, const_buffer_sequence);
+ (void)size11;
+ std::size_t size12 = buffer_copy(mbc1, cb2);
+ (void)size12;
+ std::size_t size13 = buffer_copy(mbc1, cbc2);
+ (void)size13;
+ std::size_t size14 = buffer_copy(mbc1, mb2);
+ (void)size14;
+ std::size_t size15 = buffer_copy(mbc1, mbc2);
+ (void)size15;
+ std::size_t size16 = buffer_copy(mbc1, const_buffer_sequence);
+ (void)size16;
+ std::size_t size17 = buffer_copy(mutable_buffer_sequence, cb2);
+ (void)size17;
+ std::size_t size18 = buffer_copy(mutable_buffer_sequence, cbc2);
+ (void)size18;
+ std::size_t size19 = buffer_copy(mutable_buffer_sequence, mb2);
+ (void)size19;
+ std::size_t size20 = buffer_copy(mutable_buffer_sequence, mbc2);
+ (void)size20;
+ std::size_t size21 = buffer_copy(
+ mutable_buffer_sequence, const_buffer_sequence);
+ (void)size21;
+ std::size_t size22 = buffer_copy(mb1, cb2, 128);
+ (void)size22;
+ std::size_t size23 = buffer_copy(mb1, cbc2, 128);
+ (void)size23;
+ std::size_t size24 = buffer_copy(mb1, mb2, 128);
+ (void)size24;
+ std::size_t size25 = buffer_copy(mb1, mbc2, 128);
+ (void)size25;
+ std::size_t size26 = buffer_copy(mb1, const_buffer_sequence, 128);
+ (void)size26;
+ std::size_t size27 = buffer_copy(mbc1, cb2, 128);
+ (void)size27;
+ std::size_t size28 = buffer_copy(mbc1, cbc2, 128);
+ (void)size28;
+ std::size_t size29 = buffer_copy(mbc1, mb2, 128);
+ (void)size29;
+ std::size_t size30 = buffer_copy(mbc1, mbc2, 128);
+ (void)size30;
+ std::size_t size31 = buffer_copy(mbc1, const_buffer_sequence, 128);
+ (void)size31;
+ std::size_t size32 = buffer_copy(mutable_buffer_sequence, cb2, 128);
+ (void)size32;
+ std::size_t size33 = buffer_copy(mutable_buffer_sequence, cbc2, 128);
+ (void)size33;
+ std::size_t size34 = buffer_copy(mutable_buffer_sequence, mb2, 128);
+ (void)size34;
+ std::size_t size35 = buffer_copy(mutable_buffer_sequence, mbc2, 128);
+ (void)size35;
+ std::size_t size36 = buffer_copy(
+ mutable_buffer_sequence, const_buffer_sequence, 128);
+ (void)size36;
   }
   catch (std::exception&)
   {

Modified: branches/release/libs/asio/test/buffered_read_stream.cpp
==============================================================================
--- branches/release/libs/asio/test/buffered_read_stream.cpp (original)
+++ branches/release/libs/asio/test/buffered_read_stream.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -146,7 +146,7 @@
   client_socket.lowest_layer().connect(server_endpoint);
 
   stream_type server_socket(io_service);
- acceptor.async_accept(server_socket.lowest_layer(), handle_accept);
+ acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
   io_service.run();
   io_service.reset();
 

Modified: branches/release/libs/asio/test/buffered_stream.cpp
==============================================================================
--- branches/release/libs/asio/test/buffered_stream.cpp (original)
+++ branches/release/libs/asio/test/buffered_stream.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -153,7 +153,7 @@
   client_socket.lowest_layer().connect(server_endpoint);
 
   stream_type server_socket(io_service);
- acceptor.async_accept(server_socket.lowest_layer(), handle_accept);
+ acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
   io_service.run();
   io_service.reset();
 

Modified: branches/release/libs/asio/test/buffered_write_stream.cpp
==============================================================================
--- branches/release/libs/asio/test/buffered_write_stream.cpp (original)
+++ branches/release/libs/asio/test/buffered_write_stream.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -153,7 +153,7 @@
   client_socket.lowest_layer().connect(server_endpoint);
 
   stream_type server_socket(io_service);
- acceptor.async_accept(server_socket.lowest_layer(), handle_accept);
+ acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
   io_service.run();
   io_service.reset();
 

Added: branches/release/libs/asio/test/connect.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/connect.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// connect.cpp
+// ~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/connect.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("connect");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Modified: branches/release/libs/asio/test/deadline_timer.cpp
==============================================================================
--- branches/release/libs/asio/test/deadline_timer.cpp (original)
+++ branches/release/libs/asio/test/deadline_timer.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -16,7 +16,7 @@
 // Test that header file is self-contained.
 #include <boost/asio/deadline_timer.hpp>
 
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/placeholders.hpp>
@@ -58,6 +58,12 @@
   BOOST_CHECK(num_cancelled == 1);
 }
 
+void cancel_one_timer(boost::asio::deadline_timer* t)
+{
+ std::size_t num_cancelled = t->cancel_one();
+ BOOST_CHECK(num_cancelled == 1);
+}
+
 ptime now()
 {
 #if defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK)
@@ -183,6 +189,31 @@
   end = now();
   expected_end = start + seconds(10);
   BOOST_CHECK(expected_end < end || expected_end == end);
+
+ count = 0;
+ start = now();
+
+ // Start two waits on a timer, one of which will be cancelled. The one
+ // which is not cancelled should still run to completion and increment the
+ // counter.
+ boost::asio::deadline_timer t7(ios, seconds(3));
+ t7.async_wait(boost::bind(increment_if_not_cancelled, &count,
+ boost::asio::placeholders::error));
+ t7.async_wait(boost::bind(increment_if_not_cancelled, &count,
+ boost::asio::placeholders::error));
+ boost::asio::deadline_timer t8(ios, seconds(1));
+ t8.async_wait(boost::bind(cancel_one_timer, &t7));
+
+ ios.reset();
+ ios.run();
+
+ // One of the waits should not have been cancelled, so count should have
+ // changed. The total time since the timer was created should be more than 3
+ // seconds.
+ BOOST_CHECK(count == 1);
+ end = now();
+ expected_end = start + seconds(3);
+ BOOST_CHECK(expected_end < end || expected_end == end);
 }
 
 void timer_handler(const boost::system::error_code&)
@@ -198,10 +229,10 @@
     timer() : t(io_service) { t.expires_at(boost::posix_time::pos_infin); }
   } timers[50];
 
- timers[2].t.async_wait(timer_handler);
- timers[41].t.async_wait(timer_handler);
+ timers[2].t.async_wait(&timer_handler);
+ timers[41].t.async_wait(&timer_handler);
   for (int i = 10; i < 20; ++i)
- timers[i].t.async_wait(timer_handler);
+ timers[i].t.async_wait(&timer_handler);
 
   BOOST_CHECK(timers[2].t.cancel() == 1);
   BOOST_CHECK(timers[41].t.cancel() == 1);

Modified: branches/release/libs/asio/test/io_service.cpp
==============================================================================
--- branches/release/libs/asio/test/io_service.cpp (original)
+++ branches/release/libs/asio/test/io_service.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,7 +17,7 @@
 #include <boost/asio/io_service.hpp>
 
 #include <sstream>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 #include <boost/asio/deadline_timer.hpp>
 #include "unit_test.hpp"
@@ -93,11 +93,13 @@
   ios.post(boost::bind(increment, &count));
 
   // No handlers can be called until run() is called.
+ BOOST_CHECK(!ios.stopped());
   BOOST_CHECK(count == 0);
 
   ios.run();
 
   // The run() call will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 1);
 
   count = 0;
@@ -109,20 +111,24 @@
   ios.post(boost::bind(increment, &count));
 
   // No handlers can be called until run() is called.
+ BOOST_CHECK(!ios.stopped());
   BOOST_CHECK(count == 0);
 
   ios.run();
 
   // The run() call will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 5);
 
   count = 0;
   ios.reset();
   io_service::work* w = new io_service::work(ios);
   ios.post(boost::bind(&io_service::stop, &ios));
+ BOOST_CHECK(!ios.stopped());
   ios.run();
 
   // The only operation executed should have been to stop run().
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 0);
 
   ios.reset();
@@ -130,11 +136,13 @@
   delete w;
 
   // No handlers can be called until run() is called.
+ BOOST_CHECK(!ios.stopped());
   BOOST_CHECK(count == 0);
 
   ios.run();
 
   // The run() call will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 1);
 
   count = 10;
@@ -142,11 +150,13 @@
   ios.post(boost::bind(decrement_to_zero, &ios, &count));
 
   // No handlers can be called until run() is called.
+ BOOST_CHECK(!ios.stopped());
   BOOST_CHECK(count == 10);
 
   ios.run();
 
   // The run() call will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 0);
 
   count = 10;
@@ -154,11 +164,13 @@
   ios.post(boost::bind(nested_decrement_to_zero, &ios, &count));
 
   // No handlers can be called until run() is called.
+ BOOST_CHECK(!ios.stopped());
   BOOST_CHECK(count == 10);
 
   ios.run();
 
   // The run() call will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 0);
 
   count = 10;
@@ -167,16 +179,19 @@
 
   // No handlers can be called until run() is called, even though nested
   // delivery was specifically allowed in the previous call.
+ BOOST_CHECK(!ios.stopped());
   BOOST_CHECK(count == 10);
 
   ios.run();
 
   // The run() call will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 0);
 
   count = 0;
   int count2 = 0;
   ios.reset();
+ BOOST_CHECK(!ios.stopped());
   ios.post(boost::bind(start_sleep_increments, &ios, &count));
   ios.post(boost::bind(start_sleep_increments, &ios, &count2));
   boost::thread thread1(boost::bind(io_service_run, &ios));
@@ -185,6 +200,7 @@
   thread2.join();
 
   // The run() calls will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 3);
   BOOST_CHECK(count2 == 3);
 
@@ -192,10 +208,12 @@
   io_service ios2;
   ios.dispatch(ios2.wrap(boost::bind(decrement_to_zero, &ios2, &count)));
   ios.reset();
+ BOOST_CHECK(!ios.stopped());
   ios.run();
 
   // No decrement_to_zero handlers can be called until run() is called on the
   // second io_service object.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 10);
 
   ios2.run();
@@ -206,13 +224,14 @@
   count = 0;
   int exception_count = 0;
   ios.reset();
- ios.post(throw_exception);
+ ios.post(&throw_exception);
   ios.post(boost::bind(increment, &count));
   ios.post(boost::bind(increment, &count));
- ios.post(throw_exception);
+ ios.post(&throw_exception);
   ios.post(boost::bind(increment, &count));
 
   // No handlers can be called until run() is called.
+ BOOST_CHECK(!ios.stopped());
   BOOST_CHECK(count == 0);
   BOOST_CHECK(exception_count == 0);
 
@@ -230,6 +249,7 @@
   }
 
   // The run() calls will not return until all work has finished.
+ BOOST_CHECK(ios.stopped());
   BOOST_CHECK(count == 3);
   BOOST_CHECK(exception_count == 2);
 }

Modified: branches/release/libs/asio/test/ip/address.cpp
==============================================================================
--- branches/release/libs/asio/test/ip/address.cpp (original)
+++ branches/release/libs/asio/test/ip/address.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -18,9 +18,107 @@
 
 #include "../unit_test.hpp"
 
+//------------------------------------------------------------------------------
+
+// ip_address_compile test
+// ~~~~~~~~~~~~~~~~~~~~~~~
+// The following test checks that all public member functions on the class
+// ip::address compile and link correctly. Runtime failures are ignored.
+
+namespace ip_address_compile {
+
+void test()
+{
+ using namespace boost::asio;
+ namespace ip = boost::asio::ip;
+
+ try
+ {
+ boost::system::error_code ec;
+
+ // address constructors.
+
+ ip::address addr1;
+ const ip::address_v4 const_addr_v4;
+ ip::address addr2(const_addr_v4);
+ const ip::address_v6 const_addr_v6;
+ ip::address addr3(const_addr_v6);
+
+ // address functions.
+
+ bool b = addr1.is_v4();
+ (void)b;
+
+ b = addr1.is_v6();
+ (void)b;
+
+ b = addr1.is_loopback();
+ (void)b;
+
+ b = addr1.is_unspecified();
+ (void)b;
+
+ b = addr1.is_multicast();
+ (void)b;
+
+ ip::address_v4 addr_v4_value = addr1.to_v4();
+ (void)addr_v4_value;
+
+ ip::address_v6 addr_v6_value = addr1.to_v6();
+ (void)addr_v6_value;
+
+ std::string string_value = addr1.to_string();
+ string_value = addr1.to_string(ec);
+
+ // address static functions.
+
+ addr1 = ip::address::from_string("127.0.0.1");
+ addr1 = ip::address::from_string("127.0.0.1", ec);
+ addr1 = ip::address::from_string(string_value);
+ addr1 = ip::address::from_string(string_value, ec);
+
+ // address comparisons.
+
+ b = (addr1 == addr2);
+ (void)b;
+
+ b = (addr1 != addr2);
+ (void)b;
+
+ b = (addr1 < addr2);
+ (void)b;
+
+ b = (addr1 > addr2);
+ (void)b;
+
+ b = (addr1 <= addr2);
+ (void)b;
+
+ b = (addr1 >= addr2);
+ (void)b;
+
+ // address I/O.
+
+ std::ostringstream os;
+ os << addr1;
+
+#if !defined(BOOST_NO_STD_WSTREAMBUF)
+ std::wostringstream wos;
+ wos << addr1;
+#endif // !defined(BOOST_NO_STD_WSTREAMBUF)
+ }
+ catch (std::exception&)
+ {
+ }
+}
+
+} // namespace ip_address_compile
+
+//------------------------------------------------------------------------------
+
 test_suite* init_unit_test_suite(int, char*[])
 {
   test_suite* test = BOOST_TEST_SUITE("ip/address");
- test->add(BOOST_TEST_CASE(&null_test));
+ test->add(BOOST_TEST_CASE(&ip_address_compile::test));
   return test;
 }

Modified: branches/release/libs/asio/test/ip/address_v4.cpp
==============================================================================
--- branches/release/libs/asio/test/ip/address_v4.cpp (original)
+++ branches/release/libs/asio/test/ip/address_v4.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -42,12 +42,18 @@
     ip::address_v4 addr1;
     const ip::address_v4::bytes_type const_bytes_value = { { 127, 0, 0, 1 } };
     ip::address_v4 addr2(const_bytes_value);
- const unsigned long const_ulong_value = 0x7F00001;
+ const unsigned long const_ulong_value = 0x7F000001;
     ip::address_v4 addr3(const_ulong_value);
 
     // address_v4 functions.
 
- bool b = addr1.is_class_a();
+ bool b = addr1.is_loopback();
+ (void)b;
+
+ b = addr1.is_unspecified();
+ (void)b;
+
+ b = addr1.is_class_a();
     (void)b;
 
     b = addr1.is_class_b();
@@ -124,9 +130,140 @@
 
 //------------------------------------------------------------------------------
 
+// ip_address_v4_runtime test
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+// The following test checks that the various public member functions meet the
+// necessary postconditions.
+
+namespace ip_address_v4_runtime {
+
+void test()
+{
+ using boost::asio::ip::address_v4;
+
+ address_v4 a1;
+ BOOST_CHECK(a1.to_bytes()[0] == 0);
+ BOOST_CHECK(a1.to_bytes()[1] == 0);
+ BOOST_CHECK(a1.to_bytes()[2] == 0);
+ BOOST_CHECK(a1.to_bytes()[3] == 0);
+ BOOST_CHECK(a1.to_ulong() == 0);
+
+ address_v4::bytes_type b1 = {{ 1, 2, 3, 4 }};
+ address_v4 a2(b1);
+ BOOST_CHECK(a2.to_bytes()[0] == 1);
+ BOOST_CHECK(a2.to_bytes()[1] == 2);
+ BOOST_CHECK(a2.to_bytes()[2] == 3);
+ BOOST_CHECK(a2.to_bytes()[3] == 4);
+ BOOST_CHECK(((a2.to_ulong() >> 24) & 0xFF) == b1[0]);
+ BOOST_CHECK(((a2.to_ulong() >> 16) & 0xFF) == b1[1]);
+ BOOST_CHECK(((a2.to_ulong() >> 8) & 0xFF) == b1[2]);
+ BOOST_CHECK((a2.to_ulong() & 0xFF) == b1[3]);
+
+ address_v4 a3(0x01020304);
+ BOOST_CHECK(a3.to_bytes()[0] == 1);
+ BOOST_CHECK(a3.to_bytes()[1] == 2);
+ BOOST_CHECK(a3.to_bytes()[2] == 3);
+ BOOST_CHECK(a3.to_bytes()[3] == 4);
+ BOOST_CHECK(a3.to_ulong() == 0x01020304);
+
+ BOOST_CHECK(address_v4(0x7F000001).is_loopback());
+ BOOST_CHECK(address_v4(0x7F000002).is_loopback());
+ BOOST_CHECK(!address_v4(0x00000000).is_loopback());
+ BOOST_CHECK(!address_v4(0x01020304).is_loopback());
+
+ BOOST_CHECK(address_v4(0x00000000).is_unspecified());
+ BOOST_CHECK(!address_v4(0x7F000001).is_unspecified());
+ BOOST_CHECK(!address_v4(0x01020304).is_unspecified());
+
+ BOOST_CHECK(address_v4(0x01000000).is_class_a());
+ BOOST_CHECK(address_v4(0x7F000000).is_class_a());
+ BOOST_CHECK(!address_v4(0x80000000).is_class_a());
+ BOOST_CHECK(!address_v4(0xBFFF0000).is_class_a());
+ BOOST_CHECK(!address_v4(0xC0000000).is_class_a());
+ BOOST_CHECK(!address_v4(0xDFFFFF00).is_class_a());
+ BOOST_CHECK(!address_v4(0xE0000000).is_class_a());
+ BOOST_CHECK(!address_v4(0xEFFFFFFF).is_class_a());
+ BOOST_CHECK(!address_v4(0xF0000000).is_class_a());
+ BOOST_CHECK(!address_v4(0xFFFFFFFF).is_class_a());
+
+ BOOST_CHECK(!address_v4(0x01000000).is_class_b());
+ BOOST_CHECK(!address_v4(0x7F000000).is_class_b());
+ BOOST_CHECK(address_v4(0x80000000).is_class_b());
+ BOOST_CHECK(address_v4(0xBFFF0000).is_class_b());
+ BOOST_CHECK(!address_v4(0xC0000000).is_class_b());
+ BOOST_CHECK(!address_v4(0xDFFFFF00).is_class_b());
+ BOOST_CHECK(!address_v4(0xE0000000).is_class_b());
+ BOOST_CHECK(!address_v4(0xEFFFFFFF).is_class_b());
+ BOOST_CHECK(!address_v4(0xF0000000).is_class_b());
+ BOOST_CHECK(!address_v4(0xFFFFFFFF).is_class_b());
+
+ BOOST_CHECK(!address_v4(0x01000000).is_class_c());
+ BOOST_CHECK(!address_v4(0x7F000000).is_class_c());
+ BOOST_CHECK(!address_v4(0x80000000).is_class_c());
+ BOOST_CHECK(!address_v4(0xBFFF0000).is_class_c());
+ BOOST_CHECK(address_v4(0xC0000000).is_class_c());
+ BOOST_CHECK(address_v4(0xDFFFFF00).is_class_c());
+ BOOST_CHECK(!address_v4(0xE0000000).is_class_c());
+ BOOST_CHECK(!address_v4(0xEFFFFFFF).is_class_c());
+ BOOST_CHECK(!address_v4(0xF0000000).is_class_c());
+ BOOST_CHECK(!address_v4(0xFFFFFFFF).is_class_c());
+
+ BOOST_CHECK(!address_v4(0x01000000).is_multicast());
+ BOOST_CHECK(!address_v4(0x7F000000).is_multicast());
+ BOOST_CHECK(!address_v4(0x80000000).is_multicast());
+ BOOST_CHECK(!address_v4(0xBFFF0000).is_multicast());
+ BOOST_CHECK(!address_v4(0xC0000000).is_multicast());
+ BOOST_CHECK(!address_v4(0xDFFFFF00).is_multicast());
+ BOOST_CHECK(address_v4(0xE0000000).is_multicast());
+ BOOST_CHECK(address_v4(0xEFFFFFFF).is_multicast());
+ BOOST_CHECK(!address_v4(0xF0000000).is_multicast());
+ BOOST_CHECK(!address_v4(0xFFFFFFFF).is_multicast());
+
+ address_v4 a4 = address_v4::any();
+ BOOST_CHECK(a4.to_bytes()[0] == 0);
+ BOOST_CHECK(a4.to_bytes()[1] == 0);
+ BOOST_CHECK(a4.to_bytes()[2] == 0);
+ BOOST_CHECK(a4.to_bytes()[3] == 0);
+ BOOST_CHECK(a4.to_ulong() == 0);
+
+ address_v4 a5 = address_v4::loopback();
+ BOOST_CHECK(a5.to_bytes()[0] == 0x7F);
+ BOOST_CHECK(a5.to_bytes()[1] == 0);
+ BOOST_CHECK(a5.to_bytes()[2] == 0);
+ BOOST_CHECK(a5.to_bytes()[3] == 0x01);
+ BOOST_CHECK(a5.to_ulong() == 0x7F000001);
+
+ address_v4 a6 = address_v4::broadcast();
+ BOOST_CHECK(a6.to_bytes()[0] == 0xFF);
+ BOOST_CHECK(a6.to_bytes()[1] == 0xFF);
+ BOOST_CHECK(a6.to_bytes()[2] == 0xFF);
+ BOOST_CHECK(a6.to_bytes()[3] == 0xFF);
+ BOOST_CHECK(a6.to_ulong() == 0xFFFFFFFF);
+
+ address_v4 class_a_net(0xFF000000);
+ address_v4 class_b_net(0xFFFF0000);
+ address_v4 class_c_net(0xFFFFFF00);
+ address_v4 other_net(0xFFFFFFFF);
+ BOOST_CHECK(address_v4::netmask(address_v4(0x01000000)) == class_a_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0x7F000000)) == class_a_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0x80000000)) == class_b_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0xBFFF0000)) == class_b_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0xC0000000)) == class_c_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0xDFFFFF00)) == class_c_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0xE0000000)) == other_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0xEFFFFFFF)) == other_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0xF0000000)) == other_net);
+ BOOST_CHECK(address_v4::netmask(address_v4(0xFFFFFFFF)) == other_net);
+}
+
+} // namespace ip_address_v4_runtime
+
+//------------------------------------------------------------------------------
+
 test_suite* init_unit_test_suite(int, char*[])
 {
   test_suite* test = BOOST_TEST_SUITE("ip/address_v4");
   test->add(BOOST_TEST_CASE(&ip_address_v4_compile::test));
+ test->add(BOOST_TEST_CASE(&ip_address_v4_runtime::test));
   return test;
 }

Modified: branches/release/libs/asio/test/ip/address_v6.cpp
==============================================================================
--- branches/release/libs/asio/test/ip/address_v6.cpp (original)
+++ branches/release/libs/asio/test/ip/address_v6.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -145,9 +145,229 @@
 
 //------------------------------------------------------------------------------
 
+// ip_address_v6_runtime test
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~
+// The following test checks that the various public member functions meet the
+// necessary postconditions.
+
+namespace ip_address_v6_runtime {
+
+void test()
+{
+ using boost::asio::ip::address_v6;
+
+ address_v6 a1;
+ BOOST_CHECK(a1.is_unspecified());
+ BOOST_CHECK(a1.scope_id() == 0);
+
+ address_v6::bytes_type b1 = {{ 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }};
+ address_v6 a2(b1, 12345);
+ BOOST_CHECK(a2.to_bytes()[0] == 1);
+ BOOST_CHECK(a2.to_bytes()[1] == 2);
+ BOOST_CHECK(a2.to_bytes()[2] == 3);
+ BOOST_CHECK(a2.to_bytes()[3] == 4);
+ BOOST_CHECK(a2.to_bytes()[4] == 5);
+ BOOST_CHECK(a2.to_bytes()[5] == 6);
+ BOOST_CHECK(a2.to_bytes()[6] == 7);
+ BOOST_CHECK(a2.to_bytes()[7] == 8);
+ BOOST_CHECK(a2.to_bytes()[8] == 9);
+ BOOST_CHECK(a2.to_bytes()[9] == 10);
+ BOOST_CHECK(a2.to_bytes()[10] == 11);
+ BOOST_CHECK(a2.to_bytes()[11] == 12);
+ BOOST_CHECK(a2.to_bytes()[12] == 13);
+ BOOST_CHECK(a2.to_bytes()[13] == 14);
+ BOOST_CHECK(a2.to_bytes()[14] == 15);
+ BOOST_CHECK(a2.to_bytes()[15] == 16);
+ BOOST_CHECK(a2.scope_id() == 12345);
+
+ address_v6 a3;
+ a3.scope_id(12345);
+ BOOST_CHECK(a3.scope_id() == 12345);
+
+ address_v6 unspecified_address;
+ address_v6::bytes_type loopback_bytes = {{ 0 }};
+ loopback_bytes[15] = 1;
+ address_v6 loopback_address(loopback_bytes);
+ address_v6::bytes_type link_local_bytes = {{ 0xFE, 0x80, 1 }};
+ address_v6 link_local_address(link_local_bytes);
+ address_v6::bytes_type site_local_bytes = {{ 0xFE, 0xC0, 1 }};
+ address_v6 site_local_address(site_local_bytes);
+ address_v6::bytes_type v4_mapped_bytes = {{ 0 }};
+ v4_mapped_bytes[10] = 0xFF, v4_mapped_bytes[11] = 0xFF;
+ v4_mapped_bytes[12] = 1, v4_mapped_bytes[13] = 2;
+ v4_mapped_bytes[14] = 3, v4_mapped_bytes[15] = 4;
+ address_v6 v4_mapped_address(v4_mapped_bytes);
+ address_v6::bytes_type v4_compat_bytes = {{ 0 }};
+ v4_compat_bytes[12] = 1, v4_compat_bytes[13] = 2;
+ v4_compat_bytes[14] = 3, v4_compat_bytes[15] = 4;
+ address_v6 v4_compat_address(v4_compat_bytes);
+ address_v6::bytes_type mcast_global_bytes = {{ 0xFF, 0x0E, 1 }};
+ address_v6 mcast_global_address(mcast_global_bytes);
+ address_v6::bytes_type mcast_link_local_bytes = {{ 0xFF, 0x02, 1 }};
+ address_v6 mcast_link_local_address(mcast_link_local_bytes);
+ address_v6::bytes_type mcast_node_local_bytes = {{ 0xFF, 0x01, 1 }};
+ address_v6 mcast_node_local_address(mcast_node_local_bytes);
+ address_v6::bytes_type mcast_org_local_bytes = {{ 0xFF, 0x08, 1 }};
+ address_v6 mcast_org_local_address(mcast_org_local_bytes);
+ address_v6::bytes_type mcast_site_local_bytes = {{ 0xFF, 0x05, 1 }};
+ address_v6 mcast_site_local_address(mcast_site_local_bytes);
+
+ BOOST_CHECK(!unspecified_address.is_loopback());
+ BOOST_CHECK(loopback_address.is_loopback());
+ BOOST_CHECK(!link_local_address.is_loopback());
+ BOOST_CHECK(!site_local_address.is_loopback());
+ BOOST_CHECK(!v4_mapped_address.is_loopback());
+ BOOST_CHECK(!v4_compat_address.is_loopback());
+ BOOST_CHECK(!mcast_global_address.is_loopback());
+ BOOST_CHECK(!mcast_link_local_address.is_loopback());
+ BOOST_CHECK(!mcast_node_local_address.is_loopback());
+ BOOST_CHECK(!mcast_org_local_address.is_loopback());
+ BOOST_CHECK(!mcast_site_local_address.is_loopback());
+
+ BOOST_CHECK(unspecified_address.is_unspecified());
+ BOOST_CHECK(!loopback_address.is_unspecified());
+ BOOST_CHECK(!link_local_address.is_unspecified());
+ BOOST_CHECK(!site_local_address.is_unspecified());
+ BOOST_CHECK(!v4_mapped_address.is_unspecified());
+ BOOST_CHECK(!v4_compat_address.is_unspecified());
+ BOOST_CHECK(!mcast_global_address.is_unspecified());
+ BOOST_CHECK(!mcast_link_local_address.is_unspecified());
+ BOOST_CHECK(!mcast_node_local_address.is_unspecified());
+ BOOST_CHECK(!mcast_org_local_address.is_unspecified());
+ BOOST_CHECK(!mcast_site_local_address.is_unspecified());
+
+ BOOST_CHECK(!unspecified_address.is_link_local());
+ BOOST_CHECK(!loopback_address.is_link_local());
+ BOOST_CHECK(link_local_address.is_link_local());
+ BOOST_CHECK(!site_local_address.is_link_local());
+ BOOST_CHECK(!v4_mapped_address.is_link_local());
+ BOOST_CHECK(!v4_compat_address.is_link_local());
+ BOOST_CHECK(!mcast_global_address.is_link_local());
+ BOOST_CHECK(!mcast_link_local_address.is_link_local());
+ BOOST_CHECK(!mcast_node_local_address.is_link_local());
+ BOOST_CHECK(!mcast_org_local_address.is_link_local());
+ BOOST_CHECK(!mcast_site_local_address.is_link_local());
+
+ BOOST_CHECK(!unspecified_address.is_site_local());
+ BOOST_CHECK(!loopback_address.is_site_local());
+ BOOST_CHECK(!link_local_address.is_site_local());
+ BOOST_CHECK(site_local_address.is_site_local());
+ BOOST_CHECK(!v4_mapped_address.is_site_local());
+ BOOST_CHECK(!v4_compat_address.is_site_local());
+ BOOST_CHECK(!mcast_global_address.is_site_local());
+ BOOST_CHECK(!mcast_link_local_address.is_site_local());
+ BOOST_CHECK(!mcast_node_local_address.is_site_local());
+ BOOST_CHECK(!mcast_org_local_address.is_site_local());
+ BOOST_CHECK(!mcast_site_local_address.is_site_local());
+
+ BOOST_CHECK(!unspecified_address.is_v4_mapped());
+ BOOST_CHECK(!loopback_address.is_v4_mapped());
+ BOOST_CHECK(!link_local_address.is_v4_mapped());
+ BOOST_CHECK(!site_local_address.is_v4_mapped());
+ BOOST_CHECK(v4_mapped_address.is_v4_mapped());
+ BOOST_CHECK(!v4_compat_address.is_v4_mapped());
+ BOOST_CHECK(!mcast_global_address.is_v4_mapped());
+ BOOST_CHECK(!mcast_link_local_address.is_v4_mapped());
+ BOOST_CHECK(!mcast_node_local_address.is_v4_mapped());
+ BOOST_CHECK(!mcast_org_local_address.is_v4_mapped());
+ BOOST_CHECK(!mcast_site_local_address.is_v4_mapped());
+
+ BOOST_CHECK(!unspecified_address.is_v4_compatible());
+ BOOST_CHECK(!loopback_address.is_v4_compatible());
+ BOOST_CHECK(!link_local_address.is_v4_compatible());
+ BOOST_CHECK(!site_local_address.is_v4_compatible());
+ BOOST_CHECK(!v4_mapped_address.is_v4_compatible());
+ BOOST_CHECK(v4_compat_address.is_v4_compatible());
+ BOOST_CHECK(!mcast_global_address.is_v4_compatible());
+ BOOST_CHECK(!mcast_link_local_address.is_v4_compatible());
+ BOOST_CHECK(!mcast_node_local_address.is_v4_compatible());
+ BOOST_CHECK(!mcast_org_local_address.is_v4_compatible());
+ BOOST_CHECK(!mcast_site_local_address.is_v4_compatible());
+
+ BOOST_CHECK(!unspecified_address.is_multicast());
+ BOOST_CHECK(!loopback_address.is_multicast());
+ BOOST_CHECK(!link_local_address.is_multicast());
+ BOOST_CHECK(!site_local_address.is_multicast());
+ BOOST_CHECK(!v4_mapped_address.is_multicast());
+ BOOST_CHECK(!v4_compat_address.is_multicast());
+ BOOST_CHECK(mcast_global_address.is_multicast());
+ BOOST_CHECK(mcast_link_local_address.is_multicast());
+ BOOST_CHECK(mcast_node_local_address.is_multicast());
+ BOOST_CHECK(mcast_org_local_address.is_multicast());
+ BOOST_CHECK(mcast_site_local_address.is_multicast());
+
+ BOOST_CHECK(!unspecified_address.is_multicast_global());
+ BOOST_CHECK(!loopback_address.is_multicast_global());
+ BOOST_CHECK(!link_local_address.is_multicast_global());
+ BOOST_CHECK(!site_local_address.is_multicast_global());
+ BOOST_CHECK(!v4_mapped_address.is_multicast_global());
+ BOOST_CHECK(!v4_compat_address.is_multicast_global());
+ BOOST_CHECK(mcast_global_address.is_multicast_global());
+ BOOST_CHECK(!mcast_link_local_address.is_multicast_global());
+ BOOST_CHECK(!mcast_node_local_address.is_multicast_global());
+ BOOST_CHECK(!mcast_org_local_address.is_multicast_global());
+ BOOST_CHECK(!mcast_site_local_address.is_multicast_global());
+
+ BOOST_CHECK(!unspecified_address.is_multicast_link_local());
+ BOOST_CHECK(!loopback_address.is_multicast_link_local());
+ BOOST_CHECK(!link_local_address.is_multicast_link_local());
+ BOOST_CHECK(!site_local_address.is_multicast_link_local());
+ BOOST_CHECK(!v4_mapped_address.is_multicast_link_local());
+ BOOST_CHECK(!v4_compat_address.is_multicast_link_local());
+ BOOST_CHECK(!mcast_global_address.is_multicast_link_local());
+ BOOST_CHECK(mcast_link_local_address.is_multicast_link_local());
+ BOOST_CHECK(!mcast_node_local_address.is_multicast_link_local());
+ BOOST_CHECK(!mcast_org_local_address.is_multicast_link_local());
+ BOOST_CHECK(!mcast_site_local_address.is_multicast_link_local());
+
+ BOOST_CHECK(!unspecified_address.is_multicast_node_local());
+ BOOST_CHECK(!loopback_address.is_multicast_node_local());
+ BOOST_CHECK(!link_local_address.is_multicast_node_local());
+ BOOST_CHECK(!site_local_address.is_multicast_node_local());
+ BOOST_CHECK(!v4_mapped_address.is_multicast_node_local());
+ BOOST_CHECK(!v4_compat_address.is_multicast_node_local());
+ BOOST_CHECK(!mcast_global_address.is_multicast_node_local());
+ BOOST_CHECK(!mcast_link_local_address.is_multicast_node_local());
+ BOOST_CHECK(mcast_node_local_address.is_multicast_node_local());
+ BOOST_CHECK(!mcast_org_local_address.is_multicast_node_local());
+ BOOST_CHECK(!mcast_site_local_address.is_multicast_node_local());
+
+ BOOST_CHECK(!unspecified_address.is_multicast_org_local());
+ BOOST_CHECK(!loopback_address.is_multicast_org_local());
+ BOOST_CHECK(!link_local_address.is_multicast_org_local());
+ BOOST_CHECK(!site_local_address.is_multicast_org_local());
+ BOOST_CHECK(!v4_mapped_address.is_multicast_org_local());
+ BOOST_CHECK(!v4_compat_address.is_multicast_org_local());
+ BOOST_CHECK(!mcast_global_address.is_multicast_org_local());
+ BOOST_CHECK(!mcast_link_local_address.is_multicast_org_local());
+ BOOST_CHECK(!mcast_node_local_address.is_multicast_org_local());
+ BOOST_CHECK(mcast_org_local_address.is_multicast_org_local());
+ BOOST_CHECK(!mcast_site_local_address.is_multicast_org_local());
+
+ BOOST_CHECK(!unspecified_address.is_multicast_site_local());
+ BOOST_CHECK(!loopback_address.is_multicast_site_local());
+ BOOST_CHECK(!link_local_address.is_multicast_site_local());
+ BOOST_CHECK(!site_local_address.is_multicast_site_local());
+ BOOST_CHECK(!v4_mapped_address.is_multicast_site_local());
+ BOOST_CHECK(!v4_compat_address.is_multicast_site_local());
+ BOOST_CHECK(!mcast_global_address.is_multicast_site_local());
+ BOOST_CHECK(!mcast_link_local_address.is_multicast_site_local());
+ BOOST_CHECK(!mcast_node_local_address.is_multicast_site_local());
+ BOOST_CHECK(!mcast_org_local_address.is_multicast_site_local());
+ BOOST_CHECK(mcast_site_local_address.is_multicast_site_local());
+
+ BOOST_CHECK(address_v6::loopback().is_loopback());
+}
+
+} // namespace ip_address_v6_runtime
+
+//------------------------------------------------------------------------------
+
 test_suite* init_unit_test_suite(int, char*[])
 {
   test_suite* test = BOOST_TEST_SUITE("ip/address_v6");
   test->add(BOOST_TEST_CASE(&ip_address_v6_compile::test));
+ test->add(BOOST_TEST_CASE(&ip_address_v6_runtime::test));
   return test;
 }

Modified: branches/release/libs/asio/test/ip/tcp.cpp
==============================================================================
--- branches/release/libs/asio/test/ip/tcp.cpp (original)
+++ branches/release/libs/asio/test/ip/tcp.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -26,7 +26,9 @@
 #include <boost/asio/read.hpp>
 #include <boost/asio/write.hpp>
 #include "../unit_test.hpp"
+#include "../archetypes/gettable_socket_option.hpp"
 #include "../archetypes/io_control_command.hpp"
+#include "../archetypes/settable_socket_option.hpp"
 
 //------------------------------------------------------------------------------
 
@@ -155,7 +157,12 @@
     char mutable_char_buffer[128] = "";
     const char const_char_buffer[128] = "";
     socket_base::message_flags in_flags = 0;
- socket_base::keep_alive socket_option;
+ archetypes::settable_socket_option<void> settable_socket_option1;
+ archetypes::settable_socket_option<int> settable_socket_option2;
+ archetypes::settable_socket_option<double> settable_socket_option3;
+ archetypes::gettable_socket_option<void> gettable_socket_option1;
+ archetypes::gettable_socket_option<int> gettable_socket_option2;
+ archetypes::gettable_socket_option<double> gettable_socket_option3;
     archetypes::io_control_command io_control_command;
     boost::system::error_code ec;
 
@@ -169,9 +176,20 @@
     int native_socket1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     ip::tcp::socket socket6(ios, ip::tcp::v4(), native_socket1);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ ip::tcp::socket socket7(std::move(socket6));
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_stream_socket operators.
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ socket1 = ip::tcp::socket(ios);
+ socket1 = std::move(socket2);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     // basic_io_object functions.
 
- io_service& ios_ref = socket1.io_service();
+ io_service& ios_ref = socket1.get_io_service();
     (void)ios_ref;
 
     // basic_socket functions.
@@ -179,9 +197,9 @@
     ip::tcp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
- const ip::tcp::socket& socket7 = socket1;
+ const ip::tcp::socket& socket8 = socket1;
     const ip::tcp::socket::lowest_layer_type& lowest_layer2
- = socket7.lowest_layer();
+ = socket8.lowest_layer();
     (void)lowest_layer2;
 
     socket1.open(ip::tcp::v4());
@@ -203,6 +221,10 @@
     ip::tcp::socket::native_type native_socket4 = socket1.native();
     (void)native_socket4;
 
+ ip::tcp::socket::native_handle_type native_socket5
+ = socket1.native_handle();
+ (void)native_socket5;
+
     socket1.cancel();
     socket1.cancel(ec);
 
@@ -226,18 +248,38 @@
     socket1.connect(ip::tcp::endpoint(ip::tcp::v4(), 0), ec);
     socket1.connect(ip::tcp::endpoint(ip::tcp::v6(), 0), ec);
 
- socket1.async_connect(ip::tcp::endpoint(ip::tcp::v4(), 0), connect_handler);
- socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0), connect_handler);
-
- socket1.set_option(socket_option);
- socket1.set_option(socket_option, ec);
-
- socket1.get_option(socket_option);
- socket1.get_option(socket_option, ec);
+ socket1.async_connect(ip::tcp::endpoint(ip::tcp::v4(), 0),
+ &connect_handler);
+ socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0),
+ &connect_handler);
+
+ socket1.set_option(settable_socket_option1);
+ socket1.set_option(settable_socket_option1, ec);
+ socket1.set_option(settable_socket_option2);
+ socket1.set_option(settable_socket_option2, ec);
+ socket1.set_option(settable_socket_option3);
+ socket1.set_option(settable_socket_option3, ec);
+
+ socket1.get_option(gettable_socket_option1);
+ socket1.get_option(gettable_socket_option1, ec);
+ socket1.get_option(gettable_socket_option2);
+ socket1.get_option(gettable_socket_option2, ec);
+ socket1.get_option(gettable_socket_option3);
+ socket1.get_option(gettable_socket_option3, ec);
 
     socket1.io_control(io_control_command);
     socket1.io_control(io_control_command, ec);
 
+ bool non_blocking1 = socket1.non_blocking();
+ (void)non_blocking1;
+ socket1.non_blocking(true);
+ socket1.non_blocking(false, ec);
+
+ bool non_blocking2 = socket1.native_non_blocking();
+ (void)non_blocking2;
+ socket1.native_non_blocking(true);
+ socket1.native_non_blocking(false, ec);
+
     ip::tcp::endpoint endpoint1 = socket1.local_endpoint();
     ip::tcp::endpoint endpoint2 = socket1.local_endpoint(ec);
 
@@ -259,12 +301,12 @@
     socket1.send(buffer(const_char_buffer), in_flags, ec);
     socket1.send(null_buffers(), in_flags, ec);
 
- socket1.async_send(buffer(mutable_char_buffer), send_handler);
- socket1.async_send(buffer(const_char_buffer), send_handler);
- socket1.async_send(null_buffers(), send_handler);
- socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler);
- socket1.async_send(buffer(const_char_buffer), in_flags, send_handler);
- socket1.async_send(null_buffers(), in_flags, send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), &send_handler);
+ socket1.async_send(buffer(const_char_buffer), &send_handler);
+ socket1.async_send(null_buffers(), &send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), in_flags, &send_handler);
+ socket1.async_send(buffer(const_char_buffer), in_flags, &send_handler);
+ socket1.async_send(null_buffers(), in_flags, &send_handler);
 
     socket1.receive(buffer(mutable_char_buffer));
     socket1.receive(null_buffers());
@@ -273,11 +315,11 @@
     socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
     socket1.receive(null_buffers(), in_flags, ec);
 
- socket1.async_receive(buffer(mutable_char_buffer), receive_handler);
- socket1.async_receive(null_buffers(), receive_handler);
+ socket1.async_receive(buffer(mutable_char_buffer), &receive_handler);
+ socket1.async_receive(null_buffers(), &receive_handler);
     socket1.async_receive(buffer(mutable_char_buffer), in_flags,
- receive_handler);
- socket1.async_receive(null_buffers(), in_flags, receive_handler);
+ &receive_handler);
+ socket1.async_receive(null_buffers(), in_flags, &receive_handler);
 
     socket1.write_some(buffer(mutable_char_buffer));
     socket1.write_some(buffer(const_char_buffer));
@@ -286,16 +328,16 @@
     socket1.write_some(buffer(const_char_buffer), ec);
     socket1.write_some(null_buffers(), ec);
 
- socket1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
- socket1.async_write_some(buffer(const_char_buffer), write_some_handler);
- socket1.async_write_some(null_buffers(), write_some_handler);
+ socket1.async_write_some(buffer(mutable_char_buffer), &write_some_handler);
+ socket1.async_write_some(buffer(const_char_buffer), &write_some_handler);
+ socket1.async_write_some(null_buffers(), &write_some_handler);
 
     socket1.read_some(buffer(mutable_char_buffer));
     socket1.read_some(buffer(mutable_char_buffer), ec);
     socket1.read_some(null_buffers(), ec);
 
- socket1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
- socket1.async_read_some(null_buffers(), read_some_handler);
+ socket1.async_read_some(buffer(mutable_char_buffer), &read_some_handler);
+ socket1.async_read_some(null_buffers(), &read_some_handler);
   }
   catch (std::exception&)
   {
@@ -474,6 +516,142 @@
 
 //------------------------------------------------------------------------------
 
+// ip_tcp_acceptor_compile test
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// The following test checks that all public member functions on the class
+// ip::tcp::acceptor compile and link correctly. Runtime failures are ignored.
+
+namespace ip_tcp_acceptor_compile {
+
+void accept_handler(const boost::system::error_code&)
+{
+}
+
+void test()
+{
+ using namespace boost::asio;
+ namespace ip = boost::asio::ip;
+
+ try
+ {
+ io_service ios;
+ ip::tcp::socket peer_socket(ios);
+ ip::tcp::endpoint peer_endpoint;
+ archetypes::settable_socket_option<void> settable_socket_option1;
+ archetypes::settable_socket_option<int> settable_socket_option2;
+ archetypes::settable_socket_option<double> settable_socket_option3;
+ archetypes::gettable_socket_option<void> gettable_socket_option1;
+ archetypes::gettable_socket_option<int> gettable_socket_option2;
+ archetypes::gettable_socket_option<double> gettable_socket_option3;
+ archetypes::io_control_command io_control_command;
+ boost::system::error_code ec;
+
+ // basic_socket_acceptor constructors.
+
+ ip::tcp::acceptor acceptor1(ios);
+ ip::tcp::acceptor acceptor2(ios, ip::tcp::v4());
+ ip::tcp::acceptor acceptor3(ios, ip::tcp::v6());
+ ip::tcp::acceptor acceptor4(ios, ip::tcp::endpoint(ip::tcp::v4(), 0));
+ ip::tcp::acceptor acceptor5(ios, ip::tcp::endpoint(ip::tcp::v6(), 0));
+ int native_acceptor1 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ ip::tcp::acceptor acceptor6(ios, ip::tcp::v4(), native_acceptor1);
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ ip::tcp::acceptor acceptor7(std::move(acceptor6));
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_socket_acceptor operators.
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ acceptor1 = ip::tcp::acceptor(ios);
+ acceptor1 = std::move(acceptor2);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_io_object functions.
+
+ io_service& ios_ref = acceptor1.get_io_service();
+ (void)ios_ref;
+
+ // basic_socket_acceptor functions.
+
+ acceptor1.open(ip::tcp::v4());
+ acceptor1.open(ip::tcp::v6());
+ acceptor1.open(ip::tcp::v4(), ec);
+ acceptor1.open(ip::tcp::v6(), ec);
+
+ int native_acceptor2 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ acceptor1.assign(ip::tcp::v4(), native_acceptor2);
+ int native_acceptor3 = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ acceptor1.assign(ip::tcp::v4(), native_acceptor3, ec);
+
+ bool is_open = acceptor1.is_open();
+ (void)is_open;
+
+ acceptor1.close();
+ acceptor1.close(ec);
+
+ ip::tcp::acceptor::native_type native_acceptor4 = acceptor1.native();
+ (void)native_acceptor4;
+
+ ip::tcp::acceptor::native_handle_type native_acceptor5
+ = acceptor1.native_handle();
+ (void)native_acceptor5;
+
+ acceptor1.cancel();
+ acceptor1.cancel(ec);
+
+ acceptor1.bind(ip::tcp::endpoint(ip::tcp::v4(), 0));
+ acceptor1.bind(ip::tcp::endpoint(ip::tcp::v6(), 0));
+ acceptor1.bind(ip::tcp::endpoint(ip::tcp::v4(), 0), ec);
+ acceptor1.bind(ip::tcp::endpoint(ip::tcp::v6(), 0), ec);
+
+ acceptor1.set_option(settable_socket_option1);
+ acceptor1.set_option(settable_socket_option1, ec);
+ acceptor1.set_option(settable_socket_option2);
+ acceptor1.set_option(settable_socket_option2, ec);
+ acceptor1.set_option(settable_socket_option3);
+ acceptor1.set_option(settable_socket_option3, ec);
+
+ acceptor1.get_option(gettable_socket_option1);
+ acceptor1.get_option(gettable_socket_option1, ec);
+ acceptor1.get_option(gettable_socket_option2);
+ acceptor1.get_option(gettable_socket_option2, ec);
+ acceptor1.get_option(gettable_socket_option3);
+ acceptor1.get_option(gettable_socket_option3, ec);
+
+ acceptor1.io_control(io_control_command);
+ acceptor1.io_control(io_control_command, ec);
+
+ bool non_blocking1 = acceptor1.non_blocking();
+ (void)non_blocking1;
+ acceptor1.non_blocking(true);
+ acceptor1.non_blocking(false, ec);
+
+ bool non_blocking2 = acceptor1.native_non_blocking();
+ (void)non_blocking2;
+ acceptor1.native_non_blocking(true);
+ acceptor1.native_non_blocking(false, ec);
+
+ ip::tcp::endpoint endpoint1 = acceptor1.local_endpoint();
+ ip::tcp::endpoint endpoint2 = acceptor1.local_endpoint(ec);
+
+ acceptor1.accept(peer_socket);
+ acceptor1.accept(peer_socket, ec);
+ acceptor1.accept(peer_socket, peer_endpoint);
+ acceptor1.accept(peer_socket, peer_endpoint, ec);
+
+ acceptor1.async_accept(peer_socket, &accept_handler);
+ acceptor1.async_accept(peer_socket, peer_endpoint, &accept_handler);
+ }
+ catch (std::exception&)
+ {
+ }
+}
+
+} // namespace ip_tcp_acceptor_compile
+
+//------------------------------------------------------------------------------
+
 // ip_tcp_acceptor_runtime test
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // The following test checks the runtime operation of the ip::tcp::acceptor
@@ -515,6 +693,9 @@
   ip::tcp::endpoint client_endpoint;
   acceptor.accept(server_side_socket, client_endpoint);
 
+ ip::tcp::acceptor::non_blocking_io command(false);
+ acceptor.io_control(command);
+
   ip::tcp::endpoint client_side_local_endpoint
     = client_side_socket.local_endpoint();
   BOOST_CHECK(client_side_local_endpoint.port() == client_endpoint.port());
@@ -526,16 +707,16 @@
   client_side_socket.close();
   server_side_socket.close();
 
- acceptor.async_accept(server_side_socket, handle_accept);
- client_side_socket.async_connect(server_endpoint, handle_connect);
+ acceptor.async_accept(server_side_socket, &handle_accept);
+ client_side_socket.async_connect(server_endpoint, &handle_connect);
 
   ios.run();
 
   client_side_socket.close();
   server_side_socket.close();
 
- acceptor.async_accept(server_side_socket, client_endpoint, handle_accept);
- client_side_socket.async_connect(server_endpoint, handle_connect);
+ acceptor.async_accept(server_side_socket, client_endpoint, &handle_accept);
+ client_side_socket.async_connect(server_endpoint, &handle_connect);
 
   ios.reset();
   ios.run();
@@ -581,7 +762,7 @@
 
     // basic_io_object functions.
 
- io_service& ios_ref = resolver.io_service();
+ io_service& ios_ref = resolver.get_io_service();
     (void)ios_ref;
 
     // basic_resolver functions.
@@ -600,9 +781,9 @@
     ip::tcp::resolver::iterator iter4 = resolver.resolve(e, ec);
     (void)iter4;
 
- resolver.async_resolve(q, resolve_handler);
+ resolver.async_resolve(q, &resolve_handler);
 
- resolver.async_resolve(e, resolve_handler);
+ resolver.async_resolve(e, &resolve_handler);
   }
   catch (std::exception&)
   {
@@ -620,6 +801,7 @@
   test->add(BOOST_TEST_CASE(&ip_tcp_runtime::test));
   test->add(BOOST_TEST_CASE(&ip_tcp_socket_compile::test));
   test->add(BOOST_TEST_CASE(&ip_tcp_socket_runtime::test));
+ test->add(BOOST_TEST_CASE(&ip_tcp_acceptor_compile::test));
   test->add(BOOST_TEST_CASE(&ip_tcp_acceptor_runtime::test));
   test->add(BOOST_TEST_CASE(&ip_tcp_resolver_compile::test));
   return test;

Modified: branches/release/libs/asio/test/ip/udp.cpp
==============================================================================
--- branches/release/libs/asio/test/ip/udp.cpp (original)
+++ branches/release/libs/asio/test/ip/udp.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -21,7 +21,9 @@
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/placeholders.hpp>
 #include "../unit_test.hpp"
+#include "../archetypes/gettable_socket_option.hpp"
 #include "../archetypes/io_control_command.hpp"
+#include "../archetypes/settable_socket_option.hpp"
 
 //------------------------------------------------------------------------------
 
@@ -55,7 +57,12 @@
     char mutable_char_buffer[128] = "";
     const char const_char_buffer[128] = "";
     socket_base::message_flags in_flags = 0;
- socket_base::keep_alive socket_option;
+ archetypes::settable_socket_option<void> settable_socket_option1;
+ archetypes::settable_socket_option<int> settable_socket_option2;
+ archetypes::settable_socket_option<double> settable_socket_option3;
+ archetypes::gettable_socket_option<void> gettable_socket_option1;
+ archetypes::gettable_socket_option<int> gettable_socket_option2;
+ archetypes::gettable_socket_option<double> gettable_socket_option3;
     archetypes::io_control_command io_control_command;
     boost::system::error_code ec;
 
@@ -69,9 +76,20 @@
     int native_socket1 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
     ip::udp::socket socket6(ios, ip::udp::v4(), native_socket1);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ ip::udp::socket socket7(std::move(socket6));
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_datagram_socket operators.
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ socket1 = ip::udp::socket(ios);
+ socket1 = std::move(socket2);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     // basic_io_object functions.
 
- io_service& ios_ref = socket1.io_service();
+ io_service& ios_ref = socket1.get_io_service();
     (void)ios_ref;
 
     // basic_socket functions.
@@ -79,9 +97,9 @@
     ip::udp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
     (void)lowest_layer;
 
- const ip::udp::socket& socket7 = socket1;
+ const ip::udp::socket& socket8 = socket1;
     const ip::udp::socket::lowest_layer_type& lowest_layer2
- = socket7.lowest_layer();
+ = socket8.lowest_layer();
     (void)lowest_layer2;
 
     socket1.open(ip::udp::v4());
@@ -103,6 +121,10 @@
     ip::udp::socket::native_type native_socket4 = socket1.native();
     (void)native_socket4;
 
+ ip::udp::socket::native_handle_type native_socket5
+ = socket1.native_handle();
+ (void)native_socket5;
+
     socket1.cancel();
     socket1.cancel(ec);
 
@@ -126,18 +148,38 @@
     socket1.connect(ip::udp::endpoint(ip::udp::v4(), 0), ec);
     socket1.connect(ip::udp::endpoint(ip::udp::v6(), 0), ec);
 
- socket1.async_connect(ip::udp::endpoint(ip::udp::v4(), 0), connect_handler);
- socket1.async_connect(ip::udp::endpoint(ip::udp::v6(), 0), connect_handler);
-
- socket1.set_option(socket_option);
- socket1.set_option(socket_option, ec);
-
- socket1.get_option(socket_option);
- socket1.get_option(socket_option, ec);
+ socket1.async_connect(ip::udp::endpoint(ip::udp::v4(), 0),
+ &connect_handler);
+ socket1.async_connect(ip::udp::endpoint(ip::udp::v6(), 0),
+ &connect_handler);
+
+ socket1.set_option(settable_socket_option1);
+ socket1.set_option(settable_socket_option1, ec);
+ socket1.set_option(settable_socket_option2);
+ socket1.set_option(settable_socket_option2, ec);
+ socket1.set_option(settable_socket_option3);
+ socket1.set_option(settable_socket_option3, ec);
+
+ socket1.get_option(gettable_socket_option1);
+ socket1.get_option(gettable_socket_option1, ec);
+ socket1.get_option(gettable_socket_option2);
+ socket1.get_option(gettable_socket_option2, ec);
+ socket1.get_option(gettable_socket_option3);
+ socket1.get_option(gettable_socket_option3, ec);
 
     socket1.io_control(io_control_command);
     socket1.io_control(io_control_command, ec);
 
+ bool non_blocking1 = socket1.non_blocking();
+ (void)non_blocking1;
+ socket1.non_blocking(true);
+ socket1.non_blocking(false, ec);
+
+ bool non_blocking2 = socket1.native_non_blocking();
+ (void)non_blocking2;
+ socket1.native_non_blocking(true);
+ socket1.native_non_blocking(false, ec);
+
     ip::udp::endpoint endpoint1 = socket1.local_endpoint();
     ip::udp::endpoint endpoint2 = socket1.local_endpoint(ec);
 
@@ -159,12 +201,12 @@
     socket1.send(buffer(const_char_buffer), in_flags, ec);
     socket1.send(null_buffers(), in_flags, ec);
 
- socket1.async_send(buffer(mutable_char_buffer), send_handler);
- socket1.async_send(buffer(const_char_buffer), send_handler);
- socket1.async_send(null_buffers(), send_handler);
- socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler);
- socket1.async_send(buffer(const_char_buffer), in_flags, send_handler);
- socket1.async_send(null_buffers(), in_flags, send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), &send_handler);
+ socket1.async_send(buffer(const_char_buffer), &send_handler);
+ socket1.async_send(null_buffers(), &send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), in_flags, &send_handler);
+ socket1.async_send(buffer(const_char_buffer), in_flags, &send_handler);
+ socket1.async_send(null_buffers(), in_flags, &send_handler);
 
     socket1.send_to(buffer(mutable_char_buffer),
         ip::udp::endpoint(ip::udp::v4(), 0));
@@ -204,29 +246,29 @@
         ip::udp::endpoint(ip::udp::v6(), 0), in_flags, ec);
 
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), &send_handler);
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v4(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v6(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), &send_handler);
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), in_flags, &send_handler);
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), in_flags, &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), in_flags, &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), in_flags, &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v4(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), in_flags, &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v6(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), in_flags, &send_handler);
 
     socket1.receive(buffer(mutable_char_buffer));
     socket1.receive(null_buffers());
@@ -235,11 +277,11 @@
     socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
     socket1.receive(null_buffers(), in_flags, ec);
 
- socket1.async_receive(buffer(mutable_char_buffer), receive_handler);
- socket1.async_receive(null_buffers(), receive_handler);
+ socket1.async_receive(buffer(mutable_char_buffer), &receive_handler);
+ socket1.async_receive(null_buffers(), &receive_handler);
     socket1.async_receive(buffer(mutable_char_buffer), in_flags,
- receive_handler);
- socket1.async_receive(null_buffers(), in_flags, receive_handler);
+ &receive_handler);
+ socket1.async_receive(null_buffers(), in_flags, &receive_handler);
 
     ip::udp::endpoint endpoint;
     socket1.receive_from(buffer(mutable_char_buffer), endpoint);
@@ -250,13 +292,13 @@
     socket1.receive_from(null_buffers(), endpoint, in_flags, ec);
 
     socket1.async_receive_from(buffer(mutable_char_buffer),
- endpoint, receive_handler);
+ endpoint, &receive_handler);
     socket1.async_receive_from(null_buffers(),
- endpoint, receive_handler);
+ endpoint, &receive_handler);
     socket1.async_receive_from(buffer(mutable_char_buffer),
- endpoint, in_flags, receive_handler);
+ endpoint, in_flags, &receive_handler);
     socket1.async_receive_from(null_buffers(),
- endpoint, in_flags, receive_handler);
+ endpoint, in_flags, &receive_handler);
   }
   catch (std::exception&)
   {
@@ -364,7 +406,7 @@
 
     // basic_io_object functions.
 
- io_service& ios_ref = resolver.io_service();
+ io_service& ios_ref = resolver.get_io_service();
     (void)ios_ref;
 
     // basic_resolver functions.
@@ -383,9 +425,9 @@
     ip::udp::resolver::iterator iter4 = resolver.resolve(e, ec);
     (void)iter4;
 
- resolver.async_resolve(q, resolve_handler);
+ resolver.async_resolve(q, &resolve_handler);
 
- resolver.async_resolve(e, resolve_handler);
+ resolver.async_resolve(e, &resolve_handler);
   }
   catch (std::exception&)
   {

Modified: branches/release/libs/asio/test/local/datagram_protocol.cpp
==============================================================================
--- branches/release/libs/asio/test/local/datagram_protocol.cpp (original)
+++ branches/release/libs/asio/test/local/datagram_protocol.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -70,7 +70,7 @@
 
     // basic_io_object functions.
 
- io_service& ios_ref = socket1.io_service();
+ io_service& ios_ref = socket1.get_io_service();
     (void)ios_ref;
 
     // basic_socket functions.

Modified: branches/release/libs/asio/test/local/stream_protocol.cpp
==============================================================================
--- branches/release/libs/asio/test/local/stream_protocol.cpp (original)
+++ branches/release/libs/asio/test/local/stream_protocol.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -78,7 +78,7 @@
 
     // basic_io_object functions.
 
- io_service& ios_ref = socket1.io_service();
+ io_service& ios_ref = socket1.get_io_service();
     (void)ios_ref;
 
     // basic_socket functions.

Modified: branches/release/libs/asio/test/posix/stream_descriptor.cpp
==============================================================================
--- branches/release/libs/asio/test/posix/stream_descriptor.cpp (original)
+++ branches/release/libs/asio/test/posix/stream_descriptor.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -57,9 +57,20 @@
     int native_descriptor1 = -1;
     posix::stream_descriptor descriptor2(ios, native_descriptor1);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ posix::stream_descriptor descriptor3(std::move(descriptor3));
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_stream_descriptor operators.
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ descriptor1 = posix::stream_descriptor(ios);
+ descriptor1 = std::move(descriptor2);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     // basic_io_object functions.
 
- io_service& ios_ref = descriptor1.io_service();
+ io_service& ios_ref = descriptor1.get_io_service();
     (void)ios_ref;
 
     // basic_descriptor functions.
@@ -68,9 +79,9 @@
       = descriptor1.lowest_layer();
     (void)lowest_layer;
 
- const posix::stream_descriptor& descriptor3 = descriptor1;
+ const posix::stream_descriptor& descriptor4 = descriptor1;
     const posix::stream_descriptor::lowest_layer_type& lowest_layer2
- = descriptor3.lowest_layer();
+ = descriptor4.lowest_layer();
     (void)lowest_layer2;
 
     int native_descriptor2 = -1;
@@ -86,12 +97,30 @@
       = descriptor1.native();
     (void)native_descriptor3;
 
+ posix::stream_descriptor::native_handle_type native_descriptor4
+ = descriptor1.native_handle();
+ (void)native_descriptor4;
+
+ posix::stream_descriptor::native_handle_type native_descriptor5
+ = descriptor1.release();
+ (void)native_descriptor5;
+
     descriptor1.cancel();
     descriptor1.cancel(ec);
 
     descriptor1.io_control(io_control_command);
     descriptor1.io_control(io_control_command, ec);
 
+ bool non_blocking1 = descriptor1.non_blocking();
+ (void)non_blocking1;
+ descriptor1.non_blocking(true);
+ descriptor1.non_blocking(false, ec);
+
+ bool non_blocking2 = descriptor1.native_non_blocking();
+ (void)non_blocking2;
+ descriptor1.native_non_blocking(true);
+ descriptor1.native_non_blocking(false, ec);
+
     // basic_stream_descriptor functions.
 
     descriptor1.write_some(buffer(mutable_char_buffer));

Added: branches/release/libs/asio/test/raw_socket_service.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/raw_socket_service.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// raw_socket_service.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/raw_socket_service.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("raw_socket_service");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Modified: branches/release/libs/asio/test/read.cpp
==============================================================================
--- branches/release/libs/asio/test/read.cpp (original)
+++ branches/release/libs/asio/test/read.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -88,25 +88,11 @@
   template <typename Mutable_Buffers>
   size_t read_some(const Mutable_Buffers& buffers)
   {
- size_t total_length = 0;
-
- typename Mutable_Buffers::const_iterator iter = buffers.begin();
- typename Mutable_Buffers::const_iterator end = buffers.end();
- for (; iter != end && total_length < next_read_length_; ++iter)
- {
- size_t length = boost::asio::buffer_size(*iter);
- if (length > length_ - position_)
- length = length_ - position_;
-
- if (length > next_read_length_ - total_length)
- length = next_read_length_ - total_length;
-
- memcpy(boost::asio::buffer_cast<void*>(*iter), data_ + position_, length);
- position_ += length;
- total_length += length;
- }
-
- return total_length;
+ size_t n = boost::asio::buffer_copy(buffers,
+ boost::asio::buffer(data_, length_) + position_,
+ next_read_length_);
+ position_ += n;
+ return n;
   }
 
   template <typename Mutable_Buffers>
@@ -236,6 +222,119 @@
   BOOST_CHECK(s.check_buffers(sb.data(), sizeof(read_data)));
 }
 
+void test_3_arg_nothrow_zero_buffers_read()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ std::vector<boost::asio::mutable_buffer> buffers;
+
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == 0);
+ BOOST_CHECK(!error);
+}
+
+void test_3_arg_nothrow_mutable_buffers_1_read()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(read_buf, sizeof(read_buf));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_3_arg_nothrow_multi_buffers_read()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::array<boost::asio::mutable_buffer, 2> buffers = { {
+ boost::asio::buffer(read_buf, 32),
+ boost::asio::buffer(read_buf) + 32 } };
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_3_arg_nothrow_streambuf_read()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ boost::asio::streambuf sb(sizeof(read_data));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read(s, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
 bool old_style_transfer_all(const boost::system::error_code& ec,
     size_t /*bytes_transferred*/)
 {
@@ -350,6 +449,75 @@
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read(s, buffers, old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(read_data));
   BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
@@ -492,6 +660,75 @@
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read(s, buffers, old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(read_data));
   BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
@@ -643,6 +880,84 @@
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
   bytes_transferred = boost::asio::read(s, sb, old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(read_data));
   BOOST_CHECK(sb.size() == sizeof(read_data));
@@ -814,6 +1129,93 @@
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read(s, buffers,
       old_style_transfer_all, error);
   BOOST_CHECK(bytes_transferred == sizeof(read_data));
@@ -877,9 +1279,96 @@
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- boost::system::error_code error;
- size_t bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_all(), error);
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_at_least(1), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_at_least(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_at_least(1), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_at_least(10), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_at_least(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_at_least(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, buffers,
+ boost::asio::transfer_at_least(42), error);
   BOOST_CHECK(bytes_transferred == sizeof(read_data));
   BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
   BOOST_CHECK(!error);
@@ -889,9 +1378,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ boost::asio::transfer_at_least(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -899,18 +1388,18 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ boost::asio::transfer_at_least(42), error);
+ BOOST_CHECK(bytes_transferred == 50);
+ BOOST_CHECK(s.check_buffers(buffers, 50));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(1), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -918,7 +1407,7 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(1), error);
+ boost::asio::transfer_exactly(1), error);
   BOOST_CHECK(bytes_transferred == 1);
   BOOST_CHECK(s.check_buffers(buffers, 1));
   BOOST_CHECK(!error);
@@ -928,18 +1417,18 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(1), error);
- BOOST_CHECK(bytes_transferred == 10);
- BOOST_CHECK(s.check_buffers(buffers, 10));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(10), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -947,7 +1436,7 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(10), error);
+ boost::asio::transfer_exactly(10), error);
   BOOST_CHECK(bytes_transferred == 10);
   BOOST_CHECK(s.check_buffers(buffers, 10));
   BOOST_CHECK(!error);
@@ -957,7 +1446,7 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(10), error);
+ boost::asio::transfer_exactly(10), error);
   BOOST_CHECK(bytes_transferred == 10);
   BOOST_CHECK(s.check_buffers(buffers, 10));
   BOOST_CHECK(!error);
@@ -966,9 +1455,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(42), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -976,7 +1465,7 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(42), error);
+ boost::asio::transfer_exactly(42), error);
   BOOST_CHECK(bytes_transferred == 42);
   BOOST_CHECK(s.check_buffers(buffers, 42));
   BOOST_CHECK(!error);
@@ -986,9 +1475,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read(s, buffers,
- boost::asio::transfer_at_least(42), error);
- BOOST_CHECK(bytes_transferred == 50);
- BOOST_CHECK(s.check_buffers(buffers, 50));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1181,6 +1670,102 @@
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read(s, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
   bytes_transferred = boost::asio::read(s, sb,
       old_style_transfer_all, error);
   BOOST_CHECK(bytes_transferred == sizeof(read_data));
@@ -1492,21 +2077,144 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(10),
+ boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 50, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 50));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(10),
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -1520,7 +2228,7 @@
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(10),
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -1533,21 +2241,21 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(42),
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(42),
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -1561,15 +2269,15 @@
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read(s, buffers, boost::asio::transfer_at_least(42),
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, 50));
+ BOOST_CHECK(s.check_buffers(buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
@@ -1830,6 +2538,129 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
   boost::asio::async_read(s, buffers, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
@@ -2095,6 +2926,138 @@
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(sb.data(), 1));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(sb.data(), 10));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read(s, sb, boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ called = false;
   boost::asio::async_read(s, sb, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
@@ -2188,6 +3151,10 @@
   test->add(BOOST_TEST_CASE(&test_2_arg_mutable_buffers_1_read));
   test->add(BOOST_TEST_CASE(&test_2_arg_multi_buffers_read));
   test->add(BOOST_TEST_CASE(&test_2_arg_streambuf_read));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_zero_buffers_read));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_mutable_buffers_1_read));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_multi_buffers_read));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_streambuf_read));
   test->add(BOOST_TEST_CASE(&test_3_arg_mutable_buffers_1_read));
   test->add(BOOST_TEST_CASE(&test_3_arg_multi_buffers_read));
   test->add(BOOST_TEST_CASE(&test_3_arg_streambuf_read));

Modified: branches/release/libs/asio/test/read_at.cpp
==============================================================================
--- branches/release/libs/asio/test/read_at.cpp (original)
+++ branches/release/libs/asio/test/read_at.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -91,26 +91,9 @@
   template <typename Mutable_Buffers>
   size_t read_some_at(boost::uint64_t offset, const Mutable_Buffers& buffers)
   {
- size_t total_length = 0;
-
- typename Mutable_Buffers::const_iterator iter = buffers.begin();
- typename Mutable_Buffers::const_iterator end = buffers.end();
- for (; iter != end && total_length < next_read_length_; ++iter)
- {
- size_t length = boost::asio::buffer_size(*iter);
- if (length > length_ - offset)
- length = length_ - offset;
-
- if (length > next_read_length_ - total_length)
- length = next_read_length_ - total_length;
-
- memcpy(boost::asio::buffer_cast<void*>(*iter),
- data_ + offset, length);
- offset += length;
- total_length += length;
- }
-
- return total_length;
+ return boost::asio::buffer_copy(buffers,
+ boost::asio::buffer(data_, length_) + offset,
+ next_read_length_);
   }
 
   template <typename Mutable_Buffers>
@@ -293,6 +276,179 @@
   BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
 }
 
+void test_4_arg_nothrow_mutable_buffers_1_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(read_buf, sizeof(read_buf));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_4_arg_nothrow_multi_buffers_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::array<boost::asio::mutable_buffer, 2> buffers = { {
+ boost::asio::buffer(read_buf, 32),
+ boost::asio::buffer(read_buf) + 32 } };
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_4_arg_nothrow_streambuf_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::streambuf sb(sizeof(read_data));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read_at(s, 0, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
 bool old_style_transfer_all(const boost::system::error_code& ec,
     size_t /*bytes_transferred*/)
 {
@@ -500,137 +656,275 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
-}
-
-void test_4_arg_multi_buffers_read_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- char read_buf[sizeof(read_data)];
- boost::array<boost::asio::mutable_buffer, 2> buffers = { {
- boost::asio::buffer(read_buf, 32),
- boost::asio::buffer(read_buf) + 32 } };
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- size_t bytes_transferred = boost::asio::read_at(s, 0, buffers,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
-
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+}
+
+void test_4_arg_multi_buffers_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::array<boost::asio::mutable_buffer, 2> buffers = { {
+ boost::asio::buffer(read_buf, 32),
+ boost::asio::buffer(read_buf) + 32 } };
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ size_t bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
@@ -780,132 +1074,270 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
- bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
-}
-
-void test_4_arg_streambuf_read_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::asio::streambuf sb(sizeof(read_data));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
- sb.consume(sb.size());
- size_t bytes_transferred = boost::asio::read_at(s, 0, sb,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
- sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 1234, sb,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 0, sb,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 1234, sb,
- boost::asio::transfer_all());
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
-
- s.reset(read_data, sizeof(read_data));
- s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+}
+
+void test_4_arg_streambuf_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::streambuf sb(sizeof(read_data));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ size_t bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_all());
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
   sb.consume(sb.size());
   bytes_transferred = boost::asio::read_at(s, 0, sb,
       boost::asio::transfer_all());
@@ -1081,115 +1513,271 @@
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
- bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
-}
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
 
-void test_5_arg_mutable_buffers_1_read_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- char read_buf[sizeof(read_data)];
- boost::asio::mutable_buffers_1 buffers
- = boost::asio::buffer(read_buf, sizeof(read_buf));
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
 
   s.reset(read_data, sizeof(read_data));
- memset(read_buf, 0, sizeof(read_buf));
- boost::system::error_code error;
- size_t bytes_transferred = boost::asio::read_at(s, 0, buffers,
- boost::asio::transfer_all(), error);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+}
+
+void test_5_arg_mutable_buffers_1_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(read_buf, sizeof(read_buf));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_all(), error);
   BOOST_CHECK(bytes_transferred == sizeof(read_data));
   BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
   BOOST_CHECK(!error);
@@ -1418,18 +2006,20 @@
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1437,9 +2027,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1447,9 +2037,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1457,9 +2047,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1467,25 +2057,27 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1493,9 +2085,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1503,9 +2095,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1513,9 +2105,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1523,36 +2115,27 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
-}
-
-void test_5_arg_multi_buffers_read_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- char read_buf[sizeof(read_data)];
- boost::array<boost::asio::mutable_buffer, 2> buffers = { {
- boost::asio::buffer(read_buf, 32),
- boost::asio::buffer(read_buf) + 32 } };
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- boost::system::error_code error;
- size_t bytes_transferred = boost::asio::read_at(s, 0, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1560,9 +2143,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1570,9 +2153,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1580,9 +2163,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1590,8 +2173,187 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_5_arg_multi_buffers_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::array<boost::asio::mutable_buffer, 2> buffers = { {
+ boost::asio::buffer(read_buf, 32),
+ boost::asio::buffer(read_buf) + 32 } };
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
   BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
   BOOST_CHECK(!error);
 
@@ -1771,18 +2533,20 @@
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1790,9 +2554,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1800,9 +2564,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1810,9 +2574,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1820,25 +2584,27 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1846,9 +2612,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1856,9 +2622,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1866,9 +2632,9 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -1876,24 +2642,194 @@
   memset(read_buf, 0, sizeof(read_buf));
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
-}
-
-void test_5_arg_streambuf_read_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::asio::streambuf sb(sizeof(read_data));
 
   s.reset(read_data, sizeof(read_data));
- sb.consume(sb.size());
- boost::system::error_code error;
- size_t bytes_transferred = boost::asio::read_at(s, 0, sb,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_5_arg_streambuf_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::streambuf sb(sizeof(read_data));
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
   BOOST_CHECK(sb.size() == sizeof(read_data));
   BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
   BOOST_CHECK(!error);
@@ -2145,20 +3081,22 @@
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -2166,10 +3104,10 @@
   sb.consume(sb.size());
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -2177,10 +3115,10 @@
   sb.consume(sb.size());
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -2188,10 +3126,10 @@
   sb.consume(sb.size());
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -2199,28 +3137,30 @@
   sb.consume(sb.size());
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -2228,10 +3168,10 @@
   sb.consume(sb.size());
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -2239,10 +3179,10 @@
   sb.consume(sb.size());
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 1234, sb,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
   BOOST_CHECK(!error);
 
   s.reset(read_data, sizeof(read_data));
@@ -2250,12 +3190,200 @@
   sb.consume(sb.size());
   error = boost::system::error_code();
   bytes_transferred = boost::asio::read_at(s, 0, sb,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(read_data));
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
- BOOST_CHECK(!error);
-
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ sb.consume(sb.size());
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 1234, sb,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::read_at(s, 0, sb,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(read_data));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(!error);
+
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
@@ -2520,14 +3648,805 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read_at(s, 0, sb,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ sb.consume(sb.size());
+ called = false;
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+}
+
+void test_5_arg_mutable_buffers_1_async_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ char read_buf[sizeof(read_data)];
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(read_buf, sizeof(read_buf));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ bool called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 50, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 50));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 50, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 50));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(10);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+
+ s.reset(read_data, sizeof(read_data));
+ s.next_read_length(1);
+ memset(read_buf, 0, sizeof(read_buf));
+ called = false;
+ boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::bind(async_read_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(read_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- sb.consume(sb.size());
+ memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, sb,
+ boost::asio::async_read_at(s, 0, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2535,14 +4454,13 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- sb.consume(sb.size());
+ memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::async_read_at(s, 1234, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2550,17 +4468,17 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
 }
 
-void test_5_arg_mutable_buffers_1_async_read_at()
+void test_5_arg_multi_buffers_async_read_at()
 {
   boost::asio::io_service ios;
   test_random_access_device s(ios);
   char read_buf[sizeof(read_data)];
- boost::asio::mutable_buffers_1 buffers
- = boost::asio::buffer(read_buf, sizeof(read_buf));
+ boost::array<boost::asio::mutable_buffer, 2> buffers = { {
+ boost::asio::buffer(read_buf, 32),
+ boost::asio::buffer(read_buf) + 32 } };
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
@@ -2917,270 +4835,271 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::asio::async_read_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_read_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
-}
-
-void test_5_arg_multi_buffers_async_read_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- char read_buf[sizeof(read_data)];
- boost::array<boost::asio::mutable_buffer, 2> buffers = { {
- boost::asio::buffer(read_buf, 32),
- boost::asio::buffer(read_buf) + 32 } };
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
- bool called = false;
+ called = false;
   boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
   boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
   boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
   boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
   boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
   boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3193,8 +5112,7 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3208,67 +5126,62 @@
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 1, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 1));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 1, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_read_at(s, 0, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3281,8 +5194,7 @@
   s.reset(read_data, sizeof(read_data));
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_read_at(s, 1234, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3296,67 +5208,70 @@
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_read_at(s, 0, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_read_at(s, 1234, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_read_at(s, 0, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   memset(read_buf, 0, sizeof(read_buf));
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_read_at(s, 1234, buffers, short_transfer,
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+}
+
+void test_5_arg_streambuf_async_read_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::streambuf sb(sizeof(read_data));
 
   s.reset(read_data, sizeof(read_data));
- memset(read_buf, 0, sizeof(read_buf));
- called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ sb.consume(sb.size());
+ bool called = false;
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_all(),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3364,13 +5279,14 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_all(),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3378,72 +5294,78 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_all(),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 42, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_all(),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 42, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_all(),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 50));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_all(),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ sizeof(read_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 50));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3451,12 +5373,14 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3464,68 +5388,78 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3533,12 +5467,14 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3546,76 +5482,78 @@
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == sizeof(read_data));
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 0, buffers, short_transfer,
+ boost::asio::async_read_at(s, 0, sb,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
- memset(read_buf, 0, sizeof(read_buf));
+ sb.consume(sb.size());
   called = false;
- boost::asio::async_read_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_read_at(s, 1234, sb,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(read_data)));
-}
-
-void test_5_arg_streambuf_async_read_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::asio::streambuf sb(sizeof(read_data));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
- bool called = false;
+ called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3630,7 +5568,7 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3646,101 +5584,101 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 50, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 50);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 50));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 50, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 50);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 50));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3756,7 +5694,7 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3772,69 +5710,69 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == 10);
- BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == 10);
- BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
+ BOOST_CHECK(sb.size() == 1);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 1));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 10);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 10));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3850,7 +5788,7 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3866,7 +5804,7 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3882,7 +5820,7 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3897,38 +5835,38 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(read_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == sizeof(read_data));
- BOOST_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data)));
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(1);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3944,7 +5882,7 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3960,32 +5898,32 @@
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 0, sb,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == 50);
- BOOST_CHECK(s.check_buffers(0, sb.data(), 50));
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(0, sb.data(), 42));
 
   s.reset(read_data, sizeof(read_data));
   s.next_read_length(10);
   sb.consume(sb.size());
   called = false;
   boost::asio::async_read_at(s, 1234, sb,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_read_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(sb.size() == 50);
- BOOST_CHECK(s.check_buffers(1234, sb.data(), 50));
+ BOOST_CHECK(sb.size() == 42);
+ BOOST_CHECK(s.check_buffers(1234, sb.data(), 42));
 
   s.reset(read_data, sizeof(read_data));
   sb.consume(sb.size());
@@ -4170,6 +6108,9 @@
   test->add(BOOST_TEST_CASE(&test_3_arg_mutable_buffers_1_read_at));
   test->add(BOOST_TEST_CASE(&test_3_arg_multi_buffers_read_at));
   test->add(BOOST_TEST_CASE(&test_3_arg_streambuf_read_at));
+ test->add(BOOST_TEST_CASE(&test_4_arg_nothrow_mutable_buffers_1_read_at));
+ test->add(BOOST_TEST_CASE(&test_4_arg_nothrow_multi_buffers_read_at));
+ test->add(BOOST_TEST_CASE(&test_4_arg_nothrow_streambuf_read_at));
   test->add(BOOST_TEST_CASE(&test_4_arg_mutable_buffers_1_read_at));
   test->add(BOOST_TEST_CASE(&test_4_arg_multi_buffers_read_at));
   test->add(BOOST_TEST_CASE(&test_4_arg_streambuf_read_at));

Modified: branches/release/libs/asio/test/read_until.cpp
==============================================================================
--- branches/release/libs/asio/test/read_until.cpp (original)
+++ branches/release/libs/asio/test/read_until.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -63,27 +63,11 @@
   template <typename Mutable_Buffers>
   size_t read_some(const Mutable_Buffers& buffers)
   {
- using namespace std; // For memcpy.
-
- size_t total_length = 0;
-
- typename Mutable_Buffers::const_iterator iter = buffers.begin();
- typename Mutable_Buffers::const_iterator end = buffers.end();
- for (; iter != end && total_length < next_read_length_; ++iter)
- {
- size_t length = boost::asio::buffer_size(*iter);
- if (length > length_ - position_)
- length = length_ - position_;
-
- if (length > next_read_length_ - total_length)
- length = next_read_length_ - total_length;
-
- memcpy(boost::asio::buffer_cast<void*>(*iter), data_ + position_, length);
- position_ += length;
- total_length += length;
- }
-
- return total_length;
+ size_t n = boost::asio::buffer_copy(buffers,
+ boost::asio::buffer(data_, length_) + position_,
+ next_read_length_);
+ position_ += n;
+ return n;
   }
 
   template <typename Mutable_Buffers>

Added: branches/release/libs/asio/test/seq_packet_socket_service.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/seq_packet_socket_service.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// seq_packet_socket_service.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/seq_packet_socket_service.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("seq_packet_socket_service");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Modified: branches/release/libs/asio/test/serial_port.cpp
==============================================================================
--- branches/release/libs/asio/test/serial_port.cpp (original)
+++ branches/release/libs/asio/test/serial_port.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -54,12 +54,23 @@
 
     serial_port port1(ios);
     serial_port port2(ios, "null");
- serial_port::native_type native_port1 = port1.native();
+ serial_port::native_handle_type native_port1 = port1.native_handle();
     serial_port port3(ios, native_port1);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ serial_port port4(std::move(port3));
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_serial_port operators.
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ port1 = serial_port(ios);
+ port1 = std::move(port2);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     // basic_io_object functions.
 
- io_service& ios_ref = port1.io_service();
+ io_service& ios_ref = port1.get_io_service();
     (void)ios_ref;
 
     // basic_serial_port functions.
@@ -67,16 +78,16 @@
     serial_port::lowest_layer_type& lowest_layer = port1.lowest_layer();
     (void)lowest_layer;
 
- const serial_port& port4 = port1;
- const serial_port::lowest_layer_type& lowest_layer2 = port4.lowest_layer();
+ const serial_port& port5 = port1;
+ const serial_port::lowest_layer_type& lowest_layer2 = port5.lowest_layer();
     (void)lowest_layer2;
 
     port1.open("null");
     port1.open("null", ec);
 
- serial_port::native_type native_port2 = port1.native();
+ serial_port::native_handle_type native_port2 = port1.native_handle();
     port1.assign(native_port2);
- serial_port::native_type native_port3 = port1.native();
+ serial_port::native_handle_type native_port3 = port1.native_handle();
     port1.assign(native_port3, ec);
 
     bool is_open = port1.is_open();
@@ -88,6 +99,9 @@
     serial_port::native_type native_port4 = port1.native();
     (void)native_port4;
 
+ serial_port::native_handle_type native_port5 = port1.native_handle();
+ (void)native_port5;
+
     port1.cancel();
     port1.cancel(ec);
 
@@ -105,13 +119,13 @@
     port1.write_some(buffer(mutable_char_buffer), ec);
     port1.write_some(buffer(const_char_buffer), ec);
 
- port1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
- port1.async_write_some(buffer(const_char_buffer), write_some_handler);
+ port1.async_write_some(buffer(mutable_char_buffer), &write_some_handler);
+ port1.async_write_some(buffer(const_char_buffer), &write_some_handler);
 
     port1.read_some(buffer(mutable_char_buffer));
     port1.read_some(buffer(mutable_char_buffer), ec);
 
- port1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
+ port1.async_read_some(buffer(mutable_char_buffer), &read_some_handler);
   }
   catch (std::exception&)
   {

Added: branches/release/libs/asio/test/signal_set.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/signal_set.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,86 @@
+//
+// signal_set.cpp
+// ~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/signal_set.hpp>
+
+#include <boost/asio/io_service.hpp>
+#include "unit_test.hpp"
+
+//------------------------------------------------------------------------------
+
+// signal_set_compile test
+// ~~~~~~~~~~~~~~~~~~~~~~~
+// The following test checks that all public member functions on the class
+// signal_set compile and link correctly. Runtime failures are ignored.
+
+namespace signal_set_compile {
+
+void signal_handler(const boost::system::error_code&, int)
+{
+}
+
+void test()
+{
+ using namespace boost::asio;
+
+ try
+ {
+ io_service ios;
+ boost::system::error_code ec;
+
+ // basic_signal_set constructors.
+
+ signal_set set1(ios);
+ signal_set set2(ios, 1);
+ signal_set set3(ios, 1, 2);
+ signal_set set4(ios, 1, 2, 3);
+
+ // basic_io_object functions.
+
+ io_service& ios_ref = set1.get_io_service();
+ (void)ios_ref;
+
+ // basic_signal_set functions.
+
+ set1.add(1);
+ set1.add(1, ec);
+
+ set1.remove(1);
+ set1.remove(1, ec);
+
+ set1.clear();
+ set1.clear(ec);
+
+ set1.cancel();
+ set1.cancel(ec);
+
+ set1.async_wait(&signal_handler);
+ }
+ catch (std::exception&)
+ {
+ }
+}
+
+} // namespace signal_set_compile
+
+//------------------------------------------------------------------------------
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("signal_set");
+ test->add(BOOST_TEST_CASE(&signal_set_compile::test));
+ return test;
+}

Added: branches/release/libs/asio/test/signal_set_service.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/signal_set_service.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// signal_set_service.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/signal_set_service.hpp>
+
+#include "unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("signal_set_service");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Modified: branches/release/libs/asio/test/ssl/Jamfile
==============================================================================
--- branches/release/libs/asio/test/ssl/Jamfile (original)
+++ branches/release/libs/asio/test/ssl/Jamfile 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -41,6 +41,7 @@
 run context_base.cpp <template>unit_test ;
 run context_service.cpp <template>unit_test ;
 run context.cpp <template>unit_test ;
+run rfc2818_verification.cpp <template>unit_test ;
 run stream_base.cpp <template>unit_test ;
 run stream_service.cpp <template>unit_test ;
 run stream.cpp <template>unit_test ;

Modified: branches/release/libs/asio/test/ssl/Jamfile.v2
==============================================================================
--- branches/release/libs/asio/test/ssl/Jamfile.v2 (original)
+++ branches/release/libs/asio/test/ssl/Jamfile.v2 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -58,6 +58,8 @@
   [ compile context_service.cpp : $(USE_SELECT) : context_service_select ]
   [ compile context.cpp ]
   [ compile context.cpp : $(USE_SELECT) : context_select ]
+ [ compile rfc2818_verification.cpp ]
+ [ compile rfc2818_verification.cpp : $(USE_SELECT) : rfc2818_verification_select ]
   [ compile stream_base.cpp ]
   [ compile stream_base.cpp : $(USE_SELECT) : stream_base_select ]
   [ compile stream_service.cpp ]

Added: branches/release/libs/asio/test/ssl/rfc2818_verification.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/ssl/rfc2818_verification.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,26 @@
+//
+// rfc2818_verification.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/ssl/rfc2818_verification.hpp>
+
+#include "../unit_test.hpp"
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("ssl/rfc2818_verification");
+ test->add(BOOST_TEST_CASE(&null_test));
+ return test;
+}

Modified: branches/release/libs/asio/test/ssl/stream.cpp
==============================================================================
--- branches/release/libs/asio/test/ssl/stream.cpp (original)
+++ branches/release/libs/asio/test/ssl/stream.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -29,6 +29,13 @@
 
 namespace ssl_stream_compile {
 
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+bool verify_callback(bool, boost::asio::ssl::verify_context&)
+{
+ return false;
+}
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
 void handshake_handler(const boost::system::error_code&)
 {
 }
@@ -66,11 +73,19 @@
 
     // basic_io_object functions.
 
- io_service& ios_ref = stream1.io_service();
+ io_service& ios_ref = stream1.get_io_service();
     (void)ios_ref;
 
     // ssl::stream functions.
 
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+ SSL* ssl1 = stream1.native_handle();
+ (void)ssl1;
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
+ SSL* ssl2 = stream1.impl()->ssl;
+ (void)ssl2;
+
     ssl::stream<ip::tcp::socket>::lowest_layer_type& lowest_layer
       = stream1.lowest_layer();
     (void)lowest_layer;
@@ -80,6 +95,14 @@
       = stream3.lowest_layer();
     (void)lowest_layer2;
 
+#if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+ stream1.set_verify_mode(ssl::verify_none);
+ stream1.set_verify_mode(ssl::verify_none, ec);
+
+ stream1.set_verify_callback(verify_callback);
+ stream1.set_verify_callback(verify_callback, ec);
+#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+
     stream1.handshake(ssl::stream_base::client);
     stream1.handshake(ssl::stream_base::server);
     stream1.handshake(ssl::stream_base::client, ec);
@@ -106,6 +129,7 @@
 
     stream1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
 
+#if defined(BOOST_ASIO_ENABLE_OLD_SSL)
     stream1.peek(buffer(mutable_char_buffer));
     stream1.peek(buffer(mutable_char_buffer), ec);
 
@@ -113,6 +137,7 @@
     (void)in_avail1;
     std::size_t in_avail2 = stream1.in_avail(ec);
     (void)in_avail2;
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL)
   }
   catch (std::exception&)
   {

Modified: branches/release/libs/asio/test/strand.cpp
==============================================================================
--- branches/release/libs/asio/test/strand.cpp (original)
+++ branches/release/libs/asio/test/strand.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -17,7 +17,7 @@
 #include <boost/asio/strand.hpp>
 
 #include <sstream>
-#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
 #include <boost/bind.hpp>
 #include <boost/asio/deadline_timer.hpp>
 #include <boost/asio/io_service.hpp>

Added: branches/release/libs/asio/test/streambuf.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/test/streambuf.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,63 @@
+//
+// streambuf.cpp
+// ~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2011 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)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include <boost/asio/streambuf.hpp>
+
+#include <boost/asio/buffer.hpp>
+#include "unit_test.hpp"
+
+void streambuf_test()
+{
+ boost::asio::streambuf sb;
+
+ sb.sputn("abcd", 4);
+
+ BOOST_CHECK(sb.size() == 4);
+
+ for (int i = 0; i < 100; ++i)
+ {
+ sb.consume(3);
+
+ BOOST_CHECK(sb.size() == 1);
+
+ char buf[1];
+ sb.sgetn(buf, 1);
+
+ BOOST_CHECK(sb.size() == 0);
+
+ sb.sputn("ab", 2);
+
+ BOOST_CHECK(sb.size() == 2);
+
+ boost::asio::buffer_copy(sb.prepare(10), boost::asio::buffer("cd", 2));
+ sb.commit(2);
+
+ BOOST_CHECK(sb.size() == 4);
+ }
+
+ BOOST_CHECK(sb.size() == 4);
+
+ sb.consume(4);
+
+ BOOST_CHECK(sb.size() == 0);
+}
+
+test_suite* init_unit_test_suite(int, char*[])
+{
+ test_suite* test = BOOST_TEST_SUITE("streambuf");
+ test->add(BOOST_TEST_CASE(&streambuf_test));
+ return test;
+}

Modified: branches/release/libs/asio/test/windows/overlapped_ptr.cpp
==============================================================================
--- branches/release/libs/asio/test/windows/overlapped_ptr.cpp (original)
+++ branches/release/libs/asio/test/windows/overlapped_ptr.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -54,14 +54,14 @@
 
     win::overlapped_ptr ptr1;
 
- win::overlapped_ptr ptr2(ios, overlapped_handler_1);
+ win::overlapped_ptr ptr2(ios, &overlapped_handler_1);
     win::overlapped_ptr ptr3(ios, overlapped_handler_2());
 
     // overlapped_ptr functions.
 
     ptr1.reset();
 
- ptr2.reset(ios, overlapped_handler_1);
+ ptr2.reset(ios, &overlapped_handler_1);
     ptr3.reset(ios, overlapped_handler_2());
 
     OVERLAPPED* ov1 = ptr1.get();

Modified: branches/release/libs/asio/test/windows/random_access_handle.cpp
==============================================================================
--- branches/release/libs/asio/test/windows/random_access_handle.cpp (original)
+++ branches/release/libs/asio/test/windows/random_access_handle.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -57,9 +57,20 @@
     HANDLE native_handle1 = INVALID_HANDLE_VALUE;
     win::random_access_handle handle2(ios, native_handle1);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ win::random_access_handle handle3(std::move(handle2));
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_random_access_handle operators.
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ handle1 = win::random_access_handle(ios);
+ handle1 = std::move(handle2);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     // basic_io_object functions.
 
- io_service& ios_ref = handle1.io_service();
+ io_service& ios_ref = handle1.get_io_service();
     (void)ios_ref;
 
     // basic_handle functions.
@@ -68,9 +79,9 @@
       = handle1.lowest_layer();
     (void)lowest_layer;
 
- const win::random_access_handle& handle3 = handle1;
+ const win::random_access_handle& handle4 = handle1;
     const win::random_access_handle::lowest_layer_type& lowest_layer2
- = handle3.lowest_layer();
+ = handle4.lowest_layer();
     (void)lowest_layer2;
 
     HANDLE native_handle2 = INVALID_HANDLE_VALUE;
@@ -85,6 +96,10 @@
     win::random_access_handle::native_type native_handle3 = handle1.native();
     (void)native_handle3;
 
+ win::random_access_handle::native_handle_type native_handle4
+ = handle1.native_handle();
+ (void)native_handle4;
+
     handle1.cancel();
     handle1.cancel(ec);
 
@@ -96,15 +111,15 @@
     handle1.write_some_at(offset, buffer(const_char_buffer), ec);
 
     handle1.async_write_some_at(offset,
- buffer(mutable_char_buffer), write_some_handler);
+ buffer(mutable_char_buffer), &write_some_handler);
     handle1.async_write_some_at(offset,
- buffer(const_char_buffer), write_some_handler);
+ buffer(const_char_buffer), &write_some_handler);
 
     handle1.read_some_at(offset, buffer(mutable_char_buffer));
     handle1.read_some_at(offset, buffer(mutable_char_buffer), ec);
 
     handle1.async_read_some_at(offset,
- buffer(mutable_char_buffer), read_some_handler);
+ buffer(mutable_char_buffer), &read_some_handler);
   }
   catch (std::exception&)
   {

Modified: branches/release/libs/asio/test/windows/stream_handle.cpp
==============================================================================
--- branches/release/libs/asio/test/windows/stream_handle.cpp (original)
+++ branches/release/libs/asio/test/windows/stream_handle.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -56,9 +56,20 @@
     HANDLE native_handle1 = INVALID_HANDLE_VALUE;
     win::stream_handle handle2(ios, native_handle1);
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ win::stream_handle handle3(std::move(handle2));
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // basic_stream_handle operators.
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ handle1 = win::stream_handle(ios);
+ handle1 = std::move(handle2);
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     // basic_io_object functions.
 
- io_service& ios_ref = handle1.io_service();
+ io_service& ios_ref = handle1.get_io_service();
     (void)ios_ref;
 
     // basic_handle functions.
@@ -67,9 +78,9 @@
       = handle1.lowest_layer();
     (void)lowest_layer;
 
- const win::stream_handle& handle3 = handle1;
+ const win::stream_handle& handle4 = handle1;
     const win::stream_handle::lowest_layer_type& lowest_layer2
- = handle3.lowest_layer();
+ = handle4.lowest_layer();
     (void)lowest_layer2;
 
     HANDLE native_handle2 = INVALID_HANDLE_VALUE;
@@ -84,6 +95,10 @@
     win::stream_handle::native_type native_handle3 = handle1.native();
     (void)native_handle3;
 
+ win::stream_handle::native_handle_type native_handle4
+ = handle1.native_handle();
+ (void)native_handle4;
+
     handle1.cancel();
     handle1.cancel(ec);
 
@@ -94,13 +109,13 @@
     handle1.write_some(buffer(mutable_char_buffer), ec);
     handle1.write_some(buffer(const_char_buffer), ec);
 
- handle1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
- handle1.async_write_some(buffer(const_char_buffer), write_some_handler);
+ handle1.async_write_some(buffer(mutable_char_buffer), &write_some_handler);
+ handle1.async_write_some(buffer(const_char_buffer), &write_some_handler);
 
     handle1.read_some(buffer(mutable_char_buffer));
     handle1.read_some(buffer(mutable_char_buffer), ec);
 
- handle1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
+ handle1.async_read_some(buffer(mutable_char_buffer), &read_some_handler);
   }
   catch (std::exception&)
   {

Modified: branches/release/libs/asio/test/write.cpp
==============================================================================
--- branches/release/libs/asio/test/write.cpp (original)
+++ branches/release/libs/asio/test/write.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -88,26 +88,11 @@
   template <typename Const_Buffers>
   size_t write_some(const Const_Buffers& buffers)
   {
- size_t total_length = 0;
-
- typename Const_Buffers::const_iterator iter = buffers.begin();
- typename Const_Buffers::const_iterator end = buffers.end();
- for (; iter != end && total_length < next_write_length_; ++iter)
- {
- size_t length = boost::asio::buffer_size(*iter);
- if (length > length_ - position_)
- length = length_ - position_;
-
- if (length > next_write_length_ - total_length)
- length = next_write_length_ - total_length;
-
- memcpy(data_ + position_,
- boost::asio::buffer_cast<const void*>(*iter), length);
- position_ += length;
- total_length += length;
- }
-
- return total_length;
+ size_t n = boost::asio::buffer_copy(
+ boost::asio::buffer(data_, length_) + position_,
+ buffers, next_write_length_);
+ position_ += n;
+ return n;
   }
 
   template <typename Const_Buffers>
@@ -225,6 +210,106 @@
   BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
 }
 
+void test_3_arg_nothrow_zero_buffers_write()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ std::vector<boost::asio::const_buffer> buffers;
+
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == 0);
+ BOOST_CHECK(!error);
+}
+
+void test_3_arg_nothrow_const_buffers_1_write()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ boost::asio::const_buffers_1 buffers
+ = boost::asio::buffer(write_data, sizeof(write_data));
+
+ s.reset();
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_3_arg_nothrow_mutable_buffers_1_write()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
+
+ s.reset();
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_3_arg_nothrow_multi_buffers_write()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ boost::array<boost::asio::const_buffer, 2> buffers = { {
+ boost::asio::buffer(write_data, 32),
+ boost::asio::buffer(write_data) + 32 } };
+
+ s.reset();
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+}
+
 bool old_style_transfer_all(const boost::system::error_code& ec,
     size_t /*bytes_transferred*/)
 {
@@ -325,6 +410,66 @@
   BOOST_CHECK(s.check_buffers(buffers, 50));
 
   s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
   bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(write_data));
   BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
@@ -447,6 +592,66 @@
   BOOST_CHECK(s.check_buffers(buffers, 50));
 
   s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
   bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
   BOOST_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
@@ -570,6 +775,66 @@
   BOOST_CHECK(s.check_buffers(buffers, 50));
 
   s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
   bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(write_data));
   BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
@@ -716,29 +981,107 @@
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write(s, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write(s, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write(s, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
- BOOST_CHECK(!error);
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write(s, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
 
   s.reset();
   bytes_transferred = boost::asio::write(s, buffers, short_transfer, error);
@@ -875,6 +1218,84 @@
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
   bytes_transferred = boost::asio::write(s, buffers,
       old_style_transfer_all, error);
   BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
@@ -1035,6 +1456,84 @@
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write(s, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
   bytes_transferred = boost::asio::write(s, buffers,
       old_style_transfer_all, error);
   BOOST_CHECK(bytes_transferred == sizeof(write_data));
@@ -1390,99 +1889,213 @@
 
   s.reset();
   called = false;
- boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 1));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 1));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 1));
 
   s.reset();
   called = false;
- boost::asio::async_write(s, buffers, short_transfer,
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 10));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write(s, buffers, short_transfer,
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 10));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write(s, buffers, short_transfer,
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
-}
-
-void test_4_arg_mutable_buffers_1_async_write()
-{
- boost::asio::io_service ios;
- test_stream s(ios);
- boost::asio::mutable_buffers_1 buffers
- = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(buffers, 10));
 
   s.reset();
- bool called = false;
- boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, old_style_transfer_all,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, short_transfer,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, short_transfer,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, short_transfer,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(write_data)));
+}
+
+void test_4_arg_mutable_buffers_1_async_write()
+{
+ boost::asio::io_service ios;
+ test_stream s(ios);
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
+
+ s.reset();
+ bool called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_all(),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(1);
@@ -1626,6 +2239,120 @@
 
   s.reset();
   called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ called = false;
   boost::asio::async_write(s, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
@@ -1863,6 +2590,120 @@
 
   s.reset();
   called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 1));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 10));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(buffers, 42));
+
+ s.reset();
+ called = false;
   boost::asio::async_write(s, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
@@ -1945,6 +2786,10 @@
   test->add(BOOST_TEST_CASE(&test_2_arg_const_buffers_1_write));
   test->add(BOOST_TEST_CASE(&test_2_arg_mutable_buffers_1_write));
   test->add(BOOST_TEST_CASE(&test_2_arg_multi_buffers_write));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_zero_buffers_write));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_const_buffers_1_write));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_mutable_buffers_1_write));
+ test->add(BOOST_TEST_CASE(&test_3_arg_nothrow_multi_buffers_write));
   test->add(BOOST_TEST_CASE(&test_3_arg_const_buffers_1_write));
   test->add(BOOST_TEST_CASE(&test_3_arg_mutable_buffers_1_write));
   test->add(BOOST_TEST_CASE(&test_3_arg_multi_buffers_write));

Modified: branches/release/libs/asio/test/write_at.cpp
==============================================================================
--- branches/release/libs/asio/test/write_at.cpp (original)
+++ branches/release/libs/asio/test/write_at.cpp 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -83,26 +83,9 @@
   template <typename Const_Buffers>
   size_t write_some_at(boost::uint64_t offset, const Const_Buffers& buffers)
   {
- size_t total_length = 0;
-
- typename Const_Buffers::const_iterator iter = buffers.begin();
- typename Const_Buffers::const_iterator end = buffers.end();
- for (; iter != end && total_length < next_write_length_; ++iter)
- {
- size_t length = boost::asio::buffer_size(*iter);
- if (length > length_ - offset)
- length = length_ - offset;
-
- if (length > next_write_length_ - total_length)
- length = next_write_length_ - total_length;
-
- memcpy(data_ + offset,
- boost::asio::buffer_cast<const void*>(*iter), length);
- offset += length;
- total_length += length;
- }
-
- return total_length;
+ return boost::asio::buffer_copy(
+ boost::asio::buffer(data_, length_) + offset,
+ buffers, next_write_length_);
   }
 
   template <typename Const_Buffers>
@@ -262,6 +245,154 @@
   BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
 }
 
+void test_4_arg_nothrow_const_buffers_1_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::const_buffers_1 buffers
+ = boost::asio::buffer(write_data, sizeof(write_data));
+
+ s.reset();
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_4_arg_nothrow_mutable_buffers_1_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
+
+ s.reset();
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_4_arg_nothrow_multi_buffers_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::array<boost::asio::const_buffer, 2> buffers = { {
+ boost::asio::buffer(write_data, 32),
+ boost::asio::buffer(write_data) + 32 } };
+
+ s.reset();
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+}
+
 bool old_style_transfer_all(const boost::system::error_code& ec,
     size_t /*bytes_transferred*/)
 {
@@ -443,6 +574,126 @@
 
   s.reset();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
       old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(write_data));
   BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
@@ -685,36 +936,156 @@
 
   s.reset();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset();
   s.next_write_length(1);
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset();
   s.next_write_length(1);
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset();
   s.next_write_length(10);
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(10);
@@ -928,6 +1299,126 @@
 
   s.reset();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1));
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10));
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42));
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
       old_style_transfer_all);
   BOOST_CHECK(bytes_transferred == sizeof(write_data));
   BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
@@ -1216,76 +1707,232 @@
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
   BOOST_CHECK(!error);
 
   s.reset();
@@ -1531,170 +2178,326 @@
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
-}
-
-void test_5_arg_multi_buffers_write_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::array<boost::asio::const_buffer, 2> buffers = { {
- boost::asio::buffer(write_data, 32),
- boost::asio::buffer(write_data) + 32 } };
 
   s.reset();
- boost::system::error_code error;
- size_t bytes_transferred = boost::asio::write_at(s, 0, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- boost::asio::transfer_all(), error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset();
- error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- boost::asio::transfer_at_least(1), error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(!error);
+}
+
+void test_5_arg_multi_buffers_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::array<boost::asio::const_buffer, 2> buffers = { {
+ boost::asio::buffer(write_data, 32),
+ boost::asio::buffer(write_data) + 32 } };
+
+ s.reset();
+ boost::system::error_code error;
+ size_t bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_all(), error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1), error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
   BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
   BOOST_CHECK(!error);
 
@@ -1847,124 +2650,734 @@
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- old_style_transfer_all, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(1), error);
+ BOOST_CHECK(bytes_transferred == 1);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
+ error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(1);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
   BOOST_CHECK(!error);
 
   s.reset();
   s.next_write_length(10);
   error = boost::system::error_code();
   bytes_transferred = boost::asio::write_at(s, 0, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10), error);
+ BOOST_CHECK(bytes_transferred == 10);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
   BOOST_CHECK(!error);
 
   s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42), error);
+ BOOST_CHECK(bytes_transferred == 42);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ old_style_transfer_all, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(1);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 0, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+
+ s.reset();
+ s.next_write_length(10);
+ error = boost::system::error_code();
+ bytes_transferred = boost::asio::write_at(s, 1234, buffers,
+ short_transfer, error);
+ BOOST_CHECK(bytes_transferred == sizeof(write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(!error);
+}
+
+void async_write_handler(const boost::system::error_code& e,
+ size_t bytes_transferred, size_t expected_bytes_transferred, bool* called)
+{
+ *called = true;
+ BOOST_CHECK(!e);
+ BOOST_CHECK(bytes_transferred == expected_bytes_transferred);
+}
+
+void test_4_arg_const_buffers_1_async_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::const_buffers_1 buffers
+ = boost::asio::buffer(write_data, sizeof(write_data));
+
+ s.reset();
+ bool called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+}
+
+void test_4_arg_mutable_buffers_1_async_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
+
+ s.reset();
+ bool called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(mutable_write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+}
+
+void test_4_arg_multi_buffers_async_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::array<boost::asio::const_buffer, 2> buffers = { {
+ boost::asio::buffer(write_data, 32),
+ boost::asio::buffer(write_data) + 32 } };
+
+ s.reset();
+ bool called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+}
+
+void test_5_arg_const_buffers_1_async_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::const_buffers_1 buffers
+ = boost::asio::buffer(write_data, sizeof(write_data));
+
+ s.reset();
+ bool called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_all(),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
   s.next_write_length(10);
- error = boost::system::error_code();
- bytes_transferred = boost::asio::write_at(s, 1234, buffers,
- short_transfer, error);
- BOOST_CHECK(bytes_transferred == sizeof(write_data));
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
- BOOST_CHECK(!error);
-}
-
-void async_write_handler(const boost::system::error_code& e,
- size_t bytes_transferred, size_t expected_bytes_transferred, bool* called)
-{
- *called = true;
- BOOST_CHECK(!e);
- BOOST_CHECK(bytes_transferred == expected_bytes_transferred);
-}
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
-void test_4_arg_const_buffers_1_async_write_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::asio::const_buffers_1 buffers
- = boost::asio::buffer(write_data, sizeof(write_data));
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
- bool called = false;
+ called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -1977,6 +3390,7 @@
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -1990,57 +3404,62 @@
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
   s.reset();
- s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2049,294 +3468,325 @@
   ios.run();
   BOOST_CHECK(called);
   BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
-}
 
-void test_4_arg_mutable_buffers_1_async_write_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::asio::mutable_buffers_1 buffers
- = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ sizeof(write_data), &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
 
   s.reset();
- bool called = false;
+ s.next_write_length(1);
+ called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset();
+ s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset();
- s.next_write_length(1);
+ s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 50, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 50));
 
   s.reset();
- s.next_write_length(1);
+ s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 50, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 50));
 
   s.reset();
- s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset();
- s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
   s.reset();
- s.next_write_length(10);
+ s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
-}
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
-void test_4_arg_multi_buffers_async_write_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::array<boost::asio::const_buffer, 2> buffers = { {
- boost::asio::buffer(write_data, 32),
- boost::asio::buffer(write_data) + 32 } };
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset();
- bool called = false;
+ s.next_write_length(10);
+ called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset();
+ s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset();
- s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
- s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
- s.next_write_length(10);
+ s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
- s.next_write_length(10);
+ s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
-}
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
-void test_5_arg_const_buffers_1_async_write_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::asio::const_buffers_1 buffers
- = boost::asio::buffer(write_data, sizeof(write_data));
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
- bool called = false;
+ called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_write_at(s, 0, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2348,8 +3798,7 @@
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_write_at(s, 1234, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2362,63 +3811,58 @@
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_write_at(s, 0, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 1, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 1));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_write_at(s, 1234, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 1, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_write_at(s, 0, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::async_write_at(s, 1234, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_write_at(s, 0, buffers, short_transfer,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2430,8 +3874,7 @@
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_write_at(s, 1234, buffers, short_transfer,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2444,305 +3887,313 @@
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_write_at(s, 0, buffers, short_transfer,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_write_at(s, 1234, buffers, short_transfer,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_write_at(s, 0, buffers, short_transfer,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::async_write_at(s, 1234, buffers, short_transfer,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ sizeof(write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+}
+
+void test_5_arg_mutable_buffers_1_async_write_at()
+{
+ boost::asio::io_service ios;
+ test_random_access_device s(ios);
+ boost::asio::mutable_buffers_1 buffers
+ = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
 
   s.reset();
- called = false;
+ bool called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_all(),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_all(),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_all(),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 42, &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 42));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_all(),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 42, &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_all(),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 50));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_all(),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 50));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 0, buffers, old_style_transfer_all,
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers, old_style_transfer_all,
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 0, buffers, short_transfer,
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   called = false;
- boost::asio::async_write_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ sizeof(mutable_write_data), &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 0, buffers, short_transfer,
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
   s.next_write_length(1);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 0, buffers, short_transfer,
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
   s.next_write_length(10);
   called = false;
- boost::asio::async_write_at(s, 1234, buffers, short_transfer,
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_at_least(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
-}
-
-void test_5_arg_mutable_buffers_1_async_write_at()
-{
- boost::asio::io_service ios;
- test_random_access_device s(ios);
- boost::asio::mutable_buffers_1 buffers
- = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
- bool called = false;
+ called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2755,7 +4206,7 @@
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2769,89 +4220,89 @@
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 50, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 50));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_all(),
+ boost::asio::transfer_at_least(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 50, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 50));
 
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2865,7 +4316,7 @@
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2879,61 +4330,61 @@
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 10));
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(1),
+ boost::asio::transfer_exactly(1),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 10, &called));
+ 1, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
 
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
 
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 10, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2947,7 +4398,7 @@
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2961,7 +4412,7 @@
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2975,7 +4426,7 @@
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(10),
+ boost::asio::transfer_exactly(10),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -2988,34 +4439,34 @@
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset();
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- sizeof(mutable_write_data), &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset();
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3029,7 +4480,7 @@
   s.next_write_length(1);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
@@ -3043,29 +4494,29 @@
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 0, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(0, buffers, 50));
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
 
   s.reset();
   s.next_write_length(10);
   called = false;
   boost::asio::async_write_at(s, 1234, buffers,
- boost::asio::transfer_at_least(42),
+ boost::asio::transfer_exactly(42),
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
         boost::asio::placeholders::bytes_transferred,
- 50, &called));
+ 42, &called));
   ios.reset();
   ios.run();
   BOOST_CHECK(called);
- BOOST_CHECK(s.check_buffers(1234, buffers, 50));
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
 
   s.reset();
   called = false;
@@ -3558,6 +5009,252 @@
 
   s.reset();
   called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 1));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(1),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 1, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 1));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 10));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(10),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 10, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 10));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(1);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 0, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(0, buffers, 42));
+
+ s.reset();
+ s.next_write_length(10);
+ called = false;
+ boost::asio::async_write_at(s, 1234, buffers,
+ boost::asio::transfer_exactly(42),
+ boost::bind(async_write_handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred,
+ 42, &called));
+ ios.reset();
+ ios.run();
+ BOOST_CHECK(called);
+ BOOST_CHECK(s.check_buffers(1234, buffers, 42));
+
+ s.reset();
+ called = false;
   boost::asio::async_write_at(s, 0, buffers, old_style_transfer_all,
       boost::bind(async_write_handler,
         boost::asio::placeholders::error,
@@ -3715,6 +5412,9 @@
   test->add(BOOST_TEST_CASE(&test_3_arg_const_buffers_1_write_at));
   test->add(BOOST_TEST_CASE(&test_3_arg_mutable_buffers_1_write_at));
   test->add(BOOST_TEST_CASE(&test_3_arg_multi_buffers_write_at));
+ test->add(BOOST_TEST_CASE(&test_4_arg_nothrow_const_buffers_1_write_at));
+ test->add(BOOST_TEST_CASE(&test_4_arg_nothrow_mutable_buffers_1_write_at));
+ test->add(BOOST_TEST_CASE(&test_4_arg_nothrow_multi_buffers_write_at));
   test->add(BOOST_TEST_CASE(&test_4_arg_const_buffers_1_write_at));
   test->add(BOOST_TEST_CASE(&test_4_arg_mutable_buffers_1_write_at));
   test->add(BOOST_TEST_CASE(&test_4_arg_multi_buffers_write_at));

Added: branches/release/libs/asio/tools/handlerviz.pl
==============================================================================
--- (empty file)
+++ branches/release/libs/asio/tools/handlerviz.pl 2011-06-05 19:21:43 EDT (Sun, 05 Jun 2011)
@@ -0,0 +1,299 @@
+#!/usr/bin/perl -w
+#
+# handlerviz.pl
+# ~~~~~~~~~~~~~
+#
+# A visualisation tool for post-processing the debug output generated by
+# Asio-based programs. Programs write this output to the standard error stream
+# when compiled with the define `BOOST_ASIO_ENABLE_HANDLER_TRACKING'.
+#
+# This tool generates output intended for use with the GraphViz tool `dot'. For
+# example, to convert output to a PNG image, use:
+#
+# perl handlerviz.pl < output.txt | dot -Tpng > output.png
+#
+# To convert to a PDF file, use:
+#
+# perl handlerviz.pl < output.txt | dot -Tpdf > output.pdf
+#
+# Copyright (c) 2011 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)
+#
+
+use strict;
+
+my %nodes = ();
+my @edges = ();
+my %anon_nodes = ();
+my $anon_id = 0;
+my %all_nodes = ();
+
+#-------------------------------------------------------------------------------
+# Parse the debugging output and populate the nodes and edges.
+
+sub parse_debug_output()
+{
+ while (my $line = <>)
+ {
+ chomp($line);
+
+ if ($line =~ /\@asio\|([^|]*)\|([^|]*)\|(.*)$/)
+ {
+ my $timestamp = $1;
+ my $action = $2;
+ my $description = $3;
+
+ # Handler creation.
+ if ($action =~ /^([0-9]+)\*([0-9]+)$/)
+ {
+ my $begin = $1;
+ my $end = $2;
+ my $label = $description;
+ $label =~ s/\./\\n/g;
+
+ if ($begin eq "0")
+ {
+ $begin = "a" . $anon_id++;
+ $anon_nodes{$begin} = $timestamp;
+ $all_nodes{"$timestamp-$begin"} = $begin;
+ }
+
+ my %edge = ( begin=>$begin, end=>$end, label=>$label );
+ push(@edges, \%edge);
+ }
+
+ # Begin handler invocation.
+ elsif ($action =~ /^>([0-9]+)$/)
+ {
+ my %new_node = ( label=>$description, entry=>$timestamp );
+ $new_node{content} = ();
+ $nodes{$1} = \%new_node;
+ $all_nodes{"$timestamp-$1"} = $1;
+ }
+
+ # End handler invocation.
+ elsif ($action =~ /^<([0-9]+)$/)
+ {
+ $nodes{$1}->{exit} = $timestamp;
+ }
+
+ # Handler threw exception.
+ elsif ($action =~ /^!([0-9]+)$/)
+ {
+ push(@{$nodes{$1}->{content}}, "exception");
+ }
+
+ # Handler was destroyed without being invoked.
+ elsif ($action =~ /^~([0-9]+)$/)
+ {
+ my %new_node = ( label=>"$timestamp destroyed" );
+ $new_node{content} = ();
+ $nodes{$1} = \%new_node;
+ $all_nodes{"$timestamp-$1"} = $1;
+ }
+
+ # Handler performed some operation.
+ elsif ($action =~ /^([0-9]+)$/)
+ {
+ if ($1 eq "0")
+ {
+ my $id = "a" . $anon_id++;
+ $anon_nodes{$id} = "$timestamp\\l$description";
+ $all_nodes{"$timestamp-$id"} = $id;
+ }
+ else
+ {
+ push(@{$nodes{$1}->{content}}, "$description");
+ }
+ }
+ }
+ }
+}
+
+#-------------------------------------------------------------------------------
+# Helper function to convert a string to escaped HTML text.
+
+sub escape($)
+{
+ my $text = shift;
+ $text =~ s/&/\&amp\;/g;
+ $text =~ s/</\&lt\;/g;
+ $text =~ s/>/\&gt\;/g;
+ $text =~ s/\t/ /g;
+ return $text;
+}
+
+#-------------------------------------------------------------------------------
+# Templates for dot output.
+
+my $graph_header = <<"EOF";
+/* Generated by asioviz.pl */
+digraph G
+{
+graph [ nodesep="1" ];
+node [ shape="box", fontsize="9" ];
+edge [ arrowtail="dot", fontsize="9" ];
+EOF
+
+my $graph_footer = <<"EOF";
+}
+EOF
+
+my $node_header = <<"EOF";
+"%name%"
+[
+label=<<table border="0" cellspacing="0">
+<tr><td align="left" bgcolor="gray" border="0">%label%</td></tr>
+EOF
+
+my $node_footer = <<"EOF";
+</table>>
+]
+EOF
+
+my $node_content = <<"EOF";
+<tr><td align="left" bgcolor="white" border="0">
+<font face="mono" point-size="9">%content%</font>
+</td></tr>
+EOF
+
+my $anon_nodes_header = <<"EOF";
+{
+node [ shape="record" ];
+EOF
+
+my $anon_nodes_footer = <<"EOF";
+}
+EOF
+
+my $anon_node = <<"EOF";
+"%name%" [ label="%label%", color="gray" ];
+EOF
+
+my $edges_header = <<"EOF";
+{
+edge [ style="dashed", arrowhead="open", weight="100" ];
+EOF
+
+my $edges_footer = <<"EOF";
+}
+EOF
+
+my $edge = <<"EOF";
+"%begin%" -> "%end%" [ label="%label%" ]
+EOF
+
+my $node_order_header = <<"EOF";
+{
+edge [ style="invis", weight="1" ];
+EOF
+
+my $node_order_footer = <<"EOF";
+}
+EOF
+
+my $node_order = <<"EOF";
+"%begin%" -> "%end%"
+EOF
+
+#-------------------------------------------------------------------------------
+# Generate dot output from the nodes and edges.
+
+sub print_nodes()
+{
+ foreach my $name (sort keys %nodes)
+ {
+ my $node = $nodes{$name};
+ my $entry = $node->{entry};
+ my $exit = $node->{exit};
+ my $label = escape($node->{label});
+ my $header = $node_header;
+ $header =~ s/%name%/$name/g;
+ $header =~ s/%label%/$label/g;
+ print($header);
+
+ my $line = $node_content;
+ my $content = $entry . " + " . sprintf("%.6f", $exit - $entry) . "s";
+ $line =~ s/%content%/$content/g;
+ print($line);
+
+ foreach my $content (@{$node->{content}})
+ {
+ $content = escape($content);
+ $content = " " if length($content) == 0;
+ my $line = $node_content;
+ $line =~ s/%content%/$content/g;
+ print($line);
+ }
+
+ print($node_footer);
+ }
+}
+
+sub print_anon_nodes()
+{
+ print($anon_nodes_header);
+ foreach my $name (sort keys %anon_nodes)
+ {
+ my $label = $anon_nodes{$name};
+ my $line = $anon_node;
+ $line =~ s/%name%/$name/g;
+ $line =~ s/%label%/$label/g;
+ print($line);
+ }
+ print($edges_footer);
+}
+
+sub print_edges()
+{
+ print($edges_header);
+ foreach my $e (@edges)
+ {
+ my $begin = $e->{begin};
+ my $end = $e->{end};
+ my $label = $e->{label};
+ my $line = $edge;
+ $line =~ s/%begin%/$begin/g;
+ $line =~ s/%end%/$end/g;
+ $line =~ s/%label%/$label/g;
+ print($line);
+ }
+ print($edges_footer);
+}
+
+sub print_node_order()
+{
+ my $prev = "";
+ print($node_order_header);
+ foreach my $name (sort keys %all_nodes)
+ {
+ if ($prev ne "")
+ {
+ my $begin = $prev;
+ my $end = $all_nodes{$name};
+ my $line = $node_order;
+ $line =~ s/%begin%/$begin/g;
+ $line =~ s/%end%/$end/g;
+ print($line);
+ }
+ $prev = $all_nodes{$name};
+ }
+ print($node_order_footer);
+}
+
+sub generate_dot()
+{
+ print($graph_header);
+ print_nodes();
+ print_anon_nodes();
+ print_edges();
+ print_node_order();
+ print($graph_footer);
+}
+
+#-------------------------------------------------------------------------------
+
+parse_debug_output();
+generate_dot();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk