diff --git a/CHANGELOG.md b/CHANGELOG.md index 55c54134..ea138fa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 197: + +* Improvements to echo-op example + +-------------------------------------------------------------------------------- + Version 196: * Tidy up calls to placement new diff --git a/example/echo-op/echo_op.cpp b/example/echo-op/echo_op.cpp index a26f3a06..90f86493 100644 --- a/example/echo-op/echo_op.cpp +++ b/example/echo-op/echo_op.cpp @@ -30,7 +30,7 @@ async_echo(AsyncStream& stream, CompletionToken&& token) /** Asynchronously read a line and echo it back. This function is used to asynchronously read a line ending - in a carriage-return ("CR") from the stream, and then write + in a newline ("LF") from the stream, and then write it back. The function call always returns immediately. The asynchronous operation will continue until one of the following conditions is true: @@ -209,7 +209,7 @@ operator()(boost::beast::error_code ec, std::size_t bytes_transferred) case 0: // read up to the first newline p.step = 1; - return boost::asio::async_read_until(p.stream, p.buffer, "\r", std::move(*this)); + return boost::asio::async_read_until(p.stream, p.buffer, "\n", std::move(*this)); case 1: // write everything back @@ -289,8 +289,20 @@ async_echo(AsyncStream& stream, CompletionToken&& token) //] -int main(int, char** argv) +int main(int argc, char** argv) { + if(argc != 3) + { + std::cerr + << "Usage: echo-op