diff --git a/dlib/sockets/sockets_extensions.cpp b/dlib/sockets/sockets_extensions.cpp index 65871f29a..2e30cfece 100644 --- a/dlib/sockets/sockets_extensions.cpp +++ b/dlib/sockets/sockets_extensions.cpp @@ -36,7 +36,11 @@ namespace dlib } if(create_connection(con,port,ip)) - throw socket_error("unable to connect to '" + host_or_ip + "'"); + { + std::ostringstream sout; + sout << "unable to connect to '" << host_or_ip << ":" << port << "'"; + throw socket_error(sout.str()); + } return con; }