From 298bf5fbb1498626a6ab89df5ccc05ccfc5ead58 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 17 Jun 2017 18:33:39 -0700 Subject: [PATCH] Flush the output stream in the example --- CHANGELOG.md | 1 + example/ssl-http-client/ssl_http_client.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bee69f78..866f0ce2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Version 61: * Tidy up some integer conversion warnings * Add message::header_part() * Tidy up names in error categories +* Flush the output stream in the example API Changes: diff --git a/example/ssl-http-client/ssl_http_client.cpp b/example/ssl-http-client/ssl_http_client.cpp index b179ccab..26758461 100644 --- a/example/ssl-http-client/ssl_http_client.cpp +++ b/example/ssl-http-client/ssl_http_client.cpp @@ -22,11 +22,11 @@ int main() namespace ssl = boost::asio::ssl; // Normal boost::asio setup - std::string const host = "github.com"; + std::string const host = "localhost"; io_service ios; resolver r{ios}; socket sock{ios}; - connect(sock, r.resolve(resolver::query{host, "https"})); + connect(sock, r.resolve(resolver::query{host, "1007"})); // Perform SSL handshaking ssl::context ctx{ssl::context::sslv23}; @@ -56,4 +56,7 @@ int main() stream.shutdown(ec); if(ec && ec != boost::asio::error::eof) std::cout << "error: " << ec.message(); + + // Make sure everything is written before we leave main + std::cout.flush(); }