Documentation fixes.
This commit is contained in:
parent
5cfbfe8021
commit
6cf48289ba
@ -318,6 +318,13 @@ sub copy_source_file
|
||||
while (my $line = <$input>)
|
||||
{
|
||||
chomp($line);
|
||||
|
||||
# Unconditional replacements.
|
||||
$line =~ s/[\\@]ref boost_bind/boost::bind()/g;
|
||||
$line =~ s/[\\@]ref async_read/boost::asio::async_read()/g;
|
||||
$line =~ s/[\\@]ref async_write/boost::asio::async_write()/g;
|
||||
|
||||
# Conditional replacements.
|
||||
if ($line =~ /^namespace asio {/)
|
||||
{
|
||||
print_line($output, "namespace boost {", $from, $lineno);
|
||||
@ -442,6 +449,11 @@ sub copy_source_file
|
||||
$line =~ s/asio_handler_invoke_helpers/boost_asio_handler_invoke_helpers/g;
|
||||
print_line($output, $line, $from, $lineno);
|
||||
}
|
||||
elsif ($line =~ /[\\@]ref boost_bind/)
|
||||
{
|
||||
$line =~ s/[\\@]ref boost_bind/boost::bind()/g;
|
||||
print_line($output, $line, $from, $lineno);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_line($output, $line, $from, $lineno);
|
||||
|
@ -251,8 +251,9 @@ public:
|
||||
* asio::io_service::post().
|
||||
*
|
||||
* @note The send operation may not transmit all of the data to the peer.
|
||||
* Consider using the @ref async_write function if you need to ensure that all
|
||||
* data is written before the asynchronous operation completes.
|
||||
* Consider using the @ref async_write function if you need to
|
||||
* ensure that all data is written before the asynchronous operation
|
||||
* completes.
|
||||
*
|
||||
* @par Example
|
||||
* To send a single data buffer use the @ref buffer function as follows:
|
||||
@ -294,8 +295,9 @@ public:
|
||||
* asio::io_service::post().
|
||||
*
|
||||
* @note The send operation may not transmit all of the data to the peer.
|
||||
* Consider using the @ref async_write function if you need to ensure that all
|
||||
* data is written before the asynchronous operation completes.
|
||||
* Consider using the @ref async_write function if you need to
|
||||
* ensure that all data is written before the asynchronous operation
|
||||
* completes.
|
||||
*
|
||||
* @par Example
|
||||
* To send a single data buffer use the @ref buffer function as follows:
|
||||
@ -439,9 +441,9 @@ public:
|
||||
* asio::io_service::post().
|
||||
*
|
||||
* @note The receive operation may not receive all of the requested number of
|
||||
* bytes. Consider using the @ref async_read function if you need to ensure
|
||||
* that the requested amount of data is received before the asynchronous
|
||||
* operation completes.
|
||||
* bytes. Consider using the @ref async_read function if you need to
|
||||
* ensure that the requested amount of data is received before the
|
||||
* asynchronous operation completes.
|
||||
*
|
||||
* @par Example
|
||||
* To receive into a single data buffer use the @ref buffer function as
|
||||
@ -484,9 +486,9 @@ public:
|
||||
* asio::io_service::post().
|
||||
*
|
||||
* @note The receive operation may not receive all of the requested number of
|
||||
* bytes. Consider using the @ref async_read function if you need to ensure
|
||||
* that the requested amount of data is received before the asynchronous
|
||||
* operation completes.
|
||||
* bytes. Consider using the @ref async_read function if you need to
|
||||
* ensure that the requested amount of data is received before the
|
||||
* asynchronous operation completes.
|
||||
*
|
||||
* @par Example
|
||||
* To receive into a single data buffer use the @ref buffer function as
|
||||
@ -587,8 +589,9 @@ public:
|
||||
* asio::io_service::post().
|
||||
*
|
||||
* @note The write operation may not transmit all of the data to the peer.
|
||||
* Consider using the @ref async_write function if you need to ensure that all
|
||||
* data is written before the asynchronous operation completes.
|
||||
* Consider using the @ref async_write function if you need to
|
||||
* ensure that all data is written before the asynchronous operation
|
||||
* completes.
|
||||
*
|
||||
* @par Example
|
||||
* To write a single data buffer use the @ref buffer function as follows:
|
||||
@ -690,9 +693,9 @@ public:
|
||||
* asio::io_service::post().
|
||||
*
|
||||
* @note The read operation may not read all of the requested number of bytes.
|
||||
* Consider using the @ref async_read function if you need to ensure that the
|
||||
* requested amount of data is read before the asynchronous operation
|
||||
* completes.
|
||||
* Consider using the @ref async_read function if you need to ensure
|
||||
* that the requested amount of data is read before the asynchronous
|
||||
* operation completes.
|
||||
*
|
||||
* @par Example
|
||||
* To read into a single data buffer use the @ref buffer function as follows:
|
||||
|
@ -5,6 +5,7 @@ This tutorial program shows how to use asio to implement a client application
|
||||
with TCP.
|
||||
|
||||
\dontinclude daytime1/client.cpp
|
||||
\skip #include
|
||||
|
||||
We start by including the necessary header files.
|
||||
|
||||
@ -43,7 +44,7 @@ contain both IPv4 and IPv6 endpoints, so we need to try each of them until we
|
||||
find one that works. This keeps the client program independent of a specific IP
|
||||
version.
|
||||
|
||||
\until throw error
|
||||
\until throw
|
||||
|
||||
The connection is open. All we need to do now is read the response from the
|
||||
daytime service.
|
||||
@ -53,7 +54,7 @@ function automatically determines the size of the array to help prevent buffer
|
||||
overruns. Instead of a <tt>boost::array</tt>, we could have used a <tt>char
|
||||
[]</tt> or <tt>std::vector</tt>.
|
||||
|
||||
\until assign_error
|
||||
\until read_some
|
||||
|
||||
When the server closes the connection, the asio::ip::tcp::socket::read_some()
|
||||
function will exit with the asio::error::eof error, which is how we know to
|
||||
@ -85,6 +86,7 @@ This tutorial program shows how to use asio to implement a server application
|
||||
with TCP.
|
||||
|
||||
\dontinclude daytime2/server.cpp
|
||||
\skip #include
|
||||
|
||||
\until using
|
||||
|
||||
@ -251,6 +253,7 @@ This tutorial program shows how to use asio to implement a client application
|
||||
with UDP.
|
||||
|
||||
\dontinclude daytime4/client.cpp
|
||||
\skip #include
|
||||
\until using asio::ip::udp;
|
||||
|
||||
The start of the application is essentially the same as for the TCP daytime
|
||||
@ -374,8 +377,10 @@ The constructor initialises a socket to listen on UDP port 13.
|
||||
The function asio::ip::udp::socket::async_receive_from() will cause the
|
||||
application to listen in the background for a new request. When such a request
|
||||
is received, the asio::io_service object will invoke the
|
||||
<tt>handle_receive()</tt> function with two arguments: asio::error, and
|
||||
<tt>bytes_transferred</tt>.
|
||||
<tt>handle_receive()</tt> function with two arguments: a value of type
|
||||
asio::error_code indicating whether the operation succeeded or failed, and a
|
||||
<tt>size_t</tt> value <tt>bytes_transferred</tt> specifying the number of bytes
|
||||
received.
|
||||
|
||||
\until }
|
||||
|
||||
|
@ -5,6 +5,7 @@ This tutorial program introduces asio by showing how to perform a blocking
|
||||
wait on a timer.
|
||||
|
||||
\dontinclude timer1/timer.cpp
|
||||
\skip #include
|
||||
|
||||
We start by including the necessary header files.
|
||||
|
||||
@ -26,7 +27,7 @@ type first thing in the main function.
|
||||
|
||||
Next we declare an object of type asio::deadline_timer. The core asio classes
|
||||
that provide I/O functionality (or as in this case timer functionality) always
|
||||
take a reference to a io_service as their first constructor argument. The
|
||||
take a reference to an io_service as their first constructor argument. The
|
||||
second argument to the constructor sets the timer to expire 5 seconds from now.
|
||||
|
||||
\until asio::deadline_timer
|
||||
@ -67,6 +68,7 @@ functionality by modifying the program from tutorial Timer.1 to perform an
|
||||
asynchronous wait on the timer.
|
||||
|
||||
\dontinclude timer2/timer.cpp
|
||||
\skip #include
|
||||
|
||||
\until posix_time.hpp
|
||||
|
||||
@ -127,6 +129,7 @@ timer fires once a second. This will show how to pass additional parameters to
|
||||
your handler function.
|
||||
|
||||
\dontinclude timer3/timer.cpp
|
||||
\skip #include
|
||||
|
||||
\until posix_time.hpp
|
||||
|
||||
@ -164,11 +167,11 @@ Then we start a new asynchronous wait on the timer. As you can
|
||||
see, the \ref boost_bind function is used to associate the extra parameters
|
||||
with your callback handler. The asio::deadline_timer::async_wait() function
|
||||
expects a handler function (or function object) with the signature
|
||||
<tt>void(const asio::error&)</tt>. Binding the additional parameters converts
|
||||
your <tt>print</tt> function into a function object that matches the signature
|
||||
correctly.
|
||||
<tt>void(const asio::error_code&)</tt>. Binding the additional parameters
|
||||
converts your <tt>print</tt> function into a function object that matches the
|
||||
signature correctly.
|
||||
|
||||
See the <a href="http://www.boost.org/libs/bind/bind.html">Boost: bind.hpp
|
||||
See the <a href="http://www.boost.org/libs/bind/bind.html">Boost.Bind
|
||||
documentation</a> for more information on how to use \ref boost_bind.
|
||||
|
||||
In this example, the asio::placeholders::error argument to \ref boost_bind is a
|
||||
@ -218,6 +221,7 @@ handler. The program should execute identically to the tutorial program from
|
||||
tutorial Timer.3.
|
||||
|
||||
\dontinclude timer4/timer.cpp
|
||||
\skip #include
|
||||
|
||||
\until posix_time.hpp
|
||||
|
||||
@ -239,7 +243,7 @@ functions have an implicit <tt>this</tt> parameter, we need to bind
|
||||
<tt>this</tt> to the function. As in tutorial Timer.3, \ref boost_bind
|
||||
converts our callback handler (now a member function) into a function object
|
||||
that can be invoked as though it has the signature <tt>void(const
|
||||
asio::error&)</tt>.
|
||||
asio::error_code&)</tt>.
|
||||
|
||||
You will note that the asio::placeholders::error placeholder is not specified
|
||||
here, as the <tt>print</tt> member function does not accept an error object as
|
||||
@ -306,6 +310,7 @@ allows handlers to execute concurrently, we need a method of synchronisation
|
||||
when handlers might be accessing a shared, thread-unsafe resource.
|
||||
|
||||
\dontinclude timer5/timer.cpp
|
||||
\skip #include
|
||||
|
||||
\until posix_time.hpp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user