|
Boost-Commit : |
From: troy_at_[hidden]
Date: 2008-07-03 10:40:35
Author: troy
Date: 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
New Revision: 47042
URL: http://svn.boost.org/trac/boost/changeset/47042
Log:
Merged revisions 47038 via svnmerge from
https://svn.boost.org/svn/boost/branches/release
................
r47038 | chris_kohlhoff | 2008-07-03 09:05:33 -0400 (Thu, 03 Jul 2008) | 50 lines
Merge bug and doc fixes from trunk.
........
r46535 | chris_kohlhoff | 2008-06-20 10:25:50 +1000 (Fri, 20 Jun 2008) | 2 lines
One more check needed for BSD serial port extensions.
........
r46766 | chris_kohlhoff | 2008-06-27 15:38:16 +1000 (Fri, 27 Jun 2008) | 2 lines
Add missing copyright notices.
........
r46876 | chris_kohlhoff | 2008-06-30 10:24:44 +1000 (Mon, 30 Jun 2008) | 2 lines
Some linux configurations do not automatically define _XOPEN_SOURCE.
........
r46944 | chris_kohlhoff | 2008-07-01 21:52:54 +1000 (Tue, 01 Jul 2008) | 2 lines
Fix documentation on behaviour when a connect operation fails.
........
r46945 | chris_kohlhoff | 2008-07-01 21:53:54 +1000 (Tue, 01 Jul 2008) | 2 lines
Fix name of parameter as referred to in documentation.
........
r46946 | chris_kohlhoff | 2008-07-01 21:58:39 +1000 (Tue, 01 Jul 2008) | 2 lines
Fix typos.
........
r46947 | chris_kohlhoff | 2008-07-01 21:59:25 +1000 (Tue, 01 Jul 2008) | 2 lines
Merge in new reference index page.
........
r46948 | chris_kohlhoff | 2008-07-01 22:06:49 +1000 (Tue, 01 Jul 2008) | 2 lines
Documentation generation enhancements.
........
r46949 | chris_kohlhoff | 2008-07-01 22:13:51 +1000 (Tue, 01 Jul 2008) | 2 lines
Improve buffer() documentation. Fix vector overloads to match TR2 proposal.
........
r46950 | chris_kohlhoff | 2008-07-01 22:14:57 +1000 (Tue, 01 Jul 2008) | 4 lines
Clarify behaviour of read_until/async_read_until with respect to leftover
data in the streambuf. Use separate brief descriptions for function groups.
Add some extra notes to the io_service documentation.
........
r47013 | chris_kohlhoff | 2008-07-03 08:50:50 +1000 (Thu, 03 Jul 2008) | 2 lines
Regenerate documentation.
........
................
Properties modified:
branches/CMake/release/ (props changed)
Text files modified:
branches/CMake/release/boost/asio/basic_socket.hpp | 6
branches/CMake/release/boost/asio/buffer.hpp | 232
branches/CMake/release/boost/asio/handler_alloc_hook.hpp | 2
branches/CMake/release/boost/asio/impl/serial_port_base.ipp | 2
branches/CMake/release/boost/asio/io_service.hpp | 32
branches/CMake/release/boost/asio/read.hpp | 6
branches/CMake/release/boost/asio/read_at.hpp | 6
branches/CMake/release/boost/asio/read_until.hpp | 127
branches/CMake/release/boost/asio/write.hpp | 5
branches/CMake/release/boost/asio/write_at.hpp | 5
branches/CMake/release/libs/asio/doc/asio.qbk | 2
branches/CMake/release/libs/asio/doc/quickref.xml | 524
branches/CMake/release/libs/asio/doc/reference.qbk | 51521 ++++++++++++++++++++++++++++-----------
branches/CMake/release/libs/asio/doc/reference.xsl | 79
branches/CMake/release/libs/asio/test/Jamfile.v2 | 2
15 files changed, 37484 insertions(+), 15067 deletions(-)
Modified: branches/CMake/release/boost/asio/basic_socket.hpp
==============================================================================
--- branches/CMake/release/boost/asio/basic_socket.hpp (original)
+++ branches/CMake/release/boost/asio/basic_socket.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -515,7 +515,7 @@
*
* The socket is automatically opened if it is not already open. If the
* connect fails, and the socket was automatically opened, the socket is
- * returned to the closed state.
+ * not returned to the closed state.
*
* @param peer_endpoint The remote endpoint to which the socket will be
* connected.
@@ -550,7 +550,7 @@
*
* The socket is automatically opened if it is not already open. If the
* connect fails, and the socket was automatically opened, the socket is
- * returned to the closed state.
+ * not returned to the closed state.
*
* @param peer_endpoint The remote endpoint to which the socket will be
* connected.
@@ -592,7 +592,7 @@
*
* The socket is automatically opened if it is not already open. If the
* connect fails, and the socket was automatically opened, the socket is
- * returned to the closed state.
+ * not returned to the closed state.
*
* @param peer_endpoint The remote endpoint to which the socket will be
* connected. Copies will be made of the endpoint object as required.
Modified: branches/CMake/release/boost/asio/buffer.hpp
==============================================================================
--- branches/CMake/release/boost/asio/buffer.hpp (original)
+++ branches/CMake/release/boost/asio/buffer.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -196,6 +196,12 @@
/// A random-access iterator type that may be used to read elements.
typedef const mutable_buffer* const_iterator;
+ /// Construct to represent a given memory range.
+ mutable_buffers_1(void* data, std::size_t size)
+ : mutable_buffer(data, size)
+ {
+ }
+
/// Construct to represent a single modifiable buffer.
explicit mutable_buffers_1(const mutable_buffer& b)
: mutable_buffer(b)
@@ -360,6 +366,12 @@
/// A random-access iterator type that may be used to read elements.
typedef const const_buffer* const_iterator;
+ /// Construct to represent a given memory range.
+ const_buffers_1(const void* data, std::size_t size)
+ : const_buffer(data, size)
+ {
+ }
+
/// Construct to represent a single non-modifiable buffer.
explicit const_buffers_1(const const_buffer& b)
: const_buffer(b)
@@ -443,12 +455,22 @@
/** @defgroup buffer boost::asio::buffer
*
* @brief The boost::asio::buffer function is used to create a buffer object to
- * represent raw memory, an array of POD elements, or a vector of POD elements.
+ * represent raw memory, an array of POD elements, a vector of POD elements,
+ * or a std::string.
+ *
+ * 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 <tt>{void*,
+ * size_t}</tt> specifies a mutable (modifiable) region of memory. Similarly, a
+ * tuple of the form <tt>{const void*, size_t}</tt> specifies a const
+ * (non-modifiable) region of memory. These two forms correspond to the classes
+ * mutable_buffer and const_buffer, respectively. To mirror C++'s conversion
+ * rules, a mutable_buffer is implicitly convertible to a const_buffer, and the
+ * opposite conversion is not permitted.
*
* The simplest use case involves reading or writing a single buffer of a
* specified size:
*
- * @code sock.write(boost::asio::buffer(data, size)); @endcode
+ * @code sock.send(boost::asio::buffer(data, size)); @endcode
*
* In the above example, the return value of boost::asio::buffer meets the
* requirements of the ConstBufferSequence concept so that it may be directly
@@ -460,13 +482,90 @@
* automatically determining the size of the buffer:
*
* @code char d1[128];
- * size_t bytes_transferred = sock.read(boost::asio::buffer(d1));
+ * size_t bytes_transferred = sock.receive(boost::asio::buffer(d1));
*
* std::vector<char> d2(128);
- * bytes_transferred = sock.read(boost::asio::buffer(d2));
+ * bytes_transferred = sock.receive(boost::asio::buffer(d2));
*
* boost::array<char, 128> d3;
- * bytes_transferred = sock.read(boost::asio::buffer(d3)); @endcode
+ * bytes_transferred = sock.receive(boost::asio::buffer(d3)); @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
+ * a buffer. The buffer size is determined using the vector's <tt>size()</tt>
+ * member function, and not its capacity.
+ *
+ * @par Accessing Buffer Contents
+ *
+ * The contents of a buffer may be accessed using the boost::asio::buffer_size
+ * and boost::asio::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);
+ *
+ * boost::asio::const_buffer b2 = ...;
+ * std::size_t s2 = boost::asio::buffer_size(b2);
+ * const void* p2 = boost::asio::buffer_cast<const void*>(b2); @endcode
+ *
+ * The boost::asio::buffer_cast function permits violations of type safety, so
+ * uses of it in application code should be carefully considered.
+ *
+ * @par 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::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
+ *
+ * Buffer objects may be manipulated using simple arithmetic in a safe way
+ * which helps prevent buffer overruns. Consider an array initialised as
+ * follows:
+ *
+ * @code boost::array<char, 6> a = { 'a', 'b', 'c', 'd', 'e' }; @endcode
+ *
+ * A buffer object @c b1 created using:
+ *
+ * @code b1 = boost::asio::buffer(a); @endcode
+ *
+ * represents the entire array, <tt>{ 'a', 'b', 'c', 'd', 'e' }</tt>. An
+ * optional second argument to the boost::asio::buffer function may be used to
+ * limit the size, in bytes, of the buffer:
+ *
+ * @code b2 = boost::asio::buffer(a, 3); @endcode
+ *
+ * such that @c b2 represents the data <tt>{ 'a', 'b', 'c' }</tt>. 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:
+ *
+ * @code b3 = b1 + 2; @endcode
+ *
+ * where @c b3 will set to represent <tt>{ 'c', 'd', 'e' }</tt>. 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:
+ *
+ * @code b4 = boost::asio::buffer(b1 + 1, 3); @endcode
+ *
+ * so that @c b4 will refer to the bytes <tt>{ 'b', 'c', 'd' }</tt>.
+ *
+ * @par 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
@@ -481,23 +580,32 @@
* boost::asio::buffer(d1),
* boost::asio::buffer(d2),
* boost::asio::buffer(d3) };
- * bytes_transferred = sock.read(bufs1);
+ * 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.write(bufs2); @endcode
+ * bytes_transferred = sock.send(bufs2); @endcode
*/
/*@{*/
/// Create a new modifiable buffer from an existing buffer.
+/**
+ * @returns <tt>mutable_buffers_1(b)</tt>.
+ */
inline mutable_buffers_1 buffer(const mutable_buffer& b)
{
return mutable_buffers_1(b);
}
/// Create a new modifiable buffer from an existing buffer.
+/**
+ * @returns A mutable_buffers_1 value equivalent to:
+ * @code mutable_buffers_1(
+ * buffer_cast<void*>(b),
+ * min(buffer_size(b), max_size_in_bytes)); @endcode
+ */
inline mutable_buffers_1 buffer(const mutable_buffer& b,
std::size_t max_size_in_bytes)
{
@@ -512,12 +620,21 @@
}
/// Create a new non-modifiable buffer from an existing buffer.
+/**
+ * @returns <tt>const_buffers_1(b)</tt>.
+ */
inline const_buffers_1 buffer(const const_buffer& b)
{
return const_buffers_1(b);
}
/// Create a new non-modifiable buffer from an existing buffer.
+/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * buffer_cast<const void*>(b),
+ * min(buffer_size(b), max_size_in_bytes)); @endcode
+ */
inline const_buffers_1 buffer(const const_buffer& b,
std::size_t max_size_in_bytes)
{
@@ -532,12 +649,18 @@
}
/// Create a new modifiable buffer that represents the given memory range.
+/**
+ * @returns <tt>mutable_buffers_1(data, size_in_bytes)</tt>.
+ */
inline mutable_buffers_1 buffer(void* data, std::size_t size_in_bytes)
{
return mutable_buffers_1(mutable_buffer(data, size_in_bytes));
}
/// Create a new non-modifiable buffer that represents the given memory range.
+/**
+ * @returns <tt>const_buffers_1(data, size_in_bytes)</tt>.
+ */
inline const_buffers_1 buffer(const void* data,
std::size_t size_in_bytes)
{
@@ -545,6 +668,12 @@
}
/// Create a new modifiable buffer that represents the given POD array.
+/**
+ * @returns A mutable_buffers_1 value equivalent to:
+ * @code mutable_buffers_1(
+ * static_cast<void*>(data),
+ * N * sizeof(PodType)); @endcode
+ */
template <typename PodType, std::size_t N>
inline mutable_buffers_1 buffer(PodType (&data)[N])
{
@@ -552,6 +681,12 @@
}
/// Create a new modifiable buffer that represents the given POD array.
+/**
+ * @returns A mutable_buffers_1 value equivalent to:
+ * @code mutable_buffers_1(
+ * static_cast<void*>(data),
+ * min(N * sizeof(PodType), max_size_in_bytes)); @endcode
+ */
template <typename PodType, std::size_t N>
inline mutable_buffers_1 buffer(PodType (&data)[N],
std::size_t max_size_in_bytes)
@@ -563,6 +698,12 @@
}
/// Create a new non-modifiable buffer that represents the given POD array.
+/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * static_cast<const void*>(data),
+ * N * sizeof(PodType)); @endcode
+ */
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(const PodType (&data)[N])
{
@@ -570,6 +711,12 @@
}
/// Create a new non-modifiable buffer that represents the given POD array.
+/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * static_cast<const void*>(data),
+ * min(N * sizeof(PodType), max_size_in_bytes)); @endcode
+ */
template <typename PodType, std::size_t N>
inline const_buffers_1 buffer(const PodType (&data)[N],
std::size_t max_size_in_bytes)
@@ -652,6 +799,12 @@
// || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
/// 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(boost::array<PodType, N>& data)
{
@@ -660,6 +813,12 @@
}
/// 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(boost::array<PodType, N>& data,
std::size_t max_size_in_bytes)
@@ -671,6 +830,12 @@
}
/// 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(boost::array<const PodType, N>& data)
{
@@ -679,6 +844,12 @@
}
/// 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(boost::array<const PodType, N>& data,
std::size_t max_size_in_bytes)
@@ -693,6 +864,12 @@
// || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
/// 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 boost::array<PodType, N>& data)
{
@@ -701,6 +878,12 @@
}
/// 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 boost::array<PodType, N>& data,
std::size_t max_size_in_bytes)
@@ -713,6 +896,11 @@
/// 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,
+ * data.size() * sizeof(PodType)); @endcode
+ *
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
@@ -720,7 +908,7 @@
inline mutable_buffers_1 buffer(std::vector<PodType, Allocator>& data)
{
return mutable_buffers_1(
- mutable_buffer(&data[0], data.size() * sizeof(PodType)
+ mutable_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(PodType)
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<
typename std::vector<PodType, Allocator>::iterator
@@ -731,6 +919,11 @@
/// 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,
+ * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode
+ *
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
@@ -739,7 +932,7 @@
std::size_t max_size_in_bytes)
{
return mutable_buffers_1(
- mutable_buffer(&data[0],
+ mutable_buffer(data.size() ? &data[0] : 0,
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
@@ -752,6 +945,11 @@
/// Create a new non-modifiable buffer that represents the given POD vector.
/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * data.size() ? &data[0] : 0,
+ * data.size() * sizeof(PodType)); @endcode
+ *
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
@@ -760,7 +958,7 @@
const std::vector<PodType, Allocator>& data)
{
return const_buffers_1(
- const_buffer(&data[0], data.size() * sizeof(PodType)
+ const_buffer(data.size() ? &data[0] : 0, data.size() * sizeof(PodType)
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
, detail::buffer_debug_check<
typename std::vector<PodType, Allocator>::const_iterator
@@ -771,6 +969,11 @@
/// Create a new non-modifiable buffer that represents the given POD vector.
/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * data.size() ? &data[0] : 0,
+ * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode
+ *
* @note The buffer is invalidated by any vector operation that would also
* invalidate iterators.
*/
@@ -779,7 +982,7 @@
const std::vector<PodType, Allocator>& data, std::size_t max_size_in_bytes)
{
return const_buffers_1(
- const_buffer(&data[0],
+ const_buffer(data.size() ? &data[0] : 0,
data.size() * sizeof(PodType) < max_size_in_bytes
? data.size() * sizeof(PodType) : max_size_in_bytes
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
@@ -792,6 +995,8 @@
/// Create a new non-modifiable buffer that represents the given string.
/**
+ * @returns <tt>const_buffers_1(data.data(), data.size())</tt>.
+ *
* @note The buffer is invalidated by any non-const operation called on the
* given string object.
*/
@@ -806,6 +1011,11 @@
/// Create a new non-modifiable buffer that represents the given string.
/**
+ * @returns A const_buffers_1 value equivalent to:
+ * @code const_buffers_1(
+ * data.data(),
+ * min(data.size(), max_size_in_bytes)); @endcode
+ *
* @note The buffer is invalidated by any non-const operation called on the
* given string object.
*/
Modified: branches/CMake/release/boost/asio/handler_alloc_hook.hpp
==============================================================================
--- branches/CMake/release/boost/asio/handler_alloc_hook.hpp (original)
+++ branches/CMake/release/boost/asio/handler_alloc_hook.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -36,7 +36,7 @@
*
* This default implementation is simply:
* @code
- * return ::operator new(bytes);
+ * return ::operator new(size);
* @endcode
*
* @note All temporary objects associated with a handler will be deallocated
Modified: branches/CMake/release/boost/asio/impl/serial_port_base.ipp
==============================================================================
--- branches/CMake/release/boost/asio/impl/serial_port_base.ipp (original)
+++ branches/CMake/release/boost/asio/impl/serial_port_base.ipp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -295,10 +295,12 @@
{
value_ = software;
}
+# if defined(_BSD_SOURCE)
else if (storage.c_cflag & CRTSCTS)
{
value_ = hardware;
}
+# endif
else
{
value_ = none;
Modified: branches/CMake/release/boost/asio/io_service.hpp
==============================================================================
--- branches/CMake/release/boost/asio/io_service.hpp (original)
+++ branches/CMake/release/boost/asio/io_service.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -101,6 +101,32 @@
* }
* }
* @endcode
+ *
+ * @par Stopping the io_service from running out of work
+ *
+ * Some applications may need to prevent an io_service's run() call from
+ * returning when there is no more work to do. For example, the 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 boost::asio::io_service::work:
+ *
+ * @code boost::asio::io_service io_service;
+ * boost::asio::io_service::work work(io_service);
+ * ... @endcode
+ *
+ * To effect a shutdown, the application will then need to call the io_service's
+ * stop() member function. This will cause the 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.
+ *
+ * @code 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. @endcode
*/
class io_service
: private noncopyable
@@ -160,6 +186,9 @@
* @return The number of handlers that were executed.
*
* @throws boost::system::system_error Thrown on failure.
+ *
+ * @note The poll() function may also be used to dispatch ready handlers,
+ * but without blocking.
*/
std::size_t run();
@@ -179,6 +208,9 @@
* @param ec Set to indicate what error occurred, if any.
*
* @return The number of handlers that were executed.
+ *
+ * @note The poll() function may also be used to dispatch ready handlers,
+ * but without blocking.
*/
std::size_t run(boost::system::error_code& ec);
Modified: branches/CMake/release/boost/asio/read.hpp
==============================================================================
--- branches/CMake/release/boost/asio/read.hpp (original)
+++ branches/CMake/release/boost/asio/read.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -30,6 +30,9 @@
/**
* @defgroup read boost::asio::read
+ *
+ * @brief Attempt to read a certain amount of data from a stream before
+ * returning.
*/
/*@{*/
@@ -270,6 +273,9 @@
/*@}*/
/**
* @defgroup async_read boost::asio::async_read
+ *
+ * @brief Start an asynchronous operation to read a certain amount of data from
+ * a stream.
*/
/*@{*/
Modified: branches/CMake/release/boost/asio/read_at.hpp
==============================================================================
--- branches/CMake/release/boost/asio/read_at.hpp (original)
+++ branches/CMake/release/boost/asio/read_at.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -31,6 +31,9 @@
/**
* @defgroup read_at boost::asio::read_at
+ *
+ * @brief Attempt to read a certain amount of data at the specified offset
+ * before returning.
*/
/*@{*/
@@ -305,6 +308,9 @@
/*@}*/
/**
* @defgroup async_read_at boost::asio::async_read_at
+ *
+ * @brief Start an asynchronous operation to read a certain amount of data at
+ * the specified offset.
*/
/*@{*/
Modified: branches/CMake/release/boost/asio/read_until.hpp
==============================================================================
--- branches/CMake/release/boost/asio/read_until.hpp (original)
+++ branches/CMake/release/boost/asio/read_until.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -65,10 +65,13 @@
/**
* @defgroup read_until boost::asio::read_until
+ *
+ * @brief Read data into a streambuf until it contains a delimiter, matches a
+ * regular expression, or a function object indicates a match.
*/
/*@{*/
-/// Read data into a streambuf until a delimiter is encountered.
+/// Read data into a streambuf until it contains a specified delimiter.
/**
* 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
@@ -94,6 +97,10 @@
*
* @throws boost::system::system_error Thrown on failure.
*
+ * @note 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.
+ *
* @par Example
* To read data into a streambuf until a newline is encountered:
* @code boost::asio::streambuf b;
@@ -106,7 +113,7 @@
std::size_t read_until(SyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, char delim);
-/// Read data into a streambuf until a delimiter is encountered.
+/// Read data into a streambuf until it contains a specified delimiter.
/**
* 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
@@ -131,13 +138,17 @@
*
* @returns The number of bytes in the streambuf's get area up to and including
* the delimiter. Returns 0 if an error occurred.
+ *
+ * @note 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.
*/
template <typename SyncReadStream, typename Allocator>
std::size_t read_until(SyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, char delim,
boost::system::error_code& ec);
-/// Read data into a streambuf until a delimiter is encountered.
+/// Read data into a streambuf until it contains a specified delimiter.
/**
* 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
@@ -163,6 +174,10 @@
*
* @throws boost::system::system_error Thrown on failure.
*
+ * @note 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.
+ *
* @par Example
* To read data into a streambuf until a newline is encountered:
* @code boost::asio::streambuf b;
@@ -175,7 +190,7 @@
std::size_t read_until(SyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, const std::string& delim);
-/// Read data into a streambuf until a delimiter is encountered.
+/// Read data into a streambuf until it contains a specified delimiter.
/**
* 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
@@ -200,13 +215,18 @@
*
* @returns The number of bytes in the streambuf's get area up to and including
* the delimiter. Returns 0 if an error occurred.
+ *
+ * @note 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.
*/
template <typename 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);
-/// Read data into a streambuf until a regular expression is located.
+/// Read data into a streambuf until some part of the data it contains matches
+/// a regular expression.
/**
* 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.
@@ -232,6 +252,11 @@
*
* @throws boost::system::system_error Thrown on failure.
*
+ * @note 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.
+ *
* @par Example
* To read data into a streambuf until a CR-LF sequence is encountered:
* @code boost::asio::streambuf b;
@@ -244,7 +269,8 @@
std::size_t read_until(SyncReadStream& s,
boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr);
-/// Read data into a streambuf until a regular expression is located.
+/// Read data into a streambuf until some part of the data it contains matches
+/// a regular expression.
/**
* 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.
@@ -270,6 +296,11 @@
* @returns 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.
+ *
+ * @note 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.
*/
template <typename SyncReadStream, typename Allocator>
std::size_t read_until(SyncReadStream& s,
@@ -317,6 +348,10 @@
*
* @throws boost::system::system_error Thrown on failure.
*
+ * @note 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
+ *
* @note The default implementation of the @c is_match_condition type trait
* evaluates to true for function pointers and function objects with a
* @c result_type typedef. It must be specialised for other user-defined
@@ -417,6 +452,10 @@
* @returns 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.
*
+ * @note 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
+ *
* @note The default implementation of the @c is_match_condition type trait
* evaluates to true for function pointers and function objects with a
* @c result_type typedef. It must be specialised for other user-defined
@@ -430,12 +469,16 @@
/*@}*/
/**
-* @defgroup async_read_until boost::asio::async_read_until
-*/
+ * @defgroup async_read_until boost::asio::async_read_until
+ *
+ * @brief Start an asynchronous operation to read data into a streambuf until it
+ * contains a delimiter, matches a regular expression, or a function object
+ * indicates a match.
+ */
/*@{*/
-/// Start an asynchronous operation to read data into a streambuf until a
-/// delimiter is encountered.
+/// Start an asynchronous operation to read data into a streambuf until it
+/// contains a specified delimiter.
/**
* This function is used to asynchronously read data into the specified
* streambuf until the streambuf's get area contains the specified delimiter.
@@ -463,18 +506,24 @@
* 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.
+ * // Result of operation.
+ * const boost::system::error_code& error,
*
- * std::size_t bytes_transferred // The number of bytes in the
- * // streambuf's get area up to
- * // and including the delimiter.
- * // 0 if an error occurred.
+ * // The number of bytes in the streambuf's get
+ * // area up to and including the delimiter.
+ * // 0 if an error occurred.
+ * std::size_t bytes_transferred
* ); @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 After a successful async_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 async_read_until operation
+ * to examine.
+ *
* @par Example
* To asynchronously read data into a streambuf until a newline is encountered:
* @code boost::asio::streambuf b;
@@ -497,8 +546,8 @@
boost::asio::basic_streambuf<Allocator>& b,
char delim, ReadHandler handler);
-/// Start an asynchronous operation to read data into a streambuf until a
-/// delimiter is encountered.
+/// Start an asynchronous operation to read data into a streambuf until it
+/// contains a specified delimiter.
/**
* This function is used to asynchronously read data into the specified
* streambuf until the streambuf's get area contains the specified delimiter.
@@ -526,18 +575,24 @@
* 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.
+ * // Result of operation.
+ * const boost::system::error_code& error,
*
- * std::size_t bytes_transferred // The number of bytes in the
- * // streambuf's get area up to
- * // and including the delimiter.
- * // 0 if an error occurred.
+ * // The number of bytes in the streambuf's get
+ * // area up to and including the delimiter.
+ * // 0 if an error occurred.
+ * std::size_t bytes_transferred
* ); @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 After a successful async_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 async_read_until operation
+ * to examine.
+ *
* @par Example
* To asynchronously read data into a streambuf until a newline is encountered:
* @code boost::asio::streambuf b;
@@ -560,8 +615,8 @@
boost::asio::basic_streambuf<Allocator>& b, const std::string& delim,
ReadHandler handler);
-/// Start an asynchronous operation to read data into a streambuf until a
-/// regular expression is located.
+/// Start an asynchronous operation to read data into a streambuf until some
+/// part of its data matches a regular expression.
/**
* This function is used to asynchronously read data into the specified
* streambuf until the streambuf's get area contains some data that matches a
@@ -590,20 +645,25 @@
* 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.
+ * // Result of operation.
+ * const boost::system::error_code& error,
*
- * std::size_t bytes_transferred // The number of bytes in the
- * // streambuf's get area up to
- * // and including the substring
- * // that matches the regular.
- * // expression. 0 if an error
- * // occurred.
+ * // The number of bytes in the streambuf's get
+ * // area up to and including the substring
+ * // that matches the regular. expression.
+ * // 0 if an error occurred.
+ * std::size_t bytes_transferred
* ); @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 After a successful async_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
+ * async_read_until operation to examine.
+ *
* @par Example
* To asynchronously read data into a streambuf until a CR-LF sequence is
* encountered:
@@ -682,6 +742,11 @@
* the handler will be performed in a manner equivalent to using
* boost::asio::io_service::post().
*
+ * @note After a successful async_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
+ * async_read_until operation to examine.
+ *
* @note The default implementation of the @c is_match_condition type trait
* evaluates to true for function pointers and function objects with a
* @c result_type typedef. It must be specialised for other user-defined
Modified: branches/CMake/release/boost/asio/write.hpp
==============================================================================
--- branches/CMake/release/boost/asio/write.hpp (original)
+++ branches/CMake/release/boost/asio/write.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -30,6 +30,8 @@
/**
* @defgroup write boost::asio::write
+ *
+ * @brief Write a certain amount of data to a stream before returning.
*/
/*@{*/
@@ -280,6 +282,9 @@
/*@}*/
/**
* @defgroup async_write boost::asio::async_write
+ *
+ * @brief Start an asynchronous operation to write a certain amount of data to a
+ * stream.
*/
/*@{*/
Modified: branches/CMake/release/boost/asio/write_at.hpp
==============================================================================
--- branches/CMake/release/boost/asio/write_at.hpp (original)
+++ branches/CMake/release/boost/asio/write_at.hpp 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -31,6 +31,8 @@
/**
* @defgroup write_at boost::asio::write_at
+ *
+ * @brief Write a certain amount of data at a specified offset before returning.
*/
/*@{*/
@@ -304,6 +306,9 @@
/*@}*/
/**
* @defgroup async_write_at boost::asio::async_write_at
+ *
+ * @brief Start an asynchronous operation to write a certain amount of data at
+ * the specified offset.
*/
/*@{*/
Modified: branches/CMake/release/libs/asio/doc/asio.qbk
==============================================================================
--- branches/CMake/release/libs/asio/doc/asio.qbk (original)
+++ branches/CMake/release/libs/asio/doc/asio.qbk 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -20,6 +20,8 @@
]
[template mdash[] '''— ''']
+[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
+[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
[def __POSIX__ /POSIX/]
[def __Windows__ /Windows/]
[def __accept__ [@http://www.opengroup.org/onlinepubs/000095399/functions/accept.html `accept()`]]
Modified: branches/CMake/release/libs/asio/doc/quickref.xml
==============================================================================
--- branches/CMake/release/libs/asio/doc/quickref.xml (original)
+++ branches/CMake/release/libs/asio/doc/quickref.xml 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -10,151 +10,409 @@
<informaltable frame="all">
<tgroup cols="4">
+ <colspec colname="a"/>
+ <colspec colname="b"/>
+ <colspec colname="c"/>
+ <colspec colname="d"/>
+ <thead>
+ <row>
+ <entry valign="center" namest="a" nameend="d">
+ <bridgehead renderas="sect2">Core</bridgehead>
+ </entry>
+ </row>
+ </thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.const_buffer">const_buffer</link></listitem>
- <listitem><link linkend="boost_asio.reference.const_buffers_1">const_buffers_1</link></listitem>
- <listitem><link linkend="boost_asio.reference.deadline_timer">deadline_timer</link></listitem>
- <listitem><link linkend="boost_asio.reference.io_service">io_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.io_service__id">io_service::id</link></listitem>
- <listitem><link linkend="boost_asio.reference.io_service__service">io_service::service</link></listitem>
- <listitem><link linkend="boost_asio.reference.io_service__strand">io_service::strand</link></listitem>
- <listitem><link linkend="boost_asio.reference.io_service__work">io_service::work</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__address">ip::address</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__address_v4">ip::address_v4</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__address_v6">ip::address_v6</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__resolver_query_base">ip::resolver_query_base</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__tcp">ip::tcp</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__tcp.acceptor">ip::tcp::acceptor</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__tcp.endpoint">ip::tcp::endpoint</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__tcp.iostream">ip::tcp::iostream</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__tcp.resolver">ip::tcp::resolver</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__tcp.socket">ip::tcp::socket</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__udp">ip::udp</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__udp.endpoint">ip::udp::endpoint</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__udp.resolver">ip::udp::resolver</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__udp.socket">ip::udp::socket</link></listitem>
- <listitem><link linkend="boost_asio.reference.mutable_buffer">mutable_buffer</link></listitem>
- <listitem><link linkend="boost_asio.reference.mutable_buffers_1">mutable_buffers_1</link></listitem>
- <listitem><link linkend="boost_asio.reference.socket_base">socket_base</link></listitem>
- <listitem><link linkend="boost_asio.reference.ssl__context">ssl::context</link></listitem>
- <listitem><link linkend="boost_asio.reference.ssl__context_base">ssl::context_base</link></listitem>
- <listitem><link linkend="boost_asio.reference.ssl__stream_base">ssl::stream_base</link></listitem>
- <listitem><link linkend="boost_asio.reference.streambuf">streambuf</link></listitem>
- </itemizedlist>
- </entry>
- <entry valign="top">
- <bridgehead renderas="sect3">Class Templates</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.basic_datagram_socket">basic_datagram_socket</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_deadline_timer">basic_deadline_timer</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_io_object">basic_io_object</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_socket">basic_socket</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_socket_acceptor">basic_socket_acceptor</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_socket_iostream">basic_socket_iostream</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_socket_streambuf">basic_socket_streambuf</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_stream_socket">basic_stream_socket</link></listitem>
- <listitem><link linkend="boost_asio.reference.basic_streambuf">basic_streambuf</link></listitem>
- <listitem><link linkend="boost_asio.reference.buffered_read_stream">buffered_read_stream</link></listitem>
- <listitem><link linkend="boost_asio.reference.buffered_stream">buffered_stream</link></listitem>
- <listitem><link linkend="boost_asio.reference.buffered_write_stream">buffered_write_stream</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__basic_endpoint">ip::basic_endpoint</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__basic_resolver">ip::basic_resolver</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__basic_resolver_entry">ip::basic_resolver_entry</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__basic_resolver_iterator">ip::basic_resolver_iterator</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__basic_resolver_query">ip::basic_resolver_query</link></listitem>
- <listitem><link linkend="boost_asio.reference.ssl__basic_context">ssl::basic_context</link></listitem>
- <listitem><link linkend="boost_asio.reference.ssl__stream">ssl::stream</link></listitem>
- </itemizedlist>
- <bridgehead renderas="sect3">Services</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.datagram_socket_service">datagram_socket_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.deadline_timer_service">deadline_timer_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__resolver_service">ip::resolver_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.socket_acceptor_service">socket_acceptor_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.ssl__context_service">ssl::context_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.ssl__stream_service">ssl::stream_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.stream_socket_service">stream_socket_service</link></listitem>
- </itemizedlist>
- <bridgehead renderas="sect3">Placeholders</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.placeholders__bytes_transferred">placeholders::bytes_transferred</link></listitem>
- <listitem><link linkend="boost_asio.reference.placeholders__error">placeholders::error</link></listitem>
- <listitem><link linkend="boost_asio.reference.placeholders__iterator">placeholders::iterator</link></listitem>
- </itemizedlist>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.const_buffer">const_buffer</link></member>
+ <member><link linkend="boost_asio.reference.const_buffers_1">const_buffers_1</link></member>
+ <member><link linkend="boost_asio.reference.invalid_service_owner">invalid_service_owner</link></member>
+ <member><link linkend="boost_asio.reference.io_service">io_service</link></member>
+ <member><link linkend="boost_asio.reference.io_service__id">io_service::id</link></member>
+ <member><link linkend="boost_asio.reference.io_service__service">io_service::service</link></member>
+ <member><link linkend="boost_asio.reference.io_service__strand">io_service::strand</link></member>
+ <member><link linkend="boost_asio.reference.io_service__work">io_service::work</link></member>
+ <member><link linkend="boost_asio.reference.mutable_buffer">mutable_buffer</link></member>
+ <member><link linkend="boost_asio.reference.mutable_buffers_1">mutable_buffers_1</link></member>
+ <member><link linkend="boost_asio.reference.null_buffers">null_buffers</link></member>
+ <member><link linkend="boost_asio.reference.service_already_exists">service_already_exists</link></member>
+ <member><link linkend="boost_asio.reference.streambuf">streambuf</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Class Templates</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.basic_io_object">basic_io_object</link></member>
+ <member><link linkend="boost_asio.reference.basic_streambuf">basic_streambuf</link></member>
+ <member><link linkend="boost_asio.reference.buffered_read_stream">buffered_read_stream</link></member>
+ <member><link linkend="boost_asio.reference.buffered_stream">buffered_stream</link></member>
+ <member><link linkend="boost_asio.reference.buffered_write_stream">buffered_write_stream</link></member>
+ <member><link linkend="boost_asio.reference.buffers_iterator">buffers_iterator</link></member>
+ </simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Free Functions</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.add_service">add_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.asio_handler_allocate">asio_handler_allocate</link></listitem>
- <listitem><link linkend="boost_asio.reference.asio_handler_deallocate">asio_handler_deallocate</link></listitem>
- <listitem><link linkend="boost_asio.reference.asio_handler_invoke">asio_handler_invoke</link></listitem>
- <listitem><link linkend="boost_asio.reference.async_read">async_read</link></listitem>
- <listitem><link linkend="boost_asio.reference.async_read_until">async_read_until</link></listitem>
- <listitem><link linkend="boost_asio.reference.async_write">async_write</link></listitem>
- <listitem><link linkend="boost_asio.reference.buffer">buffer</link></listitem>
- <listitem><link linkend="boost_asio.reference.has_service">has_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.ip__host_name">ip::host_name</link></listitem>
- <listitem><link linkend="boost_asio.reference.read">read</link></listitem>
- <listitem><link linkend="boost_asio.reference.read_until">read_until</link></listitem>
- <listitem><link linkend="boost_asio.reference.transfer_all">transfer_all</link></listitem>
- <listitem><link linkend="boost_asio.reference.transfer_at_least">transfer_at_least</link></listitem>
- <listitem><link linkend="boost_asio.reference.use_service">use_service</link></listitem>
- <listitem><link linkend="boost_asio.reference.write">write</link></listitem>
- </itemizedlist>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.add_service">add_service</link></member>
+ <member><link linkend="boost_asio.reference.asio_handler_allocate">asio_handler_allocate</link></member>
+ <member><link linkend="boost_asio.reference.asio_handler_deallocate">asio_handler_deallocate</link></member>
+ <member><link linkend="boost_asio.reference.asio_handler_invoke">asio_handler_invoke</link></member>
+ <member><link linkend="boost_asio.reference.async_read">async_read</link></member>
+ <member><link linkend="boost_asio.reference.async_read_at">async_read_at</link></member>
+ <member><link linkend="boost_asio.reference.async_read_until">async_read_until</link></member>
+ <member><link linkend="boost_asio.reference.async_write">async_write</link></member>
+ <member><link linkend="boost_asio.reference.async_write_at">async_write_at</link></member>
+ <member><link linkend="boost_asio.reference.buffer">buffer</link></member>
+ <member><link linkend="boost_asio.reference.buffers_begin">buffers_begin</link></member>
+ <member><link linkend="boost_asio.reference.buffers_end">buffers_end</link></member>
+ <member><link linkend="boost_asio.reference.has_service">has_service</link></member>
+ <member><link linkend="boost_asio.reference.read">read</link></member>
+ <member><link linkend="boost_asio.reference.read_at">read_at</link></member>
+ <member><link linkend="boost_asio.reference.read_until">read_until</link></member>
+ <member><link linkend="boost_asio.reference.transfer_all">transfer_all</link></member>
+ <member><link linkend="boost_asio.reference.transfer_at_least">transfer_at_least</link></member>
+ <member><link linkend="boost_asio.reference.use_service">use_service</link></member>
+ <member><link linkend="boost_asio.reference.write">write</link></member>
+ <member><link linkend="boost_asio.reference.write_at">write_at</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Placeholders</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.placeholders__bytes_transferred">placeholders::bytes_transferred</link></member>
+ <member><link linkend="boost_asio.reference.placeholders__error">placeholders::error</link></member>
+ <member><link linkend="boost_asio.reference.placeholders__iterator">placeholders::iterator</link></member>
+ </simplelist>
<bridgehead renderas="sect3">Error Codes</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.error__basic_errors">error::basic_errors</link></listitem>
- <listitem><link linkend="boost_asio.reference.error__netdb_errors">error::netdb_errors</link></listitem>
- <listitem><link linkend="boost_asio.reference.error__addrinfo_errors">error::addrinfo_errors</link></listitem>
- <listitem><link linkend="boost_asio.reference.error__misc_errors">error::misc_errors</link></listitem>
- </itemizedlist>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.error__basic_errors">error::basic_errors</link></member>
+ <member><link linkend="boost_asio.reference.error__netdb_errors">error::netdb_errors</link></member>
+ <member><link linkend="boost_asio.reference.error__addrinfo_errors">error::addrinfo_errors</link></member>
+ <member><link linkend="boost_asio.reference.error__misc_errors">error::misc_errors</link></member>
+ </simplelist>
<bridgehead renderas="sect3">Type Traits</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.is_read_buffered">is_read_buffered</link></listitem>
- <listitem><link linkend="boost_asio.reference.is_write_buffered">is_write_buffered</link></listitem>
- </itemizedlist>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.is_match_condition">is_match_condition</link></member>
+ <member><link linkend="boost_asio.reference.is_read_buffered">is_read_buffered</link></member>
+ <member><link linkend="boost_asio.reference.is_write_buffered">is_write_buffered</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Type Requirements</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.asynchronous_operations">Asynchronous operations</link></member>
+ <member><link linkend="boost_asio.reference.AsyncRandomAccessReadDevice">AsyncRandomAccessReadDevice</link></member>
+ <member><link linkend="boost_asio.reference.AsyncRandomAccessWriteDevice">AsyncRandomAccessWriteDevice</link></member>
+ <member><link linkend="boost_asio.reference.AsyncReadStream">AsyncReadStream</link></member>
+ <member><link linkend="boost_asio.reference.AsyncWriteStream">AsyncWriteStream</link></member>
+ <member><link linkend="boost_asio.reference.CompletionHandler">CompletionHandler</link></member>
+ <member><link linkend="boost_asio.reference.ConstBufferSequence">ConstBufferSequence</link></member>
+ <member><link linkend="boost_asio.reference.ConvertibleToConstBuffer">ConvertibleToConstBuffer</link></member>
+ <member><link linkend="boost_asio.reference.ConvertibleToMutableBuffer">ConvertibleToMutableBuffer</link></member>
+ <member><link linkend="boost_asio.reference.Handler">Handler</link></member>
+ <member><link linkend="boost_asio.reference.IoObjectService">IoObjectService</link></member>
+ <member><link linkend="boost_asio.reference.MutableBufferSequence">MutableBufferSequence</link></member>
+ <member><link linkend="boost_asio.reference.ReadHandler">ReadHandler</link></member>
+ <member><link linkend="boost_asio.reference.Service">Service</link></member>
+ <member><link linkend="boost_asio.reference.SyncRandomAccessReadDevice">SyncRandomAccessReadDevice</link></member>
+ <member><link linkend="boost_asio.reference.SyncRandomAccessWriteDevice">SyncRandomAccessWriteDevice</link></member>
+ <member><link linkend="boost_asio.reference.SyncReadStream">SyncReadStream</link></member>
+ <member><link linkend="boost_asio.reference.SyncWriteStream">SyncWriteStream</link></member>
+ <member><link linkend="boost_asio.reference.WriteHandler">WriteHandler</link></member>
+ </simplelist>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ <tgroup cols="4">
+ <colspec colname="a"/>
+ <colspec colname="b"/>
+ <colspec colname="c"/>
+ <colspec colname="d"/>
+ <thead>
+ <row>
+ <entry valign="center" namest="a" nameend="d">
+ <bridgehead renderas="sect2">Networking</bridgehead>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Classes</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.ip__address">ip::address</link></member>
+ <member><link linkend="boost_asio.reference.ip__address_v4">ip::address_v4</link></member>
+ <member><link linkend="boost_asio.reference.ip__address_v6">ip::address_v6</link></member>
+ <member><link linkend="boost_asio.reference.ip__icmp">ip::icmp</link></member>
+ <member><link linkend="boost_asio.reference.ip__icmp.endpoint">ip::icmp::endpoint</link></member>
+ <member><link linkend="boost_asio.reference.ip__icmp.resolver">ip::icmp::resolver</link></member>
+ <member><link linkend="boost_asio.reference.ip__icmp.socket">ip::icmp::socket</link></member>
+ <member><link linkend="boost_asio.reference.ip__resolver_query_base">ip::resolver_query_base</link></member>
+ <member><link linkend="boost_asio.reference.ip__tcp">ip::tcp</link></member>
+ <member><link linkend="boost_asio.reference.ip__tcp.acceptor">ip::tcp::acceptor</link></member>
+ <member><link linkend="boost_asio.reference.ip__tcp.endpoint">ip::tcp::endpoint</link></member>
+ <member><link linkend="boost_asio.reference.ip__tcp.iostream">ip::tcp::iostream</link></member>
+ <member><link linkend="boost_asio.reference.ip__tcp.resolver">ip::tcp::resolver</link></member>
+ <member><link linkend="boost_asio.reference.ip__tcp.socket">ip::tcp::socket</link></member>
+ <member><link linkend="boost_asio.reference.ip__udp">ip::udp</link></member>
+ <member><link linkend="boost_asio.reference.ip__udp.endpoint">ip::udp::endpoint</link></member>
+ <member><link linkend="boost_asio.reference.ip__udp.resolver">ip::udp::resolver</link></member>
+ <member><link linkend="boost_asio.reference.ip__udp.socket">ip::udp::socket</link></member>
+ <member><link linkend="boost_asio.reference.socket_base">socket_base</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Free Functions</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.ip__host_name">ip::host_name</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Class Templates</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.basic_datagram_socket">basic_datagram_socket</link></member>
+ <member><link linkend="boost_asio.reference.basic_deadline_timer">basic_deadline_timer</link></member>
+ <member><link linkend="boost_asio.reference.basic_socket">basic_socket</link></member>
+ <member><link linkend="boost_asio.reference.basic_raw_socket">basic_raw_socket</link></member>
+ <member><link linkend="boost_asio.reference.basic_socket_acceptor">basic_socket_acceptor</link></member>
+ <member><link linkend="boost_asio.reference.basic_socket_iostream">basic_socket_iostream</link></member>
+ <member><link linkend="boost_asio.reference.basic_socket_streambuf">basic_socket_streambuf</link></member>
+ <member><link linkend="boost_asio.reference.basic_stream_socket">basic_stream_socket</link></member>
+ <member><link linkend="boost_asio.reference.ip__basic_endpoint">ip::basic_endpoint</link></member>
+ <member><link linkend="boost_asio.reference.ip__basic_resolver">ip::basic_resolver</link></member>
+ <member><link linkend="boost_asio.reference.ip__basic_resolver_entry">ip::basic_resolver_entry</link></member>
+ <member><link linkend="boost_asio.reference.ip__basic_resolver_iterator">ip::basic_resolver_iterator</link></member>
+ <member><link linkend="boost_asio.reference.ip__basic_resolver_query">ip::basic_resolver_query</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Services</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.datagram_socket_service">datagram_socket_service</link></member>
+ <member><link linkend="boost_asio.reference.ip__resolver_service">ip::resolver_service</link></member>
+ <member><link linkend="boost_asio.reference.raw_socket_service">raw_socket_service</link></member>
+ <member><link linkend="boost_asio.reference.socket_acceptor_service">socket_acceptor_service</link></member>
+ <member><link linkend="boost_asio.reference.stream_socket_service">stream_socket_service</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Socket Options</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.ip__multicast__enable_loopback">ip::multicast::enable_loopback</link></member>
+ <member><link linkend="boost_asio.reference.ip__multicast__hops">ip::multicast::hops</link></member>
+ <member><link linkend="boost_asio.reference.ip__multicast__join_group">ip::multicast::join_group</link></member>
+ <member><link linkend="boost_asio.reference.ip__multicast__leave_group">ip::multicast::leave_group</link></member>
+ <member><link linkend="boost_asio.reference.ip__multicast__outbound_interface">ip::multicast::outbound_interface</link></member>
+ <member><link linkend="boost_asio.reference.ip__tcp.no_delay">ip::tcp::no_delay</link></member>
+ <member><link linkend="boost_asio.reference.ip__unicast__hops">ip::unicast::hops</link></member>
+ <member><link linkend="boost_asio.reference.ip__v6_only">ip::v6_only</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.broadcast">socket_base::broadcast</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.debug">socket_base::debug</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.do_not_route">socket_base::do_not_route</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.enable_connection_aborted">socket_base::enable_connection_aborted</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.keep_alive">socket_base::keep_alive</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.linger">socket_base::linger</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.receive_buffer_size">socket_base::receive_buffer_size</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.receive_low_watermark">socket_base::receive_low_watermark</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.reuse_address">socket_base::reuse_address</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.send_buffer_size">socket_base::send_buffer_size</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.send_low_watermark">socket_base::send_low_watermark</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">I/O Control Commands</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.socket_base.bytes_readable">socket_base::bytes_readable</link></member>
+ <member><link linkend="boost_asio.reference.socket_base.non_blocking_io">socket_base::non_blocking_io</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Type Requirements</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.AcceptHandler">AcceptHandler</link></member>
+ <member><link linkend="boost_asio.reference.ConnectHandler">ConnectHandler</link></member>
+ <member><link linkend="boost_asio.reference.DatagramSocketService">DatagramSocketService</link></member>
+ <member><link linkend="boost_asio.reference.Endpoint">Endpoint</link></member>
+ <member><link linkend="boost_asio.reference.GettableSocketOption">GettableSocketOption</link></member>
+ <member><link linkend="boost_asio.reference.InternetProtocol">InternetProtocol</link></member>
+ <member><link linkend="boost_asio.reference.IoControlCommand">IoControlCommand</link></member>
+ <member><link linkend="boost_asio.reference.Protocol">Protocol</link></member>
+ <member><link linkend="boost_asio.reference.RawSocketService">RawSocketService</link></member>
+ <member><link linkend="boost_asio.reference.ResolveHandler">ResolveHandler</link></member>
+ <member><link linkend="boost_asio.reference.ResolverService">ResolverService</link></member>
+ <member><link linkend="boost_asio.reference.SettableSocketOption">SettableSocketOption</link></member>
+ <member><link linkend="boost_asio.reference.SocketAcceptorService">SocketAcceptorService</link></member>
+ <member><link linkend="boost_asio.reference.SocketService">SocketService</link></member>
+ <member><link linkend="boost_asio.reference.StreamSocketService">StreamSocketService</link></member>
+ </simplelist>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ <tgroup cols="4">
+ <colspec colname="a"/>
+ <colspec colname="b"/>
+ <colspec colname="c"/>
+ <colspec colname="d"/>
+ <thead>
+ <row>
+ <entry valign="center" namest="a" nameend="a">
+ <bridgehead renderas="sect2">Timers</bridgehead>
+ </entry>
+ <entry valign="center" namest="b" nameend="b">
+ <bridgehead renderas="sect2">SSL</bridgehead>
+ </entry>
+ <entry valign="center" namest="c" nameend="d">
+ <bridgehead renderas="sect2">Serial Ports</bridgehead>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Classes</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.deadline_timer">deadline_timer</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Class Templates</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.basic_deadline_timer">basic_deadline_timer</link></member>
+ <member><link linkend="boost_asio.reference.time_traits_lt__ptime__gt_">time_traits</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Services</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.deadline_timer_service">deadline_timer_service</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Type Requirements</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.TimerService">TimerService</link></member>
+ <member><link linkend="boost_asio.reference.TimeTraits">TimeTraits</link></member>
+ <member><link linkend="boost_asio.reference.WaitHandler">WaitHandler</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Classes</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.ssl__context">ssl::context</link></member>
+ <member><link linkend="boost_asio.reference.ssl__context_base">ssl::context_base</link></member>
+ <member><link linkend="boost_asio.reference.ssl__stream_base">ssl::stream_base</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Class Templates</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.ssl__basic_context">ssl::basic_context</link></member>
+ <member><link linkend="boost_asio.reference.ssl__stream">ssl::stream</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Services</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.ssl__context_service">ssl::context_service</link></member>
+ <member><link linkend="boost_asio.reference.ssl__stream_service">ssl::stream_service</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Classes</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.serial_port">serial_port</link></member>
+ <member><link linkend="boost_asio.reference.serial_port_base">serial_port_base</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Class Templates</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.basic_serial_port">basic_serial_port</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Services</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.serial_port_service">serial_port_service</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Serial Port Options</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.serial_port_base__baud_rate">serial_port_base::baud_rate</link></member>
+ <member><link linkend="boost_asio.reference.serial_port_base__flow_control">serial_port_base::flow_control</link></member>
+ <member><link linkend="boost_asio.reference.serial_port_base__parity">serial_port_base::parity</link></member>
+ <member><link linkend="boost_asio.reference.serial_port_base__stop_bits">serial_port_base::stop_bits</link></member>
+ <member><link linkend="boost_asio.reference.serial_port_base__character_size">serial_port_base::character_size</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Type Requirements</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.GettableSerialPortOption">GettableSerialPortOption</link></member>
+ <member><link linkend="boost_asio.reference.SerialPortService">SerialPortService</link></member>
+ <member><link linkend="boost_asio.reference.SettableSerialPortOption">SettableSerialPortOption</link></member>
+ </simplelist>
</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ <tgroup cols="4">
+ <colspec colname="a"/>
+ <colspec colname="b"/>
+ <colspec colname="c"/>
+ <colspec colname="d"/>
+ <thead>
+ <row>
+ <entry valign="center" namest="a" nameend="b">
+ <bridgehead renderas="sect2">POSIX-specific</bridgehead>
+ </entry>
+ <entry valign="center" namest="c" nameend="d">
+ <bridgehead renderas="sect2">Windows-specific</bridgehead>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
<entry valign="top">
+ <bridgehead renderas="sect3">Classes</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.local__stream_protocol">local::stream_protocol</link></member>
+ <member><link linkend="boost_asio.reference.local__stream_protocol.acceptor">local::stream_protocol::acceptor</link></member>
+ <member><link linkend="boost_asio.reference.local__stream_protocol.endpoint">local::stream_protocol::endpoint</link></member>
+ <member><link linkend="boost_asio.reference.local__stream_protocol.iostream">local::stream_protocol::iostream</link></member>
+ <member><link linkend="boost_asio.reference.local__stream_protocol.socket">local::stream_protocol::socket</link></member>
+ <member><link linkend="boost_asio.reference.local__datagram_protocol">local::datagram_protocol</link></member>
+ <member><link linkend="boost_asio.reference.local__datagram_protocol.endpoint">local::datagram_protocol::endpoint</link></member>
+ <member><link linkend="boost_asio.reference.local__datagram_protocol.socket">local::datagram_protocol::socket</link></member>
+ <member><link linkend="boost_asio.reference.posix__descriptor_base">posix::descriptor_base</link></member>
+ <member><link linkend="boost_asio.reference.posix__stream_descriptor">posix::stream_descriptor</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Free Functions</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.local__connect_pair">local::connect_pair</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top">
+ <bridgehead renderas="sect3">Class Templates</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.local__basic_endpoint">local::basic_endpoint</link></member>
+ <member><link linkend="boost_asio.reference.posix__basic_descriptor">posix::basic_descriptor</link></member>
+ <member><link linkend="boost_asio.reference.posix__basic_stream_descriptor">posix::basic_stream_descriptor</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Services</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.posix__stream_descriptor_service">posix::stream_descriptor_service</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Type Requirements</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.DescriptorService">DescriptorService</link></member>
+ <member><link linkend="boost_asio.reference.StreamDescriptorService">StreamDescriptorService</link></member>
+ </simplelist>
+ </entry>
+ <entry valign="top" namest="c" nameend="d">
+ <bridgehead renderas="sect3">Classes</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.windows__random_access_handle">windows::random_access_handle</link></member>
+ <member><link linkend="boost_asio.reference.windows__stream_handle">windows::stream_handle</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Class Templates</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.windows__basic_handle">windows::basic_handle</link></member>
+ <member><link linkend="boost_asio.reference.windows__basic_random_access_handle">windows::basic_random_access_handle</link></member>
+ <member><link linkend="boost_asio.reference.windows__basic_stream_handle">windows::basic_stream_handle</link></member>
+ </simplelist>
+ <bridgehead renderas="sect3">Services</bridgehead>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.windows__random_access_handle_service">windows::random_access_handle_service</link></member>
+ <member><link linkend="boost_asio.reference.windows__stream_handle_service">windows::stream_handle_service</link></member>
+ </simplelist>
<bridgehead renderas="sect3">Type Requirements</bridgehead>
- <itemizedlist>
- <listitem><link linkend="boost_asio.reference.asynchronous_operations">Asynchronous operations</link></listitem>
- <listitem><link linkend="boost_asio.reference.AcceptHandler">AcceptHandler</link></listitem>
- <listitem><link linkend="boost_asio.reference.AsyncReadStream">AsyncReadStream</link></listitem>
- <listitem><link linkend="boost_asio.reference.AsyncWriteStream">AsyncWriteStream</link></listitem>
- <listitem><link linkend="boost_asio.reference.CompletionHandler">CompletionHandler</link></listitem>
- <listitem><link linkend="boost_asio.reference.ConnectHandler">ConnectHandler</link></listitem>
- <listitem><link linkend="boost_asio.reference.ConstBufferSequence">ConstBufferSequence</link></listitem>
- <listitem><link linkend="boost_asio.reference.ConvertibleToConstBuffer">ConvertibleToConstBuffer</link></listitem>
- <listitem><link linkend="boost_asio.reference.ConvertibleToMutableBuffer">ConvertibleToMutableBuffer</link></listitem>
- <listitem><link linkend="boost_asio.reference.DatagramSocketService">DatagramSocketService</link></listitem>
- <listitem><link linkend="boost_asio.reference.Endpoint">Endpoint</link></listitem>
- <listitem><link linkend="boost_asio.reference.GettableSocketOption">GettableSocketOption</link></listitem>
- <listitem><link linkend="boost_asio.reference.Handler">Handler</link></listitem>
- <listitem><link linkend="boost_asio.reference.InternetProtocol">InternetProtocol</link></listitem>
- <listitem><link linkend="boost_asio.reference.IoControlCommand">IoControlCommand</link></listitem>
- <listitem><link linkend="boost_asio.reference.IoObjectService">IoObjectService</link></listitem>
- <listitem><link linkend="boost_asio.reference.MutableBufferSequence">MutableBufferSequence</link></listitem>
- <listitem><link linkend="boost_asio.reference.Protocol">Protocol</link></listitem>
- <listitem><link linkend="boost_asio.reference.ReadHandler">ReadHandler</link></listitem>
- <listitem><link linkend="boost_asio.reference.ResolveHandler">ResolveHandler</link></listitem>
- <listitem><link linkend="boost_asio.reference.ResolverService">ResolverService</link></listitem>
- <listitem><link linkend="boost_asio.reference.Service">Service</link></listitem>
- <listitem><link linkend="boost_asio.reference.SettableSocketOption">SettableSocketOption</link></listitem>
- <listitem><link linkend="boost_asio.reference.SocketAcceptorService">SocketAcceptorService</link></listitem>
- <listitem><link linkend="boost_asio.reference.SocketService">SocketService</link></listitem>
- <listitem><link linkend="boost_asio.reference.StreamSocketService">StreamSocketService</link></listitem>
- <listitem><link linkend="boost_asio.reference.SyncReadStream">SyncReadStream</link></listitem>
- <listitem><link linkend="boost_asio.reference.SyncWriteStream">SyncWriteStream</link></listitem>
- <listitem><link linkend="boost_asio.reference.TimerService">TimerService</link></listitem>
- <listitem><link linkend="boost_asio.reference.TimeTraits">TimeTraits</link></listitem>
- <listitem><link linkend="boost_asio.reference.WaitHandler">WaitHandler</link></listitem>
- <listitem><link linkend="boost_asio.reference.WriteHandler">WriteHandler</link></listitem>
- </itemizedlist>
+ <simplelist type="vert" columns="1">
+ <member><link linkend="boost_asio.reference.HandleService">HandleService</link></member>
+ <member><link linkend="boost_asio.reference.RandomAccessHandleService">RandomAccessHandleService</link></member>
+ <member><link linkend="boost_asio.reference.StreamHandleService">StreamHandleService</link></member>
+ </simplelist>
</entry>
</row>
</tbody>
Modified: branches/CMake/release/libs/asio/doc/reference.qbk
==============================================================================
--- branches/CMake/release/libs/asio/doc/reference.qbk (original)
+++ branches/CMake/release/libs/asio/doc/reference.qbk 2008-07-03 10:40:28 EDT (Thu, 03 Jul 2008)
@@ -19,9 +19,11 @@
[include requirements/ConvertibleToConstBuffer.qbk]
[include requirements/ConvertibleToMutableBuffer.qbk]
[include requirements/DatagramSocketService.qbk]
+[include requirements/DescriptorService.qbk]
[include requirements/Endpoint.qbk]
[include requirements/GettableSocketOption.qbk]
[include requirements/Handler.qbk]
+[include requirements/HandleService.qbk]
[include requirements/InternetProtocol.qbk]
[include requirements/IoControlCommand.qbk]
[include requirements/IoObjectService.qbk]
@@ -34,6 +36,8 @@
[include requirements/SettableSocketOption.qbk]
[include requirements/SocketAcceptorService.qbk]
[include requirements/SocketService.qbk]
+[include requirements/StreamDescriptorService.qbk]
+[include requirements/StreamHandleService.qbk]
[include requirements/StreamSocketService.qbk]
[include requirements/SyncReadStream.qbk]
[include requirements/SyncWriteStream.qbk]
@@ -46,7 +50,7 @@
[section:add_service add_service]
-
+[indexterm1 add_service]
template<
typename ``[link boost_asio.reference.Service Service]``>
@@ -68,7 +72,6 @@
[[svc][The service object. On success, ownership of the service object is transferred to the io\_service. When the io\_service object is destroyed, it will destroy the service object by performing:
``
delete static_cast<io_service::service*>(svc)
-
``
]]
@@ -93,7 +96,7 @@
[section:asio_handler_allocate asio_handler_allocate]
-Default allocation function for handlers.
+[indexterm1 asio_handler_allocate] Default allocation function for handlers.
void * asio_handler_allocate(
std::size_t size,
@@ -106,7 +109,7 @@
This default implementation is simply:
- return ::operator new(bytes);
+ return ::operator new(size);
@@ -144,7 +147,7 @@
[section:asio_handler_deallocate asio_handler_deallocate]
-Default deallocation function for handlers.
+[indexterm1 asio_handler_deallocate] Default deallocation function for handlers.
void asio_handler_deallocate(
void * pointer,
@@ -170,7 +173,7 @@
[section:asio_handler_invoke asio_handler_invoke]
-Default invoke function for handlers.
+[indexterm1 asio_handler_invoke] Default invoke function for handlers.
template<
typename Function>
@@ -215,8 +218,8 @@
[section:async_read async_read]
-Start an asynchronous operation to read a certain amount of data from a stream.
-
+[indexterm1 async_read] Start an asynchronous operation to read a certain amount of data from a stream.
+
template<
typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
@@ -302,7 +305,6 @@
// bytes successfully transferred
// prior to the error.
);
-
``
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().]]
@@ -378,7 +380,6 @@
std::size_t bytes_transferred // Number of bytes transferred
// so far.
);
-
``
A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's async\_read\_some function are required.]]
@@ -393,7 +394,6 @@
// bytes successfully transferred
// prior to the error.
);
-
``
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().]]
@@ -461,7 +461,6 @@
// bytes successfully transferred
// prior to the error.
);
-
``
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().]]
@@ -527,7 +526,6 @@
std::size_t bytes_transferred // Number of bytes transferred
// so far.
);
-
``
A return value of true indicates that the read operation is complete. False indicates that further calls to the stream's async\_read\_some function are required.]]
@@ -542,7 +540,358 @@
// bytes successfully transferred
// prior to the error.
);
+``
+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(). ]]
+
+]
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:async_read_at async_read_at]
+
+[indexterm1 async_read_at] Start an asynchronous operation to read a certain amount of data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.async_read_at.overload1 async_read_at]``(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.async_read_at.overload2 async_read_at]``(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ ReadHandler handler);
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.async_read_at.overload3 async_read_at]``(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ ReadHandler handler);
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.async_read_at.overload4 async_read_at]``(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
+ ReadHandler handler);
+
+
+[section:overload1 async_read_at (1 of 4 overloads)]
+
+Start an asynchronous operation to read a certain amount of data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_at(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+
+
+This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue 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.
+
+* An error occurred.
+
+This operation is implemented in terms of one or more calls to the device's async\_read\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice 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. 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(
+ // Result of operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes copied into the buffers. If an error
+ // occurred, this will be the number of bytes successfully
+ // transferred prior to the error.
+ std::size_t bytes_transferred
+ );
+``
+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 read into a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
+
+ boost::asio::async_read_at(d, 42, 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.
+
+[heading Remarks]
+
+This overload is equivalent to calling:
+
+ boost::asio::async_read_at(
+ d, 42, buffers,
+ boost::asio::transfer_all(),
+ handler);
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload2 async_read_at (2 of 4 overloads)]
+
+Start an asynchronous operation to read a certain amount of data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_at(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ const MutableBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ ReadHandler handler);
+
+
+This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue 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 true.
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice 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. 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.]]
+
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ bool 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 true indicates that the read operation is complete. False indicates that further calls to the device's async\_read\_some\_at function are 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:
+``
+ void handler(
+ // Result of operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes copied into the buffers. If an error
+ // occurred, this will be the number of bytes successfully
+ // transferred prior to the error.
+ std::size_t bytes_transferred
+ );
+``
+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 read into a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
+
+ boost::asio::async_read_at(d, 42,
+ boost::asio::buffer(data, size),
+ boost::asio::transfer_at_least(32),
+ 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:overload3 async_read_at (3 of 4 overloads)]
+
+Start an asynchronous operation to read a certain amount of data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_at(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ ReadHandler handler);
+
+
+This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
+
+
+* An error occurred.
+
+This operation is implemented in terms of one or more calls to the device's async\_read\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
+
+[[offset][The offset at which the data will be read.]]
+
+[[b][A basic\_streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains 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(
+ // Result of operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes copied into the buffers. If an error
+ // occurred, this will be the number of bytes successfully
+ // transferred prior to the error.
+ std::size_t bytes_transferred
+ );
+``
+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 is equivalent to calling:
+
+ boost::asio::async_read_at(
+ d, 42, b,
+ boost::asio::transfer_all(),
+ handler);
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload4 async_read_at (4 of 4 overloads)]
+
+Start an asynchronous operation to read a certain amount of data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessReadDevice AsyncRandomAccessReadDevice]``,
+ typename Allocator,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_at(
+ AsyncRandomAccessReadDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
+ ReadHandler handler);
+
+
+This function is used to asynchronously read a certain number of bytes of data from a random access device at the specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
+
+
+* The completion_condition function object returns true.
+
+This operation is implemented in terms of one or more calls to the device's async\_read\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device from which the data is to be read. The type must support the AsyncRandomAccessReadDevice concept.]]
+
+[[offset][The offset at which the data will be read.]]
+
+[[b][A basic\_streambuf object into which the data will be read. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
+
+[[completion_condition][The function object to be called to determine whether the read operation is complete. The signature of the function object must be:
+``
+ bool 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 true indicates that the read operation is complete. False indicates that further calls to the device's async\_read\_some\_at function are 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:
+``
+ void handler(
+ // Result of operation.
+ const boost::system::error_code& error,
+ // Number of bytes copied into the buffers. If an error
+ // occurred, this will be the number of bytes successfully
+ // transferred prior to the error.
+ std::size_t bytes_transferred
+ );
``
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(). ]]
@@ -557,8 +906,8 @@
[section:async_read_until async_read_until]
-Start an asynchronous operation to read data into a streambuf until a delimiter is encountered.
-
+[indexterm1 async_read_until] Start an asynchronous operation to 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.AsyncReadStream AsyncReadStream]``,
typename Allocator,
@@ -589,10 +938,22 @@
const boost::regex & expr,
ReadHandler handler);
+ template<
+ typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
+ typename Allocator,
+ typename MatchCondition,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.async_read_until.overload4 async_read_until]``(
+ AsyncReadStream & s,
+ boost::asio::basic_streambuf< Allocator > & b,
+ MatchCondition match_condition,
+ ReadHandler handler,
+ typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
-[section:overload1 async_read_until (1 of 3 overloads)]
-Start an asynchronous operation to read data into a streambuf until a delimiter is encountered.
+[section:overload1 async_read_until (1 of 4 overloads)]
+
+Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter.
template<
typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
@@ -629,19 +990,23 @@
[[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.
+ // Result of operation.
+ const boost::system::error_code& error,
- std::size_t bytes_transferred // The number of bytes in the
- // streambuf's get area up to
- // and including the delimiter.
- // 0 if an error occurred.
+ // The number of bytes in the streambuf's get
+ // area up to and including the delimiter.
+ // 0 if an error occurred.
+ std::size_t bytes_transferred
);
-
``
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]
+
+After a successful async\_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 async\_read\_until operation to examine.
+
[heading Example]
To asynchronously read data into a streambuf until a newline is encountered:
@@ -670,9 +1035,9 @@
-[section:overload2 async_read_until (2 of 3 overloads)]
+[section:overload2 async_read_until (2 of 4 overloads)]
-Start an asynchronous operation to read data into a streambuf until a delimiter is encountered.
+Start an asynchronous operation to read data into a streambuf until it contains a specified delimiter.
template<
typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
@@ -709,19 +1074,23 @@
[[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.
+ // Result of operation.
+ const boost::system::error_code& error,
- std::size_t bytes_transferred // The number of bytes in the
- // streambuf's get area up to
- // and including the delimiter.
- // 0 if an error occurred.
+ // The number of bytes in the streambuf's get
+ // area up to and including the delimiter.
+ // 0 if an error occurred.
+ std::size_t bytes_transferred
);
-
``
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]
+
+After a successful async\_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 async\_read\_until operation to examine.
+
[heading Example]
To asynchronously read data into a streambuf until a newline is encountered:
@@ -750,9 +1119,9 @@
-[section:overload3 async_read_until (3 of 3 overloads)]
+[section:overload3 async_read_until (3 of 4 overloads)]
-Start an asynchronous operation to read data into a streambuf until a regular expression is located.
+Start an asynchronous operation to read data into a streambuf until some part of its data matches a regular expression.
template<
typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
@@ -789,21 +1158,24 @@
[[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.
+ // Result of operation.
+ const boost::system::error_code& error,
- std::size_t bytes_transferred // The number of bytes in the
- // streambuf's get area up to
- // and including the substring
- // that matches the regular.
- // expression. 0 if an error
- // occurred.
+ // The number of bytes in the streambuf's get
+ // area up to and including the substring
+ // that matches the regular. expression.
+ // 0 if an error occurred.
+ std::size_t bytes_transferred
);
-
``
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]
+
+After a successful async\_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 async\_read\_until operation to examine.
+
[heading Example]
To asynchronously read data into a streambuf until a CR-LF sequence is encountered:
@@ -831,12 +1203,145 @@
[endsect]
+
+[section:overload4 async_read_until (4 of 4 overloads)]
+
+Start an asynchronous operation to read data into a streambuf until a function object indicates a match.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncReadStream AsyncReadStream]``,
+ typename Allocator,
+ typename MatchCondition,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_until(
+ AsyncReadStream & s,
+ boost::asio::basic_streambuf< Allocator > & b,
+ MatchCondition match_condition,
+ ReadHandler handler,
+ typename boost::enable_if< is_match_condition< MatchCondition > >::type * = 0);
+
+
+This function is used to asynchronously 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 function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
+
+
+* The match condition function object returns a std::pair where the second element evaluates to true.
+
+* An error occurred.
+
+This operation is implemented in terms of zero or more calls to the stream's async\_read\_some function. If the match condition function object already indicates a match, the operation completes immediately.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[s][The stream from which the data is to be read. The type must support the AsyncReadStream concept.]]
+
+[[b][A streambuf object into which the data will be read.]]
+
+[[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.]]
+
+[[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(
+ // Result of operation.
+ const boost::system::error_code& error,
+
+ // The number of bytes in the streambuf's get
+ // area that have been fully consumed by the
+ // match function. O if an error occurred.
+ std::size_t bytes_transferred
+ );
+``
+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]
+
+After a successful async\_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 async\_read\_until operation to examine.
+
+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 asynchronously read data into a streambuf until whitespace is encountered:
+
+ 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);
+ }
+ ...
+ void handler(const boost::system::error_code& e, std::size_t size);
+ ...
+ boost::asio::streambuf b;
+ boost::asio::async_read_until(s, b, match_whitespace, handler);
+
+
+
+
+To asynchronously 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
+ ...
+ void handler(const boost::system::error_code& e, std::size_t size);
+ ...
+ boost::asio::streambuf b;
+ boost::asio::async_read_until(s, b, match_char('a'), handler);
+
+
+
+
+
+[endsect]
+
+
[endsect]
[section:async_write async_write]
-Start an asynchronous operation to write of all of the supplied data to a stream.
-
+[indexterm1 async_write] Start an asynchronous operation to write a certain amount of data to a stream.
+
template<
typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
@@ -880,7 +1385,7 @@
[section:overload1 async_write (1 of 4 overloads)]
-Start an asynchronous operation to write of all of the supplied data to a stream.
+Start an asynchronous operation to write all of the supplied data to a stream.
template<
typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
@@ -921,7 +1426,6 @@
// this will be less than the sum
// of the buffer sizes.
);
-
``
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().]]
@@ -988,7 +1492,6 @@
std::size_t bytes_transferred // Number of bytes transferred
// so far.
);
-
``
A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's async\_write\_some function are required.]]
@@ -1002,7 +1505,6 @@
// this will be less than the sum
// of the buffer sizes.
);
-
``
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().]]
@@ -1030,7 +1532,7 @@
[section:overload3 async_write (3 of 4 overloads)]
-Start an asynchronous operation to write a certain amount of data to a stream.
+Start an asynchronous operation to write all of the supplied data to a stream.
template<
typename ``[link boost_asio.reference.AsyncWriteStream AsyncWriteStream]``,
@@ -1071,7 +1573,6 @@
// this will be less than the sum
// of the buffer sizes.
);
-
``
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(). ]]
@@ -1127,7 +1628,6 @@
std::size_t bytes_transferred // Number of bytes transferred
// so far.
);
-
``
A return value of true indicates that the write operation is complete. False indicates that further calls to the stream's async\_write\_some function are required.]]
@@ -1141,7 +1641,6 @@
// this will be less than the sum
// of the buffer sizes.
);
-
``
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(). ]]
@@ -1154,132 +1653,463 @@
[endsect]
-[section:basic_datagram_socket basic_datagram_socket]
+[section:async_write_at async_write_at]
-Provides datagram-oriented socket functionality.
+[indexterm1 async_write_at] Start an asynchronous operation to write a certain amount of data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.async_write_at.overload1 async_write_at]``(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.DatagramSocketService DatagramSocketService]`` = datagram_socket_service<Protocol>>
- class basic_datagram_socket :
- public basic_socket< Protocol, DatagramSocketService >
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.async_write_at.overload2 async_write_at]``(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ const ConstBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ WriteHandler handler);
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename Allocator,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.async_write_at.overload3 async_write_at]``(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ WriteHandler handler);
-[heading Types]
-[table
- [[Name][Description]]
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename Allocator,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.async_write_at.overload4 async_write_at]``(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
+ WriteHandler handler);
- [
- [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+[section:overload1 async_write_at (1 of 4 overloads)]
- [
+Start an asynchronous operation to write all of the supplied data at the specified offset.
- [[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. ]
-
- ]
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_at(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
- [
- [[link boost_asio.reference.basic_datagram_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
- [
- [[link boost_asio.reference.basic_datagram_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
+* 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.
- [[link boost_asio.reference.basic_datagram_socket.enable_connection_aborted [*enable_connection_aborted]]]
- [Socket option to report aborted connections on accept. ]
-
- ]
+This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
- [
- [[link boost_asio.reference.basic_datagram_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
+[heading Parameters]
+
+
+[variablelist
- ]
+[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
- [
+[[offset][The offset at which the data will be written.]]
- [[link boost_asio.reference.basic_datagram_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+[[buffers][One or more buffers containing the data to be written. 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(
+ // Result of operation.
+ const boost::system::error_code& error,
- [[link boost_asio.reference.basic_datagram_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
+ // Number of bytes written from the buffers. If an error
+ // occurred, this will be less than the sum of the buffer sizes.
+ std::size_t bytes_transferred
+ );
+``
+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().]]
- [
+]
- [[link boost_asio.reference.basic_datagram_socket.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
+[heading Example]
- ]
+To write a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
- [
+ boost::asio::async_write_at(d, 42, boost::asio::buffer(data, size), handler);
- [[link boost_asio.reference.basic_datagram_socket.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
- [
+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.
- [[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_datagram_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
-
- ]
+[endsect]
- [
- [[link boost_asio.reference.basic_datagram_socket.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
-
- ]
- [
+[section:overload2 async_write_at (2 of 4 overloads)]
- [[link boost_asio.reference.basic_datagram_socket.protocol_type [*protocol_type]]]
- [The protocol type. ]
-
- ]
+Start an asynchronous operation to write a certain amount of data at the specified offset.
- [
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_at(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ const ConstBufferSequence & buffers,
+ CompletionCondition completion_condition,
+ WriteHandler handler);
- [[link boost_asio.reference.basic_datagram_socket.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of a socket. ]
-
- ]
- [
+This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
- [[link boost_asio.reference.basic_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
+
+* 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.
+
+* The completion_condition function object returns true.
+
+This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
+
+[[offset][The offset at which the data will be written.]]
+
+[[buffers][One or more buffers containing the data to be written. 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.]]
+
+[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
+``
+ bool completion_condition(
+ // Result of latest write_some_at operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of true indicates that the write operation is complete. False indicates that further calls to the device's async\_write\_some\_at function are required.]]
+
+[[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(
+ // Result of operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes written from the buffers. If an error
+ // occurred, this will be less than the sum of the buffer sizes.
+ std::size_t bytes_transferred
+ );
+``
+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 write a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
+
+ boost::asio::async_write_at(d, 42,
+ boost::asio::buffer(data, size),
+ boost::asio::transfer_at_least(32),
+ 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:overload3 async_write_at (3 of 4 overloads)]
+
+Start an asynchronous operation to write all of the supplied data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename Allocator,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_at(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ WriteHandler handler);
+
+
+This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
+
+
+* All of the data in the supplied basic_streambuf has been written.
+
+* An error occurred.
+
+This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
+
+[[offset][The offset at which the data will be written.]]
+
+[[b][A basic\_streambuf object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains 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(
+ // Result of operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes written from the buffers. If an error
+ // occurred, this will be less than the sum of the buffer sizes.
+ std::size_t bytes_transferred
+ );
+``
+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(). ]]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:overload4 async_write_at (4 of 4 overloads)]
+
+Start an asynchronous operation to write a certain amount of data at the specified offset.
+
+ template<
+ typename ``[link boost_asio.reference.AsyncRandomAccessWriteDevice AsyncRandomAccessWriteDevice]``,
+ typename Allocator,
+ typename CompletionCondition,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_at(
+ AsyncRandomAccessWriteDevice & d,
+ boost::uint64_t offset,
+ basic_streambuf< Allocator > & b,
+ CompletionCondition completion_condition,
+ WriteHandler handler);
+
+
+This function is used to asynchronously write a certain number of bytes of data to a random access device at a specified offset. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true:
+
+
+* All of the data in the supplied basic_streambuf has been written.
+
+* The completion_condition function object returns true.
+
+This operation is implemented in terms of one or more calls to the device's async\_write\_some\_at function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[d][The device to which the data is to be written. The type must support the AsyncRandomAccessWriteDevice concept.]]
+
+[[offset][The offset at which the data will be written.]]
+
+[[b][A basic\_streambuf object from which data will be written. Ownership of the streambuf is retained by the caller, which must guarantee that it remains valid until the handler is called.]]
+
+[[completion_condition][The function object to be called to determine whether the write operation is complete. The signature of the function object must be:
+``
+ bool completion_condition(
+ // Result of latest async_write_some_at operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes transferred so far.
+ std::size_t bytes_transferred
+ );
+``
+A return value of true indicates that the write operation is complete. False indicates that further calls to the device's async\_write\_some\_at function are required.]]
+
+[[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(
+ // Result of operation.
+ const boost::system::error_code& error,
+
+ // Number of bytes written from the buffers. If an error
+ // occurred, this will be less than the sum of the buffer sizes.
+ std::size_t bytes_transferred
+ );
+``
+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(). ]]
+
+]
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:basic_datagram_socket basic_datagram_socket]
+
+Provides datagram-oriented socket functionality.
+
+ template<
+ typename ``[link boost_asio.reference.Protocol Protocol]``,
+ typename ``[link boost_asio.reference.DatagramSocketService DatagramSocketService]`` = datagram_socket_service<Protocol>>
+ class basic_datagram_socket :
+ public basic_socket< Protocol, DatagramSocketService >
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.basic_datagram_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
+
+ ]
+
+ [
+
+ [[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_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. ]
+
+ ]
+
+ [
+
+ [[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_datagram_socket.endpoint_type [*endpoint_type]]]
+ [The endpoint 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_datagram_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
+
+ [
+
+ [[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. ]
+
+ ]
+
+ [
+
+ [[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_datagram_socket.native_type [*native_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_datagram_socket.protocol_type [*protocol_type]]]
+ [The protocol type. ]
+
+ ]
+
+ [
+
+ [[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_datagram_socket.receive_low_watermark [*receive_low_watermark]]]
+ [Socket option for the receive low watermark. ]
+
+ ]
[
@@ -1495,6 +2325,22 @@
]
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_datagram_socket.implementation [*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. ]
+ ]
+
+]
+
The basic_datagram_socket class template provides asynchronous and blocking datagram-oriented socket functionality.
@@ -1507,7 +2353,7 @@
[section:assign basic_datagram_socket::assign]
-Assign an existing native socket to the socket.
+[indexterm2 assign..basic_datagram_socket] Assign an existing native socket to the socket.
void ``[link boost_asio.reference.basic_datagram_socket.assign.overload1 assign]``(
const protocol_type & protocol,
@@ -1561,7 +2407,7 @@
['Inherited from basic_socket.]
-Start an asynchronous connect.
+[indexterm2 async_connect..basic_datagram_socket] Start an asynchronous connect.
void async_connect(
const endpoint_type & peer_endpoint,
@@ -1570,7 +2416,7 @@
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 returned to the closed state.
+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]
@@ -1585,7 +2431,6 @@
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().]]
@@ -1620,7 +2465,7 @@
[section:async_receive basic_datagram_socket::async_receive]
-Start an asynchronous receive on a connected socket.
+[indexterm2 async_receive..basic_datagram_socket] Start an asynchronous receive on a connected socket.
template<
typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
@@ -1666,7 +2511,6 @@
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().]]
@@ -1724,7 +2568,6 @@
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().]]
@@ -1743,7 +2586,7 @@
[section:async_receive_from basic_datagram_socket::async_receive_from]
-Start an asynchronous receive.
+[indexterm2 async_receive_from..basic_datagram_socket] Start an asynchronous receive.
template<
typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
@@ -1794,7 +2637,6 @@
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().]]
@@ -1852,7 +2694,6 @@
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(). ]]
@@ -1867,7 +2708,7 @@
[section:async_send basic_datagram_socket::async_send]
-Start an asynchronous send on a connected socket.
+[indexterm2 async_send..basic_datagram_socket] Start an asynchronous send on a connected socket.
template<
typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
@@ -1913,7 +2754,6 @@
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().]]
@@ -1971,7 +2811,6 @@
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().]]
@@ -1990,7 +2829,7 @@
[section:async_send_to basic_datagram_socket::async_send_to]
-Start an asynchronous send.
+[indexterm2 async_send_to..basic_datagram_socket] Start an asynchronous send.
template<
typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
@@ -2041,7 +2880,6 @@
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().]]
@@ -2101,7 +2939,6 @@
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(). ]]
@@ -2116,7 +2953,7 @@
[section:at_mark basic_datagram_socket::at_mark]
-Determine whether the socket is at the out-of-band data mark.
+[indexterm2 at_mark..basic_datagram_socket] Determine whether the socket is at the out-of-band data mark.
bool ``[link boost_asio.reference.basic_datagram_socket.at_mark.overload1 at_mark]``() const;
@@ -2192,7 +3029,7 @@
[section:available basic_datagram_socket::available]
-Determine the number of bytes available for reading.
+[indexterm2 available..basic_datagram_socket] Determine the number of bytes available for reading.
std::size_t ``[link boost_asio.reference.basic_datagram_socket.available.overload1 available]``() const;
@@ -2268,7 +3105,7 @@
[section:basic_datagram_socket basic_datagram_socket::basic_datagram_socket]
-Construct a basic_datagram_socket without opening it.
+[indexterm2 basic_datagram_socket..basic_datagram_socket] Construct a basic_datagram_socket without opening it.
``[link boost_asio.reference.basic_datagram_socket.basic_datagram_socket.overload1 basic_datagram_socket]``(
boost::asio::io_service & io_service);
@@ -2433,7 +3270,7 @@
[section:bind basic_datagram_socket::bind]
-Bind the socket to the given local endpoint.
+[indexterm2 bind..basic_datagram_socket] Bind the socket to the given local endpoint.
void ``[link boost_asio.reference.basic_datagram_socket.bind.overload1 bind]``(
const endpoint_type & endpoint);
@@ -2549,7 +3386,7 @@
['Inherited from socket_base.]
-Socket option to permit sending of broadcast messages.
+[indexterm2 broadcast..basic_datagram_socket] Socket option to permit sending of broadcast messages.
typedef implementation_defined broadcast;
@@ -2592,7 +3429,7 @@
['Inherited from socket_base.]
-IO control command to get the amount of data that can be read without blocking.
+[indexterm2 bytes_readable..basic_datagram_socket] IO control command to get the amount of data that can be read without blocking.
typedef implementation_defined bytes_readable;
@@ -2621,7 +3458,7 @@
[section:cancel basic_datagram_socket::cancel]
-Cancel all asynchronous operations associated with the socket.
+[indexterm2 cancel..basic_datagram_socket] Cancel all asynchronous operations associated with the socket.
void ``[link boost_asio.reference.basic_datagram_socket.cancel.overload1 cancel]``();
@@ -2721,7 +3558,7 @@
[section:close basic_datagram_socket::close]
-Close the socket.
+[indexterm2 close..basic_datagram_socket] Close the socket.
void ``[link boost_asio.reference.basic_datagram_socket.close.overload1 close]``();
@@ -2813,7 +3650,7 @@
[section:connect basic_datagram_socket::connect]
-Connect the socket to the specified endpoint.
+[indexterm2 connect..basic_datagram_socket] Connect the socket to the specified endpoint.
void ``[link boost_asio.reference.basic_datagram_socket.connect.overload1 connect]``(
const endpoint_type & peer_endpoint);
@@ -2836,7 +3673,7 @@
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 returned to the closed state.
+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]
@@ -2889,7 +3726,7 @@
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 returned to the closed state.
+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]
@@ -2933,7 +3770,7 @@
['Inherited from socket_base.]
-Socket option to enable socket-level debugging.
+[indexterm2 debug..basic_datagram_socket] Socket option to enable socket-level debugging.
typedef implementation_defined debug;
@@ -2976,7 +3813,7 @@
['Inherited from socket_base.]
-Socket option to prevent routing, use local interfaces only.
+[indexterm2 do_not_route..basic_datagram_socket] Socket option to prevent routing, use local interfaces only.
typedef implementation_defined do_not_route;
@@ -3019,7 +3856,7 @@
['Inherited from socket_base.]
-Socket option to report aborted connections on accept.
+[indexterm2 enable_connection_aborted..basic_datagram_socket] Socket option to report aborted connections on accept.
typedef implementation_defined enable_connection_aborted;
@@ -3059,7 +3896,7 @@
[section:endpoint_type basic_datagram_socket::endpoint_type]
-The endpoint type.
+[indexterm2 endpoint_type..basic_datagram_socket] The endpoint type.
typedef Protocol::endpoint endpoint_type;
@@ -3075,7 +3912,7 @@
['Inherited from basic_io_object.]
-Get the io_service associated with the object.
+[indexterm2 get_io_service..basic_datagram_socket] Get the io_service associated with the object.
boost::asio::io_service & get_io_service();
@@ -3094,7 +3931,7 @@
[section:get_option basic_datagram_socket::get_option]
-Get an option from the socket.
+[indexterm2 get_option..basic_datagram_socket] Get an option from the socket.
void ``[link boost_asio.reference.basic_datagram_socket.get_option.overload1 get_option]``(
GettableSocketOption & option) const;
@@ -3207,12 +4044,27 @@
[endsect]
+[section:implementation basic_datagram_socket::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_datagram_socket] The underlying implementation of the I/O object.
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
[section:implementation_type basic_datagram_socket::implementation_type]
['Inherited from basic_io_object.]
-The underlying implementation type of I/O object.
+[indexterm2 implementation_type..basic_datagram_socket] The underlying implementation type of I/O object.
typedef service_type::implementation_type implementation_type;
@@ -3224,7 +4076,7 @@
[section:io_control basic_datagram_socket::io_control]
-Perform an IO control command on the socket.
+[indexterm2 io_control..basic_datagram_socket] Perform an IO control command on the socket.
void ``[link boost_asio.reference.basic_datagram_socket.io_control.overload1 io_control]``(
IoControlCommand & command);
@@ -3342,7 +4194,7 @@
['Inherited from basic_io_object.]
-(Deprecated: use get_io_service().) Get the io_service associated with the object.
+[indexterm2 io_service..basic_datagram_socket] (Deprecated: use get_io_service().) Get the io_service associated with the object.
boost::asio::io_service & io_service();
@@ -3365,7 +4217,7 @@
['Inherited from basic_socket.]
-Determine whether the socket is open.
+[indexterm2 is_open..basic_datagram_socket] Determine whether the socket is open.
bool is_open() const;
@@ -3380,7 +4232,7 @@
['Inherited from socket_base.]
-Socket option to send keep-alives.
+[indexterm2 keep_alive..basic_datagram_socket] Socket option to send keep-alives.
typedef implementation_defined keep_alive;
@@ -3423,7 +4275,7 @@
['Inherited from socket_base.]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+[indexterm2 linger..basic_datagram_socket] Socket option to specify whether the socket lingers on close if unsent data is present.
typedef implementation_defined linger;
@@ -3463,7 +4315,7 @@
[section:local_endpoint basic_datagram_socket::local_endpoint]
-Get the local endpoint of the socket.
+[indexterm2 local_endpoint..basic_datagram_socket] Get the local endpoint of the socket.
endpoint_type ``[link boost_asio.reference.basic_datagram_socket.local_endpoint.overload1 local_endpoint]``() const;
@@ -3570,7 +4422,7 @@
['Inherited from basic_socket.]
-Get a reference to the lowest layer.
+[indexterm2 lowest_layer..basic_datagram_socket] Get a reference to the lowest layer.
lowest_layer_type & lowest_layer();
@@ -3593,7 +4445,7 @@
['Inherited from basic_socket.]
-A basic_socket is always the lowest layer.
+[indexterm2 lowest_layer_type..basic_datagram_socket] A basic_socket is always the lowest layer.
typedef basic_socket< Protocol, DatagramSocketService > lowest_layer_type;
@@ -3862,6 +4714,17 @@
]
+[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 Data Members]
[table
[[Name][Description]]
@@ -3888,6 +4751,22 @@
]
+[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. ]
+ ]
+
+]
+
The basic_socket class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
@@ -3909,7 +4788,7 @@
['Inherited from socket_base.]
-The maximum length of the queue of pending incoming connections.
+[indexterm2 max_connections..basic_datagram_socket] The maximum length of the queue of pending incoming connections.
static const int max_connections = implementation_defined;
@@ -3924,7 +4803,7 @@
['Inherited from socket_base.]
-Specify that the data should not be subject to routing.
+[indexterm2 message_do_not_route..basic_datagram_socket] Specify that the data should not be subject to routing.
static const int message_do_not_route = implementation_defined;
@@ -3939,7 +4818,7 @@
['Inherited from socket_base.]
-Bitmask type for flags that can be passed to send and receive operations.
+[indexterm2 message_flags..basic_datagram_socket] Bitmask type for flags that can be passed to send and receive operations.
typedef int message_flags;
@@ -3955,7 +4834,7 @@
['Inherited from socket_base.]
-Process out-of-band data.
+[indexterm2 message_out_of_band..basic_datagram_socket] Process out-of-band data.
static const int message_out_of_band = implementation_defined;
@@ -3970,7 +4849,7 @@
['Inherited from socket_base.]
-Peek at incoming data without removing it from the input queue.
+[indexterm2 message_peek..basic_datagram_socket] Peek at incoming data without removing it from the input queue.
static const int message_peek = implementation_defined;
@@ -3985,7 +4864,7 @@
['Inherited from basic_socket.]
-Get the native socket representation.
+[indexterm2 native..basic_datagram_socket] Get the native socket representation.
native_type native();
@@ -3999,7 +4878,7 @@
[section:native_type basic_datagram_socket::native_type]
-The native representation of a socket.
+[indexterm2 native_type..basic_datagram_socket] The native representation of a socket.
typedef DatagramSocketService::native_type native_type;
@@ -4015,7 +4894,7 @@
['Inherited from socket_base.]
-IO control command to set the blocking mode of the socket.
+[indexterm2 non_blocking_io..basic_datagram_socket] IO control command to set the blocking mode of the socket.
typedef implementation_defined non_blocking_io;
@@ -4043,7 +4922,7 @@
[section:open basic_datagram_socket::open]
-Open the socket using the specified protocol.
+[indexterm2 open..basic_datagram_socket] Open the socket using the specified protocol.
void ``[link boost_asio.reference.basic_datagram_socket.open.overload1 open]``(
const protocol_type & protocol = protocol_type());
@@ -4152,7 +5031,7 @@
[section:protocol_type basic_datagram_socket::protocol_type]
-The protocol type.
+[indexterm2 protocol_type..basic_datagram_socket] The protocol type.
typedef Protocol protocol_type;
@@ -4164,7 +5043,7 @@
[section:receive basic_datagram_socket::receive]
-Receive some data on a connected socket.
+[indexterm2 receive..basic_datagram_socket] Receive some data on a connected socket.
template<
typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
@@ -4338,7 +5217,7 @@
['Inherited from socket_base.]
-Socket option for the receive buffer size of a socket.
+[indexterm2 receive_buffer_size..basic_datagram_socket] Socket option for the receive buffer size of a socket.
typedef implementation_defined receive_buffer_size;
@@ -4377,7 +5256,7 @@
[section:receive_from basic_datagram_socket::receive_from]
-Receive a datagram with the endpoint of the sender.
+[indexterm2 receive_from..basic_datagram_socket] Receive a datagram with the endpoint of the sender.
template<
typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
@@ -4553,7 +5432,7 @@
['Inherited from socket_base.]
-Socket option for the receive low watermark.
+[indexterm2 receive_low_watermark..basic_datagram_socket] Socket option for the receive low watermark.
typedef implementation_defined receive_low_watermark;
@@ -4592,7 +5471,7 @@
[section:remote_endpoint basic_datagram_socket::remote_endpoint]
-Get the remote endpoint of the socket.
+[indexterm2 remote_endpoint..basic_datagram_socket] Get the remote endpoint of the socket.
endpoint_type ``[link boost_asio.reference.basic_datagram_socket.remote_endpoint.overload1 remote_endpoint]``() const;
@@ -4699,7 +5578,7 @@
['Inherited from socket_base.]
-Socket option to allow the socket to be bound to an address that is already in use.
+[indexterm2 reuse_address..basic_datagram_socket] Socket option to allow the socket to be bound to an address that is already in use.
typedef implementation_defined reuse_address;
@@ -4738,7 +5617,7 @@
[section:send basic_datagram_socket::send]
-Send some data on a connected socket.
+[indexterm2 send..basic_datagram_socket] Send some data on a connected socket.
template<
typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
@@ -4912,7 +5791,7 @@
['Inherited from socket_base.]
-Socket option for the send buffer size of a socket.
+[indexterm2 send_buffer_size..basic_datagram_socket] Socket option for the send buffer size of a socket.
typedef implementation_defined send_buffer_size;
@@ -4955,7 +5834,7 @@
['Inherited from socket_base.]
-Socket option for the send low watermark.
+[indexterm2 send_low_watermark..basic_datagram_socket] Socket option for the send low watermark.
typedef implementation_defined send_low_watermark;
@@ -4994,7 +5873,7 @@
[section:send_to basic_datagram_socket::send_to]
-Send a datagram to the specified endpoint.
+[indexterm2 send_to..basic_datagram_socket] Send a datagram to the specified endpoint.
template<
typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
@@ -5165,12 +6044,27 @@
[endsect]
+[section:service basic_datagram_socket::service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_datagram_socket] The service associated with the I/O object.
+
+ service_type & service;
+
+
+
+[endsect]
+
+
+
[section:service_type basic_datagram_socket::service_type]
['Inherited from basic_io_object.]
-The type of the service that will be used to provide I/O operations.
+[indexterm2 service_type..basic_datagram_socket] The type of the service that will be used to provide I/O operations.
typedef DatagramSocketService service_type;
@@ -5182,7 +6076,7 @@
[section:set_option basic_datagram_socket::set_option]
-Set an option on the socket.
+[indexterm2 set_option..basic_datagram_socket] Set an option on the socket.
void ``[link boost_asio.reference.basic_datagram_socket.set_option.overload1 set_option]``(
const SettableSocketOption & option);
@@ -5294,7 +6188,7 @@
[section:shutdown basic_datagram_socket::shutdown]
-Disable sends or receives on the socket.
+[indexterm2 shutdown..basic_datagram_socket] Disable sends or receives on the socket.
void ``[link boost_asio.reference.basic_datagram_socket.shutdown.overload1 shutdown]``(
shutdown_type what);
@@ -5408,7 +6302,7 @@
['Inherited from socket_base.]
-Different ways a socket may be shutdown.
+[indexterm2 shutdown_type..basic_datagram_socket] Different ways a socket may be shutdown.
enum shutdown_type
@@ -5539,6 +6433,22 @@
]
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[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. ]
+ ]
+
+]
+
The basic_deadline_timer class template provides the ability to perform a blocking or asynchronous wait for a timer to expire.
Most applications will use the boost::asio::deadline\_timer typedef.
@@ -5629,7 +6539,7 @@
[section:async_wait basic_deadline_timer::async_wait]
-Start an asynchronous wait on the timer.
+[indexterm2 async_wait..basic_deadline_timer] Start an asynchronous wait on the timer.
template<
typename ``[link boost_asio.reference.WaitHandler WaitHandler]``>
@@ -5656,7 +6566,6 @@
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(). ]]
@@ -5669,7 +6578,7 @@
[section:basic_deadline_timer basic_deadline_timer::basic_deadline_timer]
-Constructor.
+[indexterm2 basic_deadline_timer..basic_deadline_timer] Constructor.
``[link boost_asio.reference.basic_deadline_timer.basic_deadline_timer.overload1 basic_deadline_timer]``(
boost::asio::io_service & io_service);
@@ -5770,7 +6679,7 @@
[section:cancel basic_deadline_timer::cancel]
-Cancel any asynchronous operations that are waiting on the timer.
+[indexterm2 cancel..basic_deadline_timer] Cancel any asynchronous operations that are waiting on the timer.
std::size_t ``[link boost_asio.reference.basic_deadline_timer.cancel.overload1 cancel]``();
@@ -5845,7 +6754,7 @@
[section:duration_type basic_deadline_timer::duration_type]
-The duration type.
+[indexterm2 duration_type..basic_deadline_timer] The duration type.
typedef traits_type::duration_type duration_type;
@@ -5857,7 +6766,7 @@
[section:expires_at basic_deadline_timer::expires_at]
-Get the timer's expiry time as an absolute time.
+[indexterm2 expires_at..basic_deadline_timer] Get the timer's expiry time as an absolute time.
time_type ``[link boost_asio.reference.basic_deadline_timer.expires_at.overload1 expires_at]``() const;
@@ -5958,7 +6867,7 @@
[section:expires_from_now basic_deadline_timer::expires_from_now]
-Get the timer's expiry time relative to now.
+[indexterm2 expires_from_now..basic_deadline_timer] Get the timer's expiry time relative to now.
duration_type ``[link boost_asio.reference.basic_deadline_timer.expires_from_now.overload1 expires_from_now]``() const;
@@ -6063,7 +6972,7 @@
['Inherited from basic_io_object.]
-Get the io_service associated with the object.
+[indexterm2 get_io_service..basic_deadline_timer] Get the io_service associated with the object.
boost::asio::io_service & get_io_service();
@@ -6081,12 +6990,27 @@
+[section:implementation basic_deadline_timer::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_deadline_timer] The underlying implementation of the I/O object.
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
[section:implementation_type basic_deadline_timer::implementation_type]
['Inherited from basic_io_object.]
-The underlying implementation type of I/O object.
+[indexterm2 implementation_type..basic_deadline_timer] The underlying implementation type of I/O object.
typedef service_type::implementation_type implementation_type;
@@ -6102,7 +7026,7 @@
['Inherited from basic_io_object.]
-(Deprecated: use get_io_service().) Get the io_service associated with the object.
+[indexterm2 io_service..basic_deadline_timer] (Deprecated: use get_io_service().) Get the io_service associated with the object.
boost::asio::io_service & io_service();
@@ -6120,12 +7044,27 @@
+[section:service basic_deadline_timer::service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_deadline_timer] The service associated with the I/O object.
+
+ service_type & service;
+
+
+
+[endsect]
+
+
+
[section:service_type basic_deadline_timer::service_type]
['Inherited from basic_io_object.]
-The type of the service that will be used to provide I/O operations.
+[indexterm2 service_type..basic_deadline_timer] The type of the service that will be used to provide I/O operations.
typedef TimerService service_type;
@@ -6138,7 +7077,7 @@
[section:time_type basic_deadline_timer::time_type]
-The time type.
+[indexterm2 time_type..basic_deadline_timer] The time type.
typedef traits_type::time_type time_type;
@@ -6151,7 +7090,7 @@
[section:traits_type basic_deadline_timer::traits_type]
-The time traits type.
+[indexterm2 traits_type..basic_deadline_timer] The time traits type.
typedef TimeTraits traits_type;
@@ -6163,7 +7102,7 @@
[section:wait basic_deadline_timer::wait]
-Perform a blocking wait on the timer.
+[indexterm2 wait..basic_deadline_timer] Perform a blocking wait on the timer.
void ``[link boost_asio.reference.basic_deadline_timer.wait.overload1 wait]``();
@@ -6272,10 +7211,62 @@
]
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_io_object.basic_io_object [*basic_io_object]]]
+ [Construct a basic_io_object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_io_object._basic_io_object [*~basic_io_object]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_io_object.implementation [*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. ]
+ ]
+
+]
+
+
+[section:basic_io_object basic_io_object::basic_io_object]
+
+[indexterm2 basic_io_object..basic_io_object] Construct a basic_io_object.
+
+ basic_io_object(
+ boost::asio::io_service & io_service);
+
+
+Performs:
+
+ service.construct(implementation);
+
+
+
+
+
+[endsect]
+
+
[section:get_io_service basic_io_object::get_io_service]
-Get the io_service associated with the object.
+[indexterm2 get_io_service..basic_io_object] Get the io_service associated with the object.
boost::asio::io_service & get_io_service();
@@ -6293,9 +7284,21 @@
+[section:implementation basic_io_object::implementation]
+
+[indexterm2 implementation..basic_io_object] The underlying implementation of the I/O object.
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
[section:implementation_type basic_io_object::implementation_type]
-The underlying implementation type of I/O object.
+[indexterm2 implementation_type..basic_io_object] The underlying implementation type of I/O object.
typedef service_type::implementation_type implementation_type;
@@ -6308,7 +7311,7 @@
[section:io_service basic_io_object::io_service]
-(Deprecated: use get_io_service().) Get the io_service associated with the object.
+[indexterm2 io_service..basic_io_object] (Deprecated: use get_io_service().) Get the io_service associated with the object.
boost::asio::io_service & io_service();
@@ -6326,9 +7329,21 @@
+[section:service basic_io_object::service]
+
+[indexterm2 service..basic_io_object] The service associated with the I/O object.
+
+ service_type & service;
+
+
+
+[endsect]
+
+
+
[section:service_type basic_io_object::service_type]
-The type of the service that will be used to provide I/O operations.
+[indexterm2 service_type..basic_io_object] The type of the service that will be used to provide I/O operations.
typedef IoObjectService service_type;
@@ -6339,18 +7354,36 @@
+[section:_basic_io_object basic_io_object::~basic_io_object]
+
+[indexterm2 ~basic_io_object..basic_io_object] Protected destructor to prevent deletion through this type.
+
+ ~basic_io_object();
+
+
+Performs:
+
+ service.destroy(implementation);
+
+
+
+
+
+[endsect]
+
+
+
[endsect]
-[section:basic_socket basic_socket]
+[section:basic_raw_socket basic_raw_socket]
-Provides socket functionality.
+Provides raw-oriented socket functionality.
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
+ typename ``[link boost_asio.reference.RawSocketService RawSocketService]`` = raw_socket_service<Protocol>>
+ class basic_raw_socket :
+ public basic_socket< Protocol, RawSocketService >
[heading Types]
@@ -6359,147 +7392,147 @@
[
- [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
+ [[link boost_asio.reference.basic_raw_socket.broadcast [*broadcast]]]
[Socket option to permit sending of broadcast messages. ]
]
[
- [[link boost_asio.reference.basic_socket.bytes_readable [*bytes_readable]]]
+ [[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.basic_socket.debug [*debug]]]
+ [[link boost_asio.reference.basic_raw_socket.debug [*debug]]]
[Socket option to enable socket-level debugging. ]
]
[
- [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
+ [[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_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [[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.basic_socket.endpoint_type [*endpoint_type]]]
+ [[link boost_asio.reference.basic_raw_socket.endpoint_type [*endpoint_type]]]
[The endpoint type. ]
]
[
- [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
+ [[link boost_asio.reference.basic_raw_socket.implementation_type [*implementation_type]]]
[The underlying implementation type of I/O object. ]
]
[
- [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
+ [[link boost_asio.reference.basic_raw_socket.keep_alive [*keep_alive]]]
[Socket option to send keep-alives. ]
]
[
- [[link boost_asio.reference.basic_socket.linger [*linger]]]
+ [[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_socket.lowest_layer_type [*lowest_layer_type]]]
+ [[link boost_asio.reference.basic_raw_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]]]
+ [[link boost_asio.reference.basic_raw_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_type [*native_type]]]
+ [[link boost_asio.reference.basic_raw_socket.native_type [*native_type]]]
[The native representation of a socket. ]
]
[
- [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
+ [[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_socket.protocol_type [*protocol_type]]]
+ [[link boost_asio.reference.basic_raw_socket.protocol_type [*protocol_type]]]
[The protocol type. ]
]
[
- [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
+ [[link boost_asio.reference.basic_raw_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]]]
+ [[link boost_asio.reference.basic_raw_socket.receive_low_watermark [*receive_low_watermark]]]
[Socket option for the receive low watermark. ]
]
[
- [[link boost_asio.reference.basic_socket.reuse_address [*reuse_address]]]
+ [[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. ]
]
[
- [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
+ [[link boost_asio.reference.basic_raw_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]]]
+ [[link boost_asio.reference.basic_raw_socket.send_low_watermark [*send_low_watermark]]]
[Socket option for the send low watermark. ]
]
[
- [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
+ [[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. ]
]
[
- [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
+ [[link boost_asio.reference.basic_raw_socket.shutdown_type [*shutdown_type]]]
[Different ways a socket may be shutdown. ]
]
@@ -6511,107 +7544,147 @@
[[Name][Description]]
[
- [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [[link boost_asio.reference.basic_raw_socket.assign [*assign]]]
[Assign an existing native socket to the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [[link boost_asio.reference.basic_raw_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_raw_socket.async_receive [*async_receive]]]
+ [Start an asynchronous receive on a connected socket. ]
]
[
- [[link boost_asio.reference.basic_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
+ [[link boost_asio.reference.basic_raw_socket.async_receive_from [*async_receive_from]]]
+ [Start an asynchronous receive. ]
]
[
- [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
- [Construct a basic_socket without opening it. ]
+ [[link boost_asio.reference.basic_raw_socket.async_send [*async_send]]]
+ [Start an asynchronous send on a connected socket. ]
]
[
- [[link boost_asio.reference.basic_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
+ [[link boost_asio.reference.basic_raw_socket.async_send_to [*async_send_to]]]
+ [Start an asynchronous send. ]
]
[
- [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
+ [[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_socket.close [*close]]]
+ [[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. ]
+ ]
+
+ [
+ [[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_socket.connect [*connect]]]
+ [[link boost_asio.reference.basic_raw_socket.connect [*connect]]]
[Connect the socket to the specified endpoint. ]
]
[
- [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
+ [[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_socket.get_option [*get_option]]]
+ [[link boost_asio.reference.basic_raw_socket.get_option [*get_option]]]
[Get an option from the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
+ [[link boost_asio.reference.basic_raw_socket.io_control [*io_control]]]
[Perform an IO control command on the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.io_service [*io_service]]]
+ [[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_socket.is_open [*is_open]]]
+ [[link boost_asio.reference.basic_raw_socket.is_open [*is_open]]]
[Determine whether the socket is open. ]
]
[
- [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
+ [[link boost_asio.reference.basic_raw_socket.local_endpoint [*local_endpoint]]]
[Get the local endpoint of the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
+ [[link boost_asio.reference.basic_raw_socket.lowest_layer [*lowest_layer]]]
[Get a reference to the lowest layer. ]
]
[
- [[link boost_asio.reference.basic_socket.native [*native]]]
+ [[link boost_asio.reference.basic_raw_socket.native [*native]]]
[Get the native socket representation. ]
]
[
- [[link boost_asio.reference.basic_socket.open [*open]]]
+ [[link boost_asio.reference.basic_raw_socket.open [*open]]]
[Open the socket using the specified protocol. ]
]
[
- [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
+ [[link boost_asio.reference.basic_raw_socket.receive [*receive]]]
+ [Receive some data on a connected socket. ]
+ ]
+
+ [
+ [[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. ]
]
[
- [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
+ [[link boost_asio.reference.basic_raw_socket.send [*send]]]
+ [Send some data on a connected socket. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.send_to [*send_to]]]
+ [Send raw data to the specified endpoint. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.set_option [*set_option]]]
[Set an option on the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
+ [[link boost_asio.reference.basic_raw_socket.shutdown [*shutdown]]]
[Disable sends or receives on the socket. ]
]
@@ -6622,28 +7695,44 @@
[[Name][Description]]
[
- [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
+ [[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.basic_socket.message_do_not_route [*message_do_not_route]]]
+ [[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.basic_socket.message_out_of_band [*message_out_of_band]]]
+ [[link boost_asio.reference.basic_raw_socket.message_out_of_band [*message_out_of_band]]]
[Process out-of-band data. ]
]
[
- [[link boost_asio.reference.basic_socket.message_peek [*message_peek]]]
+ [[link boost_asio.reference.basic_raw_socket.message_peek [*message_peek]]]
[Peek at incoming data without removing it from the input queue. ]
]
]
-The basic_socket class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_raw_socket.implementation [*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. ]
+ ]
+
+]
+
+The basic_raw_socket class template provides asynchronous and blocking raw-oriented socket functionality.
[heading Thread Safety]
@@ -6653,21 +7742,24 @@
[*Shared] [*objects:] Unsafe.
-[section:assign basic_socket::assign]
+[section:assign basic_raw_socket::assign]
-Assign an existing native socket to the socket.
+[indexterm2 assign..basic_raw_socket] Assign an existing native socket to the socket.
- void ``[link boost_asio.reference.basic_socket.assign.overload1 assign]``(
+ void ``[link boost_asio.reference.basic_raw_socket.assign.overload1 assign]``(
const protocol_type & protocol,
const native_type & native_socket);
- boost::system::error_code ``[link boost_asio.reference.basic_socket.assign.overload2 assign]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.assign.overload2 assign]``(
const protocol_type & protocol,
const native_type & native_socket,
boost::system::error_code & ec);
-[section:overload1 basic_socket::assign (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::assign (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Assign an existing native socket to the socket.
@@ -6681,7 +7773,10 @@
-[section:overload2 basic_socket::assign (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::assign (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Assign an existing native socket to the socket.
@@ -6698,12 +7793,13 @@
[endsect]
-[section:async_connect basic_socket::async_connect]
+[section:async_connect basic_raw_socket::async_connect]
-Start an asynchronous connect.
- template<
- typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+['Inherited from basic_socket.]
+
+[indexterm2 async_connect..basic_raw_socket] Start an asynchronous connect.
+
void async_connect(
const endpoint_type & peer_endpoint,
ConnectHandler handler);
@@ -6711,7 +7807,7 @@
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 returned to the closed state.
+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]
@@ -6726,7 +7822,6 @@
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().]]
@@ -6759,54 +7854,94 @@
[endsect]
-[section:at_mark basic_socket::at_mark]
-
-Determine whether the socket is at the out-of-band data mark.
+[section:async_receive basic_raw_socket::async_receive]
- bool ``[link boost_asio.reference.basic_socket.at_mark.overload1 at_mark]``() const;
+[indexterm2 async_receive..basic_raw_socket] Start an asynchronous receive on a connected socket.
- bool ``[link boost_asio.reference.basic_socket.at_mark.overload2 at_mark]``(
- boost::system::error_code & ec) const;
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_receive.overload1 async_receive]``(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_receive.overload2 async_receive]``(
+ const MutableBufferSequence & buffers,
+ socket_base::message_flags flags,
+ ReadHandler handler);
-[section:overload1 basic_socket::at_mark (1 of 2 overloads)]
-Determine whether the socket is at the out-of-band data mark.
+[section:overload1 basic_raw_socket::async_receive (1 of 2 overloads)]
- bool at_mark() const;
+Start an asynchronous receive on a connected socket.
+ 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 check whether the socket input is currently positioned at the out-of-band data mark.
+This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
-[heading Exceptions]
+[heading Parameters]
[variablelist
-[[boost::system::system_error][Thrown on failure. ]]
+[[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 async\_receive operation can only be used with a connected socket. Use the async\_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.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_socket::at_mark (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::async_receive (2 of 2 overloads)]
-Determine whether the socket is at the out-of-band data mark.
+Start an asynchronous receive on a connected socket.
- bool at_mark(
- boost::system::error_code & ec) const;
+ 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 check whether the socket input is currently positioned at the out-of-band data mark.
+This function is used to asynchronously receive data from the raw socket. The function call always returns immediately.
[heading Parameters]
@@ -6814,13 +7949,24 @@
[variablelist
-[[ec][Set to indicate what error occurred, if any.]]
+[[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 Return Value]
+[heading Remarks]
-A bool indicating whether the socket is at the out-of-band data mark.
+The async\_receive operation can only be used with a connected socket. Use the async\_receive\_from function to receive data on an unconnected raw socket.
@@ -6829,54 +7975,97 @@
[endsect]
-[section:available basic_socket::available]
-
-Determine the number of bytes available for reading.
+[section:async_receive_from basic_raw_socket::async_receive_from]
- std::size_t ``[link boost_asio.reference.basic_socket.available.overload1 available]``() const;
+[indexterm2 async_receive_from..basic_raw_socket] Start an asynchronous receive.
- std::size_t ``[link boost_asio.reference.basic_socket.available.overload2 available]``(
- boost::system::error_code & ec) const;
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_receive_from.overload1 async_receive_from]``(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ ReadHandler handler);
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_receive_from.overload2 async_receive_from]``(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
+ ReadHandler handler);
-[section:overload1 basic_socket::available (1 of 2 overloads)]
-Determine the number of bytes available for reading.
+[section:overload1 basic_raw_socket::async_receive_from (1 of 2 overloads)]
- std::size_t available() const;
+Start an asynchronous receive.
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive_from(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ ReadHandler handler);
-This function is used to determine the number of bytes that may be read without blocking.
+This function is used to asynchronously receive raw data. The function call always returns immediately.
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
-[heading Exceptions]
+[heading Parameters]
[variablelist
-[[boost::system::system_error][Thrown on failure. ]]
+[[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.]]
+
+[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data. Ownership of the sender\_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 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 Example]
+
+To receive into a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
+
+ socket.async_receive_from(
+ boost::asio::buffer(data, size), 0, sender_endpoint, 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_socket::available (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::async_receive_from (2 of 2 overloads)]
-Determine the number of bytes available for reading.
+Start an asynchronous receive.
- std::size_t available(
- boost::system::error_code & ec) const;
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_receive_from(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
+ ReadHandler handler);
-This function is used to determine the number of bytes that may be read without blocking.
+This function is used to asynchronously receive raw data. The function call always returns immediately.
[heading Parameters]
@@ -6884,51 +8073,63 @@
[variablelist
-[[ec][Set to indicate what error occurred, if any.]]
+[[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.]]
-]
+[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data. Ownership of the sender\_endpoint object is retained by the caller, which must guarantee that it is valid until the handler is called.]]
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
+[[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(). ]]
+]
-[endsect]
[endsect]
-[section:basic_socket basic_socket::basic_socket]
-Construct a basic_socket without opening it.
+[endsect]
- ``[link boost_asio.reference.basic_socket.basic_socket.overload1 basic_socket]``(
- boost::asio::io_service & io_service);
+[section:async_send basic_raw_socket::async_send]
- ``[link boost_asio.reference.basic_socket.basic_socket.overload2 basic_socket]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
+[indexterm2 async_send..basic_raw_socket] Start an asynchronous send on a connected socket.
- ``[link boost_asio.reference.basic_socket.basic_socket.overload3 basic_socket]``(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint);
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_send.overload1 async_send]``(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
- ``[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);
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_send.overload2 async_send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
+ WriteHandler handler);
-[section:overload1 basic_socket::basic_socket (1 of 4 overloads)]
+[section:overload1 basic_raw_socket::async_send (1 of 2 overloads)]
-Construct a basic_socket without opening it.
+Start an asynchronous send on a connected socket.
- basic_socket(
- boost::asio::io_service & io_service);
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
-This constructor creates a socket without opening it.
+This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
[heading Parameters]
@@ -6936,26 +8137,54 @@
[variablelist
-[[io_service][The io\_service object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]]
+[[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 async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected raw socket.
+
+[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_socket::basic_socket (2 of 4 overloads)]
+[section:overload2 basic_raw_socket::async_send (2 of 2 overloads)]
-Construct and open a basic_socket.
+Start an asynchronous send on a connected socket.
- basic_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
+ 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 socket.
+This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
[heading Parameters]
@@ -6963,37 +8192,68 @@
[variablelist
-[[io_service][The io\_service object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+[[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.]]
-[[protocol][An object specifying protocol parameters to be used.]]
+[[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 Exceptions]
-
+[heading Remarks]
+
+The async\_send operation can only be used with a connected socket. Use the async\_send\_to function to send data on an unconnected raw socket.
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
-]
+[endsect]
[endsect]
+[section:async_send_to basic_raw_socket::async_send_to]
+[indexterm2 async_send_to..basic_raw_socket] Start an asynchronous send.
-[section:overload3 basic_socket::basic_socket (3 of 4 overloads)]
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_send_to.overload1 async_send_to]``(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ WriteHandler handler);
-Construct a basic_socket, opening it and binding it to the given local endpoint.
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void ``[link boost_asio.reference.basic_raw_socket.async_send_to.overload2 async_send_to]``(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
+ WriteHandler handler);
- basic_socket(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint);
+[section:overload1 basic_raw_socket::async_send_to (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_to(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ WriteHandler handler);
-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.
+
+This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
[heading Parameters]
@@ -7001,20 +8261,34 @@
[variablelist
-[[io_service][The io\_service object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+[[buffers][One or more data buffers to be sent to the remote endpoint. 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.]]
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
-]
+[[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 Exceptions]
-
+]
-[variablelist
+[heading Example]
-[[boost::system::system_error][Thrown on failure. ]]
+To send a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
+
+ boost::asio::ip::udp::endpoint destination(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.async_send_to(
+ boost::asio::buffer(data, size), destination, 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.
@@ -7022,17 +8296,21 @@
-[section:overload4 basic_socket::basic_socket (4 of 4 overloads)]
+[section:overload2 basic_raw_socket::async_send_to (2 of 2 overloads)]
-Construct a basic_socket on an existing native socket.
+Start an asynchronous send.
- basic_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_socket);
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_send_to(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
+ WriteHandler handler);
-This constructor creates a socket object to hold an existing native socket.
+This function is used to asynchronously send raw data to the specified remote endpoint. The function call always returns immediately.
[heading Parameters]
@@ -7040,20 +8318,20 @@
[variablelist
-[[io_service][The 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.]]
+[[buffers][One or more data buffers to be sent to the remote endpoint. 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.]]
-[heading Exceptions]
-
+[[destination][The remote endpoint to which the data will be sent. Copies will be made of the endpoint as required.]]
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+[[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(). ]]
]
@@ -7064,75 +8342,60 @@
[endsect]
-[section:bind basic_socket::bind]
+[section:at_mark basic_raw_socket::at_mark]
-Bind the socket to the given local endpoint.
+[indexterm2 at_mark..basic_raw_socket] Determine whether the socket is at the out-of-band data mark.
- void ``[link boost_asio.reference.basic_socket.bind.overload1 bind]``(
- const endpoint_type & endpoint);
+ bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload1 at_mark]``() const;
- boost::system::error_code ``[link boost_asio.reference.basic_socket.bind.overload2 bind]``(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+ bool ``[link boost_asio.reference.basic_raw_socket.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
-[section:overload1 basic_socket::bind (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::at_mark (1 of 2 overloads)]
-Bind the socket to the given local endpoint.
- void bind(
- const endpoint_type & endpoint);
+['Inherited from basic_socket.]
+Determine whether the socket is at the out-of-band data mark.
-This function binds the socket to the specified endpoint on the local machine.
+ 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
-
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
-]
+[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.]]
+[[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]
-[endsect]
+[section:overload2 basic_raw_socket::at_mark (2 of 2 overloads)]
-[section:overload2 basic_socket::bind (2 of 2 overloads)]
+['Inherited from basic_socket.]
-Bind the socket to the given local endpoint.
+Determine whether the socket is at the out-of-band data mark.
- boost::system::error_code bind(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+ bool at_mark(
+ boost::system::error_code & ec) const;
-This function binds the socket to the specified endpoint on the local machine.
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
[heading Parameters]
@@ -7140,17 +8403,355 @@
[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]
-
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
- boost::asio::ip::tcp::socket socket(io_service);
+
+[endsect]
+
+
+[endsect]
+
+[section:available basic_raw_socket::available]
+
+[indexterm2 available..basic_raw_socket] Determine the number of bytes available for reading.
+
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload1 available]``() const;
+
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.available.overload2 available]``(
+ boost::system::error_code & ec) const;
+
+
+[section:overload1 basic_raw_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_raw_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_raw_socket basic_raw_socket::basic_raw_socket]
+
+[indexterm2 basic_raw_socket..basic_raw_socket] Construct a basic_raw_socket without opening it.
+
+ ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload1 basic_raw_socket]``(
+ boost::asio::io_service & io_service);
+
+ ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload2 basic_raw_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+
+ ``[link boost_asio.reference.basic_raw_socket.basic_raw_socket.overload3 basic_raw_socket]``(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
+
+ ``[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);
+
+
+[section:overload1 basic_raw_socket::basic_raw_socket (1 of 4 overloads)]
+
+Construct a basic_raw_socket without opening it.
+
+ basic_raw_socket(
+ boost::asio::io_service & io_service);
+
+
+This constructor creates a raw socket without opening it. The open() function must be called before data can be sent or received on the socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The io\_service object that the raw socket will use to dispatch handlers for any asynchronous operations performed on the socket. ]]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:overload2 basic_raw_socket::basic_raw_socket (2 of 4 overloads)]
+
+Construct and open a basic_raw_socket.
+
+ basic_raw_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+
+
+This constructor creates and opens a raw socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The io\_service object that the raw 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_raw_socket::basic_raw_socket (3 of 4 overloads)]
+
+Construct a basic_raw_socket, opening it and binding it to the given local endpoint.
+
+ basic_raw_socket(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
+
+
+This constructor creates a raw 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 io\_service object that the raw socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+
+[[endpoint][An endpoint on the local machine to which the raw socket will be bound.]]
+
+]
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:overload4 basic_raw_socket::basic_raw_socket (4 of 4 overloads)]
+
+Construct a basic_raw_socket on an existing native socket.
+
+ basic_raw_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_type & native_socket);
+
+
+This constructor creates a raw socket object to hold an existing native socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The io\_service object that the raw 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]
+
+
+[endsect]
+
+[section:bind basic_raw_socket::bind]
+
+[indexterm2 bind..basic_raw_socket] Bind the socket to the given local endpoint.
+
+ void ``[link boost_asio.reference.basic_raw_socket.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+
+
+[section:overload1 basic_raw_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_raw_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(
@@ -7171,12 +8772,12 @@
[endsect]
-[section:broadcast basic_socket::broadcast]
+[section:broadcast basic_raw_socket::broadcast]
['Inherited from socket_base.]
-Socket option to permit sending of broadcast messages.
+[indexterm2 broadcast..basic_raw_socket] Socket option to permit sending of broadcast messages.
typedef implementation_defined broadcast;
@@ -7214,12 +8815,12 @@
-[section:bytes_readable basic_socket::bytes_readable]
+[section:bytes_readable basic_raw_socket::bytes_readable]
['Inherited from socket_base.]
-IO control command to get the amount of data that can be read without blocking.
+[indexterm2 bytes_readable..basic_raw_socket] IO control command to get the amount of data that can be read without blocking.
typedef implementation_defined bytes_readable;
@@ -7246,17 +8847,20 @@
[endsect]
-[section:cancel basic_socket::cancel]
+[section:cancel basic_raw_socket::cancel]
-Cancel all asynchronous operations associated with the socket.
+[indexterm2 cancel..basic_raw_socket] Cancel all asynchronous operations associated with the socket.
- void ``[link boost_asio.reference.basic_socket.cancel.overload1 cancel]``();
+ void ``[link boost_asio.reference.basic_raw_socket.cancel.overload1 cancel]``();
- boost::system::error_code ``[link boost_asio.reference.basic_socket.cancel.overload2 cancel]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.cancel.overload2 cancel]``(
boost::system::error_code & ec);
-[section:overload1 basic_socket::cancel (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::cancel (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Cancel all asynchronous operations associated with the socket.
@@ -7297,7 +8901,10 @@
-[section:overload2 basic_socket::cancel (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::cancel (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Cancel all asynchronous operations associated with the socket.
@@ -7340,17 +8947,20 @@
[endsect]
-[section:close basic_socket::close]
+[section:close basic_raw_socket::close]
-Close the socket.
+[indexterm2 close..basic_raw_socket] Close the socket.
- void ``[link boost_asio.reference.basic_socket.close.overload1 close]``();
+ void ``[link boost_asio.reference.basic_raw_socket.close.overload1 close]``();
- boost::system::error_code ``[link boost_asio.reference.basic_socket.close.overload2 close]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.close.overload2 close]``(
boost::system::error_code & ec);
-[section:overload1 basic_socket::close (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::close (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Close the socket.
@@ -7379,7 +8989,10 @@
-[section:overload2 basic_socket::close (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::close (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Close the socket.
@@ -7426,19 +9039,22 @@
[endsect]
-[section:connect basic_socket::connect]
+[section:connect basic_raw_socket::connect]
-Connect the socket to the specified endpoint.
+[indexterm2 connect..basic_raw_socket] Connect the socket to the specified endpoint.
- void ``[link boost_asio.reference.basic_socket.connect.overload1 connect]``(
+ void ``[link boost_asio.reference.basic_raw_socket.connect.overload1 connect]``(
const endpoint_type & peer_endpoint);
- boost::system::error_code ``[link boost_asio.reference.basic_socket.connect.overload2 connect]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.connect.overload2 connect]``(
const endpoint_type & peer_endpoint,
boost::system::error_code & ec);
-[section:overload1 basic_socket::connect (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::connect (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Connect the socket to the specified endpoint.
@@ -7448,7 +9064,7 @@
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 returned to the closed state.
+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]
@@ -7487,7 +9103,10 @@
-[section:overload2 basic_socket::connect (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::connect (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Connect the socket to the specified endpoint.
@@ -7498,7 +9117,7 @@
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 returned to the closed state.
+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]
@@ -7537,12 +9156,12 @@
[endsect]
-[section:debug basic_socket::debug]
+[section:debug basic_raw_socket::debug]
['Inherited from socket_base.]
-Socket option to enable socket-level debugging.
+[indexterm2 debug..basic_raw_socket] Socket option to enable socket-level debugging.
typedef implementation_defined debug;
@@ -7580,12 +9199,12 @@
-[section:do_not_route basic_socket::do_not_route]
+[section:do_not_route basic_raw_socket::do_not_route]
['Inherited from socket_base.]
-Socket option to prevent routing, use local interfaces only.
+[indexterm2 do_not_route..basic_raw_socket] Socket option to prevent routing, use local interfaces only.
typedef implementation_defined do_not_route;
@@ -7623,12 +9242,12 @@
-[section:enable_connection_aborted basic_socket::enable_connection_aborted]
+[section:enable_connection_aborted basic_raw_socket::enable_connection_aborted]
['Inherited from socket_base.]
-Socket option to report aborted connections on accept.
+[indexterm2 enable_connection_aborted..basic_raw_socket] Socket option to report aborted connections on accept.
typedef implementation_defined enable_connection_aborted;
@@ -7666,9 +9285,9 @@
-[section:endpoint_type basic_socket::endpoint_type]
+[section:endpoint_type basic_raw_socket::endpoint_type]
-The endpoint type.
+[indexterm2 endpoint_type..basic_raw_socket] The endpoint type.
typedef Protocol::endpoint endpoint_type;
@@ -7679,12 +9298,12 @@
-[section:get_io_service basic_socket::get_io_service]
+[section:get_io_service basic_raw_socket::get_io_service]
['Inherited from basic_io_object.]
-Get the io_service associated with the object.
+[indexterm2 get_io_service..basic_raw_socket] Get the io_service associated with the object.
boost::asio::io_service & get_io_service();
@@ -7701,28 +9320,25 @@
[endsect]
-[section:get_option basic_socket::get_option]
+[section:get_option basic_raw_socket::get_option]
-Get an option from the socket.
+[indexterm2 get_option..basic_raw_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]``(
+ void ``[link boost_asio.reference.basic_raw_socket.get_option.overload1 get_option]``(
GettableSocketOption & option) const;
- template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket.get_option.overload2 get_option]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.get_option.overload2 get_option]``(
GettableSocketOption & option,
boost::system::error_code & ec) const;
-[section:overload1 basic_socket::get_option (1 of 2 overloads)]
+[section:overload1 basic_raw_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;
@@ -7767,12 +9383,13 @@
-[section:overload2 basic_socket::get_option (2 of 2 overloads)]
+[section:overload2 basic_raw_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;
@@ -7818,12 +9435,27 @@
[endsect]
-[section:implementation_type basic_socket::implementation_type]
+[section:implementation basic_raw_socket::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_raw_socket] The underlying implementation of the I/O object.
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
+[section:implementation_type basic_raw_socket::implementation_type]
['Inherited from basic_io_object.]
-The underlying implementation type of I/O object.
+[indexterm2 implementation_type..basic_raw_socket] The underlying implementation type of I/O object.
typedef service_type::implementation_type implementation_type;
@@ -7833,28 +9465,25 @@
[endsect]
-[section:io_control basic_socket::io_control]
+[section:io_control basic_raw_socket::io_control]
-Perform an IO control command on the socket.
+[indexterm2 io_control..basic_raw_socket] Perform an IO control command on the socket.
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- void ``[link boost_asio.reference.basic_socket.io_control.overload1 io_control]``(
+ void ``[link boost_asio.reference.basic_raw_socket.io_control.overload1 io_control]``(
IoControlCommand & command);
- template<
- typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
- boost::system::error_code ``[link boost_asio.reference.basic_socket.io_control.overload2 io_control]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.io_control.overload2 io_control]``(
IoControlCommand & command,
boost::system::error_code & ec);
-[section:overload1 basic_socket::io_control (1 of 2 overloads)]
+[section:overload1 basic_raw_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);
@@ -7899,12 +9528,13 @@
-[section:overload2 basic_socket::io_control (2 of 2 overloads)]
+[section:overload2 basic_raw_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);
@@ -7950,12 +9580,12 @@
[endsect]
-[section:io_service basic_socket::io_service]
+[section:io_service basic_raw_socket::io_service]
['Inherited from basic_io_object.]
-(Deprecated: use get_io_service().) Get the io_service associated with the object.
+[indexterm2 io_service..basic_raw_socket] (Deprecated: use get_io_service().) Get the io_service associated with the object.
boost::asio::io_service & io_service();
@@ -7973,9 +9603,12 @@
-[section:is_open basic_socket::is_open]
+[section:is_open basic_raw_socket::is_open]
+
-Determine whether the socket is open.
+['Inherited from basic_socket.]
+
+[indexterm2 is_open..basic_raw_socket] Determine whether the socket is open.
bool is_open() const;
@@ -7985,12 +9618,12 @@
-[section:keep_alive basic_socket::keep_alive]
+[section:keep_alive basic_raw_socket::keep_alive]
['Inherited from socket_base.]
-Socket option to send keep-alives.
+[indexterm2 keep_alive..basic_raw_socket] Socket option to send keep-alives.
typedef implementation_defined keep_alive;
@@ -8028,12 +9661,12 @@
-[section:linger basic_socket::linger]
+[section:linger basic_raw_socket::linger]
['Inherited from socket_base.]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+[indexterm2 linger..basic_raw_socket] Socket option to specify whether the socket lingers on close if unsent data is present.
typedef implementation_defined linger;
@@ -8071,17 +9704,20 @@
[endsect]
-[section:local_endpoint basic_socket::local_endpoint]
+[section:local_endpoint basic_raw_socket::local_endpoint]
-Get the local endpoint of the socket.
+[indexterm2 local_endpoint..basic_raw_socket] Get the local endpoint of the socket.
- endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload1 local_endpoint]``() const;
+ endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload1 local_endpoint]``() const;
- endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload2 local_endpoint]``(
+ endpoint_type ``[link boost_asio.reference.basic_raw_socket.local_endpoint.overload2 local_endpoint]``(
boost::system::error_code & ec) const;
-[section:overload1 basic_socket::local_endpoint (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::local_endpoint (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Get the local endpoint of the socket.
@@ -8121,7 +9757,10 @@
-[section:overload2 basic_socket::local_endpoint (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::local_endpoint (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Get the local endpoint of the socket.
@@ -8169,9 +9808,12 @@
[endsect]
-[section:lowest_layer basic_socket::lowest_layer]
+[section:lowest_layer basic_raw_socket::lowest_layer]
+
+
+['Inherited from basic_socket.]
-Get a reference to the lowest layer.
+[indexterm2 lowest_layer..basic_raw_socket] Get a reference to the lowest layer.
lowest_layer_type & lowest_layer();
@@ -8189,11 +9831,14 @@
-[section:lowest_layer_type basic_socket::lowest_layer_type]
+[section:lowest_layer_type basic_raw_socket::lowest_layer_type]
-A basic_socket is always the lowest layer.
- typedef basic_socket< Protocol, SocketService > lowest_layer_type;
+['Inherited from basic_socket.]
+
+[indexterm2 lowest_layer_type..basic_raw_socket] A basic_socket is always the lowest layer.
+
+ typedef basic_socket< Protocol, RawSocketService > lowest_layer_type;
[heading Types]
@@ -8460,6 +10105,17 @@
]
+[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 Data Members]
[table
[[Name][Description]]
@@ -8486,6 +10142,22 @@
]
+[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. ]
+ ]
+
+]
+
The basic_socket class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
@@ -8502,12 +10174,12 @@
-[section:max_connections basic_socket::max_connections]
+[section:max_connections basic_raw_socket::max_connections]
['Inherited from socket_base.]
-The maximum length of the queue of pending incoming connections.
+[indexterm2 max_connections..basic_raw_socket] The maximum length of the queue of pending incoming connections.
static const int max_connections = implementation_defined;
@@ -8517,12 +10189,12 @@
-[section:message_do_not_route basic_socket::message_do_not_route]
+[section:message_do_not_route basic_raw_socket::message_do_not_route]
['Inherited from socket_base.]
-Specify that the data should not be subject to routing.
+[indexterm2 message_do_not_route..basic_raw_socket] Specify that the data should not be subject to routing.
static const int message_do_not_route = implementation_defined;
@@ -8532,12 +10204,12 @@
-[section:message_flags basic_socket::message_flags]
+[section:message_flags basic_raw_socket::message_flags]
['Inherited from socket_base.]
-Bitmask type for flags that can be passed to send and receive operations.
+[indexterm2 message_flags..basic_raw_socket] Bitmask type for flags that can be passed to send and receive operations.
typedef int message_flags;
@@ -8548,12 +10220,12 @@
-[section:message_out_of_band basic_socket::message_out_of_band]
+[section:message_out_of_band basic_raw_socket::message_out_of_band]
['Inherited from socket_base.]
-Process out-of-band data.
+[indexterm2 message_out_of_band..basic_raw_socket] Process out-of-band data.
static const int message_out_of_band = implementation_defined;
@@ -8563,12 +10235,12 @@
-[section:message_peek basic_socket::message_peek]
+[section:message_peek basic_raw_socket::message_peek]
['Inherited from socket_base.]
-Peek at incoming data without removing it from the input queue.
+[indexterm2 message_peek..basic_raw_socket] Peek at incoming data without removing it from the input queue.
static const int message_peek = implementation_defined;
@@ -8578,9 +10250,12 @@
-[section:native basic_socket::native]
+[section:native basic_raw_socket::native]
+
+
+['Inherited from basic_socket.]
-Get the native socket representation.
+[indexterm2 native..basic_raw_socket] Get the native socket representation.
native_type native();
@@ -8592,11 +10267,11 @@
-[section:native_type basic_socket::native_type]
+[section:native_type basic_raw_socket::native_type]
-The native representation of a socket.
+[indexterm2 native_type..basic_raw_socket] The native representation of a socket.
- typedef SocketService::native_type native_type;
+ typedef RawSocketService::native_type native_type;
@@ -8605,12 +10280,12 @@
-[section:non_blocking_io basic_socket::non_blocking_io]
+[section:non_blocking_io basic_raw_socket::non_blocking_io]
['Inherited from socket_base.]
-IO control command to set the blocking mode of the socket.
+[indexterm2 non_blocking_io..basic_raw_socket] IO control command to set the blocking mode of the socket.
typedef implementation_defined non_blocking_io;
@@ -8636,19 +10311,22 @@
[endsect]
-[section:open basic_socket::open]
+[section:open basic_raw_socket::open]
-Open the socket using the specified protocol.
+[indexterm2 open..basic_raw_socket] Open the socket using the specified protocol.
- void ``[link boost_asio.reference.basic_socket.open.overload1 open]``(
+ void ``[link boost_asio.reference.basic_raw_socket.open.overload1 open]``(
const protocol_type & protocol = protocol_type());
- boost::system::error_code ``[link boost_asio.reference.basic_socket.open.overload2 open]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.open.overload2 open]``(
const protocol_type & protocol,
boost::system::error_code & ec);
-[section:overload1 basic_socket::open (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::open (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Open the socket using the specified protocol.
@@ -8693,7 +10371,10 @@
-[section:overload2 basic_socket::open (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::open (2 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
Open the socket using the specified protocol.
@@ -8739,9 +10420,9 @@
[endsect]
-[section:protocol_type basic_socket::protocol_type]
+[section:protocol_type basic_raw_socket::protocol_type]
-The protocol type.
+[indexterm2 protocol_type..basic_raw_socket] The protocol type.
typedef Protocol protocol_type;
@@ -8751,132 +10432,210 @@
[endsect]
+[section:receive basic_raw_socket::receive]
-[section:receive_buffer_size basic_socket::receive_buffer_size]
+[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);
-['Inherited from socket_base.]
+ 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);
-Socket option for the receive buffer size of a socket.
+ 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);
- typedef implementation_defined receive_buffer_size;
+[section:overload1 basic_raw_socket::receive (1 of 3 overloads)]
+Receive some data on a connected socket.
-Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive(
+ const MutableBufferSequence & buffers);
-[heading Examples]
-
-Setting the option:
+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.
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option(8192);
- socket.set_option(option);
+[heading Parameters]
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received.]]
+]
-Getting the current option value:
+[heading Return Value]
+
+The number of bytes received.
- 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 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));
-[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:receive_low_watermark basic_socket::receive_low_watermark]
+[endsect]
-['Inherited from socket_base.]
-Socket option for the receive low watermark.
- typedef implementation_defined receive_low_watermark;
+[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);
-Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
+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 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 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.]]
+]
-Getting the current option value:
+[heading Return Value]
+
+The number of bytes received.
- 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 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.
[endsect]
-[section:remote_endpoint basic_socket::remote_endpoint]
-Get the remote endpoint of the socket.
+[section:overload3 basic_raw_socket::receive (3 of 3 overloads)]
- endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload1 remote_endpoint]``() const;
+Receive some data on a connected socket.
- endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload2 remote_endpoint]``(
- boost::system::error_code & ec) const;
+ 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);
-[section:overload1 basic_socket::remote_endpoint (1 of 2 overloads)]
+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.
-Get the remote endpoint of the socket.
- endpoint_type remote_endpoint() const;
+[heading Parameters]
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be received.]]
-This function is used to obtain the remote endpoint of the socket.
+[[flags][Flags specifying how the receive call is to be made.]]
+[[ec][Set to indicate what error occurred, if any.]]
+
+]
[heading Return Value]
-An object that represents the remote endpoint of the socket.
+The number of bytes received.
-[heading Exceptions]
-
+[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.
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
-]
-[heading Example]
+[endsect]
+
+
+[endsect]
+
+
+[section:receive_buffer_size basic_raw_socket::receive_buffer_size]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 receive_buffer_size..basic_raw_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);
- boost::asio::ip::tcp::socket socket(io_service);
+
+
+Getting the current option value:
+
+ boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
+ boost::asio::socket_base::receive_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
@@ -8886,16 +10645,44 @@
[endsect]
+[section:receive_from basic_raw_socket::receive_from]
-[section:overload2 basic_socket::remote_endpoint (2 of 2 overloads)]
+[indexterm2 receive_from..basic_raw_socket] Receive raw data with the endpoint of the sender.
-Get the remote endpoint of the socket.
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload1 receive_from]``(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint);
- endpoint_type remote_endpoint(
- boost::system::error_code & ec) const;
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload2 receive_from]``(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags);
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.receive_from.overload3 receive_from]``(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
-This function is used to obtain the remote endpoint of the socket.
+[section:overload1 basic_raw_socket::receive_from (1 of 3 overloads)]
+
+Receive raw data with the endpoint of the sender.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive_from(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint);
+
+
+This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
[heading Parameters]
@@ -8903,74 +10690,84 @@
[variablelist
-[[ec][Set to indicate what error occurred, if any.]]
+[[buffers][One or more buffers into which the data will be received.]]
+
+[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
]
[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]
-
+The number of bytes received.
+[heading Exceptions]
+
- 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.
- }
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+]
+[heading Example]
+
+To receive into a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
+ boost::asio::ip::udp::endpoint sender_endpoint;
+ socket.receive_from(
+ boost::asio::buffer(data, size), sender_endpoint);
+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:reuse_address basic_socket::reuse_address]
-
-['Inherited from socket_base.]
+[section:overload2 basic_raw_socket::receive_from (2 of 3 overloads)]
-Socket option to allow the socket to be bound to an address that is already in use.
+Receive raw data with the endpoint of the sender.
- typedef implementation_defined reuse_address;
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive_from(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags);
+This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
-Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
+[heading Parameters]
+
-[heading Examples]
+[variablelist
-Setting the option:
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option(true);
- acceptor.set_option(option);
-
+[[buffers][One or more buffers into which the data will be received.]]
+[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
+[[flags][Flags specifying how the receive call is to be made.]]
-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 Return Value]
+
+The number of bytes received.
+[heading Exceptions]
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+]
@@ -8978,61 +10775,61 @@
-[section:send_buffer_size basic_socket::send_buffer_size]
-
-
-['Inherited from socket_base.]
+[section:overload3 basic_raw_socket::receive_from (3 of 3 overloads)]
-Socket option for the send buffer size of a socket.
+Receive raw data with the endpoint of the sender.
- typedef implementation_defined send_buffer_size;
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t receive_from(
+ const MutableBufferSequence & buffers,
+ endpoint_type & sender_endpoint,
+ socket_base::message_flags flags,
+ boost::system::error_code & ec);
+This function is used to receive raw data. The function call will block until data has been received successfully or an error occurs.
-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);
-
+[[buffers][One or more buffers into which the data will be received.]]
+[[sender_endpoint][An endpoint object that receives the endpoint of the remote sender of the data.]]
+[[flags][Flags specifying how the receive call is to be made.]]
-Getting the current option value:
+[[ec][Set to indicate what error occurred, if any.]]
- 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 Return Value]
+
+The number of bytes received.
+[endsect]
[endsect]
-
-[section:send_low_watermark basic_socket::send_low_watermark]
+[section:receive_low_watermark basic_raw_socket::receive_low_watermark]
['Inherited from socket_base.]
-Socket option for the send low watermark.
+[indexterm2 receive_low_watermark..basic_raw_socket] Socket option for the receive low watermark.
- typedef implementation_defined send_low_watermark;
+ typedef implementation_defined receive_low_watermark;
-Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
+Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
[heading Examples]
@@ -9041,7 +10838,7 @@
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::socket_base::send_low_watermark option(1024);
+ boost::asio::socket_base::receive_low_watermark option(1024);
socket.set_option(option);
@@ -9051,7 +10848,7 @@
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::socket_base::send_low_watermark option;
+ boost::asio::socket_base::receive_low_watermark option;
socket.get_option(option);
int size = option.value();
@@ -9063,59 +10860,32 @@
[endsect]
+[section:remote_endpoint basic_raw_socket::remote_endpoint]
-[section:service_type basic_socket::service_type]
-
-
-['Inherited from basic_io_object.]
-
-The type of the service that will be used to provide I/O operations.
-
- typedef SocketService service_type;
-
-
-
-
-[endsect]
-
-
-[section:set_option basic_socket::set_option]
-
-Set an option on the socket.
+[indexterm2 remote_endpoint..basic_raw_socket] Get the remote endpoint of the socket.
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void ``[link boost_asio.reference.basic_socket.set_option.overload1 set_option]``(
- const SettableSocketOption & option);
+ endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload1 remote_endpoint]``() const;
- 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);
+ endpoint_type ``[link boost_asio.reference.basic_raw_socket.remote_endpoint.overload2 remote_endpoint]``(
+ boost::system::error_code & ec) const;
-[section:overload1 basic_socket::set_option (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::remote_endpoint (1 of 2 overloads)]
-Set an option on the socket.
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void set_option(
- const SettableSocketOption & option);
+['Inherited from basic_socket.]
+Get the remote endpoint of the socket.
-This function is used to set an option on the socket.
+ endpoint_type remote_endpoint() const;
-[heading Parameters]
-
+This function is used to obtain the remote endpoint of the socket.
-[variablelist
-
-[[option][The new option value to be set on the socket.]]
-]
+[heading Return Value]
+
+An object that represents the remote endpoint of the socket.
[heading Exceptions]
@@ -9128,12 +10898,11 @@
[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);
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
@@ -9144,18 +10913,18 @@
-[section:overload2 basic_socket::set_option (2 of 2 overloads)]
+[section:overload2 basic_raw_socket::remote_endpoint (2 of 2 overloads)]
-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);
+['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 set an option on the socket.
+
+This function is used to obtain the remote endpoint of the socket.
[heading Parameters]
@@ -9163,21 +10932,22 @@
[variablelist
-[[option][The new option value to be set on the socket.]]
-
[[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]
-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);
+ boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
if (ec)
{
// An error occurred.
@@ -9193,54 +10963,40 @@
[endsect]
-[section:shutdown basic_socket::shutdown]
-
-Disable sends or receives on the socket.
-
- void ``[link boost_asio.reference.basic_socket.shutdown.overload1 shutdown]``(
- shutdown_type what);
- boost::system::error_code ``[link boost_asio.reference.basic_socket.shutdown.overload2 shutdown]``(
- shutdown_type what,
- boost::system::error_code & ec);
+[section:reuse_address basic_raw_socket::reuse_address]
-[section:overload1 basic_socket::shutdown (1 of 2 overloads)]
+['Inherited from socket_base.]
-Disable sends or receives on the socket.
+[indexterm2 reuse_address..basic_raw_socket] Socket option to allow the socket to be bound to an address that is already in use.
- void shutdown(
- shutdown_type what);
+ typedef implementation_defined reuse_address;
-This function is used to disable send operations, receive operations, or both.
+Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
-[heading Parameters]
-
-[variablelist
+[heading Examples]
-[[what][Determines what types of operation will no longer be allowed.]]
+Setting the option:
-]
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::socket_base::reuse_address option(true);
+ acceptor.set_option(option);
-[heading Exceptions]
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
-]
-[heading Example]
-
-Shutting down the send side of the socket:
+Getting the current option value:
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
...
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
+ boost::asio::socket_base::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
@@ -9250,17 +11006,40 @@
[endsect]
+[section:send basic_raw_socket::send]
-[section:overload2 basic_socket::shutdown (2 of 2 overloads)]
+[indexterm2 send..basic_raw_socket] Send some data on a connected socket.
-Disable sends or receives on the socket.
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload1 send]``(
+ const ConstBufferSequence & buffers);
- boost::system::error_code shutdown(
- shutdown_type what,
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload2 send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags);
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.send.overload3 send]``(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags,
boost::system::error_code & ec);
-This function is used to disable send operations, receive operations, or both.
+[section:overload1 basic_raw_socket::send (1 of 3 overloads)]
+
+Send some data on a connected 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 raw socket. The function call will block until the data has been sent successfully or an error occurs.
[heading Parameters]
@@ -9268,407 +11047,259 @@
[variablelist
-[[what][Determines what types of operation will no longer be allowed.]]
+[[buffers][One ore more data buffers to be sent on the socket.]]
-[[ec][Set to indicate what error occurred, if any.]]
+]
+
+[heading Return Value]
+
+The number of bytes sent.
+
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
]
+[heading Remarks]
+
+The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket.
+
[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.
- }
+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]
-[endsect]
+[section:overload2 basic_raw_socket::send (2 of 3 overloads)]
-[section:shutdown_type basic_socket::shutdown_type]
+Send some data on a connected socket.
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send(
+ const ConstBufferSequence & buffers,
+ socket_base::message_flags flags);
-['Inherited from socket_base.]
+This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
-Different ways a socket may be shutdown.
- enum shutdown_type
+[heading Parameters]
+
-[heading Values]
[variablelist
+
+[[buffers][One ore more data buffers to be sent on the socket.]]
- [
- [shutdown_receive]
- [Shutdown the receive side of the socket. ]
- ]
+[[flags][Flags specifying how the send call is to be made.]]
- [
- [shutdown_send]
- [Shutdown the send side of the socket. ]
- ]
+]
- [
- [shutdown_both]
- [Shutdown both send and receive on the socket. ]
- ]
+[heading Return Value]
+
+The number of bytes sent.
-]
+[heading Exceptions]
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+]
-[endsect]
+[heading Remarks]
+
+The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket.
[endsect]
-[section:basic_socket_acceptor basic_socket_acceptor]
-Provides the ability to accept new connections.
- 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
+[section:overload3 basic_raw_socket::send (3 of 3 overloads)]
+Send some data on a connected socket.
-[heading Types]
-[table
- [[Name][Description]]
+ 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_acceptor.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+This function is used to send data on the raw socket. The function call will block until the data has been sent successfully or an error occurs.
- [
- [[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. ]
+[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_acceptor.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+[[ec][Set to indicate what error occurred, if any.]]
- [
+]
- [[link boost_asio.reference.basic_socket_acceptor.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
+[heading Return Value]
+
+The number of bytes sent.
- [
+[heading Remarks]
+
+The send operation can only be used with a connected socket. Use the send\_to function to send data on an unconnected raw socket.
- [[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. ]
-
- ]
+[endsect]
- [
- [[link boost_asio.reference.basic_socket_acceptor.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
+[section:send_buffer_size basic_raw_socket::send_buffer_size]
- [
- [[link boost_asio.reference.basic_socket_acceptor.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
+['Inherited from socket_base.]
- [
+[indexterm2 send_buffer_size..basic_raw_socket] Socket option for the send buffer size of a socket.
- [[link boost_asio.reference.basic_socket_acceptor.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
+ typedef implementation_defined send_buffer_size;
- [
- [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
- [The native representation of an acceptor. ]
-
- ]
- [
+Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
- [[link boost_asio.reference.basic_socket_acceptor.non_blocking_io [*non_blocking_io]]]
- [IO control command to set the blocking mode of the socket. ]
+
+[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);
- [[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. ]
-
- ]
- [
+Getting the current option value:
- [[link boost_asio.reference.basic_socket_acceptor.receive_low_watermark [*receive_low_watermark]]]
- [Socket option for the receive low watermark. ]
-
- ]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
- [
- [[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.basic_socket_acceptor.send_buffer_size [*send_buffer_size]]]
- [Socket option for the send buffer size of a socket. ]
-
- ]
- [
- [[link boost_asio.reference.basic_socket_acceptor.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
+[endsect]
- [
- [[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:send_low_watermark basic_raw_socket::send_low_watermark]
- [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
-]
+['Inherited from socket_base.]
-[heading Member Functions]
-[table
- [[Name][Description]]
+[indexterm2 send_low_watermark..basic_raw_socket] Socket option for the send low watermark.
- [
- [[link boost_asio.reference.basic_socket_acceptor.accept [*accept]]]
- [Accept a new connection. ]
- ]
-
- [
- [[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. ]
- ]
-
- [
- [[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. ]
- ]
-
-]
+ typedef implementation_defined send_low_watermark;
-[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. ]
- ]
+Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
- [
- [[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 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);
-The basic_socket_acceptor class template is used for accepting new socket connections.
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
-[*Shared] [*objects:] Unsafe.
+Getting the current option value:
-[heading Example]
-
-Opening a socket acceptor with the SO\_REUSEADDR option enabled:
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
- 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:accept basic_socket_acceptor::accept]
+[endsect]
-Accept a new connection.
- 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);
+[section:send_to basic_raw_socket::send_to]
+
+[indexterm2 send_to..basic_raw_socket] Send raw data to the specified endpoint.
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);
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload1 send_to]``(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination);
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);
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload2 send_to]``(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags);
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,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.basic_raw_socket.send_to.overload3 send_to]``(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
boost::system::error_code & ec);
-[section:overload1 basic_socket_acceptor::accept (1 of 4 overloads)]
+[section:overload1 basic_raw_socket::send_to (1 of 3 overloads)]
-Accept a new connection.
+Send raw data to the specified endpoint.
template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- void accept(
- basic_socket< protocol_type, SocketService > & peer);
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send_to(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination);
-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 is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
[heading Parameters]
@@ -9676,10 +11307,16 @@
[variablelist
-[[peer][The socket into which the new connection will be accepted.]]
+[[buffers][One or more data buffers to be sent to the remote endpoint.]]
+
+[[destination][The remote endpoint to which the data will be sent.]]
]
+[heading Return Value]
+
+The number of bytes sent.
+
[heading Exceptions]
@@ -9691,15 +11328,63 @@
[heading Example]
+To send a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
+
+ boost::asio::ip::udp::endpoint destination(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.send_to(boost::asio::buffer(data, size), destination);
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::socket socket(io_service);
- acceptor.accept(socket);
+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_raw_socket::send_to (2 of 3 overloads)]
+
+Send raw data to the specified endpoint.
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send_to(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags);
+
+
+This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more data buffers to be sent to the remote endpoint.]]
+
+[[destination][The remote endpoint to which the data will be sent.]]
+
+[[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. ]]
+
+]
@@ -9707,18 +11392,20 @@
-[section:overload2 basic_socket_acceptor::accept (2 of 4 overloads)]
+[section:overload3 basic_raw_socket::send_to (3 of 3 overloads)]
-Accept a new connection.
+Send raw data to the specified endpoint.
template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- boost::system::error_code accept(
- basic_socket< protocol_type, SocketService > & peer,
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t send_to(
+ const ConstBufferSequence & buffers,
+ const endpoint_type & destination,
+ socket_base::message_flags flags,
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.
+This function is used to send raw data to the specified remote endpoint. The function call will block until the data has been sent successfully or an error occurs.
[heading Parameters]
@@ -9726,27 +11413,51 @@
[variablelist
-[[peer][The socket into which the new connection will be accepted.]]
+[[buffers][One or more data buffers to be sent to the remote endpoint.]]
+
+[[destination][The remote endpoint to which the data will be sent.]]
+
+[[flags][Flags specifying how the send call is to be made.]]
[[ec][Set to indicate what error occurred, if any.]]
]
-[heading Example]
-
+[heading Return Value]
+
+The number of bytes sent.
- 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]
+
+
+[endsect]
+
+
+[section:service basic_raw_socket::service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_raw_socket] The service associated with the I/O object.
+
+ service_type & service;
+
+
+
+[endsect]
+
+[section:service_type basic_raw_socket::service_type]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service_type..basic_raw_socket] The type of the service that will be used to provide I/O operations.
+
+ typedef RawSocketService service_type;
@@ -9754,19 +11465,30 @@
[endsect]
+[section:set_option basic_raw_socket::set_option]
-[section:overload3 basic_socket_acceptor::accept (3 of 4 overloads)]
+[indexterm2 set_option..basic_raw_socket] Set an option on the socket.
-Accept a new connection and obtain the endpoint of the peer.
+ void ``[link boost_asio.reference.basic_raw_socket.set_option.overload1 set_option]``(
+ const SettableSocketOption & option);
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- void accept(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint);
+ boost::system::error_code ``[link boost_asio.reference.basic_raw_socket.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
+ 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.
+[section:overload1 basic_raw_socket::set_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Set an option on the socket.
+
+ void set_option(
+ const SettableSocketOption & option);
+
+
+This function is used to set an option on the socket.
[heading Parameters]
@@ -9774,9 +11496,7 @@
[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.]]
+[[option][The new option value to be set on the socket.]]
]
@@ -9791,13 +11511,12 @@
[heading Example]
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
-
- 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);
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
+ socket.set_option(option);
@@ -9808,19 +11527,19 @@
-[section:overload4 basic_socket_acceptor::accept (4 of 4 overloads)]
+[section:overload2 basic_raw_socket::set_option (2 of 2 overloads)]
-Accept a new connection and obtain the endpoint of the peer.
- template<
- typename ``[link boost_asio.reference.SocketService SocketService]``>
- boost::system::error_code accept(
- basic_socket< protocol_type, SocketService > & peer,
- endpoint_type & peer_endpoint,
+['Inherited from basic_socket.]
+
+Set an option on the socket.
+
+ boost::system::error_code set_option(
+ const SettableSocketOption & option,
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 set an option on the socket.
[heading Parameters]
@@ -9828,9 +11547,7 @@
[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.]]
+[[option][The new option value to be set on the socket.]]
[[ec][Set to indicate what error occurred, if any.]]
@@ -9838,14 +11555,13 @@
[heading Example]
+Setting the IPPROTO\_TCP/TCP\_NODELAY option:
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
boost::asio::ip::tcp::socket socket(io_service);
- boost::asio::ip::tcp::endpoint endpoint;
+ ...
+ boost::asio::ip::tcp::no_delay option(true);
boost::system::error_code ec;
- acceptor.accept(socket, endpoint, ec);
+ socket.set_option(option, ec);
if (ec)
{
// An error occurred.
@@ -9861,83 +11577,80 @@
[endsect]
-[section:assign basic_socket_acceptor::assign]
+[section:shutdown basic_raw_socket::shutdown]
-Assigns an existing native acceptor to the acceptor.
+[indexterm2 shutdown..basic_raw_socket] Disable sends or receives on the socket.
- void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload1 assign]``(
- const protocol_type & protocol,
- const native_type & native_acceptor);
+ void ``[link boost_asio.reference.basic_raw_socket.shutdown.overload1 shutdown]``(
+ shutdown_type what);
- 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_raw_socket.shutdown.overload2 shutdown]``(
+ shutdown_type what,
boost::system::error_code & ec);
-[section:overload1 basic_socket_acceptor::assign (1 of 2 overloads)]
+[section:overload1 basic_raw_socket::shutdown (1 of 2 overloads)]
-Assigns an existing native acceptor to the acceptor.
- void assign(
- const protocol_type & protocol,
- const native_type & native_acceptor);
+['Inherited from basic_socket.]
+Disable sends or receives on the socket.
+ void shutdown(
+ shutdown_type what);
-[endsect]
+This function is used to disable send operations, receive operations, or both.
-[section:overload2 basic_socket_acceptor::assign (2 of 2 overloads)]
+[heading Parameters]
+
-Assigns an existing native acceptor to the acceptor.
+[variablelist
+
+[[what][Determines what types of operation will no longer be allowed.]]
- boost::system::error_code assign(
- const protocol_type & protocol,
- const native_type & native_acceptor,
- boost::system::error_code & ec);
+]
+[heading Exceptions]
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
-[endsect]
+]
+[heading Example]
+
+Shutting down the send side of the socket:
-[endsect]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
-[section:async_accept basic_socket_acceptor::async_accept]
-Start an asynchronous accept.
- 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);
- 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);
-[section:overload1 basic_socket_acceptor::async_accept (1 of 2 overloads)]
+[endsect]
-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);
+[section:overload2 basic_raw_socket::shutdown (2 of 2 overloads)]
-This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately.
+
+['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]
@@ -9945,38 +11658,25 @@
[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.
- );
+[[what][Determines what types of operation will no longer be allowed.]]
-``
-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]
+Shutting down the send side of the socket:
-
- void accept_handler(const boost::system::error_code& error)
+ 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)
{
- if (!error)
- {
- // Accept succeeded.
- }
+ // An error occurred.
}
- ...
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::socket socket(io_service);
- acceptor.async_accept(socket, accept_handler);
-
@@ -9985,40 +11685,35 @@
[endsect]
+[endsect]
-[section:overload2 basic_socket_acceptor::async_accept (2 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,
- endpoint_type & peer_endpoint,
- AcceptHandler handler);
+[section:shutdown_type basic_raw_socket::shutdown_type]
-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.
+['Inherited from socket_base.]
+[indexterm2 shutdown_type..basic_raw_socket] Different ways a socket may be shutdown.
-[heading Parameters]
-
+ enum shutdown_type
+[heading Values]
[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.]]
-[[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.]]
+ [
+ [shutdown_receive]
+ [Shutdown the receive side of the socket. ]
+ ]
-[[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.
- );
+ [
+ [shutdown_send]
+ [Shutdown the send side of the socket. ]
+ ]
-``
-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(). ]]
+ [
+ [shutdown_both]
+ [Shutdown both send and receive on the socket. ]
+ ]
]
@@ -10027,87 +11722,189 @@
[endsect]
-[endsect]
-
-[section:basic_socket_acceptor basic_socket_acceptor::basic_socket_acceptor]
-Construct an acceptor without opening it.
+[endsect]
- ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 basic_socket_acceptor]``(
- boost::asio::io_service & io_service);
+[section:basic_serial_port basic_serial_port]
- ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 basic_socket_acceptor]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
+Provides serial port functionality.
- ``[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);
+ template<
+ typename ``[link boost_asio.reference.SerialPortService SerialPortService]`` = serial_port_service>
+ class basic_serial_port :
+ public basic_io_object< SerialPortService >,
+ public serial_port_base
- ``[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);
+[heading Types]
+[table
+ [[Name][Description]]
-[section:overload1 basic_socket_acceptor::basic_socket_acceptor (1 of 4 overloads)]
+ [
-Construct an acceptor without opening it.
+ [[link boost_asio.reference.basic_serial_port.implementation_type [*implementation_type]]]
+ [The underlying implementation type of I/O object. ]
+
+ ]
- basic_socket_acceptor(
- boost::asio::io_service & io_service);
+ [
+ [[link boost_asio.reference.basic_serial_port.lowest_layer_type [*lowest_layer_type]]]
+ [A basic_serial_port is always the lowest layer. ]
+
+ ]
-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.
+ [
+ [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
+ [The native representation of a serial port. ]
+
+ ]
-[heading Parameters]
-
+ [
-[variablelist
+ [[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. ]
-[[io_service][The io\_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor. ]]
+ ]
]
+[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. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_serial_port.basic_serial_port [*basic_serial_port]]]
+ [Construct a basic_serial_port without opening it. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+]
-[endsect]
+[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. ]
+ ]
-[section:overload2 basic_socket_acceptor::basic_socket_acceptor (2 of 4 overloads)]
+]
-Construct an open acceptor.
+The basic_serial_port class template provides functionality that is common to all serial ports.
- basic_socket_acceptor(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
-This constructor creates an acceptor and automatically opens it.
+[*Shared] [*objects:] Unsafe.
-[heading Parameters]
-
+[section:assign basic_serial_port::assign]
-[variablelist
-
-[[io_service][The io\_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
+[indexterm2 assign..basic_serial_port] Assign an existing native serial port to the serial port.
-[[protocol][An object specifying protocol parameters to be used.]]
+ void ``[link boost_asio.reference.basic_serial_port.assign.overload1 assign]``(
+ const native_type & native_serial_port);
-]
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.assign.overload2 assign]``(
+ const native_type & native_serial_port,
+ boost::system::error_code & ec);
-[heading Exceptions]
-
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+[section:overload1 basic_serial_port::assign (1 of 2 overloads)]
-]
+Assign an existing native serial port to the serial port.
+
+ void assign(
+ const native_type & native_serial_port);
@@ -10115,54 +11912,70 @@
-[section:overload3 basic_socket_acceptor::basic_socket_acceptor (3 of 4 overloads)]
+[section:overload2 basic_serial_port::assign (2 of 2 overloads)]
-Construct an acceptor opened on the given endpoint.
+Assign an existing native serial port to the serial port.
- basic_socket_acceptor(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint,
- bool reuse_addr = true);
+ boost::system::error_code assign(
+ const native_type & native_serial_port,
+ boost::system::error_code & ec);
-This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
+[endsect]
-[heading Parameters]
-
-[variablelist
-
-[[io_service][The io\_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
+[endsect]
-[[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.]]
+[section:async_read_some basic_serial_port::async_read_some]
-]
+[indexterm2 async_read_some..basic_serial_port] Start an asynchronous read.
-[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);
+
+
+This function is used to asynchronously read data from the serial port. The function call always returns immediately.
+
+
+[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 Remarks]
-This constructor is equivalent to the following code:
+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.
- 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 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.
@@ -10170,17 +11983,19 @@
-[section:overload4 basic_socket_acceptor::basic_socket_acceptor (4 of 4 overloads)]
+[section:async_write_some basic_serial_port::async_write_some]
-Construct a basic_socket_acceptor on an existing native acceptor.
+[indexterm2 async_write_some..basic_serial_port] Start an asynchronous write.
- 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]``,
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_write_some(
+ const ConstBufferSequence & buffers,
+ WriteHandler handler);
-This constructor creates an acceptor object to hold an existing native acceptor.
+This function is used to asynchronously write data to the serial port. The function call always returns immediately.
[heading Parameters]
@@ -10188,98 +12003,96 @@
[variablelist
-[[io_service][The 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. 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.]]
-[[native_acceptor][A native acceptor.]]
+[[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 Exceptions]
-
+[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.
-[variablelist
+[heading Example]
-[[boost::system::system_error][Thrown on failure. ]]
+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);
+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:bind basic_socket_acceptor::bind]
-Bind the acceptor to the given local endpoint.
+[section:basic_serial_port basic_serial_port::basic_serial_port]
- void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload1 bind]``(
- const endpoint_type & endpoint);
+[indexterm2 basic_serial_port..basic_serial_port] Construct a basic_serial_port without opening it.
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.bind.overload2 bind]``(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+ ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload1 basic_serial_port]``(
+ boost::asio::io_service & io_service);
+ ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload2 basic_serial_port]``(
+ boost::asio::io_service & io_service,
+ const char * device);
-[section:overload1 basic_socket_acceptor::bind (1 of 2 overloads)]
+ ``[link boost_asio.reference.basic_serial_port.basic_serial_port.overload3 basic_serial_port]``(
+ boost::asio::io_service & io_service,
+ const std::string & device);
-Bind the acceptor to the given local endpoint.
+ ``[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);
- void bind(
- const endpoint_type & endpoint);
+[section:overload1 basic_serial_port::basic_serial_port (1 of 4 overloads)]
-This function binds the socket acceptor to the specified endpoint on the local machine.
+Construct a basic_serial_port without opening it.
+ basic_serial_port(
+ boost::asio::io_service & io_service);
-[heading Parameters]
-
-[variablelist
-
-[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
+This constructor creates a serial port without opening it.
-]
-[heading Exceptions]
+[heading Parameters]
[variablelist
-[[boost::system::system_error][Thrown on failure.]]
+[[io_service][The io\_service object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port. ]]
]
-[heading Example]
-
-
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- acceptor.open(boost::asio::ip::tcp::v4());
- acceptor.bind(boost::asio::ip::tcp::endpoint(12345));
-
-
-
-
[endsect]
-[section:overload2 basic_socket_acceptor::bind (2 of 2 overloads)]
+[section:overload2 basic_serial_port::basic_serial_port (2 of 4 overloads)]
-Bind the acceptor to the given local endpoint.
+Construct and open a basic_serial_port.
- boost::system::error_code bind(
- const endpoint_type & endpoint,
- boost::system::error_code & ec);
+ basic_serial_port(
+ boost::asio::io_service & io_service,
+ const char * device);
-This function binds the socket acceptor to the specified endpoint on the local machine.
+This constructor creates and opens a serial port for the specified device name.
[heading Parameters]
@@ -10287,72 +12100,40 @@
[variablelist
-[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
+[[io_service][The io\_service object that the serial port will use to dispatch handlers for any asynchronous operations performed on the port.]]
-[[ec][Set to indicate what error occurred, if any.]]
+[[device][The platform-specific device name for this serial port. ]]
]
-[heading Example]
-
-
-
- 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.
- }
-
-
-
-
-
-
-[endsect]
[endsect]
-[section:broadcast basic_socket_acceptor::broadcast]
-
-['Inherited from socket_base.]
+[section:overload3 basic_serial_port::basic_serial_port (3 of 4 overloads)]
-Socket option to permit sending of broadcast messages.
+Construct and open a basic_serial_port.
- typedef implementation_defined broadcast;
+ basic_serial_port(
+ boost::asio::io_service & io_service,
+ const std::string & device);
+This constructor creates and opens a serial port for the specified device name.
-Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
+[heading Parameters]
+
-[heading Examples]
+[variablelist
-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();
-
+[[io_service][The 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. ]]
+]
@@ -10360,56 +12141,63 @@
-[section:bytes_readable basic_socket_acceptor::bytes_readable]
-
-
-['Inherited from socket_base.]
+[section:overload4 basic_serial_port::basic_serial_port (4 of 4 overloads)]
-IO control command to get the amount of data that can be read without blocking.
+Construct a basic_serial_port on an existing native serial port.
- typedef implementation_defined bytes_readable;
+ basic_serial_port(
+ boost::asio::io_service & io_service,
+ const native_type & native_serial_port);
+This constructor creates a serial port object to hold an existing native serial port.
-Implements the FIONREAD IO control command.
+[heading Parameters]
+
-[heading Example]
+[variablelist
+[[io_service][The 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.]]
- 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 Exceptions]
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+]
[endsect]
-[section:cancel basic_socket_acceptor::cancel]
+[endsect]
-Cancel all asynchronous operations associated with the acceptor.
+[section:cancel basic_serial_port::cancel]
- void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload1 cancel]``();
+[indexterm2 cancel..basic_serial_port] Cancel all asynchronous operations associated with the serial port.
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload2 cancel]``(
+ void ``[link boost_asio.reference.basic_serial_port.cancel.overload1 cancel]``();
+
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.cancel.overload2 cancel]``(
boost::system::error_code & ec);
-[section:overload1 basic_socket_acceptor::cancel (1 of 2 overloads)]
+[section:overload1 basic_serial_port::cancel (1 of 2 overloads)]
-Cancel all asynchronous operations associated with the acceptor.
+Cancel all asynchronous operations associated with the serial port.
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.
+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]
@@ -10427,15 +12215,15 @@
-[section:overload2 basic_socket_acceptor::cancel (2 of 2 overloads)]
+[section:overload2 basic_serial_port::cancel (2 of 2 overloads)]
-Cancel all asynchronous operations associated with the acceptor.
+Cancel all asynchronous operations associated with the serial port.
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.
+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]
@@ -10454,26 +12242,24 @@
[endsect]
-[section:close basic_socket_acceptor::close]
+[section:close basic_serial_port::close]
-Close the acceptor.
+[indexterm2 close..basic_serial_port] Close the serial port.
- void ``[link boost_asio.reference.basic_socket_acceptor.close.overload1 close]``();
+ void ``[link boost_asio.reference.basic_serial_port.close.overload1 close]``();
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.close.overload2 close]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.close.overload2 close]``(
boost::system::error_code & ec);
-[section:overload1 basic_socket_acceptor::close (1 of 2 overloads)]
+[section:overload1 basic_serial_port::close (1 of 2 overloads)]
-Close the acceptor.
+Close the serial port.
void close();
-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 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 Exceptions]
@@ -10491,17 +12277,15 @@
-[section:overload2 basic_socket_acceptor::close (2 of 2 overloads)]
+[section:overload2 basic_serial_port::close (2 of 2 overloads)]
-Close the acceptor.
+Close the serial port.
boost::system::error_code close(
boost::system::error_code & ec);
-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 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]
@@ -10509,182 +12293,24 @@
[variablelist
-[[ec][Set to indicate what error occurred, if any.]]
+[[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.close(ec);
- if (ec)
- {
- // An error occurred.
- }
-
-
-
-
-
-
-[endsect]
-
-
-[endsect]
-
-
-[section:debug basic_socket_acceptor::debug]
-
-
-['Inherited from socket_base.]
-
-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();
-
-
-
-
-
-
-[endsect]
-
-
-
-[section:do_not_route basic_socket_acceptor::do_not_route]
-
-
-['Inherited from socket_base.]
-
-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();
-
-
-
-
-
-
-[endsect]
-
-
-
-[section:enable_connection_aborted basic_socket_acceptor::enable_connection_aborted]
-
-
-['Inherited from socket_base.]
-
-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();
-
-
-
-
[endsect]
-
-[section:endpoint_type basic_socket_acceptor::endpoint_type]
-
-The endpoint type.
-
- typedef Protocol::endpoint endpoint_type;
-
-
-
-
[endsect]
-
-[section:get_io_service basic_socket_acceptor::get_io_service]
+[section:get_io_service basic_serial_port::get_io_service]
['Inherited from basic_io_object.]
-Get the io_service associated with the object.
+[indexterm2 get_io_service..basic_serial_port] Get the io_service associated with the object.
boost::asio::io_service & get_io_service();
@@ -10701,33 +12327,33 @@
[endsect]
-[section:get_option basic_socket_acceptor::get_option]
+[section:get_option basic_serial_port::get_option]
-Get an option from the acceptor.
+[indexterm2 get_option..basic_serial_port] Get an option from the serial port.
template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload1 get_option]``(
- GettableSocketOption & option);
+ typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
+ void ``[link boost_asio.reference.basic_serial_port.get_option.overload1 get_option]``(
+ GettableSerialPortOption & option);
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,
+ 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);
-[section:overload1 basic_socket_acceptor::get_option (1 of 2 overloads)]
+[section:overload1 basic_serial_port::get_option (1 of 2 overloads)]
-Get an option from the acceptor.
+Get an option from the serial port.
template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
void get_option(
- GettableSocketOption & option);
+ GettableSerialPortOption & option);
-This function is used to get the current value of an option on the acceptor.
+This function is used to get the current value of an option on the serial port.
[heading Parameters]
@@ -10735,7 +12361,7 @@
[variablelist
-[[option][The option value to be obtained from the acceptor.]]
+[[option][The option value to be obtained from the serial port.]]
]
@@ -10748,37 +12374,24 @@
]
-[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:overload2 basic_socket_acceptor::get_option (2 of 2 overloads)]
+[section:overload2 basic_serial_port::get_option (2 of 2 overloads)]
-Get an option from the acceptor.
+Get an option from the serial port.
template<
- typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ typename ``[link boost_asio.reference.GettableSerialPortOption GettableSerialPortOption]``>
boost::system::error_code get_option(
- GettableSocketOption & option,
+ GettableSerialPortOption & option,
boost::system::error_code & ec);
-This function is used to get the current value of an option on the acceptor.
+This function is used to get the current value of an option on the serial port.
[heading Parameters]
@@ -10786,44 +12399,41 @@
[variablelist
-[[option][The option value to be obtained from the acceptor.]]
+[[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]
-
-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:implementation basic_serial_port::implementation]
-[endsect]
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_serial_port] The underlying implementation of the I/O object.
+
+ implementation_type implementation;
+
[endsect]
-[section:implementation_type basic_socket_acceptor::implementation_type]
+
+[section:implementation_type basic_serial_port::implementation_type]
['Inherited from basic_io_object.]
-The underlying implementation type of I/O object.
+[indexterm2 implementation_type..basic_serial_port] The underlying implementation type of I/O object.
typedef service_type::implementation_type implementation_type;
@@ -10834,12 +12444,12 @@
-[section:io_service basic_socket_acceptor::io_service]
+[section:io_service basic_serial_port::io_service]
['Inherited from basic_io_object.]
-(Deprecated: use get_io_service().) Get the io_service associated with the object.
+[indexterm2 io_service..basic_serial_port] (Deprecated: use get_io_service().) Get the io_service associated with the object.
boost::asio::io_service & io_service();
@@ -10857,9 +12467,9 @@
-[section:is_open basic_socket_acceptor::is_open]
+[section:is_open basic_serial_port::is_open]
-Determine whether the acceptor is open.
+[indexterm2 is_open..basic_serial_port] Determine whether the serial port is open.
bool is_open() const;
@@ -10869,113 +12479,237 @@
-[section:keep_alive basic_socket_acceptor::keep_alive]
+[section:lowest_layer basic_serial_port::lowest_layer]
+[indexterm2 lowest_layer..basic_serial_port] Get a reference to the lowest layer.
-['Inherited from socket_base.]
+ lowest_layer_type & lowest_layer();
-Socket option to send keep-alives.
- typedef implementation_defined keep_alive;
+This function returns a reference to the lowest layer in a stack of layers. Since a 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.
-Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
-[heading Examples]
-
-Setting the option:
+[endsect]
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::keep_alive option(true);
- socket.set_option(option);
+[section:lowest_layer_type basic_serial_port::lowest_layer_type]
+[indexterm2 lowest_layer_type..basic_serial_port] A basic_serial_port is always the lowest layer.
-Getting the current option value:
+ typedef basic_serial_port< SerialPortService > lowest_layer_type;
- 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 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. ]
+
+ ]
-[endsect]
+ [
+ [[link boost_asio.reference.basic_serial_port.native_type [*native_type]]]
+ [The native representation of a serial port. ]
+
+ ]
+ [
-[section:linger basic_socket_acceptor::linger]
+ [[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. ]
+
+ ]
+]
-['Inherited from socket_base.]
+[heading Member Functions]
+[table
+ [[Name][Description]]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+]
- typedef implementation_defined linger;
+[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. ]
+ ]
-Implements the SOL\_SOCKET/SO\_LINGER socket option.
+]
+The basic_serial_port class template provides functionality that is common to all serial ports.
-[heading Examples]
+
+[heading Thread Safety]
-Setting the option:
+[*Distinct] [*objects:] Safe.
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::linger option(true, 30);
- socket.set_option(option);
+[*Shared] [*objects:] Unsafe.
-Getting the current option value:
+[endsect]
+
- 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();
+[section:native basic_serial_port::native]
+[indexterm2 native..basic_serial_port] 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:listen basic_socket_acceptor::listen]
-Place the acceptor into the state where it will listen for new connections.
+[section:native_type basic_serial_port::native_type]
- void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload1 listen]``(
- int backlog = socket_base::max_connections);
+[indexterm2 native_type..basic_serial_port] The native representation of a serial port.
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.listen.overload2 listen]``(
- int backlog,
+ typedef SerialPortService::native_type native_type;
+
+
+
+
+[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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.open.overload2 open]``(
+ const std::string & device,
boost::system::error_code & ec);
-[section:overload1 basic_socket_acceptor::listen (1 of 2 overloads)]
+[section:overload1 basic_serial_port::open (1 of 2 overloads)]
-Place the acceptor into the state where it will listen for new connections.
+Open the serial port using the specified device name.
- void listen(
- int backlog = socket_base::max_connections);
+ void open(
+ const std::string & device);
-This function puts the socket acceptor into the state where it may accept new connections.
+This function opens the serial port for the specified device name.
[heading Parameters]
@@ -10983,7 +12717,7 @@
[variablelist
-[[backlog][The maximum length of the queue of pending connections.]]
+[[device][The platform-specific device name.]]
]
@@ -11002,16 +12736,16 @@
-[section:overload2 basic_socket_acceptor::listen (2 of 2 overloads)]
+[section:overload2 basic_serial_port::open (2 of 2 overloads)]
-Place the acceptor into the state where it will listen for new connections.
+Open the serial port using the specified device name.
- boost::system::error_code listen(
- int backlog,
+ boost::system::error_code open(
+ const std::string & device,
boost::system::error_code & ec);
-This function puts the socket acceptor into the state where it may accept new connections.
+This function opens the serial port using the given platform-specific device name.
[heading Parameters]
@@ -11019,78 +12753,85 @@
[variablelist
-[[backlog][The maximum length of the queue of pending connections.]]
+[[device][The platform-specific device name.]]
-[[ec][Set to indicate what error occurred, if any.]]
+[[ec][Set the 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.
- }
-
-
+[endsect]
[endsect]
+[section:read_some basic_serial_port::read_some]
-[endsect]
+[indexterm2 read_some..basic_serial_port] Read some data from the serial port.
-[section:local_endpoint basic_socket_acceptor::local_endpoint]
+ 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);
-Get the local endpoint of the acceptor.
+ 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);
- endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 local_endpoint]``() const;
- endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 local_endpoint]``(
- boost::system::error_code & ec) const;
+[section:overload1 basic_serial_port::read_some (1 of 2 overloads)]
+Read some data from the serial port.
-[section:overload1 basic_socket_acceptor::local_endpoint (1 of 2 overloads)]
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
-Get the local endpoint of the acceptor.
- endpoint_type local_endpoint() const;
+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 obtain the locally bound endpoint of the acceptor.
+[heading Parameters]
+
+
+[variablelist
+
+[[buffers][One or more buffers into which the data will be read.]]
+]
[heading Return Value]
-An object that represents the local endpoint of the acceptor.
+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 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:
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
-
+ 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.
@@ -11098,15 +12839,18 @@
-[section:overload2 basic_socket_acceptor::local_endpoint (2 of 2 overloads)]
+[section:overload2 basic_serial_port::read_some (2 of 2 overloads)]
-Get the local endpoint of the acceptor.
+Read some data from the serial port.
- endpoint_type local_endpoint(
- boost::system::error_code & ec) const;
+ 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 obtain the locally bound endpoint of the acceptor.
+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]
@@ -11114,29 +12858,20 @@
[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]
-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::acceptor acceptor(io_service);
- ...
- boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
- if (ec)
- {
- // 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.
@@ -11145,61 +12880,77 @@
[endsect]
+[section:send_break basic_serial_port::send_break]
-[section:max_connections basic_socket_acceptor::max_connections]
+[indexterm2 send_break..basic_serial_port] Send a break sequence to the serial port.
+ void ``[link boost_asio.reference.basic_serial_port.send_break.overload1 send_break]``();
-['Inherited from socket_base.]
+ boost::system::error_code ``[link boost_asio.reference.basic_serial_port.send_break.overload2 send_break]``(
+ boost::system::error_code & ec);
-The maximum length of the queue of pending incoming connections.
- static const int max_connections = implementation_defined;
+[section:overload1 basic_serial_port::send_break (1 of 2 overloads)]
+Send a break sequence to the serial port.
+ void send_break();
-[endsect]
+This function causes a break sequence of platform-specific duration to be sent out the serial port.
-[section:message_do_not_route basic_socket_acceptor::message_do_not_route]
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+]
-['Inherited from socket_base.]
-Specify that the data should not be subject to routing.
- static const int message_do_not_route = implementation_defined;
+[endsect]
-[endsect]
+[section:overload2 basic_serial_port::send_break (2 of 2 overloads)]
+Send a break sequence to the serial port.
+ boost::system::error_code send_break(
+ boost::system::error_code & ec);
-[section:message_flags basic_socket_acceptor::message_flags]
+This function causes a break sequence of platform-specific duration to be sent out the serial port.
-['Inherited from socket_base.]
-Bitmask type for flags that can be passed to send and receive operations.
+[heading Parameters]
+
- typedef int message_flags;
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. ]]
+]
[endsect]
+[endsect]
-[section:message_out_of_band basic_socket_acceptor::message_out_of_band]
+[section:service basic_serial_port::service]
-['Inherited from socket_base.]
-Process out-of-band data.
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_serial_port] The service associated with the I/O object.
- static const int message_out_of_band = implementation_defined;
+ service_type & service;
@@ -11207,100 +12958,133 @@
-[section:message_peek basic_socket_acceptor::message_peek]
+[section:service_type basic_serial_port::service_type]
-['Inherited from socket_base.]
+['Inherited from basic_io_object.]
-Peek at incoming data without removing it from the input queue.
+[indexterm2 service_type..basic_serial_port] The type of the service that will be used to provide I/O operations.
+
+ typedef SerialPortService service_type;
- static const int message_peek = implementation_defined;
[endsect]
+[section:set_option basic_serial_port::set_option]
-[section:native basic_socket_acceptor::native]
+[indexterm2 set_option..basic_serial_port] Set an option on the serial port.
-Get the native acceptor representation.
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ void ``[link boost_asio.reference.basic_serial_port.set_option.overload1 set_option]``(
+ const SettableSerialPortOption & option);
- native_type native();
+ 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);
-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_serial_port::set_option (1 of 2 overloads)]
+Set an option on the serial port.
-[endsect]
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ void set_option(
+ const SettableSerialPortOption & option);
+This function is used to set an option on the serial port.
-[section:native_type basic_socket_acceptor::native_type]
-The native representation of an acceptor.
+[heading Parameters]
+
- typedef SocketAcceptorService::native_type native_type;
+[variablelist
+
+[[option][The option value to be set on the serial port.]]
+]
+[heading Exceptions]
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
-[endsect]
+]
-[section:non_blocking_io basic_socket_acceptor::non_blocking_io]
+[endsect]
-['Inherited from socket_base.]
-IO control command to set the blocking mode of the socket.
+[section:overload2 basic_serial_port::set_option (2 of 2 overloads)]
- typedef implementation_defined non_blocking_io;
+Set an option on the serial port.
+ template<
+ typename ``[link boost_asio.reference.SettableSerialPortOption SettableSerialPortOption]``>
+ boost::system::error_code set_option(
+ const SettableSerialPortOption & option,
+ boost::system::error_code & ec);
-Implements the FIONBIO IO control command.
+This function is used to set an option on the serial port.
-[heading Example]
-
+[heading Parameters]
+
+[variablelist
+
+[[option][The option value to be set on the serial port.]]
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
+[[ec][Set to indicate what error occurred, if any.]]
+]
+[endsect]
[endsect]
+[section:write_some basic_serial_port::write_some]
-[section:open basic_socket_acceptor::open]
-
-Open the acceptor using the specified protocol.
+[indexterm2 write_some..basic_serial_port] Write some data to the serial port.
- void ``[link boost_asio.reference.basic_socket_acceptor.open.overload1 open]``(
- const protocol_type & protocol = protocol_type());
+ 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);
- boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.open.overload2 open]``(
- const protocol_type & protocol,
+ 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);
-[section:overload1 basic_socket_acceptor::open (1 of 2 overloads)]
+[section:overload1 basic_serial_port::write_some (1 of 2 overloads)]
-Open the acceptor using the specified protocol.
+Write some data to the serial port.
- void open(
- const protocol_type & protocol = protocol_type());
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers);
-This function opens the socket acceptor so that it will use the specified protocol.
+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]
@@ -11308,28 +13092,38 @@
[variablelist
-[[protocol][An object specifying which protocol is to be used.]]
+[[buffers][One or more data buffers to be written to the serial port.]]
]
+[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]
+To write a single data buffer use the
+[link boost_asio.reference.buffer buffer] function as follows:
-
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- acceptor.open(boost::asio::ip::tcp::v4());
-
+ 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.
@@ -11337,16 +13131,18 @@
-[section:overload2 basic_socket_acceptor::open (2 of 2 overloads)]
+[section:overload2 basic_serial_port::write_some (2 of 2 overloads)]
-Open the acceptor using the specified protocol.
+Write some data to the serial port.
- boost::system::error_code open(
- const protocol_type & protocol,
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
boost::system::error_code & ec);
-This function opens the socket acceptor so that it will use the specified protocol.
+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]
@@ -11354,210 +13150,466 @@
[variablelist
-[[protocol][An object specifying which protocol is to be used.]]
+[[buffers][One or more data buffers to be written to the serial port.]]
[[ec][Set to indicate what error occurred, if any.]]
]
-[heading Example]
-
+[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.
- 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.
- }
+[endsect]
+[endsect]
[endsect]
+[section:basic_socket basic_socket]
-[endsect]
+Provides socket functionality.
+ 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
-[section:protocol_type basic_socket_acceptor::protocol_type]
-The protocol type.
+[heading Types]
+[table
+ [[Name][Description]]
- typedef Protocol protocol_type;
+ [
+ [[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. ]
+
+ ]
-[endsect]
+ [
+ [[link boost_asio.reference.basic_socket.debug [*debug]]]
+ [Socket option to enable socket-level debugging. ]
+
+ ]
+ [
-[section:receive_buffer_size basic_socket_acceptor::receive_buffer_size]
+ [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
+ [Socket option to prevent routing, use local interfaces only. ]
+
+ ]
+ [
-['Inherited from socket_base.]
+ [[link boost_asio.reference.basic_socket.enable_connection_aborted [*enable_connection_aborted]]]
+ [Socket option to report aborted connections on accept. ]
+
+ ]
-Socket option for the receive buffer size of a socket.
+ [
- typedef implementation_defined receive_buffer_size;
+ [[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. ]
+
+ ]
-Implements the SOL\_SOCKET/SO\_RCVBUF socket option.
+ [
+ [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
+ [Socket option to send keep-alives. ]
+
+ ]
-[heading Examples]
+ [
+
+ [[link boost_asio.reference.basic_socket.linger [*linger]]]
+ [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-Setting the option:
+ ]
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option(8192);
- socket.set_option(option);
+ [
+ [[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. ]
+
+ ]
-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_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. ]
+
+ ]
+ [
-[endsect]
+ [[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. ]
+
+ ]
-[section:receive_low_watermark basic_socket_acceptor::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. ]
+
+ ]
-['Inherited from socket_base.]
+ [
-Socket option for the receive low watermark.
+ [[link boost_asio.reference.basic_socket.send_buffer_size [*send_buffer_size]]]
+ [Socket option for the send buffer size of a socket. ]
+
+ ]
- typedef implementation_defined receive_low_watermark;
+ [
+ [[link boost_asio.reference.basic_socket.send_low_watermark [*send_low_watermark]]]
+ [Socket option for the send low watermark. ]
+
+ ]
+ [
-Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
+ [[link boost_asio.reference.basic_socket.service_type [*service_type]]]
+ [The type of the service that will be used to provide I/O operations. ]
+
+ ]
+ [
-[heading Examples]
+ [[link boost_asio.reference.basic_socket.shutdown_type [*shutdown_type]]]
+ [Different ways a socket may be shutdown. ]
-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 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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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]]
-Getting the current option value:
+ [
+ [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
- 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 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_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]]]
+ [The underlying implementation of the I/O object. ]
+ ]
+ [
+ [[link boost_asio.reference.basic_socket.service [*service]]]
+ [The service associated with the I/O object. ]
+ ]
-[section:reuse_address basic_socket_acceptor::reuse_address]
+]
+The basic_socket class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
-['Inherited from socket_base.]
-Socket option to allow the socket to be bound to an address that is already in use.
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
- typedef implementation_defined reuse_address;
+[*Shared] [*objects:] Unsafe.
+[section:assign basic_socket::assign]
-Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
+[indexterm2 assign..basic_socket] Assign an existing native socket to the socket.
+ void ``[link boost_asio.reference.basic_socket.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_type & native_socket);
-[heading Examples]
-
-Setting the option:
+ 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);
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option(true);
- acceptor.set_option(option);
+[section:overload1 basic_socket::assign (1 of 2 overloads)]
+Assign an existing native socket to the socket.
+ void assign(
+ const protocol_type & protocol,
+ const native_type & native_socket);
+
+
+
+[endsect]
-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();
+[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]
+[endsect]
-[section:send_buffer_size basic_socket_acceptor::send_buffer_size]
+[section:async_connect basic_socket::async_connect]
-['Inherited from socket_base.]
+[indexterm2 async_connect..basic_socket] Start an asynchronous connect.
-Socket option for the send buffer size of a socket.
+ template<
+ typename ``[link boost_asio.reference.ConnectHandler ConnectHandler]``>
+ void async_connect(
+ const endpoint_type & peer_endpoint,
+ ConnectHandler handler);
- typedef implementation_defined send_buffer_size;
+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 SOL\_SOCKET/SO\_SNDBUF socket option.
+[heading Parameters]
+
-[heading Examples]
+[variablelist
-Setting the option:
+[[peer_endpoint][The remote endpoint to which the socket will be connected. Copies will be made of the endpoint object as required.]]
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::send_buffer_size option(8192);
- socket.set_option(option);
+[[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]
+
-Getting the current option value:
+ void connect_handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Connect succeeded.
+ }
+ }
- boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::socket_base::send_buffer_size option;
- socket.get_option(option);
- int size = option.value();
+
+ 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);
@@ -11567,142 +13619,176 @@
[endsect]
+[section:at_mark basic_socket::at_mark]
-[section:send_low_watermark basic_socket_acceptor::send_low_watermark]
+[indexterm2 at_mark..basic_socket] Determine whether the socket is at the out-of-band data mark.
+ bool ``[link boost_asio.reference.basic_socket.at_mark.overload1 at_mark]``() const;
-['Inherited from socket_base.]
+ bool ``[link boost_asio.reference.basic_socket.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
-Socket option for the send low watermark.
- typedef implementation_defined send_low_watermark;
+[section:overload1 basic_socket::at_mark (1 of 2 overloads)]
+Determine whether the socket is at the out-of-band data mark.
+ bool at_mark() const;
-Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
-[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);
+[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. ]]
+]
-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();
+[endsect]
+[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;
-[endsect]
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
-[section:service_type basic_socket_acceptor::service_type]
+[heading Parameters]
+
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any.]]
-['Inherited from basic_io_object.]
+]
-The type of the service that will be used to provide I/O operations.
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
- typedef SocketAcceptorService service_type;
+[endsect]
[endsect]
+[section:available basic_socket::available]
-[section:set_option basic_socket_acceptor::set_option]
+[indexterm2 available..basic_socket] Determine the number of bytes available for reading.
-Set an option on the acceptor.
+ std::size_t ``[link boost_asio.reference.basic_socket.available.overload1 available]``() const;
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload1 set_option]``(
- const SettableSocketOption & option);
+ std::size_t ``[link boost_asio.reference.basic_socket.available.overload2 available]``(
+ boost::system::error_code & ec) const;
- 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);
+[section:overload1 basic_socket::available (1 of 2 overloads)]
-[section:overload1 basic_socket_acceptor::set_option (1 of 2 overloads)]
+Determine the number of bytes available for reading.
-Set an option on the acceptor.
+ std::size_t available() const;
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- void set_option(
- const SettableSocketOption & option);
+This function is used to determine the number of bytes that may be read without blocking.
-This function is used to set an option on the acceptor.
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
-[heading Parameters]
+[heading Exceptions]
[variablelist
-[[option][The new option value to be set on the acceptor.]]
+[[boost::system::system_error][Thrown on failure. ]]
]
-[heading Exceptions]
+
+
+[endsect]
+
+
+
+[section:overload2 basic_socket::available (2 of 2 overloads)]
+
+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
-[[boost::system::system_error][Thrown on failure.]]
+[[ec][Set to indicate what error occurred, if any.]]
]
-[heading Example]
-
-Setting the SOL\_SOCKET/SO\_REUSEADDR option:
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::ip::tcp::acceptor::reuse_address option(true);
- acceptor.set_option(option);
+[endsect]
+[endsect]
+[section:basic_socket basic_socket::basic_socket]
-[endsect]
+[indexterm2 basic_socket..basic_socket] Construct a basic_socket without opening it.
+ ``[link boost_asio.reference.basic_socket.basic_socket.overload1 basic_socket]``(
+ boost::asio::io_service & io_service);
+ ``[link boost_asio.reference.basic_socket.basic_socket.overload2 basic_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
-[section:overload2 basic_socket_acceptor::set_option (2 of 2 overloads)]
+ ``[link boost_asio.reference.basic_socket.basic_socket.overload3 basic_socket]``(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
-Set an option on the acceptor.
+ ``[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);
- template<
- typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
- boost::system::error_code set_option(
- const SettableSocketOption & option,
- boost::system::error_code & ec);
+[section:overload1 basic_socket::basic_socket (1 of 4 overloads)]
-This function is used to set an option on the acceptor.
+Construct a basic_socket without opening it.
+
+ basic_socket(
+ boost::asio::io_service & io_service);
+
+
+This constructor creates a socket without opening it.
[heading Parameters]
@@ -11710,63 +13796,45 @@
[variablelist
-[[option][The new option value to be set on the acceptor.]]
-
-[[ec][Set to indicate what error occurred, if any.]]
+[[io_service][The io\_service object that the socket will use to dispatch handlers for any asynchronous operations performed on 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]
+[section:overload2 basic_socket::basic_socket (2 of 4 overloads)]
+Construct and open a basic_socket.
-[endsect]
+ basic_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
-[endsect]
+This constructor creates and opens a socket.
-[section:shutdown_type basic_socket_acceptor::shutdown_type]
+[heading Parameters]
+
+[variablelist
+
+[[io_service][The io\_service object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
-['Inherited from socket_base.]
+[[protocol][An object specifying protocol parameters to be used.]]
-Different ways a socket may be shutdown.
+]
- enum shutdown_type
+[heading Exceptions]
+
-[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. ]
- ]
+
+[[boost::system::system_error][Thrown on failure. ]]
]
@@ -11776,87 +13844,79 @@
-[endsect]
+[section:overload3 basic_socket::basic_socket (3 of 4 overloads)]
-[section:basic_socket_iostream basic_socket_iostream]
+Construct a basic_socket, opening it and binding it to the given local endpoint.
-Iostream interface for a socket.
+ basic_socket(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
- template<
- typename ``[link boost_asio.reference.Protocol Protocol]``,
- typename ``[link boost_asio.reference.StreamSocketService StreamSocketService]`` = stream_socket_service<Protocol>>
- class basic_socket_iostream
+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 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. ]
- ]
-
- [
- [[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. ]
- ]
+[heading Parameters]
+
+
+[variablelist
- [
- [[link boost_asio.reference.basic_socket_iostream.rdbuf [*rdbuf]]]
- [Return a pointer to the underlying streambuf. ]
- ]
+[[io_service][The 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. ]]
+
]
-[section:basic_socket_iostream basic_socket_iostream::basic_socket_iostream]
-Construct a basic_socket_iostream without establishing a connection.
- ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 basic_socket_iostream]``();
+[endsect]
- template<
- typename T1,
- ... ,
- typename TN>
- ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 basic_socket_iostream]``(
- T1 t1,
- ... ,
- TN tn);
-[section:overload1 basic_socket_iostream::basic_socket_iostream (1 of 2 overloads)]
+[section:overload4 basic_socket::basic_socket (4 of 4 overloads)]
-Construct a basic_socket_iostream without establishing a connection.
+Construct a basic_socket on an existing native socket.
- basic_socket_iostream();
+ basic_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_type & native_socket);
+This constructor creates a socket object to hold an existing native socket.
-[endsect]
+[heading Parameters]
+
+[variablelist
+
+[[io_service][The io\_service object that the socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
-[section:overload2 basic_socket_iostream::basic_socket_iostream (2 of 2 overloads)]
+[[protocol][An object specifying protocol parameters to be used.]]
-Establish a connection to an endpoint corresponding to a resolver query.
+[[native_socket][A native socket.]]
- template<
- typename T1,
- ... ,
- typename TN>
- basic_socket_iostream(
- T1 t1,
- ... ,
- TN tn);
+]
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+
+]
-This constructor automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
[endsect]
@@ -11864,45 +13924,58 @@
[endsect]
+[section:bind basic_socket::bind]
-[section:close basic_socket_iostream::close]
+[indexterm2 bind..basic_socket] Bind the socket to the given local endpoint.
-Close the connection.
+ void ``[link boost_asio.reference.basic_socket.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
- void close();
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+[section:overload1 basic_socket::bind (1 of 2 overloads)]
-[endsect]
+Bind the socket to the given local endpoint.
+ void bind(
+ const endpoint_type & endpoint);
-[section:connect basic_socket_iostream::connect]
+This function binds the socket to the specified endpoint on the local machine.
-Establish a connection to an endpoint corresponding to a resolver query.
- template<
- typename T1,
- ... ,
- typename TN>
- void connect(
- T1 t1,
- ... ,
- TN tn);
+[heading Parameters]
+
+[variablelist
+
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
-This function automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
+]
+[heading Exceptions]
+
-[endsect]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
+[heading Example]
+
-[section:rdbuf basic_socket_iostream::rdbuf]
+ 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));
+
-Return a pointer to the underlying streambuf.
- basic_socket_streambuf< Protocol, StreamSocketService > * rdbuf() const;
@@ -11910,496 +13983,216 @@
-[endsect]
+[section:overload2 basic_socket::bind (2 of 2 overloads)]
-[section:basic_socket_streambuf basic_socket_streambuf]
+Bind the socket to the given local endpoint.
-Iostream streambuf for a socket.
+ boost::system::error_code bind(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
- 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 >
+This function binds the socket to the specified endpoint on the local machine.
-[heading Types]
-[table
- [[Name][Description]]
- [
+[heading Parameters]
+
- [[link boost_asio.reference.basic_socket_streambuf.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
+[variablelist
- ]
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
- [
+[[ec][Set to indicate what error occurred, if any.]]
- [[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 Example]
- ]
- [
- [[link boost_asio.reference.basic_socket_streambuf.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+ 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_streambuf.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
- [
- [[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. ]
-
- ]
+[endsect]
- [
- [[link boost_asio.reference.basic_socket_streambuf.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
-
- ]
+[endsect]
- [
- [[link boost_asio.reference.basic_socket_streambuf.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
-
- ]
+[section:broadcast basic_socket::broadcast]
- [
- [[link boost_asio.reference.basic_socket_streambuf.linger [*linger]]]
- [Socket option to specify whether the socket lingers on close if unsent data is present. ]
-
- ]
+['Inherited from socket_base.]
- [
+[indexterm2 broadcast..basic_socket] Socket option to permit sending of broadcast messages.
- [[link boost_asio.reference.basic_socket_streambuf.lowest_layer_type [*lowest_layer_type]]]
- [A basic_socket is always the lowest layer. ]
-
- ]
+ typedef implementation_defined broadcast;
- [
- [[link boost_asio.reference.basic_socket_streambuf.message_flags [*message_flags]]]
- [Bitmask type for flags that can be passed to send and receive operations. ]
-
- ]
- [
+Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
- [[link boost_asio.reference.basic_socket_streambuf.native_type [*native_type]]]
- [The native representation of a socket. ]
+
+[heading Examples]
- ]
+Setting the option:
- [
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option(true);
+ socket.set_option(option);
- [[link boost_asio.reference.basic_socket_streambuf.non_blocking_io [*non_blocking_io]]]
- [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. ]
-
- ]
- [
+Getting the current option value:
- [[link boost_asio.reference.basic_socket_streambuf.receive_buffer_size [*receive_buffer_size]]]
- [Socket option for the receive buffer size of 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();
- [
- [[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. ]
-
- ]
+[endsect]
- [
- [[link boost_asio.reference.basic_socket_streambuf.send_low_watermark [*send_low_watermark]]]
- [Socket option for the send low watermark. ]
-
- ]
- [
+[section:bytes_readable basic_socket::bytes_readable]
- [[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. ]
-
- ]
- [
+['Inherited from socket_base.]
- [[link boost_asio.reference.basic_socket_streambuf.shutdown_type [*shutdown_type]]]
- [Different ways a socket may be shutdown. ]
-
- ]
+[indexterm2 bytes_readable..basic_socket] IO control command to get the amount of data that can be read without blocking.
-]
+ typedef implementation_defined bytes_readable;
-[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. ]
- ]
-
- [
- [[link boost_asio.reference.basic_socket_streambuf.connect [*connect]]]
- [Establish a connection. ]
- ]
-
- [
- [[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. ]
- ]
-
- [
- [[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. ]
- ]
-
-]
-
-[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_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. ]
- ]
-
-]
-
-[section:assign basic_socket_streambuf::assign]
-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_type & native_socket);
+Implements the FIONREAD IO control command.
- 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 & ec);
+[heading Example]
+
-[section:overload1 basic_socket_streambuf::assign (1 of 2 overloads)]
+ 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_socket.]
-Assign an existing native socket to the socket.
- void assign(
- const protocol_type & protocol,
- const native_type & native_socket);
[endsect]
+[section:cancel basic_socket::cancel]
-[section:overload2 basic_socket_streambuf::assign (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[indexterm2 cancel..basic_socket] Cancel all asynchronous operations associated with the socket.
-Assign an existing native socket to the socket.
+ void ``[link boost_asio.reference.basic_socket.cancel.overload1 cancel]``();
- boost::system::error_code assign(
- const protocol_type & protocol,
- const native_type & native_socket,
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.cancel.overload2 cancel]``(
boost::system::error_code & ec);
+[section:overload1 basic_socket::cancel (1 of 2 overloads)]
-[endsect]
-
-
-[endsect]
-
-
-[section:async_connect basic_socket_streambuf::async_connect]
-
-
-['Inherited from basic_socket.]
-
-Start an asynchronous connect.
-
- void async_connect(
- const endpoint_type & peer_endpoint,
- ConnectHandler handler);
+Cancel all asynchronous operations associated with the socket.
+ void cancel();
-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 returned to the closed state.
+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]
+[heading Exceptions]
[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::system::system_error][Thrown on failure.]]
]
-[heading Example]
-
-
+[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:
- void connect_handler(const boost::system::error_code& error)
- {
- if (!error)
- {
- // Connect succeeded.
- }
- }
+* 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.
- 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);
+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:at_mark basic_socket_streambuf::at_mark]
-
-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;
-
- bool ``[link boost_asio.reference.basic_socket_streambuf.at_mark.overload2 at_mark]``(
- boost::system::error_code & ec) const;
-
-
-[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.
+[section:overload2 basic_socket::cancel (2 of 2 overloads)]
- bool at_mark() const;
+Cancel all asynchronous operations associated with the socket.
+ boost::system::error_code cancel(
+ boost::system::error_code & ec);
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+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 Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
-[heading Exceptions]
+[heading Parameters]
[variablelist
-[[boost::system::system_error][Thrown on failure. ]]
+[[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.
-[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.
-
+* 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 Parameters]
-
+For portable cancellation, consider using one of the following alternatives:
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
-]
+* Disable asio's I/O completion port backend by defining BOOST_ASIO_DISABLE_IOCP.
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
+* 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]
@@ -12407,60 +14200,54 @@
[endsect]
-[section:available basic_socket_streambuf::available]
-
-Determine the number of bytes available for reading.
-
- std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload1 available]``() const;
-
- std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload2 available]``(
- boost::system::error_code & ec) const;
+[section:close basic_socket::close]
+[indexterm2 close..basic_socket] Close the socket.
-[section:overload1 basic_socket_streambuf::available (1 of 2 overloads)]
+ void ``[link boost_asio.reference.basic_socket.close.overload1 close]``();
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.close.overload2 close]``(
+ boost::system::error_code & ec);
-['Inherited from basic_socket.]
-Determine the number of bytes available for reading.
+[section:overload1 basic_socket::close (1 of 2 overloads)]
- std::size_t available() const;
+Close the socket.
+ void close();
-This function is used to determine the number of bytes that may be read without blocking.
+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]
-
-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. ]]
+[[boost::system::system_error][Thrown on failure.]]
]
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call shutdown() before closing the socket.
-[endsect]
-
+[endsect]
-[section:overload2 basic_socket_streambuf::available (2 of 2 overloads)]
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::close (2 of 2 overloads)]
-Determine the number of bytes available for reading.
+Close the socket.
- std::size_t available(
- boost::system::error_code & ec) const;
+ boost::system::error_code close(
+ boost::system::error_code & ec);
-This function is used to determine the number of bytes that may be read without blocking.
+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]
@@ -12472,53 +14259,56 @@
]
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
-
+[heading Example]
+
-[endsect]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::system::error_code ec;
+ socket.close(ec);
+ if (ec)
+ {
+ // An error occurred.
+ }
-[endsect]
-[section:basic_socket_streambuf basic_socket_streambuf::basic_socket_streambuf]
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call shutdown() before closing the socket.
-Construct a basic_socket_streambuf without establishing a connection.
- basic_socket_streambuf();
+[endsect]
[endsect]
+[section:connect basic_socket::connect]
-[section:bind basic_socket_streambuf::bind]
-
-Bind the socket to the given local endpoint.
+[indexterm2 connect..basic_socket] Connect the socket to the specified endpoint.
- void ``[link boost_asio.reference.basic_socket_streambuf.bind.overload1 bind]``(
- const endpoint_type & endpoint);
+ void ``[link boost_asio.reference.basic_socket.connect.overload1 connect]``(
+ const endpoint_type & peer_endpoint);
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.bind.overload2 bind]``(
- const endpoint_type & endpoint,
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.connect.overload2 connect]``(
+ const endpoint_type & peer_endpoint,
boost::system::error_code & ec);
-[section:overload1 basic_socket_streambuf::bind (1 of 2 overloads)]
-
+[section:overload1 basic_socket::connect (1 of 2 overloads)]
-['Inherited from basic_socket.]
+Connect the socket to the specified endpoint.
-Bind the socket to the given local endpoint.
+ void connect(
+ const endpoint_type & peer_endpoint);
- void bind(
- const endpoint_type & 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.
-This function binds the socket to the specified endpoint on the local machine.
+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]
@@ -12526,7 +14316,7 @@
[variablelist
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
]
@@ -12544,9 +14334,9 @@
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::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
+ socket.connect(endpoint);
@@ -12557,19 +14347,18 @@
-[section:overload2 basic_socket_streambuf::bind (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::connect (2 of 2 overloads)]
-Bind the socket to the given local endpoint.
+Connect the socket to the specified endpoint.
- boost::system::error_code bind(
- const endpoint_type & endpoint,
+ boost::system::error_code connect(
+ const endpoint_type & peer_endpoint,
boost::system::error_code & ec);
-This function binds the socket to the specified endpoint on the local machine.
+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]
@@ -12577,7 +14366,7 @@
[variablelist
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
[[ec][Set to indicate what error occurred, if any.]]
@@ -12588,10 +14377,10 @@
boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+ boost::asio::ip::tcp::endpoint endpoint(
+ boost::asio::ip::address::from_string("1.2.3.4"), 12345);
boost::system::error_code ec;
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345), ec);
+ socket.connect(endpoint, ec);
if (ec)
{
// An error occurred.
@@ -12608,27 +14397,27 @@
[endsect]
-[section:broadcast basic_socket_streambuf::broadcast]
+[section:debug basic_socket::debug]
['Inherited from socket_base.]
-Socket option to permit sending of broadcast messages.
+[indexterm2 debug..basic_socket] Socket option to enable socket-level debugging.
- typedef implementation_defined broadcast;
+ typedef implementation_defined debug;
-Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
+Implements the SOL\_SOCKET/SO\_DEBUG 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::debug option(true);
socket.set_option(option);
@@ -12636,9 +14425,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::debug option;
socket.get_option(option);
bool is_set = option.value();
@@ -12651,486 +14440,111 @@
-[section:bytes_readable basic_socket_streambuf::bytes_readable]
+[section:do_not_route basic_socket::do_not_route]
['Inherited from socket_base.]
-IO control command to get the amount of data that can be read without blocking.
+[indexterm2 do_not_route..basic_socket] Socket option to prevent routing, use local interfaces only.
- typedef implementation_defined bytes_readable;
+ typedef implementation_defined do_not_route;
-Implements the FIONREAD IO control command.
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
-[heading Example]
+[heading Examples]
+Setting the option:
-
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::udp::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::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();
-[endsect]
-[section:cancel basic_socket_streambuf::cancel]
-Cancel all asynchronous operations associated with the socket.
- void ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload1 cancel]``();
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload2 cancel]``(
- boost::system::error_code & ec);
+[endsect]
-[section:overload1 basic_socket_streambuf::cancel (1 of 2 overloads)]
+[section:enable_connection_aborted basic_socket::enable_connection_aborted]
-['Inherited from basic_socket.]
-Cancel all asynchronous operations associated with the socket.
+['Inherited from socket_base.]
- void cancel();
+[indexterm2 enable_connection_aborted..basic_socket] Socket option to report aborted connections on accept.
+ typedef implementation_defined enable_connection_aborted;
-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]
-
+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]
-[[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);
-[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:
+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();
-* 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)]
+[section:endpoint_type basic_socket::endpoint_type]
+[indexterm2 endpoint_type..basic_socket] The endpoint type.
-['Inherited from basic_socket.]
+ typedef Protocol::endpoint endpoint_type;
-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.
+[endsect]
-[heading Parameters]
-
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+[section:get_io_service basic_socket::get_io_service]
-]
-[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:
+['Inherited from basic_io_object.]
-* 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]
-
-Close the connection.
-
- basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.close.overload1 close]``();
-
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.close.overload2 close]``(
- boost::system::error_code & ec);
-
-
-[section:overload1 basic_socket_streambuf::close (1 of 2 overloads)]
-
-Close the connection.
-
- basic_socket_streambuf< Protocol, StreamSocketService > * 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.]]
-
-]
-
-[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]
-
-Establish a connection.
-
- basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload1 connect]``(
- const endpoint_type & endpoint);
-
- template<
- typename T1,
- ... ,
- typename TN>
- basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload2 connect]``(
- T1 t1,
- ... ,
- TN tn);
-
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.connect.overload3 connect]``(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
-
-
-[section:overload1 basic_socket_streambuf::connect (1 of 3 overloads)]
-
-Establish a connection.
-
- basic_socket_streambuf< Protocol, StreamSocketService > * 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 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.]
-
-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();
-
-
-
-
-
-
-[endsect]
-
-
-
-[section:do_not_route basic_socket_streambuf::do_not_route]
-
-
-['Inherited from socket_base.]
-
-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();
-
-
-
-
-
-
-[endsect]
-
-
-
-[section:enable_connection_aborted basic_socket_streambuf::enable_connection_aborted]
-
-
-['Inherited from socket_base.]
-
-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();
-
-
-
-
-
-
-[endsect]
-
-
-
-[section:endpoint_type basic_socket_streambuf::endpoint_type]
-
-The endpoint type.
-
- typedef Protocol::endpoint endpoint_type;
-
-
-
-
-[endsect]
-
-
-
-[section:get_io_service basic_socket_streambuf::get_io_service]
-
-
-['Inherited from basic_io_object.]
-
-Get the io_service associated with the object.
+[indexterm2 get_io_service..basic_socket] Get the io_service associated with the object.
boost::asio::io_service & get_io_service();
@@ -13147,25 +14561,28 @@
[endsect]
-[section:get_option basic_socket_streambuf::get_option]
+[section:get_option basic_socket::get_option]
-Get an option from the socket.
+[indexterm2 get_option..basic_socket] Get an option from the socket.
- void ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload1 get_option]``(
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket.get_option.overload1 get_option]``(
GettableSocketOption & option) const;
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload2 get_option]``(
+ 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;
-[section:overload1 basic_socket_streambuf::get_option (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[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;
@@ -13210,13 +14627,12 @@
-[section:overload2 basic_socket_streambuf::get_option (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::get_option (2 of 2 overloads)]
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;
@@ -13262,12 +14678,27 @@
[endsect]
-[section:implementation_type basic_socket_streambuf::implementation_type]
+[section:implementation basic_socket::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_socket] The underlying implementation of the I/O object.
+
+ implementation_type implementation;
+
+
+
+[endsect]
+
+
+
+[section:implementation_type basic_socket::implementation_type]
['Inherited from basic_io_object.]
-The underlying implementation type of I/O object.
+[indexterm2 implementation_type..basic_socket] The underlying implementation type of I/O object.
typedef service_type::implementation_type implementation_type;
@@ -13277,25 +14708,28 @@
[endsect]
-[section:io_control basic_socket_streambuf::io_control]
+[section:io_control basic_socket::io_control]
-Perform an IO control command on the socket.
+[indexterm2 io_control..basic_socket] Perform an IO control command on the socket.
- void ``[link boost_asio.reference.basic_socket_streambuf.io_control.overload1 io_control]``(
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
+ void ``[link boost_asio.reference.basic_socket.io_control.overload1 io_control]``(
IoControlCommand & command);
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.io_control.overload2 io_control]``(
+ 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);
-[section:overload1 basic_socket_streambuf::io_control (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload1 basic_socket::io_control (1 of 2 overloads)]
Perform an IO control command on the socket.
+ template<
+ typename ``[link boost_asio.reference.IoControlCommand IoControlCommand]``>
void io_control(
IoControlCommand & command);
@@ -13340,13 +14774,12 @@
-[section:overload2 basic_socket_streambuf::io_control (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::io_control (2 of 2 overloads)]
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);
@@ -13392,12 +14825,12 @@
[endsect]
-[section:io_service basic_socket_streambuf::io_service]
+[section:io_service basic_socket::io_service]
['Inherited from basic_io_object.]
-(Deprecated: use get_io_service().) Get the io_service associated with the object.
+[indexterm2 io_service..basic_socket] (Deprecated: use get_io_service().) Get the io_service associated with the object.
boost::asio::io_service & io_service();
@@ -13415,12 +14848,9 @@
-[section:is_open basic_socket_streambuf::is_open]
-
-
-['Inherited from basic_socket.]
+[section:is_open basic_socket::is_open]
-Determine whether the socket is open.
+[indexterm2 is_open..basic_socket] Determine whether the socket is open.
bool is_open() const;
@@ -13430,12 +14860,12 @@
-[section:keep_alive basic_socket_streambuf::keep_alive]
+[section:keep_alive basic_socket::keep_alive]
['Inherited from socket_base.]
-Socket option to send keep-alives.
+[indexterm2 keep_alive..basic_socket] Socket option to send keep-alives.
typedef implementation_defined keep_alive;
@@ -13473,12 +14903,12 @@
-[section:linger basic_socket_streambuf::linger]
+[section:linger basic_socket::linger]
['Inherited from socket_base.]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+[indexterm2 linger..basic_socket] Socket option to specify whether the socket lingers on close if unsent data is present.
typedef implementation_defined linger;
@@ -13516,20 +14946,17 @@
[endsect]
-[section:local_endpoint basic_socket_streambuf::local_endpoint]
+[section:local_endpoint basic_socket::local_endpoint]
-Get the local endpoint of the socket.
+[indexterm2 local_endpoint..basic_socket] Get the local endpoint of the socket.
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload1 local_endpoint]``() const;
+ endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload1 local_endpoint]``() const;
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload2 local_endpoint]``(
+ endpoint_type ``[link boost_asio.reference.basic_socket.local_endpoint.overload2 local_endpoint]``(
boost::system::error_code & ec) const;
-[section:overload1 basic_socket_streambuf::local_endpoint (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload1 basic_socket::local_endpoint (1 of 2 overloads)]
Get the local endpoint of the socket.
@@ -13569,10 +14996,7 @@
-[section:overload2 basic_socket_streambuf::local_endpoint (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::local_endpoint (2 of 2 overloads)]
Get the local endpoint of the socket.
@@ -13620,12 +15044,9 @@
[endsect]
-[section:lowest_layer basic_socket_streambuf::lowest_layer]
-
-
-['Inherited from basic_socket.]
+[section:lowest_layer basic_socket::lowest_layer]
-Get a reference to the lowest layer.
+[indexterm2 lowest_layer..basic_socket] Get a reference to the lowest layer.
lowest_layer_type & lowest_layer();
@@ -13643,14 +15064,11 @@
-[section:lowest_layer_type basic_socket_streambuf::lowest_layer_type]
-
-
-['Inherited from basic_socket.]
+[section:lowest_layer_type basic_socket::lowest_layer_type]
-A basic_socket is always the lowest layer.
+[indexterm2 lowest_layer_type..basic_socket] A basic_socket is always the lowest layer.
- typedef basic_socket< Protocol, StreamSocketService > lowest_layer_type;
+ typedef basic_socket< Protocol, SocketService > lowest_layer_type;
[heading Types]
@@ -13917,6 +15335,17 @@
]
+[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 Data Members]
[table
[[Name][Description]]
@@ -13943,6 +15372,22 @@
]
+[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. ]
+ ]
+
+]
+
The basic_socket class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
@@ -13959,12 +15404,12 @@
-[section:max_connections basic_socket_streambuf::max_connections]
+[section:max_connections basic_socket::max_connections]
['Inherited from socket_base.]
-The maximum length of the queue of pending incoming connections.
+[indexterm2 max_connections..basic_socket] The maximum length of the queue of pending incoming connections.
static const int max_connections = implementation_defined;
@@ -13974,12 +15419,12 @@
-[section:message_do_not_route basic_socket_streambuf::message_do_not_route]
+[section:message_do_not_route basic_socket::message_do_not_route]
['Inherited from socket_base.]
-Specify that the data should not be subject to routing.
+[indexterm2 message_do_not_route..basic_socket] Specify that the data should not be subject to routing.
static const int message_do_not_route = implementation_defined;
@@ -13989,12 +15434,12 @@
-[section:message_flags basic_socket_streambuf::message_flags]
+[section:message_flags basic_socket::message_flags]
['Inherited from socket_base.]
-Bitmask type for flags that can be passed to send and receive operations.
+[indexterm2 message_flags..basic_socket] Bitmask type for flags that can be passed to send and receive operations.
typedef int message_flags;
@@ -14005,12 +15450,12 @@
-[section:message_out_of_band basic_socket_streambuf::message_out_of_band]
+[section:message_out_of_band basic_socket::message_out_of_band]
['Inherited from socket_base.]
-Process out-of-band data.
+[indexterm2 message_out_of_band..basic_socket] Process out-of-band data.
static const int message_out_of_band = implementation_defined;
@@ -14020,12 +15465,12 @@
-[section:message_peek basic_socket_streambuf::message_peek]
+[section:message_peek basic_socket::message_peek]
['Inherited from socket_base.]
-Peek at incoming data without removing it from the input queue.
+[indexterm2 message_peek..basic_socket] Peek at incoming data without removing it from the input queue.
static const int message_peek = implementation_defined;
@@ -14035,12 +15480,9 @@
-[section:native basic_socket_streambuf::native]
-
-
-['Inherited from basic_socket.]
+[section:native basic_socket::native]
-Get the native socket representation.
+[indexterm2 native..basic_socket] Get the native socket representation.
native_type native();
@@ -14052,14 +15494,11 @@
-[section:native_type basic_socket_streambuf::native_type]
-
-
-['Inherited from basic_socket.]
+[section:native_type basic_socket::native_type]
-The native representation of a socket.
+[indexterm2 native_type..basic_socket] The native representation of a socket.
- typedef StreamSocketService::native_type native_type;
+ typedef SocketService::native_type native_type;
@@ -14068,12 +15507,12 @@
-[section:non_blocking_io basic_socket_streambuf::non_blocking_io]
+[section:non_blocking_io basic_socket::non_blocking_io]
['Inherited from socket_base.]
-IO control command to set the blocking mode of the socket.
+[indexterm2 non_blocking_io..basic_socket] IO control command to set the blocking mode of the socket.
typedef implementation_defined non_blocking_io;
@@ -14099,22 +15538,19 @@
[endsect]
-[section:open basic_socket_streambuf::open]
+[section:open basic_socket::open]
-Open the socket using the specified protocol.
+[indexterm2 open..basic_socket] Open the socket using the specified protocol.
- void ``[link boost_asio.reference.basic_socket_streambuf.open.overload1 open]``(
+ void ``[link boost_asio.reference.basic_socket.open.overload1 open]``(
const protocol_type & protocol = protocol_type());
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.open.overload2 open]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.open.overload2 open]``(
const protocol_type & protocol,
boost::system::error_code & ec);
-[section:overload1 basic_socket_streambuf::open (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload1 basic_socket::open (1 of 2 overloads)]
Open the socket using the specified protocol.
@@ -14159,10 +15595,7 @@
-[section:overload2 basic_socket_streambuf::open (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::open (2 of 2 overloads)]
Open the socket using the specified protocol.
@@ -14208,12 +15641,9 @@
[endsect]
-[section:protocol_type basic_socket_streambuf::protocol_type]
-
-
-['Inherited from basic_socket.]
+[section:protocol_type basic_socket::protocol_type]
-The protocol type.
+[indexterm2 protocol_type..basic_socket] The protocol type.
typedef Protocol protocol_type;
@@ -14224,12 +15654,12 @@
-[section:receive_buffer_size basic_socket_streambuf::receive_buffer_size]
+[section:receive_buffer_size basic_socket::receive_buffer_size]
['Inherited from socket_base.]
-Socket option for the receive buffer size of a socket.
+[indexterm2 receive_buffer_size..basic_socket] Socket option for the receive buffer size of a socket.
typedef implementation_defined receive_buffer_size;
@@ -14267,12 +15697,12 @@
-[section:receive_low_watermark basic_socket_streambuf::receive_low_watermark]
+[section:receive_low_watermark basic_socket::receive_low_watermark]
['Inherited from socket_base.]
-Socket option for the receive low watermark.
+[indexterm2 receive_low_watermark..basic_socket] Socket option for the receive low watermark.
typedef implementation_defined receive_low_watermark;
@@ -14309,20 +15739,17 @@
[endsect]
-[section:remote_endpoint basic_socket_streambuf::remote_endpoint]
+[section:remote_endpoint basic_socket::remote_endpoint]
-Get the remote endpoint of the socket.
+[indexterm2 remote_endpoint..basic_socket] Get the remote endpoint of the socket.
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload1 remote_endpoint]``() const;
+ endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload1 remote_endpoint]``() const;
- endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload2 remote_endpoint]``(
+ endpoint_type ``[link boost_asio.reference.basic_socket.remote_endpoint.overload2 remote_endpoint]``(
boost::system::error_code & ec) const;
-[section:overload1 basic_socket_streambuf::remote_endpoint (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload1 basic_socket::remote_endpoint (1 of 2 overloads)]
Get the remote endpoint of the socket.
@@ -14362,10 +15789,7 @@
-[section:overload2 basic_socket_streambuf::remote_endpoint (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::remote_endpoint (2 of 2 overloads)]
Get the remote endpoint of the socket.
@@ -14413,12 +15837,12 @@
[endsect]
-[section:reuse_address basic_socket_streambuf::reuse_address]
+[section:reuse_address basic_socket::reuse_address]
['Inherited from socket_base.]
-Socket option to allow the socket to be bound to an address that is already in use.
+[indexterm2 reuse_address..basic_socket] Socket option to allow the socket to be bound to an address that is already in use.
typedef implementation_defined reuse_address;
@@ -14456,12 +15880,12 @@
-[section:send_buffer_size basic_socket_streambuf::send_buffer_size]
+[section:send_buffer_size basic_socket::send_buffer_size]
['Inherited from socket_base.]
-Socket option for the send buffer size of a socket.
+[indexterm2 send_buffer_size..basic_socket] Socket option for the send buffer size of a socket.
typedef implementation_defined send_buffer_size;
@@ -14499,12 +15923,12 @@
-[section:send_low_watermark basic_socket_streambuf::send_low_watermark]
+[section:send_low_watermark basic_socket::send_low_watermark]
['Inherited from socket_base.]
-Socket option for the send low watermark.
+[indexterm2 send_low_watermark..basic_socket] Socket option for the send low watermark.
typedef implementation_defined send_low_watermark;
@@ -14542,14 +15966,29 @@
-[section:service_type basic_socket_streambuf::service_type]
+[section:service basic_socket::service]
['Inherited from basic_io_object.]
-The type of the service that will be used to provide I/O operations.
+[indexterm2 service..basic_socket] The service associated with the I/O object.
+
+ service_type & service;
+
+
+
+[endsect]
- typedef StreamSocketService service_type;
+
+
+[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;
@@ -14557,25 +15996,28 @@
[endsect]
-[section:set_option basic_socket_streambuf::set_option]
+[section:set_option basic_socket::set_option]
-Set an option on the socket.
+[indexterm2 set_option..basic_socket] Set an option on the socket.
- void ``[link boost_asio.reference.basic_socket_streambuf.set_option.overload1 set_option]``(
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket.set_option.overload1 set_option]``(
const SettableSocketOption & option);
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.set_option.overload2 set_option]``(
+ 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);
-[section:overload1 basic_socket_streambuf::set_option (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload1 basic_socket::set_option (1 of 2 overloads)]
Set an option on the socket.
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
void set_option(
const SettableSocketOption & option);
@@ -14619,13 +16061,12 @@
-[section:overload2 basic_socket_streambuf::set_option (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::set_option (2 of 2 overloads)]
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);
@@ -14669,22 +16110,19 @@
[endsect]
-[section:shutdown basic_socket_streambuf::shutdown]
+[section:shutdown basic_socket::shutdown]
-Disable sends or receives on the socket.
+[indexterm2 shutdown..basic_socket] Disable sends or receives on the socket.
- void ``[link boost_asio.reference.basic_socket_streambuf.shutdown.overload1 shutdown]``(
+ void ``[link boost_asio.reference.basic_socket.shutdown.overload1 shutdown]``(
shutdown_type what);
- boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.shutdown.overload2 shutdown]``(
+ boost::system::error_code ``[link boost_asio.reference.basic_socket.shutdown.overload2 shutdown]``(
shutdown_type what,
boost::system::error_code & ec);
-[section:overload1 basic_socket_streambuf::shutdown (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload1 basic_socket::shutdown (1 of 2 overloads)]
Disable sends or receives on the socket.
@@ -14730,10 +16168,7 @@
-[section:overload2 basic_socket_streambuf::shutdown (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket::shutdown (2 of 2 overloads)]
Disable sends or receives on the socket.
@@ -14780,12 +16215,12 @@
[endsect]
-[section:shutdown_type basic_socket_streambuf::shutdown_type]
+[section:shutdown_type basic_socket::shutdown_type]
['Inherited from socket_base.]
-Different ways a socket may be shutdown.
+[indexterm2 shutdown_type..basic_socket] Different ways a socket may be shutdown.
enum shutdown_type
@@ -14815,11 +16250,11 @@
-[section:_basic_socket_streambuf basic_socket_streambuf::~basic_socket_streambuf]
+[section:_basic_socket basic_socket::~basic_socket]
-Destructor flushes buffered data.
+[indexterm2 ~basic_socket..basic_socket] Protected destructor to prevent deletion through this type.
- virtual ~basic_socket_streambuf();
+ ~basic_socket();
@@ -14829,15 +16264,16 @@
[endsect]
-[section:basic_stream_socket basic_stream_socket]
+[section:basic_socket_acceptor basic_socket_acceptor]
-Provides stream-oriented socket functionality.
+Provides the ability to accept new connections.
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 >
+ 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]
@@ -14846,147 +16282,140 @@
[
- [[link boost_asio.reference.basic_stream_socket.broadcast [*broadcast]]]
+ [[link boost_asio.reference.basic_socket_acceptor.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_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.basic_stream_socket.debug [*debug]]]
+ [[link boost_asio.reference.basic_socket_acceptor.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_socket_acceptor.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_socket_acceptor.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_socket_acceptor.endpoint_type [*endpoint_type]]]
[The endpoint type. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.implementation_type [*implementation_type]]]
+ [[link boost_asio.reference.basic_socket_acceptor.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_socket_acceptor.keep_alive [*keep_alive]]]
[Socket option to send keep-alives. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.linger [*linger]]]
+ [[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.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]]]
+ [[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_stream_socket.native_type [*native_type]]]
- [The native representation of a socket. ]
+ [[link boost_asio.reference.basic_socket_acceptor.native_type [*native_type]]]
+ [The native representation of an acceptor. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.non_blocking_io [*non_blocking_io]]]
+ [[link boost_asio.reference.basic_socket_acceptor.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]]]
+ [[link boost_asio.reference.basic_socket_acceptor.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_socket_acceptor.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_socket_acceptor.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_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.basic_stream_socket.send_buffer_size [*send_buffer_size]]]
+ [[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.basic_stream_socket.send_low_watermark [*send_low_watermark]]]
+ [[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_stream_socket.service_type [*service_type]]]
+ [[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_stream_socket.shutdown_type [*shutdown_type]]]
+ [[link boost_asio.reference.basic_socket_acceptor.shutdown_type [*shutdown_type]]]
[Different ways a socket may be shutdown. ]
]
@@ -14998,148 +16427,83 @@
[[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_socket_acceptor.accept [*accept]]]
+ [Accept a new connection. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.available [*available]]]
- [Determine the number of bytes available for reading. ]
+ [[link boost_asio.reference.basic_socket_acceptor.assign [*assign]]]
+ [Assigns an existing native acceptor to the acceptor. ]
]
[
- [[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_socket_acceptor.async_accept [*async_accept]]]
+ [Start an asynchronous accept. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.bind [*bind]]]
- [Bind the socket to the given local endpoint. ]
+ [[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor [*basic_socket_acceptor]]]
+ [Construct an acceptor without opening it. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.cancel [*cancel]]]
- [Cancel all asynchronous operations associated with the socket. ]
+ [[link boost_asio.reference.basic_socket_acceptor.bind [*bind]]]
+ [Bind the acceptor to the given local endpoint. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.close [*close]]]
- [Close the socket. ]
+ [[link boost_asio.reference.basic_socket_acceptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the acceptor. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
+ [[link boost_asio.reference.basic_socket_acceptor.close [*close]]]
+ [Close the acceptor. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.get_io_service [*get_io_service]]]
+ [[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_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_socket_acceptor.get_option [*get_option]]]
+ [Get an option from the acceptor. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.io_service [*io_service]]]
+ [[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_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. ]
- ]
-
- [
- [[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. ]
+ [[link boost_asio.reference.basic_socket_acceptor.is_open [*is_open]]]
+ [Determine whether the acceptor is open. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.remote_endpoint [*remote_endpoint]]]
- [Get the remote endpoint of the socket. ]
+ [[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_stream_socket.send [*send]]]
- [Send some data on the socket. ]
+ [[link boost_asio.reference.basic_socket_acceptor.local_endpoint [*local_endpoint]]]
+ [Get the local endpoint of the acceptor. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.set_option [*set_option]]]
- [Set an option on the socket. ]
+ [[link boost_asio.reference.basic_socket_acceptor.native [*native]]]
+ [Get the native acceptor representation. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.shutdown [*shutdown]]]
- [Disable sends or receives on the socket. ]
+ [[link boost_asio.reference.basic_socket_acceptor.open [*open]]]
+ [Open the acceptor using the specified protocol. ]
]
[
- [[link boost_asio.reference.basic_stream_socket.write_some [*write_some]]]
- [Write some data to the socket. ]
+ [[link boost_asio.reference.basic_socket_acceptor.set_option [*set_option]]]
+ [Set an option on the acceptor. ]
]
]
@@ -15149,28 +16513,44 @@
[[Name][Description]]
[
- [[link boost_asio.reference.basic_stream_socket.max_connections [*max_connections]]]
+ [[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_stream_socket.message_do_not_route [*message_do_not_route]]]
+ [[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_stream_socket.message_out_of_band [*message_out_of_band]]]
+ [[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_stream_socket.message_peek [*message_peek]]]
+ [[link boost_asio.reference.basic_socket_acceptor.message_peek [*message_peek]]]
[Peek at incoming data without removing it from the input queue. ]
]
]
-The basic_stream_socket class template provides asynchronous and blocking stream-oriented socket functionality.
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_socket_acceptor.implementation [*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. ]
+ ]
+
+]
+
+The basic_socket_acceptor class template is used for accepting new socket connections.
[heading Thread Safety]
@@ -15179,73 +16559,111 @@
[*Shared] [*objects:] Unsafe.
+[heading Example]
+
+Opening a socket acceptor with the SO\_REUSEADDR option enabled:
-[section:assign basic_stream_socket::assign]
+ 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();
-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_type & native_socket);
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.assign.overload2 assign]``(
- const protocol_type & protocol,
- const native_type & native_socket,
+
+
+[section:accept basic_socket_acceptor::accept]
+
+[indexterm2 accept..basic_socket_acceptor] Accept a new connection.
+
+ 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);
+
+ 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);
+ 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);
-[section:overload1 basic_stream_socket::assign (1 of 2 overloads)]
+ 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);
-['Inherited from basic_socket.]
+[section:overload1 basic_socket_acceptor::accept (1 of 4 overloads)]
-Assign an existing native socket to the socket.
+Accept a new connection.
- void assign(
- const protocol_type & protocol,
- const native_type & native_socket);
+ template<
+ typename ``[link boost_asio.reference.SocketService SocketService]``>
+ void accept(
+ basic_socket< protocol_type, SocketService > & peer);
+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.
-[endsect]
+[heading Parameters]
+
+[variablelist
+
+[[peer][The socket into which the new connection will be accepted.]]
-[section:overload2 basic_stream_socket::assign (2 of 2 overloads)]
+]
+[heading Exceptions]
+
-['Inherited from basic_socket.]
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
-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);
+[heading Example]
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
+ boost::asio::ip::tcp::socket socket(io_service);
+ acceptor.accept(socket);
-[endsect]
-[endsect]
-[section:async_connect basic_stream_socket::async_connect]
+[endsect]
-['Inherited from basic_socket.]
-Start an asynchronous connect.
- void async_connect(
- const endpoint_type & peer_endpoint,
- ConnectHandler handler);
+[section:overload2 basic_socket_acceptor::accept (2 of 4 overloads)]
+
+Accept a new connection.
+ 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 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 returned to the closed state.
+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 Parameters]
@@ -15253,16 +16671,9 @@
[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
- );
+[[peer][The socket into which the new connection will be accepted.]]
-``
-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.]]
]
@@ -15270,21 +16681,16 @@
- void connect_handler(const boost::system::error_code& error)
+ 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)
{
- 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);
-
@@ -15294,19 +16700,18 @@
-[section:async_read_some basic_stream_socket::async_read_some]
+[section:overload3 basic_socket_acceptor::accept (3 of 4 overloads)]
-Start an asynchronous read.
+Accept a new connection and obtain the endpoint of the peer.
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.SocketService SocketService]``>
+ void accept(
+ basic_socket< protocol_type, SocketService > & peer,
+ endpoint_type & peer_endpoint);
-This function is used to asynchronously read data from the stream socket. The function call always returns immediately.
+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]
@@ -15314,74 +16719,53 @@
[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.
- );
+[[peer][The socket into which the new connection will be accepted.]]
-``
-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().]]
+[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
]
-[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 Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure.]]
+
+]
[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);
+
+ 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);
+
-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]
-Start an asynchronous receive.
+[section:overload4 basic_socket_acceptor::accept (4 of 4 overloads)]
- 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);
+Accept a new connection and obtain the endpoint of the peer.
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);
+ 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);
-[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.
+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]
@@ -15389,94 +16773,75 @@
[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.]]
+[[peer][The socket into which the new connection will be accepted.]]
-[[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.
- );
+[[peer_endpoint][An endpoint object which will receive the endpoint of the remote peer.]]
-``
-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 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);
+
+ 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.
+ }
-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:overload2 basic_stream_socket::async_receive (2 of 2 overloads)]
+[endsect]
-Start an asynchronous receive.
+[section:assign basic_socket_acceptor::assign]
- 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);
+[indexterm2 assign..basic_socket_acceptor] Assigns an existing native acceptor to the acceptor.
+ void ``[link boost_asio.reference.basic_socket_acceptor.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_type & native_acceptor);
-This function is used to asynchronously receive data from the stream socket. The function call always returns immediately.
+ 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 & ec);
-[heading Parameters]
-
+[section:overload1 basic_socket_acceptor::assign (1 of 2 overloads)]
-[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.]]
+Assigns an existing native acceptor to the acceptor.
-[[flags][Flags specifying how the receive call is to be made.]]
+ void assign(
+ const protocol_type & protocol,
+ const native_type & native_acceptor);
-[[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().]]
-]
+[endsect]
-[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);
+[section:overload2 basic_socket_acceptor::assign (2 of 2 overloads)]
+Assigns an existing native acceptor to the acceptor.
-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.
+ boost::system::error_code assign(
+ const protocol_type & protocol,
+ const native_type & native_acceptor,
+ boost::system::error_code & ec);
@@ -15485,39 +16850,39 @@
[endsect]
-[section:async_send basic_stream_socket::async_send]
+[section:async_accept basic_socket_acceptor::async_accept]
-Start an asynchronous send.
+[indexterm2 async_accept..basic_socket_acceptor] Start an asynchronous accept.
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);
+ 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);
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);
+ 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);
-[section:overload1 basic_stream_socket::async_send (1 of 2 overloads)]
+[section:overload1 basic_socket_acceptor::async_accept (1 of 2 overloads)]
-Start an asynchronous send.
+Start an asynchronous accept.
template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_send(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
+ 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 send data on the stream socket. The function call always returns immediately.
+This function is used to asynchronously accept a new connection into a socket. The function call always returns immediately.
[heading Parameters]
@@ -15525,35 +16890,39 @@
[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.]]
+[[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 send 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 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.
- std::size_t bytes_transferred // Number of bytes sent.
+ 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 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);
+
+ 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);
+
-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.
@@ -15561,20 +16930,20 @@
-[section:overload2 basic_stream_socket::async_send (2 of 2 overloads)]
+[section:overload2 basic_socket_acceptor::async_accept (2 of 2 overloads)]
-Start an asynchronous send.
+Start an asynchronous accept.
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);
+ 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 asynchronously send data on the stream socket. The function call always returns immediately.
+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]
@@ -15582,59 +16951,58 @@
[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.]]
+[[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.]]
-[[flags][Flags specifying how the send call is to be made.]]
+[[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 send 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 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.
- std::size_t bytes_transferred // Number of bytes sent.
+ 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().]]
+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);
+[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.
+[endsect]
+[section:basic_socket_acceptor basic_socket_acceptor::basic_socket_acceptor]
+[indexterm2 basic_socket_acceptor..basic_socket_acceptor] Construct an acceptor without opening it.
-[endsect]
+ ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload1 basic_socket_acceptor]``(
+ boost::asio::io_service & io_service);
+ ``[link boost_asio.reference.basic_socket_acceptor.basic_socket_acceptor.overload2 basic_socket_acceptor]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
-[endsect]
+ ``[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);
+ ``[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);
-[section:async_write_some basic_stream_socket::async_write_some]
-Start an asynchronous write.
+[section:overload1 basic_socket_acceptor::basic_socket_acceptor (1 of 4 overloads)]
- template<
- typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``,
- typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
- void async_write_some(
- const ConstBufferSequence & buffers,
- WriteHandler handler);
+Construct an acceptor without opening it.
+
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service);
-This function is used to asynchronously write data to the stream socket. The function call always returns immediately.
+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]
@@ -15642,67 +17010,38 @@
[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().]]
+[[io_service][The io\_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor. ]]
]
-[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]
-
-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;
-
- bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload2 at_mark]``(
- boost::system::error_code & ec) const;
+[section:overload2 basic_socket_acceptor::basic_socket_acceptor (2 of 4 overloads)]
-[section:overload1 basic_stream_socket::at_mark (1 of 2 overloads)]
+Construct an open acceptor.
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
-['Inherited from basic_socket.]
-Determine whether the socket is at the out-of-band data mark.
+This constructor creates an acceptor and automatically opens it.
- 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
+
+[[io_service][The 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.]]
-[heading Return Value]
-
-A bool indicating whether the socket is at the out-of-band data mark.
+]
[heading Exceptions]
@@ -15719,66 +17058,86 @@
-[section:overload2 basic_stream_socket::at_mark (2 of 2 overloads)]
+[section:overload3 basic_socket_acceptor::basic_socket_acceptor (3 of 4 overloads)]
+Construct an acceptor opened on the given endpoint.
-['Inherited from basic_socket.]
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint,
+ bool reuse_addr = true);
-Determine whether the socket is at the out-of-band data mark.
- bool at_mark(
- boost::system::error_code & ec) const;
+This constructor creates an acceptor and automatically opens it to listen for new connections on the specified endpoint.
-This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
+[heading Parameters]
+
+[variablelist
+
+[[io_service][The io\_service object that the acceptor will use to dispatch handlers for any asynchronous operations performed on the acceptor.]]
-[heading Parameters]
+[[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 Exceptions]
[variablelist
-[[ec][Set to indicate what error occurred, if any.]]
+[[boost::system::system_error][Thrown on failure.]]
]
-[heading Return Value]
+[heading Remarks]
-A bool indicating whether the socket is at the out-of-band data mark.
+This constructor is equivalent to the following code:
+ 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);
-[endsect]
-[endsect]
-[section:available basic_stream_socket::available]
-Determine the number of bytes available for reading.
+[endsect]
- std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload1 available]``() const;
- std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload2 available]``(
- boost::system::error_code & ec) const;
+[section:overload4 basic_socket_acceptor::basic_socket_acceptor (4 of 4 overloads)]
-[section:overload1 basic_stream_socket::available (1 of 2 overloads)]
+Construct a basic_socket_acceptor on an existing native acceptor.
+ basic_socket_acceptor(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_type & native_acceptor);
-['Inherited from basic_socket.]
-Determine the number of bytes available for reading.
+This constructor creates an acceptor object to hold an existing native acceptor.
- std::size_t available() const;
+[heading Parameters]
+
-This function is used to determine the number of bytes that may be read without blocking.
+[variablelist
+
+[[io_service][The 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.]]
-[heading Return Value]
-
-The number of bytes that may be read without blocking, or 0 if an error occurs.
+[[native_acceptor][A native acceptor.]]
+
+]
[heading Exceptions]
@@ -15794,19 +17153,29 @@
[endsect]
+[endsect]
-[section:overload2 basic_stream_socket::available (2 of 2 overloads)]
+[section:bind basic_socket_acceptor::bind]
+[indexterm2 bind..basic_socket_acceptor] Bind the acceptor to the given local endpoint.
-['Inherited from basic_socket.]
+ void ``[link boost_asio.reference.basic_socket_acceptor.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
-Determine the number of bytes available for reading.
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
- std::size_t available(
- boost::system::error_code & ec) const;
+[section:overload1 basic_socket_acceptor::bind (1 of 2 overloads)]
-This function is used to determine the number of bytes that may be read without blocking.
+Bind the acceptor to the given local endpoint.
+
+ void bind(
+ const endpoint_type & endpoint);
+
+
+This function binds the socket acceptor to the specified endpoint on the local machine.
[heading Parameters]
@@ -15814,51 +17183,46 @@
[variablelist
-[[ec][Set to indicate what error occurred, if any.]]
+[[endpoint][An endpoint on the local machine to which the socket acceptor will be bound.]]
]
-[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]
+[heading Example]
+
-[endsect]
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ acceptor.open(boost::asio::ip::tcp::v4());
+ acceptor.bind(boost::asio::ip::tcp::endpoint(12345));
-[section:basic_stream_socket basic_stream_socket::basic_stream_socket]
-Construct a basic_stream_socket without opening it.
- ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 basic_stream_socket]``(
- boost::asio::io_service & io_service);
- ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 basic_stream_socket]``(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
- ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 basic_stream_socket]``(
- boost::asio::io_service & io_service,
- const endpoint_type & endpoint);
- ``[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);
+[endsect]
-[section:overload1 basic_stream_socket::basic_stream_socket (1 of 4 overloads)]
-Construct a basic_stream_socket without opening it.
+[section:overload2 basic_socket_acceptor::bind (2 of 2 overloads)]
- basic_stream_socket(
- boost::asio::io_service & io_service);
+Bind the acceptor to the given local endpoint.
+
+ boost::system::error_code bind(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
-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.
+This function binds the socket acceptor to the specified endpoint on the local machine.
[heading Parameters]
@@ -15866,117 +17230,130 @@
[variablelist
-[[io_service][The 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 socket acceptor will be bound.]]
+
+[[ec][Set to indicate what error occurred, if any.]]
]
+[heading Example]
+
-[endsect]
+ 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.
+ }
-[section:overload2 basic_stream_socket::basic_stream_socket (2 of 4 overloads)]
-Construct and open a basic_stream_socket.
- basic_stream_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol);
+[endsect]
-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.
+[endsect]
-[heading Parameters]
-
-[variablelist
-
-[[io_service][The io\_service object that the stream socket will use to dispatch handlers for any asynchronous operations performed on the socket.]]
+[section:broadcast basic_socket_acceptor::broadcast]
-[[protocol][An object specifying protocol parameters to be used.]]
-]
+['Inherited from socket_base.]
-[heading Exceptions]
-
+[indexterm2 broadcast..basic_socket_acceptor] Socket option to permit sending of broadcast messages.
-[variablelist
-
-[[boost::system::system_error][Thrown on failure. ]]
+ typedef implementation_defined broadcast;
-]
+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:overload3 basic_stream_socket::basic_stream_socket (3 of 4 overloads)]
-Construct a 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);
+Getting the current option value:
-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.
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option;
+ socket.get_option(option);
+ bool is_set = option.value();
-[heading Parameters]
-
-[variablelist
-
-[[io_service][The 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]
-
+[endsect]
-[variablelist
+
+
+[section:bytes_readable basic_socket_acceptor::bytes_readable]
+
+
+['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.
+
+ typedef implementation_defined bytes_readable;
+
+
+
+Implements the FIONREAD IO control command.
+
+
+[heading Example]
-[[boost::system::system_error][Thrown on failure. ]]
-]
+ 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();
-[endsect]
-[section:overload4 basic_stream_socket::basic_stream_socket (4 of 4 overloads)]
-Construct a basic_stream_socket on an existing native socket.
+[endsect]
- basic_stream_socket(
- boost::asio::io_service & io_service,
- const protocol_type & protocol,
- const native_type & native_socket);
+[section:cancel basic_socket_acceptor::cancel]
-This constructor creates a stream socket object to hold an existing native socket.
+[indexterm2 cancel..basic_socket_acceptor] Cancel all asynchronous operations associated with the acceptor.
+ void ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload1 cancel]``();
-[heading Parameters]
-
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
-[variablelist
-
-[[io_service][The 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.]]
+[section:overload1 basic_socket_acceptor::cancel (1 of 2 overloads)]
-[[native_socket][The new underlying socket implementation.]]
+Cancel all asynchronous operations associated with the acceptor.
+
+ 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]
@@ -15992,83 +17369,82 @@
[endsect]
-[endsect]
-
-[section:bind basic_stream_socket::bind]
-Bind the socket to the given local endpoint.
+[section:overload2 basic_socket_acceptor::cancel (2 of 2 overloads)]
- void ``[link boost_asio.reference.basic_stream_socket.bind.overload1 bind]``(
- const endpoint_type & endpoint);
+Cancel all asynchronous operations associated with the acceptor.
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.bind.overload2 bind]``(
- const endpoint_type & endpoint,
+ boost::system::error_code cancel(
boost::system::error_code & ec);
-[section:overload1 basic_stream_socket::bind (1 of 2 overloads)]
+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.
-['Inherited from basic_socket.]
+[heading Parameters]
+
-Bind the socket to the given local endpoint.
+[variablelist
+
+[[ec][Set to indicate what error occurred, if any. ]]
- void bind(
- const endpoint_type & endpoint);
+]
-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.]]
+[endsect]
-]
+[section:close basic_socket_acceptor::close]
-[heading Exceptions]
-
+[indexterm2 close..basic_socket_acceptor] Close the acceptor.
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
+ void ``[link boost_asio.reference.basic_socket_acceptor.close.overload1 close]``();
-]
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.close.overload2 close]``(
+ boost::system::error_code & ec);
-[heading Example]
-
+[section:overload1 basic_socket_acceptor::close (1 of 2 overloads)]
- 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));
+Close the acceptor.
+ void close();
+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.
-[endsect]
+[heading Exceptions]
+
+
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+]
-[section:overload2 basic_stream_socket::bind (2 of 2 overloads)]
+[endsect]
-['Inherited from basic_socket.]
-Bind the socket to the given local endpoint.
- boost::system::error_code bind(
- const endpoint_type & endpoint,
+[section:overload2 basic_socket_acceptor::close (2 of 2 overloads)]
+
+Close the acceptor.
+
+ boost::system::error_code close(
boost::system::error_code & ec);
-This function binds the socket to the specified endpoint on the local machine.
+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]
@@ -16076,8 +17452,6 @@
[variablelist
-[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
-
[[ec][Set to indicate what error occurred, if any.]]
]
@@ -16086,11 +17460,10 @@
- boost::asio::ip::tcp::socket socket(io_service);
- socket.open(boost::asio::ip::tcp::v4());
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
+ ...
boost::system::error_code ec;
- socket.bind(boost::asio::ip::tcp::endpoint(
- boost::asio::ip::tcp::v4(), 12345), ec);
+ acceptor.close(ec);
if (ec)
{
// An error occurred.
@@ -16107,27 +17480,27 @@
[endsect]
-[section:broadcast basic_stream_socket::broadcast]
+[section:debug basic_socket_acceptor::debug]
['Inherited from socket_base.]
-Socket option to permit sending of broadcast messages.
+[indexterm2 debug..basic_socket_acceptor] Socket option to enable socket-level debugging.
- typedef implementation_defined broadcast;
+ typedef implementation_defined debug;
-Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
+Implements the SOL\_SOCKET/SO\_DEBUG 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::debug option(true);
socket.set_option(option);
@@ -16135,9 +17508,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::debug option;
socket.get_option(option);
bool is_set = option.value();
@@ -16150,160 +17523,164 @@
-[section:bytes_readable basic_stream_socket::bytes_readable]
+[section:do_not_route basic_socket_acceptor::do_not_route]
['Inherited from socket_base.]
-IO control command to get the amount of data that can be read without blocking.
+[indexterm2 do_not_route..basic_socket_acceptor] Socket option to prevent routing, use local interfaces only.
- typedef implementation_defined bytes_readable;
+ typedef implementation_defined do_not_route;
-Implements the FIONREAD IO control command.
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
-[heading Example]
+[heading Examples]
+Setting the option:
-
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::udp::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::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();
-[endsect]
-[section:cancel basic_stream_socket::cancel]
-Cancel all asynchronous operations associated with the socket.
- void ``[link boost_asio.reference.basic_stream_socket.cancel.overload1 cancel]``();
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.cancel.overload2 cancel]``(
- boost::system::error_code & ec);
+[endsect]
-[section:overload1 basic_stream_socket::cancel (1 of 2 overloads)]
+[section:enable_connection_aborted basic_socket_acceptor::enable_connection_aborted]
-['Inherited from basic_socket.]
-Cancel all asynchronous operations associated with the socket.
+['Inherited from socket_base.]
- void cancel();
+[indexterm2 enable_connection_aborted..basic_socket_acceptor] Socket option to report aborted connections on accept.
+ typedef implementation_defined enable_connection_aborted;
-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]
-
+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]
-[[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);
-[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:
+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();
-* 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)]
+[section:endpoint_type basic_socket_acceptor::endpoint_type]
+[indexterm2 endpoint_type..basic_socket_acceptor] The endpoint type.
-['Inherited from basic_socket.]
+ typedef Protocol::endpoint endpoint_type;
-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.
+[endsect]
-[heading Parameters]
-
-[variablelist
-
-[[ec][Set to indicate what error occurred, if any.]]
+[section:get_io_service basic_socket_acceptor::get_io_service]
-]
-[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:
+['Inherited from basic_io_object.]
-* It will only cancel asynchronous operations that were initiated in the current thread.
+[indexterm2 get_io_service..basic_socket_acceptor] Get the io_service associated with the object.
-* 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.
+ boost::asio::io_service & get_io_service();
-For portable cancellation, consider using one of the following alternatives:
+This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
-* 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.
+[heading Return Value]
+
+A reference to the io_service object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
-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]
+[section:get_option basic_socket_acceptor::get_option]
-Close the socket.
+[indexterm2 get_option..basic_socket_acceptor] Get an option from the acceptor.
- void ``[link boost_asio.reference.basic_stream_socket.close.overload1 close]``();
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.get_option.overload1 get_option]``(
+ GettableSocketOption & option);
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.close.overload2 close]``(
+ 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);
-[section:overload1 basic_stream_socket::close (1 of 2 overloads)]
+[section:overload1 basic_socket_acceptor::get_option (1 of 2 overloads)]
+Get an option from the acceptor.
-['Inherited from basic_socket.]
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ void get_option(
+ GettableSocketOption & option);
-Close the socket.
- void close();
+This function is used to get the current value of an option on 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 Parameters]
+
+[variablelist
+
+[[option][The option value to be obtained from the acceptor.]]
+
+]
[heading Exceptions]
@@ -16314,28 +17691,37 @@
]
-[heading Remarks]
-
-For portable behaviour with respect to graceful closure of a connected socket, call shutdown() before closing the socket.
+[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:overload2 basic_stream_socket::close (2 of 2 overloads)]
+[endsect]
-['Inherited from basic_socket.]
-Close the socket.
+[section:overload2 basic_socket_acceptor::get_option (2 of 2 overloads)]
- boost::system::error_code close(
+Get an option from the acceptor.
+
+ template<
+ typename ``[link boost_asio.reference.GettableSocketOption GettableSocketOption]``>
+ boost::system::error_code get_option(
+ GettableSocketOption & option,
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.
+This function is used to get the current value of an option on the acceptor.
[heading Parameters]
@@ -16343,30 +17729,30 @@
[variablelist
+[[option][The option value to be obtained from the acceptor.]]
+
[[ec][Set to indicate what error occurred, if any.]]
]
[heading Example]
+Getting the value of the SOL\_SOCKET/SO\_REUSEADDR option:
-
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
...
+ boost::asio::ip::tcp::acceptor::reuse_address option;
boost::system::error_code ec;
- socket.close(ec);
+ acceptor.get_option(option, ec);
if (ec)
{
// An error occurred.
}
+ bool is_set = option.get();
-[heading Remarks]
-
-For portable behaviour with respect to graceful closure of a connected socket, call shutdown() before closing the socket.
-
[endsect]
@@ -16374,62 +17760,30 @@
[endsect]
-[section:connect basic_stream_socket::connect]
-
-Connect the socket to the specified endpoint.
-
- void ``[link boost_asio.reference.basic_stream_socket.connect.overload1 connect]``(
- const endpoint_type & peer_endpoint);
-
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.connect.overload2 connect]``(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
-
-
-[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);
+[section:implementation basic_socket_acceptor::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.
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is returned to the closed state.
+['Inherited from basic_io_object.]
+[indexterm2 implementation..basic_socket_acceptor] The underlying implementation of the I/O object.
-[heading Parameters]
-
+ implementation_type implementation;
-[variablelist
-
-[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
-]
-[heading Exceptions]
-
+[endsect]
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
-]
-[heading Example]
-
+[section:implementation_type basic_socket_acceptor::implementation_type]
- 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);
+['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;
@@ -16438,71 +17792,53 @@
-[section:overload2 basic_stream_socket::connect (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:io_service basic_socket_acceptor::io_service]
-Connect the socket to the specified endpoint.
- boost::system::error_code connect(
- const endpoint_type & peer_endpoint,
- boost::system::error_code & ec);
+['Inherited from basic_io_object.]
+[indexterm2 io_service..basic_socket_acceptor] (Deprecated: use get_io_service().) Get the io_service associated with the object.
-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::asio::io_service & io_service();
-The socket is automatically opened if it is not already open. If the connect fails, and the socket was automatically opened, the socket is returned to the closed state.
+This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
-[heading Parameters]
-
-[variablelist
-
-[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
+[heading Return Value]
+
+A reference to the io_service object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
-[[ec][Set to indicate what error occurred, if any.]]
-]
-[heading Example]
-
+[endsect]
- 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.
- }
+[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]
-[endsect]
-
-[section:debug basic_stream_socket::debug]
+[section:keep_alive basic_socket_acceptor::keep_alive]
['Inherited from socket_base.]
-Socket option to enable socket-level debugging.
+[indexterm2 keep_alive..basic_socket_acceptor] Socket option to send keep-alives.
- typedef implementation_defined debug;
+ typedef implementation_defined keep_alive;
-Implements the SOL\_SOCKET/SO\_DEBUG socket option.
+Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
[heading Examples]
@@ -16511,7 +17847,7 @@
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::socket_base::debug option(true);
+ boost::asio::socket_base::keep_alive option(true);
socket.set_option(option);
@@ -16521,7 +17857,7 @@
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::socket_base::debug option;
+ boost::asio::socket_base::keep_alive option;
socket.get_option(option);
bool is_set = option.value();
@@ -16534,27 +17870,27 @@
-[section:do_not_route basic_stream_socket::do_not_route]
+[section:linger basic_socket_acceptor::linger]
['Inherited from socket_base.]
-Socket option to prevent routing, use local interfaces only.
+[indexterm2 linger..basic_socket_acceptor] Socket option to specify whether the socket lingers on close if unsent data is present.
- typedef implementation_defined do_not_route;
+ typedef implementation_defined linger;
-Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
+Implements the SOL\_SOCKET/SO\_LINGER 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::do_not_route option(true);
+ boost::asio::socket_base::linger option(true, 30);
socket.set_option(option);
@@ -16562,11 +17898,12 @@
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::do_not_route option;
+ boost::asio::socket_base::linger option;
socket.get_option(option);
- bool is_set = option.value();
+ bool is_set = option.enabled();
+ unsigned short timeout = option.timeout();
@@ -16576,119 +17913,122 @@
[endsect]
+[section:listen basic_socket_acceptor::listen]
+
+[indexterm2 listen..basic_socket_acceptor] Place the acceptor into the state where it will listen for new connections.
-[section:enable_connection_aborted basic_stream_socket::enable_connection_aborted]
+ void ``[link boost_asio.reference.basic_socket_acceptor.listen.overload1 listen]``(
+ int backlog = socket_base::max_connections);
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.listen.overload2 listen]``(
+ int backlog,
+ boost::system::error_code & ec);
-['Inherited from socket_base.]
-Socket option to report aborted connections on accept.
+[section:overload1 basic_socket_acceptor::listen (1 of 2 overloads)]
- typedef implementation_defined enable_connection_aborted;
+Place the acceptor into the state where it will listen for new connections.
+ void listen(
+ int backlog = socket_base::max_connections);
-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.
+This function puts the socket acceptor into the state where it may accept new connections.
-[heading Examples]
+[heading Parameters]
+
+
+[variablelist
-Setting the option:
+[[backlog][The maximum length of the queue of pending connections.]]
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::enable_connection_aborted option(true);
- acceptor.set_option(option);
+]
+[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::enable_connection_aborted option;
- acceptor.get_option(option);
- bool is_set = option.value();
+[endsect]
+[section:overload2 basic_socket_acceptor::listen (2 of 2 overloads)]
+Place the acceptor into the state where it will listen for new connections.
-[endsect]
+ boost::system::error_code listen(
+ int backlog,
+ boost::system::error_code & ec);
+This function puts the socket acceptor into the state where it may accept new connections.
-[section:endpoint_type basic_stream_socket::endpoint_type]
-The endpoint type.
+[heading Parameters]
+
- typedef Protocol::endpoint endpoint_type;
+[variablelist
+
+[[backlog][The maximum length of the queue of pending connections.]]
+[[ec][Set to indicate what error occurred, if any.]]
+]
+[heading Example]
+
-[endsect]
+ 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.
+ }
-[section:get_io_service basic_stream_socket::get_io_service]
-['Inherited from basic_io_object.]
-Get the io_service associated with the object.
- boost::asio::io_service & get_io_service();
+[endsect]
-This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
+[endsect]
+[section:local_endpoint basic_socket_acceptor::local_endpoint]
-[heading Return Value]
-
-A reference to the io_service object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
-
-
-
-[endsect]
-
+[indexterm2 local_endpoint..basic_socket_acceptor] Get the local endpoint of the acceptor.
-[section:get_option basic_stream_socket::get_option]
-
-Get an option from the socket.
-
- void ``[link boost_asio.reference.basic_stream_socket.get_option.overload1 get_option]``(
- GettableSocketOption & option) const;
+ endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload1 local_endpoint]``() const;
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.get_option.overload2 get_option]``(
- GettableSocketOption & option,
+ endpoint_type ``[link boost_asio.reference.basic_socket_acceptor.local_endpoint.overload2 local_endpoint]``(
boost::system::error_code & ec) const;
-[section:overload1 basic_stream_socket::get_option (1 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
-
-Get an option from the socket.
-
- void get_option(
- GettableSocketOption & option) const;
+[section:overload1 basic_socket_acceptor::local_endpoint (1 of 2 overloads)]
+Get the local endpoint of the acceptor.
-This function is used to get the current value of an option on the socket.
+ endpoint_type local_endpoint() const;
-[heading Parameters]
-
+This function is used to obtain the locally bound endpoint of the acceptor.
-[variablelist
-
-[[option][The option value to be obtained from the socket.]]
-]
+[heading Return Value]
+
+An object that represents the local endpoint of the acceptor.
[heading Exceptions]
@@ -16701,13 +18041,11 @@
[heading Example]
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
- boost::asio::ip::tcp::socket socket(io_service);
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
...
- boost::asio::ip::tcp::socket::keep_alive option;
- socket.get_option(option);
- bool is_set = option.get();
+ boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint();
@@ -16718,19 +18056,15 @@
-[section:overload2 basic_stream_socket::get_option (2 of 2 overloads)]
-
-
-['Inherited from basic_socket.]
+[section:overload2 basic_socket_acceptor::local_endpoint (2 of 2 overloads)]
-Get an option from the socket.
+Get the local endpoint of the acceptor.
- boost::system::error_code get_option(
- GettableSocketOption & option,
+ endpoint_type local_endpoint(
boost::system::error_code & ec) const;
-This function is used to get the current value of an option on the socket.
+This function is used to obtain the locally bound endpoint of the acceptor.
[heading Parameters]
@@ -16738,26 +18072,26 @@
[variablelist
-[[option][The option value to be obtained from the socket.]]
-
[[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.
+
[heading Example]
-Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
- boost::asio::ip::tcp::socket socket(io_service);
+
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
...
- boost::asio::ip::tcp::socket::keep_alive option;
boost::system::error_code ec;
- socket.get_option(option, ec);
+ boost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec);
if (ec)
{
// An error occurred.
}
- bool is_set = option.get();
@@ -16770,45 +18104,161 @@
[endsect]
-[section:implementation_type basic_stream_socket::implementation_type]
+[section:max_connections basic_socket_acceptor::max_connections]
-['Inherited from basic_io_object.]
+['Inherited from socket_base.]
-The underlying implementation type of I/O object.
+[indexterm2 max_connections..basic_socket_acceptor] The maximum length of the queue of pending incoming connections.
- typedef service_type::implementation_type implementation_type;
+ static const int max_connections = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:message_do_not_route basic_socket_acceptor::message_do_not_route]
+
+
+['Inherited from socket_base.]
+[indexterm2 message_do_not_route..basic_socket_acceptor] Specify that the data should not be subject to routing.
+
+ static const int message_do_not_route = implementation_defined;
[endsect]
-[section:io_control basic_stream_socket::io_control]
-Perform an IO control command on the socket.
+[section:message_flags basic_socket_acceptor::message_flags]
- void ``[link boost_asio.reference.basic_stream_socket.io_control.overload1 io_control]``(
- IoControlCommand & command);
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.io_control.overload2 io_control]``(
- IoControlCommand & command,
- boost::system::error_code & ec);
+['Inherited from socket_base.]
+[indexterm2 message_flags..basic_socket_acceptor] Bitmask type for flags that can be passed to send and receive operations.
-[section:overload1 basic_stream_socket::io_control (1 of 2 overloads)]
+ typedef int message_flags;
-['Inherited from basic_socket.]
-Perform an IO control command on the socket.
- void io_control(
- IoControlCommand & command);
+[endsect]
-This function is used to execute an IO control command on the socket.
+
+[section:message_out_of_band basic_socket_acceptor::message_out_of_band]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 message_out_of_band..basic_socket_acceptor] Process out-of-band data.
+
+ static const int message_out_of_band = implementation_defined;
+
+
+
+[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.
+
+ static const int message_peek = implementation_defined;
+
+
+
+[endsect]
+
+
+
+[section:native basic_socket_acceptor::native]
+
+[indexterm2 native..basic_socket_acceptor] Get the native acceptor representation.
+
+ native_type native();
+
+
+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]
+
+
+
+[section:native_type basic_socket_acceptor::native_type]
+
+[indexterm2 native_type..basic_socket_acceptor] The native representation of an acceptor.
+
+ typedef SocketAcceptorService::native_type native_type;
+
+
+
+
+[endsect]
+
+
+
+[section:non_blocking_io basic_socket_acceptor::non_blocking_io]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 non_blocking_io..basic_socket_acceptor] 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);
+
+
+
+
+
+
+[endsect]
+
+
+[section:open basic_socket_acceptor::open]
+
+[indexterm2 open..basic_socket_acceptor] Open the acceptor using the specified protocol.
+
+ void ``[link boost_asio.reference.basic_socket_acceptor.open.overload1 open]``(
+ const protocol_type & protocol = protocol_type());
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_acceptor.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+
+
+[section:overload1 basic_socket_acceptor::open (1 of 2 overloads)]
+
+Open the acceptor using the specified protocol.
+
+ void open(
+ const protocol_type & protocol = protocol_type());
+
+
+This function opens the socket acceptor so that it will use the specified protocol.
[heading Parameters]
@@ -16816,7 +18266,7 @@
[variablelist
-[[command][The IO control command to be performed on the socket.]]
+[[protocol][An object specifying which protocol is to be used.]]
]
@@ -16831,36 +18281,30 @@
[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.
- 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]
@@ -16868,7 +18312,7 @@
[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.]]
@@ -16876,18 +18320,15 @@
[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();
@@ -16900,37 +18341,55 @@
[endsect]
-[section:io_service basic_stream_socket::io_service]
+[section:protocol_type basic_socket_acceptor::protocol_type]
+[indexterm2 protocol_type..basic_socket_acceptor] The protocol type.
-['Inherited from basic_io_object.]
+ typedef Protocol protocol_type;
-(Deprecated: use get_io_service().) Get the io_service associated with the object.
- boost::asio::io_service & io_service();
-This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
+[endsect]
-[heading Return Value]
-
-A reference to the io_service object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+[section:receive_buffer_size basic_socket_acceptor::receive_buffer_size]
-[endsect]
+['Inherited from socket_base.]
+
+[indexterm2 receive_buffer_size..basic_socket_acceptor] Socket option for the receive buffer size of a socket.
+ typedef implementation_defined receive_buffer_size;
-[section:is_open basic_stream_socket::is_open]
+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();
-['Inherited from basic_socket.]
-Determine whether the socket is open.
- bool is_open() const;
@@ -16938,18 +18397,18 @@
-[section:keep_alive basic_stream_socket::keep_alive]
+[section:receive_low_watermark basic_socket_acceptor::receive_low_watermark]
['Inherited from socket_base.]
-Socket option to send keep-alives.
+[indexterm2 receive_low_watermark..basic_socket_acceptor] Socket option for the receive low watermark.
- typedef implementation_defined keep_alive;
+ typedef implementation_defined receive_low_watermark;
-Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
+Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
[heading Examples]
@@ -16958,7 +18417,7 @@
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::socket_base::keep_alive option(true);
+ boost::asio::socket_base::receive_low_watermark option(1024);
socket.set_option(option);
@@ -16968,9 +18427,9 @@
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::socket_base::keep_alive option;
+ boost::asio::socket_base::receive_low_watermark option;
socket.get_option(option);
- bool is_set = option.value();
+ int size = option.value();
@@ -16981,40 +18440,39 @@
-[section:linger basic_stream_socket::linger]
+[section:reuse_address basic_socket_acceptor::reuse_address]
['Inherited from socket_base.]
-Socket option to specify whether the socket lingers on close if unsent data is present.
+[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 linger;
+ typedef implementation_defined reuse_address;
-Implements the SOL\_SOCKET/SO\_LINGER socket option.
+Implements the SOL\_SOCKET/SO\_REUSEADDR socket option.
[heading Examples]
Setting the option:
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
...
- boost::asio::socket_base::linger option(true, 30);
- socket.set_option(option);
+ boost::asio::socket_base::reuse_address option(true);
+ acceptor.set_option(option);
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::linger option;
- socket.get_option(option);
- bool is_set = option.enabled();
- unsigned short timeout = option.timeout();
+ boost::asio::socket_base::reuse_address option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
@@ -17024,49 +18482,40 @@
[endsect]
-[section:local_endpoint basic_stream_socket::local_endpoint]
-
-Get the local endpoint of the socket.
-
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload1 local_endpoint]``() const;
-
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 local_endpoint]``(
- boost::system::error_code & ec) const;
+[section:send_buffer_size basic_socket_acceptor::send_buffer_size]
-[section:overload1 basic_stream_socket::local_endpoint (1 of 2 overloads)]
+['Inherited from socket_base.]
-['Inherited from basic_socket.]
+[indexterm2 send_buffer_size..basic_socket_acceptor] Socket option for the send buffer size of a socket.
-Get the local endpoint of the socket.
+ typedef implementation_defined send_buffer_size;
- endpoint_type local_endpoint() const;
-This function is used to obtain the locally bound endpoint of the socket.
+Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
-[heading Return Value]
-
-An object that represents the local endpoint of the socket.
+[heading Examples]
+
+Setting the option:
-[heading Exceptions]
-
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::send_buffer_size option(8192);
+ socket.set_option(option);
-[variablelist
-
-[[boost::system::system_error][Thrown on failure.]]
-]
-[heading Example]
-
+Getting the current option value:
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint();
+ boost::asio::socket_base::send_buffer_size option;
+ socket.get_option(option);
+ int size = option.value();
@@ -17077,45 +18526,39 @@
-[section:overload2 basic_stream_socket::local_endpoint (2 of 2 overloads)]
+[section:send_low_watermark basic_socket_acceptor::send_low_watermark]
-['Inherited from basic_socket.]
+['Inherited from socket_base.]
-Get the local endpoint of the socket.
+[indexterm2 send_low_watermark..basic_socket_acceptor] Socket option for the send low watermark.
- endpoint_type local_endpoint(
- boost::system::error_code & ec) const;
+ typedef implementation_defined send_low_watermark;
-This function is used to obtain the locally bound endpoint of the socket.
+Implements the SOL\_SOCKET/SO\_SNDLOWAT 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_low_watermark option(1024);
+ 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]
-
- boost::asio::ip::tcp::socket socket(io_service);
+Getting the current option value:
+
+ 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_low_watermark option;
+ socket.get_option(option);
+ int size = option.value();
@@ -17125,189 +18568,481 @@
[endsect]
-[endsect]
-
-[section:lowest_layer basic_stream_socket::lowest_layer]
+[section:service basic_socket_acceptor::service]
-['Inherited from basic_socket.]
+['Inherited from basic_io_object.]
-Get a reference to the lowest layer.
+[indexterm2 service..basic_socket_acceptor] The service associated with the I/O object.
- lowest_layer_type & lowest_layer();
+ service_type & service;
-This function returns a reference to the lowest layer in a stack of layers. Since a basic_socket 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:service_type basic_socket_acceptor::service_type]
-[endsect]
+['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.
-[section:lowest_layer_type basic_stream_socket::lowest_layer_type]
+ typedef SocketAcceptorService service_type;
-['Inherited from basic_socket.]
-A basic_socket is always the lowest layer.
- typedef basic_socket< Protocol, StreamSocketService > lowest_layer_type;
+[endsect]
-[heading Types]
-[table
- [[Name][Description]]
+[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.broadcast [*broadcast]]]
- [Socket option to permit sending of broadcast messages. ]
-
- ]
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void ``[link boost_asio.reference.basic_socket_acceptor.set_option.overload1 set_option]``(
+ const SettableSocketOption & option);
- [
+ 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);
- [[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. ]
-
- ]
- [
+[section:overload1 basic_socket_acceptor::set_option (1 of 2 overloads)]
- [[link boost_asio.reference.basic_socket.debug [*debug]]]
- [Socket option to enable socket-level debugging. ]
-
- ]
+Set an option on the acceptor.
- [
+ template<
+ typename ``[link boost_asio.reference.SettableSocketOption SettableSocketOption]``>
+ void set_option(
+ const SettableSocketOption & option);
- [[link boost_asio.reference.basic_socket.do_not_route [*do_not_route]]]
- [Socket option to prevent routing, use local interfaces only. ]
-
- ]
- [
+This function is used to 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. ]
-
- ]
- [
+[heading Parameters]
+
- [[link boost_asio.reference.basic_socket.endpoint_type [*endpoint_type]]]
- [The endpoint type. ]
+[variablelist
- ]
+[[option][The new option value to be set on the acceptor.]]
- [
+]
- [[link boost_asio.reference.basic_socket.implementation_type [*implementation_type]]]
- [The underlying implementation type of I/O object. ]
+[heading Exceptions]
+
+
+[variablelist
- ]
+[[boost::system::system_error][Thrown on failure.]]
- [
+]
- [[link boost_asio.reference.basic_socket.keep_alive [*keep_alive]]]
- [Socket option to send keep-alives. ]
+[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.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. ]
-
- ]
+
+[endsect]
+
+
+
+[section:overload2 basic_socket_acceptor::set_option (2 of 2 overloads)]
+
+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 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
+
+[heading Values]
+[variablelist
[
+ [shutdown_receive]
+ [Shutdown the receive side of the socket. ]
+ ]
- [[link boost_asio.reference.basic_socket.native_type [*native_type]]]
+ [
+ [shutdown_send]
+ [Shutdown the send side of the socket. ]
+ ]
+
+ [
+ [shutdown_both]
+ [Shutdown both send and receive on the 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>>
+ 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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+]
+
+[section:basic_socket_iostream basic_socket_iostream::basic_socket_iostream]
+
+[indexterm2 basic_socket_iostream..basic_socket_iostream] Construct a basic_socket_iostream without establishing a connection.
+
+ ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload1 basic_socket_iostream]``();
+
+ template<
+ typename T1,
+ ... ,
+ typename TN>
+ ``[link boost_asio.reference.basic_socket_iostream.basic_socket_iostream.overload2 basic_socket_iostream]``(
+ T1 t1,
+ ... ,
+ TN tn);
+
+
+[section:overload1 basic_socket_iostream::basic_socket_iostream (1 of 2 overloads)]
+
+Construct a basic_socket_iostream without establishing a connection.
+
+ basic_socket_iostream();
+
+
+
+[endsect]
+
+
+
+[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);
+
+
+This constructor automatically establishes a connection based on the supplied resolver query parameters. The arguments are used to construct a resolver query object.
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:close basic_socket_iostream::close]
+
+[indexterm2 close..basic_socket_iostream] Close the connection.
+
+ void close();
+
+
+
+[endsect]
+
+
+
+[section:connect basic_socket_iostream::connect]
+
+[indexterm2 connect..basic_socket_iostream] Establish a connection to an endpoint corresponding to a resolver query.
+
+ 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.
+
+
+[endsect]
+
+
+
+[section:rdbuf basic_socket_iostream::rdbuf]
+
+[indexterm2 rdbuf..basic_socket_iostream] Return a pointer to the underlying streambuf.
+
+ basic_socket_streambuf< Protocol, StreamSocketService > * rdbuf() const;
+
+
+
+[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>>
+ 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.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_type [*native_type]]]
[The native representation of a socket. ]
]
[
- [[link boost_asio.reference.basic_socket.non_blocking_io [*non_blocking_io]]]
+ [[link boost_asio.reference.basic_socket_streambuf.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]]]
+ [[link boost_asio.reference.basic_socket_streambuf.protocol_type [*protocol_type]]]
[The protocol type. ]
]
[
- [[link boost_asio.reference.basic_socket.receive_buffer_size [*receive_buffer_size]]]
+ [[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.receive_low_watermark [*receive_low_watermark]]]
+ [[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.reuse_address [*reuse_address]]]
+ [[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.send_buffer_size [*send_buffer_size]]]
+ [[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.send_low_watermark [*send_low_watermark]]]
+ [[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.service_type [*service_type]]]
+ [[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.shutdown_type [*shutdown_type]]]
+ [[link boost_asio.reference.basic_socket_streambuf.shutdown_type [*shutdown_type]]]
[Different ways a socket may be shutdown. ]
]
@@ -17319,110 +19054,141 @@
[[Name][Description]]
[
- [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [[link boost_asio.reference.basic_socket_streambuf.assign [*assign]]]
[Assign an existing native socket to the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [[link boost_asio.reference.basic_socket_streambuf.async_connect [*async_connect]]]
[Start an asynchronous connect. ]
]
[
- [[link boost_asio.reference.basic_socket.at_mark [*at_mark]]]
+ [[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.available [*available]]]
+ [[link boost_asio.reference.basic_socket_streambuf.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. ]
+ [[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.bind [*bind]]]
+ [[link boost_asio.reference.basic_socket_streambuf.bind [*bind]]]
[Bind the socket to the given local endpoint. ]
]
[
- [[link boost_asio.reference.basic_socket.cancel [*cancel]]]
+ [[link boost_asio.reference.basic_socket_streambuf.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_streambuf.close [*close]]]
+ [Close the connection. ]
]
[
- [[link boost_asio.reference.basic_socket.connect [*connect]]]
- [Connect the socket to the specified endpoint. ]
+ [[link boost_asio.reference.basic_socket_streambuf.connect [*connect]]]
+ [Establish a connection. ]
]
[
- [[link boost_asio.reference.basic_socket.get_io_service [*get_io_service]]]
+ [[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.get_option [*get_option]]]
+ [[link boost_asio.reference.basic_socket_streambuf.get_option [*get_option]]]
[Get an option from the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.io_control [*io_control]]]
+ [[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.io_service [*io_service]]]
+ [[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.is_open [*is_open]]]
+ [[link boost_asio.reference.basic_socket_streambuf.is_open [*is_open]]]
[Determine whether the socket is open. ]
]
[
- [[link boost_asio.reference.basic_socket.local_endpoint [*local_endpoint]]]
+ [[link boost_asio.reference.basic_socket_streambuf.local_endpoint [*local_endpoint]]]
[Get the local endpoint of the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.lowest_layer [*lowest_layer]]]
+ [[link boost_asio.reference.basic_socket_streambuf.lowest_layer [*lowest_layer]]]
[Get a reference to the lowest layer. ]
]
[
- [[link boost_asio.reference.basic_socket.native [*native]]]
+ [[link boost_asio.reference.basic_socket_streambuf.native [*native]]]
[Get the native socket representation. ]
]
[
- [[link boost_asio.reference.basic_socket.open [*open]]]
+ [[link boost_asio.reference.basic_socket_streambuf.open [*open]]]
[Open the socket using the specified protocol. ]
]
[
- [[link boost_asio.reference.basic_socket.remote_endpoint [*remote_endpoint]]]
+ [[link boost_asio.reference.basic_socket_streambuf.remote_endpoint [*remote_endpoint]]]
[Get the remote endpoint of the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.set_option [*set_option]]]
+ [[link boost_asio.reference.basic_socket_streambuf.set_option [*set_option]]]
[Set an option on the socket. ]
]
[
- [[link boost_asio.reference.basic_socket.shutdown [*shutdown]]]
+ [[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.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]
@@ -17430,51 +19196,67 @@
[[Name][Description]]
[
- [[link boost_asio.reference.basic_socket.max_connections [*max_connections]]]
+ [[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.message_do_not_route [*message_do_not_route]]]
+ [[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.message_out_of_band [*message_out_of_band]]]
+ [[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.message_peek [*message_peek]]]
+ [[link boost_asio.reference.basic_socket_streambuf.message_peek [*message_peek]]]
[Peek at incoming data without removing it from the input queue. ]
]
]
-The basic_socket class template provides functionality that is common to both stream-oriented and datagram-oriented sockets.
-
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
-[heading Thread Safety]
-
-[*Distinct] [*objects:] Safe.
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.implementation [*implementation]]]
+ [The underlying implementation of the I/O object. ]
+ ]
-[*Shared] [*objects:] Unsafe.
+ [
+ [[link boost_asio.reference.basic_socket_streambuf.service [*service]]]
+ [The service associated with the I/O object. ]
+ ]
+]
+[section:assign basic_socket_streambuf::assign]
+[indexterm2 assign..basic_socket_streambuf] Assign an existing native socket to the socket.
-[endsect]
+ void ``[link boost_asio.reference.basic_socket_streambuf.assign.overload1 assign]``(
+ const protocol_type & protocol,
+ const native_type & native_socket);
+ 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 & ec);
-[section:max_connections basic_stream_socket::max_connections]
+[section:overload1 basic_socket_streambuf::assign (1 of 2 overloads)]
-['Inherited from socket_base.]
+['Inherited from basic_socket.]
-The maximum length of the queue of pending incoming connections.
+Assign an existing native socket to the socket.
- static const int max_connections = implementation_defined;
+ void assign(
+ const protocol_type & protocol,
+ const native_type & native_socket);
@@ -17482,90 +19264,122 @@
-[section:message_do_not_route basic_stream_socket::message_do_not_route]
+[section:overload2 basic_socket_streambuf::assign (2 of 2 overloads)]
-['Inherited from socket_base.]
+['Inherited from basic_socket.]
-Specify that the data should not be subject to routing.
+Assign an existing native socket to the socket.
- static const int message_do_not_route = implementation_defined;
+ boost::system::error_code assign(
+ const protocol_type & protocol,
+ const native_type & native_socket,
+ boost::system::error_code & ec);
[endsect]
+[endsect]
-[section:message_flags basic_stream_socket::message_flags]
+[section:async_connect basic_socket_streambuf::async_connect]
-['Inherited from socket_base.]
-Bitmask type for flags that can be passed to send and receive operations.
+['Inherited from basic_socket.]
- typedef int message_flags;
+[indexterm2 async_connect..basic_socket_streambuf] Start an asynchronous connect.
+ 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.
-[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.
+[heading Parameters]
+
-[section:message_out_of_band basic_stream_socket::message_out_of_band]
+[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().]]
-['Inherited from socket_base.]
+]
-Process out-of-band data.
+[heading Example]
+
- static const int message_out_of_band = implementation_defined;
+ void connect_handler(const boost::system::error_code& error)
+ {
+ if (!error)
+ {
+ // Connect succeeded.
+ }
+ }
+ ...
-[endsect]
+ 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);
-[section:message_peek basic_stream_socket::message_peek]
-['Inherited from socket_base.]
-Peek at incoming data without removing it from the input queue.
+[endsect]
- static const int message_peek = implementation_defined;
+[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.
-[endsect]
+ bool ``[link boost_asio.reference.basic_socket_streambuf.at_mark.overload1 at_mark]``() const;
+ bool ``[link boost_asio.reference.basic_socket_streambuf.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
-[section:native basic_stream_socket::native]
+[section:overload1 basic_socket_streambuf::at_mark (1 of 2 overloads)]
['Inherited from basic_socket.]
-Get the native socket representation.
+Determine whether the socket is at the out-of-band data mark.
- native_type native();
+ bool at_mark() const;
-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]
-
+This function is used to check whether the socket input is currently positioned at the out-of-band data mark.
-[section:native_type basic_stream_socket::native_type]
+[heading Return Value]
+
+A bool indicating whether the socket is at the out-of-band data mark.
-The native representation of a socket.
+[heading Exceptions]
+
- typedef StreamSocketService::native_type native_type;
+[variablelist
+
+[[boost::system::system_error][Thrown on failure. ]]
+]
@@ -17573,110 +19387,94 @@
-[section:non_blocking_io basic_stream_socket::non_blocking_io]
+[section:overload2 basic_socket_streambuf::at_mark (2 of 2 overloads)]
-['Inherited from socket_base.]
+['Inherited from basic_socket.]
-IO control command to set the blocking mode of the socket.
+Determine whether the socket is at the out-of-band data mark.
- typedef implementation_defined non_blocking_io;
+ 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.
-Implements the FIONBIO IO control command.
+[heading Parameters]
+
-[heading Example]
+[variablelist
+[[ec][Set to indicate what error occurred, if any.]]
+]
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
-
+[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]
-[section:open basic_stream_socket::open]
-
-Open the socket using the specified protocol.
+[indexterm2 available..basic_socket_streambuf] Determine the number of bytes available for reading.
- void ``[link boost_asio.reference.basic_stream_socket.open.overload1 open]``(
- const protocol_type & protocol = protocol_type());
+ std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload1 available]``() const;
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.open.overload2 open]``(
- const protocol_type & protocol,
- boost::system::error_code & ec);
+ std::size_t ``[link boost_asio.reference.basic_socket_streambuf.available.overload2 available]``(
+ boost::system::error_code & ec) const;
-[section:overload1 basic_stream_socket::open (1 of 2 overloads)]
+[section:overload1 basic_socket_streambuf::available (1 of 2 overloads)]
['Inherited from basic_socket.]
-Open the socket using the specified protocol.
-
- void open(
- const protocol_type & protocol = protocol_type());
-
+Determine the number of bytes available for reading.
-This function opens the socket so that it will use the specified protocol.
+ std::size_t available() const;
-[heading Parameters]
-
+This function is used to determine the number of bytes that may be read without blocking.
-[variablelist
-
-[[protocol][An object specifying protocol parameters to be used.]]
-]
+[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.]]
+[[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)]
+[section:overload2 basic_socket_streambuf::available (2 of 2 overloads)]
['Inherited from basic_socket.]
-Open the socket using the specified protocol.
+Determine the number of bytes available for reading.
- boost::system::error_code open(
- const protocol_type & protocol,
- boost::system::error_code & ec);
+ std::size_t available(
+ boost::system::error_code & ec) const;
-This function opens the socket so that it will use the specified protocol.
+This function is used to determine the number of bytes that may be read without blocking.
[heading Parameters]
@@ -17684,26 +19482,13 @@
[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.
- }
-
-
-
+[heading Return Value]
+
+The number of bytes that may be read without blocking, or 0 if an error occurs.
@@ -17713,45 +19498,41 @@
[endsect]
-[section:protocol_type basic_stream_socket::protocol_type]
-
-The protocol type.
+[section:basic_socket_streambuf basic_socket_streambuf::basic_socket_streambuf]
- typedef Protocol protocol_type;
+[indexterm2 basic_socket_streambuf..basic_socket_streambuf] Construct a basic_socket_streambuf without establishing a connection.
+ basic_socket_streambuf();
[endsect]
-[section:read_some basic_stream_socket::read_some]
+[section:bind basic_socket_streambuf::bind]
-Read some data from the socket.
+[indexterm2 bind..basic_socket_streambuf] Bind the socket to the given local endpoint.
- 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);
+ void ``[link boost_asio.reference.basic_socket_streambuf.bind.overload1 bind]``(
+ const endpoint_type & endpoint);
- 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 ``[link boost_asio.reference.basic_socket_streambuf.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
boost::system::error_code & ec);
-[section:overload1 basic_stream_socket::read_some (1 of 2 overloads)]
+[section:overload1 basic_socket_streambuf::bind (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);
+['Inherited from basic_socket.]
+
+Bind the socket to the given local endpoint.
+ void bind(
+ const endpoint_type & endpoint);
-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.
+
+This function binds the socket to the specified endpoint on the local machine.
[heading Parameters]
@@ -17759,38 +19540,30 @@
[variablelist
-[[buffers][One or more buffers into which the data will be read.]]
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
]
-[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.]]
+[[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.
-
[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));
+
+ 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));
+
-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.
@@ -17798,18 +19571,19 @@
-[section:overload2 basic_stream_socket::read_some (2 of 2 overloads)]
+[section:overload2 basic_socket_streambuf::bind (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,
+['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 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.
+This function binds the socket to the specified endpoint on the local machine.
[heading Parameters]
@@ -17817,101 +19591,73 @@
[variablelist
-[[buffers][One or more buffers into which the data will be read.]]
+[[endpoint][An endpoint on the local machine to which the socket will be bound.]]
[[ec][Set to indicate what error occurred, if any.]]
]
-[heading Return Value]
-
-The number of bytes read. Returns 0 if an error occurred.
+[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::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:receive basic_stream_socket::receive]
-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);
- 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);
+[endsect]
- 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);
+[section:broadcast basic_socket_streambuf::broadcast]
-[section:overload1 basic_stream_socket::receive (1 of 3 overloads)]
-Receive some data on the socket.
+['Inherited from socket_base.]
- template<
- typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
- std::size_t receive(
- const MutableBufferSequence & buffers);
+[indexterm2 broadcast..basic_socket_streambuf] Socket option to permit sending of broadcast messages.
+ typedef implementation_defined broadcast;
-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]
-
+Implements the SOL\_SOCKET/SO\_BROADCAST socket option.
-[variablelist
-
-[[buffers][One or more buffers into which the data will be received.]]
-]
+[heading Examples]
+
+Setting the option:
-[heading Return Value]
-
-The number of bytes received.
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option(true);
+ socket.set_option(option);
-[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.
+Getting the current option value:
-[heading Example]
-
-To receive into a single data buffer use the
-[link boost_asio.reference.buffer buffer] function as follows:
+ boost::asio::ip::udp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::broadcast option;
+ socket.get_option(option);
+ bool is_set = option.value();
- 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.
@@ -17919,242 +19665,159 @@
-[section:overload2 basic_stream_socket::receive (2 of 3 overloads)]
+[section:bytes_readable basic_socket_streambuf::bytes_readable]
-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);
+['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.
-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.
+ typedef implementation_defined bytes_readable;
-[heading Parameters]
-
-[variablelist
+Implements the FIONREAD IO control command.
+
+
+[heading Example]
-[[buffers][One or more buffers into which the data will be received.]]
-[[flags][Flags specifying how the receive call is to be made.]]
-]
+ 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 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:
+[endsect]
- socket.receive(boost::asio::buffer(data, size), 0);
+[section:cancel basic_socket_streambuf::cancel]
-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.
+[indexterm2 cancel..basic_socket_streambuf] Cancel all asynchronous operations associated with the socket.
+ void ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload1 cancel]``();
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
-[endsect]
+[section:overload1 basic_socket_streambuf::cancel (1 of 2 overloads)]
-[section:overload3 basic_stream_socket::receive (3 of 3 overloads)]
+['Inherited from basic_socket.]
-Receive some data on a connected socket.
+Cancel all asynchronous operations associated with the 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);
+ void cancel();
-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.
+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]
+[heading Exceptions]
[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.]]
+[[boost::system::system_error][Thrown on failure.]]
]
-[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.]
-
-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);
-
-
+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.
-Getting the current option value:
+* 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.
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_buffer_size option;
- socket.get_option(option);
- int size = option.value();
+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:receive_low_watermark basic_stream_socket::receive_low_watermark]
+[section:overload2 basic_socket_streambuf::cancel (2 of 2 overloads)]
-['Inherited from socket_base.]
+['Inherited from basic_socket.]
-Socket option for the receive low watermark.
+Cancel all asynchronous operations associated with the socket.
- typedef implementation_defined receive_low_watermark;
+ 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.
-Implements the SOL\_SOCKET/SO\_RCVLOWAT socket option.
+[heading Parameters]
+
-[heading Examples]
+[variablelist
-Setting the option:
-
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option(1024);
- socket.set_option(option);
+[[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.
-Getting the current option value:
+* 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.
- boost::asio::ip::tcp::socket socket(io_service);
- ...
- boost::asio::socket_base::receive_low_watermark option;
- socket.get_option(option);
- int size = option.value();
+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:remote_endpoint basic_stream_socket::remote_endpoint]
-
-Get the remote endpoint of the socket.
-
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload1 remote_endpoint]``() const;
+[endsect]
- endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 remote_endpoint]``(
- boost::system::error_code & ec) const;
+[section:close basic_socket_streambuf::close]
+[indexterm2 close..basic_socket_streambuf] Close the connection.
-[section:overload1 basic_stream_socket::remote_endpoint (1 of 2 overloads)]
+ basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.close.overload1 close]``();
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.close.overload2 close]``(
+ boost::system::error_code & ec);
-['Inherited from basic_socket.]
-Get the remote endpoint of the socket.
+[section:overload1 basic_socket_streambuf::close (1 of 2 overloads)]
- endpoint_type remote_endpoint() const;
+Close the connection.
+ basic_socket_streambuf< Protocol, StreamSocketService > * close();
-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();
-
-
-
+`this` if a connection was successfully established, a null pointer otherwise.
@@ -18162,18 +19825,18 @@
-[section:overload2 basic_stream_socket::remote_endpoint (2 of 2 overloads)]
+[section:overload2 basic_socket_streambuf::close (2 of 2 overloads)]
['Inherited from basic_socket.]
-Get the remote endpoint of the socket.
+Close the socket.
- endpoint_type remote_endpoint(
- boost::system::error_code & ec) const;
+ boost::system::error_code close(
+ boost::system::error_code & ec);
-This function is used to obtain the remote endpoint of the socket.
+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]
@@ -18185,10 +19848,6 @@
]
-[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]
@@ -18196,7 +19855,7 @@
boost::asio::ip::tcp::socket socket(io_service);
...
boost::system::error_code ec;
- boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec);
+ socket.close(ec);
if (ec)
{
// An error occurred.
@@ -18205,148 +19864,101 @@
+[heading Remarks]
+
+For portable behaviour with respect to graceful closure of a connected socket, call shutdown() before closing the socket.
-[endsect]
-
[endsect]
-[section:reuse_address basic_stream_socket::reuse_address]
-
+[endsect]
-['Inherited from socket_base.]
+[section:connect basic_socket_streambuf::connect]
-Socket option to allow the socket to be bound to an address that is already in use.
+[indexterm2 connect..basic_socket_streambuf] Establish a connection.
- typedef implementation_defined reuse_address;
+ basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload1 connect]``(
+ const endpoint_type & endpoint);
+ template<
+ typename T1,
+ ... ,
+ typename TN>
+ basic_socket_streambuf< Protocol, StreamSocketService > * ``[link boost_asio.reference.basic_socket_streambuf.connect.overload2 connect]``(
+ T1 t1,
+ ... ,
+ TN tn);
-
-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);
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.connect.overload3 connect]``(
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+[section:overload1 basic_socket_streambuf::connect (1 of 3 overloads)]
+Establish a connection.
-Getting the current option value:
+ basic_socket_streambuf< Protocol, StreamSocketService > * connect(
+ const endpoint_type & endpoint);
- boost::asio::ip::tcp::acceptor acceptor(io_service);
- ...
- boost::asio::socket_base::reuse_address option;
- acceptor.get_option(option);
- bool is_set = option.value();
+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:send basic_stream_socket::send]
-
-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);
-
- 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);
-
- 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);
-
-[section:overload1 basic_stream_socket::send (1 of 3 overloads)]
+[section:overload2 basic_socket_streambuf::connect (2 of 3 overloads)]
-Send some data on the socket.
+Establish a connection.
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.
-
+ typename T1,
+ ... ,
+ typename TN>
+ basic_socket_streambuf< Protocol, StreamSocketService > * connect(
+ T1 t1,
+ ... ,
+ TN tn);
-[heading Parameters]
-
-[variablelist
-
-[[buffers][One or more data buffers to be sent on the socket.]]
+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]
-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:
+`this` if a connection was successfully established, a null pointer otherwise.
- 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]
-[endsect]
+[section:overload3 basic_socket_streambuf::connect (3 of 3 overloads)]
+['Inherited from basic_socket.]
-[section:overload2 basic_stream_socket::send (2 of 3 overloads)]
+Connect the socket to the specified endpoint.
-Send some data on the socket.
+ boost::system::error_code connect(
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
- 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 connect a socket to the specified remote endpoint. The function call will block until the connection is successfully made or an error occurs.
-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.
+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]
@@ -18354,113 +19966,101 @@
[variablelist
-[[buffers][One or more data buffers to be sent on the socket.]]
+[[peer_endpoint][The remote endpoint to which the socket will be connected.]]
-[[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.
-
-[heading Exceptions]
-
-
-[variablelist
+[heading Example]
-[[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.
+ 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.
+ }
-[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]
+
[endsect]
+[section:debug basic_socket_streambuf::debug]
-[section:overload3 basic_stream_socket::send (3 of 3 overloads)]
-Send some data on the socket.
+['Inherited from socket_base.]
- 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);
+[indexterm2 debug..basic_socket_streambuf] Socket option to enable socket-level debugging.
+ typedef implementation_defined debug;
-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]
-
+Implements the SOL\_SOCKET/SO\_DEBUG socket option.
-[variablelist
+
+[heading Examples]
-[[buffers][One or more data buffers to be sent on the socket.]]
+Setting the option:
-[[flags][Flags specifying how the send call is to be made.]]
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::debug option(true);
+ socket.set_option(option);
-[[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.
+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();
+
-[endsect]
[endsect]
-[section:send_buffer_size basic_stream_socket::send_buffer_size]
+
+[section:do_not_route basic_socket_streambuf::do_not_route]
['Inherited from socket_base.]
-Socket option for the send buffer size of a socket.
+[indexterm2 do_not_route..basic_socket_streambuf] Socket option to prevent routing, use local interfaces only.
- typedef implementation_defined send_buffer_size;
+ typedef implementation_defined do_not_route;
-Implements the SOL\_SOCKET/SO\_SNDBUF socket option.
+Implements the SOL\_SOCKET/SO\_DONTROUTE socket option.
[heading Examples]
Setting the option:
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::udp::socket socket(io_service);
...
- boost::asio::socket_base::send_buffer_size option(8192);
+ boost::asio::socket_base::do_not_route option(true);
socket.set_option(option);
@@ -18468,11 +20068,11 @@
Getting the current option value:
- boost::asio::ip::tcp::socket socket(io_service);
+ boost::asio::ip::udp::socket socket(io_service);
...
- boost::asio::socket_base::send_buffer_size option;
+ boost::asio::socket_base::do_not_route option;
socket.get_option(option);
- int size = option.value();
+ bool is_set = option.value();
@@ -18483,39 +20083,39 @@
-[section:send_low_watermark basic_stream_socket::send_low_watermark]
+[section:enable_connection_aborted basic_socket_streambuf::enable_connection_aborted]
['Inherited from socket_base.]
-Socket option for the send low watermark.
+[indexterm2 enable_connection_aborted..basic_socket_streambuf] Socket option to report aborted connections on accept.
- typedef implementation_defined send_low_watermark;
+ typedef implementation_defined enable_connection_aborted;
-Implements the SOL\_SOCKET/SO\_SNDLOWAT socket option.
+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::socket socket(io_service);
+ boost::asio::ip::tcp::acceptor acceptor(io_service);
...
- boost::asio::socket_base::send_low_watermark option(1024);
- socket.set_option(option);
+ boost::asio::socket_base::enable_connection_aborted option(true);
+ acceptor.set_option(option);
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();
+ boost::asio::socket_base::enable_connection_aborted option;
+ acceptor.get_option(option);
+ bool is_set = option.value();
@@ -18526,45 +20126,65 @@
-[section:service_type basic_stream_socket::service_type]
+[section:endpoint_type basic_socket_streambuf::endpoint_type]
+
+[indexterm2 endpoint_type..basic_socket_streambuf] The endpoint type.
+
+ typedef Protocol::endpoint endpoint_type;
+
+
+
+
+[endsect]
+
+
+
+[section:get_io_service basic_socket_streambuf::get_io_service]
['Inherited from basic_io_object.]
-The type of the service that will be used to provide I/O operations.
+[indexterm2 get_io_service..basic_socket_streambuf] Get the io_service associated with the object.
- typedef StreamSocketService service_type;
+ boost::asio::io_service & get_io_service();
+This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
+
+
+[heading Return Value]
+
+A reference to the io_service object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
+
[endsect]
-[section:set_option basic_stream_socket::set_option]
+[section:get_option basic_socket_streambuf::get_option]
-Set an option on the socket.
+[indexterm2 get_option..basic_socket_streambuf] Get an option from the socket.
- void ``[link boost_asio.reference.basic_stream_socket.set_option.overload1 set_option]``(
- const SettableSocketOption & option);
+ void ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload1 get_option]``(
+ GettableSocketOption & option) const;
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.set_option.overload2 set_option]``(
- const SettableSocketOption & option,
- boost::system::error_code & ec);
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.get_option.overload2 get_option]``(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
-[section:overload1 basic_stream_socket::set_option (1 of 2 overloads)]
+[section:overload1 basic_socket_streambuf::get_option (1 of 2 overloads)]
['Inherited from basic_socket.]
-Set an option on the socket.
+Get an option from the socket.
- void set_option(
- const SettableSocketOption & option);
+ void get_option(
+ GettableSocketOption & option) const;
-This function is used to set an option on the socket.
+This function is used to get the current value of an option on the socket.
[heading Parameters]
@@ -18572,7 +20192,7 @@
[variablelist
-[[option][The new option value to be set on the socket.]]
+[[option][The option value to be obtained from the socket.]]
]
@@ -18587,12 +20207,13 @@
[heading Example]
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::ip::tcp::no_delay option(true);
- socket.set_option(option);
+ boost::asio::ip::tcp::socket::keep_alive option;
+ socket.get_option(option);
+ bool is_set = option.get();
@@ -18603,19 +20224,19 @@
-[section:overload2 basic_stream_socket::set_option (2 of 2 overloads)]
+[section:overload2 basic_socket_streambuf::get_option (2 of 2 overloads)]
['Inherited from basic_socket.]
-Set an option on the socket.
+Get an option from the socket.
- boost::system::error_code set_option(
- const SettableSocketOption & option,
- boost::system::error_code & ec);
+ boost::system::error_code get_option(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
-This function is used to set an option on the socket.
+This function is used to get the current value of an option on the socket.
[heading Parameters]
@@ -18623,7 +20244,7 @@
[variablelist
-[[option][The new option value to be set on the socket.]]
+[[option][The option value to be obtained from the socket.]]
[[ec][Set to indicate what error occurred, if any.]]
@@ -18631,17 +20252,18 @@
[heading Example]
-Setting the IPPROTO\_TCP/TCP\_NODELAY option:
+Getting the value of the SOL\_SOCKET/SO\_KEEPALIVE option:
boost::asio::ip::tcp::socket socket(io_service);
...
- boost::asio::ip::tcp::no_delay option(true);
+ boost::asio::ip::tcp::socket::keep_alive option;
boost::system::error_code ec;
- socket.set_option(option, ec);
+ socket.get_option(option, ec);
if (ec)
{
// An error occurred.
}
+ bool is_set = option.get();
@@ -18653,30 +20275,61 @@
[endsect]
-[section:shutdown basic_stream_socket::shutdown]
-Disable sends or receives on the socket.
+[section:implementation basic_socket_streambuf::implementation]
- void ``[link boost_asio.reference.basic_stream_socket.shutdown.overload1 shutdown]``(
- shutdown_type what);
- boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.shutdown.overload2 shutdown]``(
- shutdown_type what,
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_socket_streambuf] 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;
+
+
+
+
+[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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.io_control.overload2 io_control]``(
+ IoControlCommand & command,
boost::system::error_code & ec);
-[section:overload1 basic_stream_socket::shutdown (1 of 2 overloads)]
+[section:overload1 basic_socket_streambuf::io_control (1 of 2 overloads)]
['Inherited from basic_socket.]
-Disable sends or receives on the socket.
+Perform an IO control command on the socket.
- void shutdown(
- shutdown_type what);
+ void io_control(
+ IoControlCommand & command);
-This function is used to disable send operations, receive operations, or both.
+This function is used to execute an IO control command on the socket.
[heading Parameters]
@@ -18684,7 +20337,7 @@
[variablelist
-[[what][Determines what types of operation will no longer be allowed.]]
+[[command][The IO control command to be performed on the socket.]]
]
@@ -18699,11 +20352,13 @@
[heading Example]
-Shutting down the send side of the socket:
+Getting the number of bytes ready to read:
boost::asio::ip::tcp::socket socket(io_service);
...
- socket.shutdown(boost::asio::ip::tcp::socket::shutdown_send);
+ boost::asio::ip::tcp::socket::bytes_readable command;
+ socket.io_control(command);
+ std::size_t bytes_readable = command.get();
@@ -18714,19 +20369,19 @@
-[section:overload2 basic_stream_socket::shutdown (2 of 2 overloads)]
+[section:overload2 basic_socket_streambuf::io_control (2 of 2 overloads)]
['Inherited from basic_socket.]
-Disable sends or receives on the socket.
+Perform an IO control command on the socket.
- boost::system::error_code shutdown(
- shutdown_type what,
+ boost::system::error_code io_control(
+ IoControlCommand & command,
boost::system::error_code & ec);
-This function is used to disable send operations, receive operations, or both.
+This function is used to execute an IO control command on the socket.
[heading Parameters]
@@ -18734,7 +20389,7 @@
[variablelist
-[[what][Determines what types of operation will no longer be allowed.]]
+[[command][The IO control command to be performed on the socket.]]
[[ec][Set to indicate what error occurred, if any.]]
@@ -18742,16 +20397,18 @@
[heading Example]
-Shutting down the send side of the socket:
+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.shutdown(boost::asio::ip::tcp::socket::shutdown_send, ec);
+ socket.io_control(command, ec);
if (ec)
{
// An error occurred.
}
+ std::size_t bytes_readable = command.get();
@@ -18764,165 +20421,265 @@
[endsect]
-[section:shutdown_type basic_stream_socket::shutdown_type]
-
+[section:io_service basic_socket_streambuf::io_service]
-['Inherited from socket_base.]
-Different ways a socket may be shutdown.
+['Inherited from basic_io_object.]
- enum shutdown_type
+[indexterm2 io_service..basic_socket_streambuf] (Deprecated: use get_io_service().) Get the io_service associated with the object.
-[heading Values]
-[variablelist
+ boost::asio::io_service & io_service();
- [
- [shutdown_receive]
- [Shutdown the receive side of the socket. ]
- ]
- [
- [shutdown_send]
- [Shutdown the send side of the socket. ]
- ]
+This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
- [
- [shutdown_both]
- [Shutdown both send and receive on the socket. ]
- ]
-]
+[heading Return Value]
+
+A reference to the io_service object that the I/O object will use to dispatch handlers. Ownership is not transferred to the caller.
[endsect]
-[section:write_some basic_stream_socket::write_some]
-Write some data to the socket.
+[section:is_open basic_socket_streambuf::is_open]
- 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);
- 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);
+['Inherited from basic_socket.]
+[indexterm2 is_open..basic_socket_streambuf] Determine whether the socket is open.
-[section:overload1 basic_stream_socket::write_some (1 of 2 overloads)]
+ bool is_open() const;
-Write some data to the socket.
- 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.
-[heading Parameters]
-
+[section:keep_alive basic_socket_streambuf::keep_alive]
-[variablelist
-
-[[buffers][One or more data buffers to be written to the socket.]]
-]
+['Inherited from socket_base.]
-[heading Return Value]
-
-The number of bytes written.
+[indexterm2 keep_alive..basic_socket_streambuf] Socket option to send keep-alives.
-[heading Exceptions]
-
+ typedef implementation_defined keep_alive;
-[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.
+Implements the SOL\_SOCKET/SO\_KEEPALIVE socket option.
-[heading Example]
+
+[heading Examples]
-To write a single data buffer use the
-[link boost_asio.reference.buffer buffer] function as follows:
+Setting the option:
- socket.write_some(boost::asio::buffer(data, size));
+ boost::asio::ip::tcp::socket socket(io_service);
+ ...
+ boost::asio::socket_base::keep_alive option(true);
+ socket.set_option(option);
-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.
+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_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);
+[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.
-[heading Parameters]
-
+[section:linger basic_socket_streambuf::linger]
-[variablelist
-
-[[buffers][One or more data buffers to be written to the socket.]]
-[[ec][Set to indicate what error occurred, if any.]]
+['Inherited from socket_base.]
-]
+[indexterm2 linger..basic_socket_streambuf] Socket option to specify whether the socket lingers on close if unsent data is present.
-[heading Return Value]
-
-The number of bytes written. Returns 0 if an error occurred.
+ 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();
+
+
+
+
+
+
+[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;
+
+ endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.local_endpoint.overload2 local_endpoint]``(
+ boost::system::error_code & ec) const;
+
+
+[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();
-[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]
+
+[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]
-[section:basic_streambuf basic_streambuf]
-Automatically resizable buffer class based on std::streambuf.
+[endsect]
- template<
- typename Allocator = std::allocator<char>>
- class basic_streambuf :
- noncopyable
+
+[section:lowest_layer basic_socket_streambuf::lowest_layer]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 lowest_layer..basic_socket_streambuf] 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 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:lowest_layer_type basic_socket_streambuf::lowest_layer_type]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 lowest_layer_type..basic_socket_streambuf] A basic_socket is always the lowest layer.
+
+ typedef basic_socket< Protocol, StreamSocketService > lowest_layer_type;
[heading Types]
@@ -18931,15 +20688,148 @@
[
- [[link boost_asio.reference.basic_streambuf.const_buffers_type [*const_buffers_type]]]
- [The type used to represent the get area as a list of buffers. ]
+ [[link boost_asio.reference.basic_socket.broadcast [*broadcast]]]
+ [Socket option to permit sending of broadcast messages. ]
]
[
- [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
- [The type used to represent the put area as a list of buffers. ]
+ [[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_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. ]
+
+ ]
+
+ [
+
+ [[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. ]
]
@@ -18950,50 +20840,174 @@
[[Name][Description]]
[
- [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
- [Construct a buffer with a specified maximum size. ]
+ [[link boost_asio.reference.basic_socket.assign [*assign]]]
+ [Assign an existing native socket to the socket. ]
]
[
- [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
- [Move the start of the put area by the specified number of characters. ]
+ [[link boost_asio.reference.basic_socket.async_connect [*async_connect]]]
+ [Start an asynchronous connect. ]
]
[
- [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
- [Move the start of the get area by the specified number of characters. ]
+ [[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_streambuf.data [*data]]]
- [Get a list of buffers that represents the get area. ]
+ [[link boost_asio.reference.basic_socket.available [*available]]]
+ [Determine the number of bytes available for reading. ]
]
[
- [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
- [Return the maximum size of the buffer. ]
+ [[link boost_asio.reference.basic_socket.basic_socket [*basic_socket]]]
+ [Construct a basic_socket without opening it. ]
]
[
- [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
- [Get a list of buffers that represents the put area, with the given size. ]
+ [[link boost_asio.reference.basic_socket.bind [*bind]]]
+ [Bind the socket to the given local endpoint. ]
]
[
- [[link boost_asio.reference.basic_streambuf.size [*size]]]
- [Return the size of the get area in characters. ]
+ [[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. ]
+ ]
+
+ [
+ [[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]]
-[section:basic_streambuf basic_streambuf::basic_streambuf]
+ [
+ [[link boost_asio.reference.basic_socket._basic_socket [*~basic_socket]]]
+ [Protected destructor to prevent deletion through this type. ]
+ ]
+
+]
-Construct a buffer with a specified maximum size.
+[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_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. ]
+ ]
+
+]
+
+The 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.
- basic_streambuf(
- std::size_t max_size = (std::numeric_limits< std::size_t >::max)(),
- const Allocator & allocator = Allocator());
@@ -19001,12 +21015,14 @@
-[section:commit basic_streambuf::commit]
+[section:max_connections basic_socket_streambuf::max_connections]
-Move the start of the put area by the specified number of characters.
- void commit(
- std::size_t n);
+['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;
@@ -19014,12 +21030,14 @@
-[section:const_buffers_type basic_streambuf::const_buffers_type]
+[section:message_do_not_route basic_socket_streambuf::message_do_not_route]
-The type used to represent the get area as a list of buffers.
- typedef implementation_defined const_buffers_type;
+['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;
@@ -19027,12 +21045,15 @@
-[section:consume basic_streambuf::consume]
+[section:message_flags basic_socket_streambuf::message_flags]
-Move the start of the get area by the specified number of characters.
- void consume(
- std::size_t n);
+['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;
+
@@ -19040,11 +21061,14 @@
-[section:data basic_streambuf::data]
+[section:message_out_of_band basic_socket_streambuf::message_out_of_band]
-Get a list of buffers that represents the get area.
- const_buffers_type data() const;
+['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;
@@ -19052,11 +21076,14 @@
-[section:max_size basic_streambuf::max_size]
+[section:message_peek basic_socket_streambuf::message_peek]
-Return the maximum size of the buffer.
- std::size_t max_size() const;
+['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;
@@ -19064,25 +21091,32 @@
-[section:mutable_buffers_type basic_streambuf::mutable_buffers_type]
+[section:native basic_socket_streambuf::native]
-The type used to represent the put area as a list of buffers.
- typedef implementation_defined mutable_buffers_type;
+['Inherited from basic_socket.]
+
+[indexterm2 native..basic_socket_streambuf] 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:prepare basic_streambuf::prepare]
+[section:native_type basic_socket_streambuf::native_type]
-Get a list of buffers that represents the put area, with the given size.
- mutable_buffers_type prepare(
- std::size_t size);
+['Inherited from basic_socket.]
+
+[indexterm2 native_type..basic_socket_streambuf] The native representation of a socket.
+
+ typedef StreamSocketService::native_type native_type;
+
@@ -19090,201 +21124,17565 @@
-[section:size basic_streambuf::size]
+[section:non_blocking_io basic_socket_streambuf::non_blocking_io]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 non_blocking_io..basic_socket_streambuf] 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);
+
+
+
+
+
+
+[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());
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+
+
+[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;
+
+
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[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;
+
+ endpoint_type ``[link boost_asio.reference.basic_socket_streambuf.remote_endpoint.overload2 remote_endpoint]``(
+ boost::system::error_code & ec) const;
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[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;
+
+
+
+
+[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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+
+
+[section:overload1 basic_socket_streambuf::set_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Set an option on the socket.
+
+ 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.
+
+ 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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_socket_streambuf.shutdown.overload2 shutdown]``(
+ shutdown_type what,
+ boost::system::error_code & ec);
+
+
+[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
+
+[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: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_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. ]
+
+ ]
+
+ [
+
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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]]
+
+ [
+ [[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.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]]]
+ [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. ]
+ ]
+
+]
+
+The basic_stream_socket class template provides asynchronous and blocking stream-oriented socket functionality.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+[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_type & native_socket);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.assign.overload2 assign]``(
+ const protocol_type & protocol,
+ const native_type & native_socket,
+ boost::system::error_code & ec);
+
+
+[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_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_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.
+
+ 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);
+
+ 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);
+
+
+[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);
+
+ 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);
+
+
+[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;
+
+ bool ``[link boost_asio.reference.basic_stream_socket.at_mark.overload2 at_mark]``(
+ boost::system::error_code & ec) const;
+
+
+[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;
+
+ std::size_t ``[link boost_asio.reference.basic_stream_socket.available.overload2 available]``(
+ boost::system::error_code & ec) const;
+
+
+[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 basic_stream_socket without opening it.
+
+ ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload1 basic_stream_socket]``(
+ boost::asio::io_service & io_service);
+
+ ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload2 basic_stream_socket]``(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol);
+
+ ``[link boost_asio.reference.basic_stream_socket.basic_stream_socket.overload3 basic_stream_socket]``(
+ boost::asio::io_service & io_service,
+ const endpoint_type & endpoint);
+
+ ``[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);
+
+
+[section:overload1 basic_stream_socket::basic_stream_socket (1 of 4 overloads)]
+
+Construct a 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 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 4 overloads)]
+
+Construct and open a 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 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 4 overloads)]
+
+Construct a 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 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 4 overloads)]
+
+Construct a basic_stream_socket on an existing native socket.
+
+ basic_stream_socket(
+ boost::asio::io_service & io_service,
+ const protocol_type & protocol,
+ const native_type & native_socket);
+
+
+This constructor creates a stream socket object to hold an existing native socket.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[io_service][The 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]
+
+
+[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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.bind.overload2 bind]``(
+ const endpoint_type & endpoint,
+ boost::system::error_code & ec);
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[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]``();
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.cancel.overload2 cancel]``(
+ boost::system::error_code & ec);
+
+
+[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]``();
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.close.overload2 close]``(
+ boost::system::error_code & ec);
+
+
+[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.]]
+
+]
+
+[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.]]
+
+]
+
+[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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.connect.overload2 connect]``(
+ const endpoint_type & peer_endpoint,
+ boost::system::error_code & ec);
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:endpoint_type basic_stream_socket::endpoint_type]
+
+[indexterm2 endpoint_type..basic_stream_socket] The endpoint type.
+
+ typedef Protocol::endpoint endpoint_type;
+
+
+
+
+[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 io_service associated with the object.
+
+ boost::asio::io_service & get_io_service();
+
+
+This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
+
+
+[heading Return Value]
+
+A reference to the 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;
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.get_option.overload2 get_option]``(
+ GettableSocketOption & option,
+ boost::system::error_code & ec) const;
+
+
+[section:overload1 basic_stream_socket::get_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Get an option from the socket.
+
+ 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.
+
+ 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:implementation basic_stream_socket::implementation]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 implementation..basic_stream_socket] 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;
+
+
+
+
+[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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.io_control.overload2 io_control]``(
+ IoControlCommand & command,
+ boost::system::error_code & ec);
+
+
+[section:overload1 basic_stream_socket::io_control (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Perform an IO control command on the socket.
+
+ 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.
+
+ 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_service basic_stream_socket::io_service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 io_service..basic_stream_socket] (Deprecated: use get_io_service().) Get the io_service associated with the object.
+
+ boost::asio::io_service & io_service();
+
+
+This function may be used to obtain the io_service object that the I/O object uses to dispatch handlers for asynchronous operations.
+
+
+[heading Return Value]
+
+A reference to the 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_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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[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;
+
+ endpoint_type ``[link boost_asio.reference.basic_stream_socket.local_endpoint.overload2 local_endpoint]``(
+ boost::system::error_code & ec) const;
+
+
+[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]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 lowest_layer..basic_stream_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 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:lowest_layer_type basic_stream_socket::lowest_layer_type]
+
+
+['Inherited from basic_socket.]
+
+[indexterm2 lowest_layer_type..basic_stream_socket] A 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_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. ]
+
+ ]
+
+ [
+
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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]]
+
+ [
+ [[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_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. ]
+ ]
+
+]
+
+The 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.
+
+
+
+
+[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_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;
+
+
+
+
+[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] 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_type basic_stream_socket::native_type]
+
+[indexterm2 native_type..basic_stream_socket] The native representation of a socket.
+
+ typedef StreamSocketService::native_type native_type;
+
+
+
+
+[endsect]
+
+
+
+[section:non_blocking_io basic_stream_socket::non_blocking_io]
+
+
+['Inherited from socket_base.]
+
+[indexterm2 non_blocking_io..basic_stream_socket] 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);
+
+
+
+
+
+
+[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());
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.open.overload2 open]``(
+ const protocol_type & protocol,
+ boost::system::error_code & ec);
+
+
+[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:protocol_type basic_stream_socket::protocol_type]
+
+[indexterm2 protocol_type..basic_stream_socket] The protocol type.
+
+ typedef Protocol protocol_type;
+
+
+
+
+[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);
+
+ 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);
+
+
+[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);
+
+ 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);
+
+ 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);
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[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;
+
+ endpoint_type ``[link boost_asio.reference.basic_stream_socket.remote_endpoint.overload2 remote_endpoint]``(
+ boost::system::error_code & ec) const;
+
+
+[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();
+
+
+
+
+
+
+[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);
+
+ 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);
+
+ 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);
+
+
+[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();
+
+
+
+
+
+
+[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();
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:service basic_stream_socket::service]
+
+
+['Inherited from basic_io_object.]
+
+[indexterm2 service..basic_stream_socket] The service associated with the I/O object.
+
+ service_type & service;
+
+
+
+[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;
+
+
+
+
+[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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.set_option.overload2 set_option]``(
+ const SettableSocketOption & option,
+ boost::system::error_code & ec);
+
+
+[section:overload1 basic_stream_socket::set_option (1 of 2 overloads)]
+
+
+['Inherited from basic_socket.]
+
+Set an option on the socket.
+
+ 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.
+
+ 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);
+
+ boost::system::error_code ``[link boost_asio.reference.basic_stream_socket.shutdown.overload2 shutdown]``(
+ shutdown_type what,
+ boost::system::error_code & ec);
+
+
+[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
+
+[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);
+
+ 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);
+
+
+[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 get area as a list of buffers. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.basic_streambuf.mutable_buffers_type [*mutable_buffers_type]]]
+ [The type used to represent the put area as a list of buffers. ]
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.basic_streambuf [*basic_streambuf]]]
+ [Construct a buffer with a specified maximum size. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.commit [*commit]]]
+ [Move the start of the put area by the specified number of characters. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.consume [*consume]]]
+ [Move the start of the get area by the specified number of characters. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.data [*data]]]
+ [Get a list of buffers that represents the get area. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.max_size [*max_size]]]
+ [Return the maximum size of the buffer. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.prepare [*prepare]]]
+ [Get a list of buffers that represents the put area, with the given size. ]
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.size [*size]]]
+ [Return the size of the get area in characters. ]
+ ]
+
+]
+
+[heading Protected Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.overflow [*overflow]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.reserve [*reserve]]]
+ []
+ ]
+
+ [
+ [[link boost_asio.reference.basic_streambuf.underflow [*underflow]]]
+ []
+ ]
+
+]
+
+
+[section:basic_streambuf basic_streambuf::basic_streambuf]
+
+[indexterm2 basic_streambuf..basic_streambuf] Construct a buffer with a specified maximum size.
+
+ basic_streambuf(
+ std::size_t max_size = (std::numeric_limits< std::size_t >::max)(),
+ const Allocator & allocator = Allocator());
+
+
+
+[endsect]
+
+
+
+[section:commit basic_streambuf::commit]
+
+[indexterm2 commit..basic_streambuf] Move the start of the put area by the specified number of characters.
+
+ void commit(
+ std::size_t n);
+
+
+
+[endsect]
+
+
+
+[section:const_buffers_type basic_streambuf::const_buffers_type]
+
+[indexterm2 const_buffers_type..basic_streambuf] The type used to represent the get area as a list of buffers.
+
+ typedef implementation_defined const_buffers_type;
+
+
+
+
+[endsect]
+
+
+
+[section:consume basic_streambuf::consume]
+
+[indexterm2 consume..basic_streambuf] Move the start of the get area by the specified number of characters.
+
+ void consume(
+ std::size_t n);
+
+
+
+[endsect]
+
+
+
+[section:data basic_streambuf::data]
+
+[indexterm2 data..basic_streambuf] Get a list of buffers that represents the get area.
+
+ const_buffers_type data() const;
+
+
+
+[endsect]
+
+
+
+[section:max_size basic_streambuf::max_size]
+
+[indexterm2 max_size..basic_streambuf] Return the maximum size of the buffer.
+
+ std::size_t max_size() const;
+
+
+
+[endsect]
+
+
+
+[section:mutable_buffers_type basic_streambuf::mutable_buffers_type]
+
+[indexterm2 mutable_buffers_type..basic_streambuf] The type used to represent the put area as a list of buffers.
+
+ typedef implementation_defined mutable_buffers_type;
+
+
+
+
+[endsect]
+
+
+
+[section:overflow basic_streambuf::overflow]
+
+[indexterm2 overflow..basic_streambuf]
+
+ int_type overflow(
+ int_type c);
+
+
+
+[endsect]
+
+
+
+[section:prepare basic_streambuf::prepare]
+
+[indexterm2 prepare..basic_streambuf] Get a list of buffers that represents the put area, with the given size.
+
+ mutable_buffers_type prepare(
+ std::size_t size);
+
+
+
+[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] Return the size of the get area in characters.
+
+ std::size_t size() const;
+
+
+
+[endsect]
+
+
+
+[section:underflow basic_streambuf::underflow]
+
+[indexterm2 underflow..basic_streambuf]
+
+ int_type 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);
+
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload2 buffer]``(
+ const mutable_buffer & b,
+ std::size_t max_size_in_bytes);
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload3 buffer]``(
+ const const_buffer & b);
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload4 buffer]``(
+ const const_buffer & b,
+ std::size_t max_size_in_bytes);
+
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload5 buffer]``(
+ void * data,
+ std::size_t size_in_bytes);
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload6 buffer]``(
+ const void * data,
+ std::size_t size_in_bytes);
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload7 buffer]``(
+ PodType & data);
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload8 buffer]``(
+ PodType & data,
+ std::size_t max_size_in_bytes);
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload9 buffer]``(
+ const PodType & data);
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload10 buffer]``(
+ const PodType & data,
+ std::size_t max_size_in_bytes);
+
+ template<
+ typename PodType,
+ std::size_t N>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload11 buffer]``(
+ boost::array< PodType, N > & data);
+
+ 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);
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload13 buffer]``(
+ boost::array< const PodType, N > & data);
+
+ 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);
+
+ template<
+ typename PodType,
+ std::size_t N>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload15 buffer]``(
+ const boost::array< PodType, N > & data);
+
+ 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);
+
+ template<
+ typename PodType,
+ typename Allocator>
+ mutable_buffers_1 ``[link boost_asio.reference.buffer.overload17 buffer]``(
+ std::vector< PodType, Allocator > & data);
+
+ 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);
+
+ template<
+ typename PodType,
+ typename Allocator>
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload19 buffer]``(
+ const std::vector< PodType, Allocator > & data);
+
+ 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);
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload21 buffer]``(
+ const std::string & data);
+
+ const_buffers_1 ``[link boost_asio.reference.buffer.overload22 buffer]``(
+ const std::string & data,
+ std::size_t max_size_in_bytes);
+
+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 mutable_buffer and const_buffer, respectively. To mirror C++'s conversion rules, a mutable_buffer is implicitly convertible to a 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 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));
+
+ boost::array<char, 128> d3;
+ bytes_transferred = sock.receive(boost::asio::buffer(d3));
+
+
+
+
+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 boost::asio::buffer\_size and boost::asio::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.
+
+
+[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::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);
+
+
+
+
+
+[section:overload1 buffer (1 of 22 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 22 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 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 22 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 22 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 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 22 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 22 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 22 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);
+
+
+
+[heading Return Value]
+
+A mutable_buffers_1 value equivalent to:
+
+ mutable_buffers_1(
+ static_cast<void*>(data),
+ N * sizeof(PodType));
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload8 buffer (8 of 22 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,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A 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 22 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);
+
+
+
+[heading Return Value]
+
+A const_buffers_1 value equivalent to:
+
+ const_buffers_1(
+ static_cast<const void*>(data),
+ N * sizeof(PodType));
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload10 buffer (10 of 22 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,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A 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 22 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 mutable_buffers_1 value equivalent to:
+
+ mutable_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload12 buffer (12 of 22 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 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 22 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 const_buffers_1 value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload14 buffer (14 of 22 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 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 22 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 const_buffers_1 value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ data.size() * sizeof(PodType));
+
+
+
+
+
+
+[endsect]
+
+
+
+[section:overload16 buffer (16 of 22 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 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 22 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 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:overload18 buffer (18 of 22 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 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:overload19 buffer (19 of 22 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 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:overload20 buffer (20 of 22 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 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:overload21 buffer (21 of 22 overloads)]
+
+Create a new non-modifiable buffer that represents the given string.
+
+ const_buffers_1 buffer(
+ const std::string & data);
+
+
+
+[heading Return Value]
+
+`const_buffers_1(data.data(), data.size())`.
+
+[heading Remarks]
+
+The buffer is invalidated by any non-const operation called on the given string object.
+
+
+
+[endsect]
+
+
+
+[section:overload22 buffer (22 of 22 overloads)]
+
+Create a new non-modifiable buffer that represents the given string.
+
+ const_buffers_1 buffer(
+ const std::string & data,
+ std::size_t max_size_in_bytes);
+
+
+
+[heading Return Value]
+
+A const_buffers_1 value equivalent to:
+
+ const_buffers_1(
+ data.data(),
+ min(data.size(), max_size_in_bytes));
+
+
+
+
+[heading Remarks]
+
+The buffer is invalidated by any non-const operation called on the given string object.
+
+
+
+[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.buffered_read_stream.default_buffer_size [*default_buffer_size]]]
+ [The default buffer size. ]
+ ]
+
+]
+
+The 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.
+
+
+
+[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: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);
+
+
+
+[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);
+
+
+
+[endsect]
+
+
+[section:buffered_read_stream buffered_read_stream::buffered_read_stream]
+
+[indexterm2 buffered_read_stream..buffered_read_stream] Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload1 buffered_read_stream]``(
+ Arg & a);
+
+ template<
+ typename Arg>
+ ``[link boost_asio.reference.buffered_read_stream.buffered_read_stream.overload2 buffered_read_stream]``(
+ Arg & a,
+ std::size_t buffer_size);
+
+
+[section:overload1 buffered_read_stream::buffered_read_stream (1 of 2 overloads)]
+
+Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ buffered_read_stream(
+ Arg & a);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_read_stream::buffered_read_stream (2 of 2 overloads)]
+
+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]
+
+[indexterm2 close..buffered_read_stream] Close the stream.
+
+ void ``[link boost_asio.reference.buffered_read_stream.close.overload1 close]``();
+
+ boost::system::error_code ``[link boost_asio.reference.buffered_read_stream.close.overload2 close]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 buffered_read_stream::close (1 of 2 overloads)]
+
+Close the stream.
+
+ void close();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_read_stream::close (2 of 2 overloads)]
+
+Close the stream.
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:default_buffer_size buffered_read_stream::default_buffer_size]
+
+[indexterm2 default_buffer_size..buffered_read_stream] The default buffer size.
+
+ 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]``();
+
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.fill.overload2 fill]``(
+ boost::system::error_code & ec);
+
+
+[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.
+
+ 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]
+
+
+[endsect]
+
+
+[section:get_io_service buffered_read_stream::get_io_service]
+
+[indexterm2 get_io_service..buffered_read_stream] Get the io_service associated with the object.
+
+ boost::asio::io_service & get_io_service();
+
+
+
+[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]``();
+
+ std::size_t ``[link boost_asio.reference.buffered_read_stream.in_avail.overload2 in_avail]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 buffered_read_stream::in_avail (1 of 2 overloads)]
+
+Determine the amount of data that may be read without blocking.
+
+ std::size_t in_avail();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_read_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);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:io_service buffered_read_stream::io_service]
+
+[indexterm2 io_service..buffered_read_stream] (Deprecated: use get_io_service().) Get the io_service associated with the object.
+
+ boost::asio::io_service & io_service();
+
+
+
+[endsect]
+
+
+
+[section:lowest_layer buffered_read_stream::lowest_layer]
+
+[indexterm2 lowest_layer..buffered_read_stream] Get a reference to the lowest layer.
+
+ lowest_layer_type & lowest_layer();
+
+
+
+[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;
+
+
+
+
+[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;
+
+
+
+
+[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 ``[link boost_asio.reference.buffered_read_stream.peek.overload1 peek]``(
+ const MutableBufferSequence & buffers);
+
+ 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);
+
+
+[section:overload1 buffered_read_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]
+
+
+
+[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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
+[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);
+
+ 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);
+
+
+[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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_read_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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[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.
+
+ 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);
+
+ 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);
+
+
+[section:overload1 buffered_read_stream::write_some (1 of 2 overloads)]
+
+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 write_some(
+ const ConstBufferSequence & buffers);
+
+
+
+[endsect]
+
+
+
+[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.
+
+ template<
+ typename ``[link boost_asio.reference.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t write_some(
+ const ConstBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[endsect]
+
+[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]]
+
+ [
+
+ [[link boost_asio.reference.buffered_stream.lowest_layer_type [*lowest_layer_type]]]
+ [The type of the lowest layer. ]
+
+ ]
+
+ [
+
+ [[link boost_asio.reference.buffered_stream.next_layer_type [*next_layer_type]]]
+ [The type of the next layer. ]
+
+ ]
+
+]
+
+[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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.io_service [*io_service]]]
+ [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_stream.lowest_layer [*lowest_layer]]]
+ [Get a 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. ]
+ ]
+
+ [
+ [[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.buffered_stream.write_some [*write_some]]]
+ [Write the given data to the stream. Returns the number of bytes written. Throws an exception on failure. ]
+ ]
+
+]
+
+The buffered_stream class template can be used to add buffering to the synchronous and asynchronous read and write operations of a stream.
+
+
+[heading Thread Safety]
+
+[*Distinct] [*objects:] Safe.
+
+[*Shared] [*objects:] Unsafe.
+
+
+
+[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]
+
+
+
+[section:async_flush buffered_stream::async_flush]
+
+[indexterm2 async_flush..buffered_stream] Start an asynchronous flush.
+
+ template<
+ typename ``[link boost_asio.reference.WriteHandler WriteHandler]``>
+ void async_flush(
+ WriteHandler handler);
+
+
+
+[endsect]
+
+
+
+[section:async_read_some buffered_stream::async_read_some]
+
+[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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``,
+ typename ``[link boost_asio.reference.ReadHandler ReadHandler]``>
+ void async_read_some(
+ const MutableBufferSequence & buffers,
+ ReadHandler handler);
+
+
+
+[endsect]
+
+
+
+[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.
+
+ 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_stream buffered_stream::buffered_stream]
+
+[indexterm2 buffered_stream..buffered_stream] Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ ``[link boost_asio.reference.buffered_stream.buffered_stream.overload1 buffered_stream]``(
+ Arg & a);
+
+ template<
+ typename Arg>
+ ``[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);
+
+
+[section:overload1 buffered_stream::buffered_stream (1 of 2 overloads)]
+
+Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ buffered_stream(
+ Arg & a);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_stream::buffered_stream (2 of 2 overloads)]
+
+Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ buffered_stream(
+ Arg & a,
+ std::size_t read_buffer_size,
+ std::size_t write_buffer_size);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:close buffered_stream::close]
+
+[indexterm2 close..buffered_stream] Close the stream.
+
+ void ``[link boost_asio.reference.buffered_stream.close.overload1 close]``();
+
+ boost::system::error_code ``[link boost_asio.reference.buffered_stream.close.overload2 close]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 buffered_stream::close (1 of 2 overloads)]
+
+Close the stream.
+
+ void close();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_stream::close (2 of 2 overloads)]
+
+Close the stream.
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+
+[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.
+
+ std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload1 fill]``();
+
+ std::size_t ``[link boost_asio.reference.buffered_stream.fill.overload2 fill]``(
+ boost::system::error_code & ec);
+
+
+[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.
+
+ std::size_t fill();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_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]
+
+
+[endsect]
+
+[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.
+
+ std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload1 flush]``();
+
+ std::size_t ``[link boost_asio.reference.buffered_stream.flush.overload2 flush]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 buffered_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.
+
+ std::size_t flush();
+
+
+
+[endsect]
+
+
+
+[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:get_io_service buffered_stream::get_io_service]
+
+[indexterm2 get_io_service..buffered_stream] Get the io_service associated with the object.
+
+ boost::asio::io_service & get_io_service();
+
+
+
+[endsect]
+
+
+[section:in_avail buffered_stream::in_avail]
+
+[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]``();
+
+ std::size_t ``[link boost_asio.reference.buffered_stream.in_avail.overload2 in_avail]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 buffered_stream::in_avail (1 of 2 overloads)]
+
+Determine the amount of data that may be read without blocking.
+
+ std::size_t in_avail();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_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);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:io_service buffered_stream::io_service]
+
+[indexterm2 io_service..buffered_stream] (Deprecated: use get_io_service().) Get the io_service associated with the object.
+
+ boost::asio::io_service & io_service();
+
+
+
+[endsect]
+
+
+
+[section:lowest_layer buffered_stream::lowest_layer]
+
+[indexterm2 lowest_layer..buffered_stream] Get a reference to the lowest layer.
+
+ lowest_layer_type & lowest_layer();
+
+
+
+[endsect]
+
+
+
+[section:lowest_layer_type buffered_stream::lowest_layer_type]
+
+[indexterm2 lowest_layer_type..buffered_stream] The type of the lowest layer.
+
+ typedef next_layer_type::lowest_layer_type lowest_layer_type;
+
+
+
+
+[endsect]
+
+
+
+[section:next_layer buffered_stream::next_layer]
+
+[indexterm2 next_layer..buffered_stream] Get a reference to the next layer.
+
+ next_layer_type & next_layer();
+
+
+
+[endsect]
+
+
+
+[section:next_layer_type buffered_stream::next_layer_type]
+
+[indexterm2 next_layer_type..buffered_stream] The type of the next layer.
+
+ typedef boost::remove_reference< Stream >::type next_layer_type;
+
+
+
+
+[endsect]
+
+
+[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);
+
+ 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);
+
+
+[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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t peek(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
+[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.
+
+ 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);
+
+ 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);
+
+
+[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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_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.
+
+ template<
+ typename ``[link boost_asio.reference.MutableBufferSequence MutableBufferSequence]``>
+ std::size_t read_some(
+ const MutableBufferSequence & buffers,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[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.ConstBufferSequence ConstBufferSequence]``>
+ std::size_t ``[link boost_asio.reference.buffered_stream.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buffers);
+
+ 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);
+
+
+[section:overload1 buffered_stream::write_some (1 of 2 overloads)]
+
+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 write_some(
+ const ConstBufferSequence & buffers);
+
+
+
+[endsect]
+
+
+
+[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]
+
+
+[endsect]
+
+[section:buffered_write_stream buffered_write_stream]
+
+Adds buffering to the write-related operations of a stream.
+
+ template<
+ typename Stream>
+ class buffered_write_stream :
+ noncopyable
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link boost_asio.reference.buffered_write_stream.lowest_layer_type [*lowest_layer_type]]]
+ [The type of the lowest layer. ]
+
+ ]
+
+ [
+
+ [[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. ]
+ ]
+
+ [
+ [[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.io_service [*io_service]]]
+ [(Deprecated: use get_io_service().) Get the io_service associated with the object. ]
+ ]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.lowest_layer [*lowest_layer]]]
+ [Get a 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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+ [
+ [[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. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link boost_asio.reference.buffered_write_stream.default_buffer_size [*default_buffer_size]]]
+ [The default buffer size. ]
+ ]
+
+]
+
+The 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.
+
+
+
+[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);
+
+
+
+[endsect]
+
+
+
+[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]
+
+[indexterm2 buffered_write_stream..buffered_write_stream] Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload1 buffered_write_stream]``(
+ Arg & a);
+
+ template<
+ typename Arg>
+ ``[link boost_asio.reference.buffered_write_stream.buffered_write_stream.overload2 buffered_write_stream]``(
+ Arg & a,
+ std::size_t buffer_size);
+
+
+[section:overload1 buffered_write_stream::buffered_write_stream (1 of 2 overloads)]
+
+Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ buffered_write_stream(
+ Arg & a);
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_write_stream::buffered_write_stream (2 of 2 overloads)]
+
+Construct, passing the specified argument to initialise the next layer.
+
+ template<
+ typename Arg>
+ buffered_write_stream(
+ Arg & a,
+ std::size_t buffer_size);
+
+
+
+[endsect]
+
+
+[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]``();
+
+ boost::system::error_code ``[link boost_asio.reference.buffered_write_stream.close.overload2 close]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 buffered_write_stream::close (1 of 2 overloads)]
+
+Close the stream.
+
+ void close();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_write_stream::close (2 of 2 overloads)]
+
+Close the stream.
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:default_buffer_size buffered_write_stream::default_buffer_size]
+
+[indexterm2 default_buffer_size..buffered_write_stream] The default buffer size.
+
+ static const std::size_t default_buffer_size = implementation_defined;
+
+
+
+[endsect]
+
+
+[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.
+
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload1 flush]``();
+
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.flush.overload2 flush]``(
+ boost::system::error_code & ec);
+
+
+[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.
+
+ std::size_t flush();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_write_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:get_io_service buffered_write_stream::get_io_service]
+
+[indexterm2 get_io_service..buffered_write_stream] Get the io_service associated with the object.
+
+ boost::asio::io_service & get_io_service();
+
+
+
+[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]``();
+
+ std::size_t ``[link boost_asio.reference.buffered_write_stream.in_avail.overload2 in_avail]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 buffered_write_stream::in_avail (1 of 2 overloads)]
+
+Determine the amount of data that may be read without blocking.
+
+ std::size_t in_avail();
+
+
+
+[endsect]
+
+
+
+[section:overload2 buffered_write_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);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:io_service buffered_write_stream::io_service]
+
+[indexterm2 io_service..buffered_write_stream] (Deprecated: use get_io_service().) Get the io_service associated with the object.
+
+ boost::asio::io_service & io_service();
+
+
+
+[endsect]
+
+
+
+[section:lowest_layer buffered_write_stream::lowest_layer]
+
+[indexterm2 lowest_layer..buffered_write_stream] Get a reference to the lowest layer.
+
+ lowest_layer_type & lowest_layer();
+
+
+
+[endsect]
+
+
+
+[section:lowest_layer_type buffered_write_stream::lowest_layer_type]
+
+[indexterm2 lowest_layer_type..buffered_wr