id summary reporter owner description type status milestone component version severity resolution keywords cc 10744 wrong error code when doing async_connect and the connection is refused Martin Bonetti chris_kohlhoff "When executing the following example the error_code provided is not correctly recognized as connection_refused. This is because the error_code supplied is provided by '''GetLastError''' and the error_code expected is provided by '''WSAGetLastError'''. {{{ #!div style=""font-size: 80%"" {{{#!cpp #include #include ""boost/asio.hpp"" using namespace boost::asio; int main(int argc, const char* argv[]) { io_service io_service; ip::tcp::socket::endpoint_type endpoint(ip::address_v4::from_string(""127.0.0.1""), 9999); ip::tcp::socket tcp_socket(io_service); tcp_socket.async_connect(endpoint, [](const boost::system::error_code& ec) { if (ec.value() != boost::asio::error::connection_refused) { std::cout << ""Expected error code "" << boost::asio::error::connection_refused << "" but got "" << ec.value() << std::endl; } else { std::cout << ""got error code "" << ec.value() << std::endl; } }); io_service.run(); return 0; } }}} }}} It seems that that this behavior change to earlier boost version has something to-do with this commit: [[github.com/boostorg/asio/commit/0484963a55bf109353922e1d5fdc2a218995d9e7]] On linux system this example works fine" Bugs new To Be Determined asio Boost 1.56.0 Regression errror_code, async_connect