I'm having some trouble when putting a very simple c++ program to listen to a given port. Mainly, I have problems when creating a basic_resolver_query. If I do it like this:
boost::asio::ip::tcp::resolver::query query( "0.0.0.0", "5938" );
i works flawlessly. But obviously I don't want to hardcode the port, so I've been trying to read it from a file an passing it there: it isn't working.
If I try to pass it directly as std::string
, it doesn't work, with I guess was to be expected. But I've tried passing m_listenPort.c_string()
and it doesn't do it.
I've been trying to look in the documentation, and in examples, but I can find nothing. How do I have to do it?