I am running the c++11 chat example from boost.asio examples and trying to print out the tcp::v4() return value to see what ip address the server is using. There is no to_string function that works on boost::asio::ip::tcp as it does on boost::asio::ip.
Here is the main function from the server.cpp of the chat example:
int main(int argc, char* argv[])
{
try
{
if (argc < 2)
{
std::cerr << "Usage: chat_server <port> [<port> ...]\n";
return 1;
}
boost::asio::io_context io_context;
std::list<chat_server> servers;
for (int i = 1; i < argc; ++i)
{
tcp::endpoint endpoint(tcp::v4(), std::atoi(argv[i]));
servers.emplace_back(io_context, endpoint);
}
io_context.run();
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}