Flush the output stream in the example

This commit is contained in:
Vinnie Falco
2017-06-17 18:33:39 -07:00
parent c8b8439ebc
commit 298bf5fbb1
2 changed files with 6 additions and 2 deletions

View File

@ -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:

View File

@ -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();
}