Add back the ostream operator for socket_error since it is needed by the

log_error error handler.
This commit is contained in:
chris 2004-05-25 03:22:43 +00:00
parent d4b7057c4e
commit 82372055e4
8 changed files with 15 additions and 7 deletions

View File

@ -21,6 +21,7 @@
#include <cerrno>
#include <exception>
#include <string>
#include <iostream>
#include "asio/detail/pop_options.hpp"
#include "asio/detail/socket_types.hpp"
@ -242,6 +243,13 @@ public:
return e1.code_ != e2.code_;
}
/// Write an error message to an output stream.
friend std::ostream& operator<<(std::ostream& os, const socket_error& e)
{
os << e.what() << ": " << e.message();
return os;
}
private:
// The code associated with the error.
int code_;

View File

@ -24,7 +24,7 @@ int main(int argc, char* argv[])
}
catch (asio::socket_error& e)
{
std::cerr << e.what() << ": " << e.message() << std::endl;
std::cerr << e << std::endl;
}
return 0;

View File

@ -25,7 +25,7 @@ int main()
}
catch (asio::socket_error& e)
{
std::cerr << e.what() << ": " << e.message() << std::endl;
std::cerr << e << std::endl;
}
return 0;

View File

@ -54,7 +54,7 @@ int main()
}
catch (asio::socket_error& e)
{
std::cerr << e.what() << ": " << e.message() << std::endl;
std::cerr << e << std::endl;
}
return 0;

View File

@ -25,7 +25,7 @@ int main(int argc, char* argv[])
}
catch (asio::socket_error& e)
{
std::cerr << e.what() << ": " << e.message() << std::endl;
std::cerr << e << std::endl;
}
return 0;

View File

@ -29,7 +29,7 @@ int main()
}
catch (asio::socket_error& e)
{
std::cerr << e.what() << ": " << e.message() << std::endl;
std::cerr << e << std::endl;
}
return 0;

View File

@ -51,7 +51,7 @@ int main()
}
catch (asio::socket_error& e)
{
std::cerr << e.what() << ": " << e.message() << std::endl;
std::cerr << e << std::endl;
}
return 0;

View File

@ -88,7 +88,7 @@ int main()
}
catch (asio::socket_error& e)
{
std::cerr << e.what() << ": " << e.message() << std::endl;
std::cerr << e << std::endl;
}
return 0;