I have this code in my server (scattered around the constructors etc. but I've left out the unnecessary parts):
using namespace boost::asio;
io_service ioserv;
ip::tcp::endpoint endpoint(ip::tcp::v4(), 1922);
ip::tcp::acceptor acceptor(ioserv, endpoint);
ip::tcp::socket socket(ioserv);
acceptor.accept(socket);
Now I want to write my IP to the console. Unfortunately both
cout << endpoint.address() << endl;
and
cout << acceptor.local_endpoint().address() << endl;
0.0.0.0
How to get the IP address of my machine?