The following comparison fails for an error whom outputs "asio.misc" for errorCode.category().name() and "end of file" for errorCode.message() If it claims to be in category asio.misc, then why does the if condition of (errorCode.category() == boost::asio::error::misc_category ) evaluate to false? Googling says that a boost::system::error_code can have the same value in more than one category, so I assume that in order to get the proper message and meaning we must compare boost::system::error_category as well as boost::system::error_code::value. How do we properly compare the category if this fails to work? Code in question: //-------------------------------------------------------------------------------------------------- std::string ClientSocketASIO::ErrorCodeToString(const boost::system::error_code & errorCode) { std::ostringstream debugMsg; debugMsg << " Error Category: " << errorCode.category().name() << ". " << " Error Message: " << errorCode.message() << ". "; if( errorCode.category() == boost::asio::error::misc_category ) { switch (errorCode.value()) { case boost::asio::error::eof: debugMsg << ". Server has disconnected."; break; case boost::asio::error::connection_refused: debugMsg << ". Connection Refused"; break; default: debugMsg << ". Unknown Error."; break; } } else { debugMsg << ". Unknown Error category."; } return debugMsg.str(); } -- View this message in context: http://boost.2283326.n4.nabble.com/Compare-boost-system-error-category-tp469... Sent from the Boost - Users mailing list archive at Nabble.com.