Ответ 1
У сокета есть функция, которая будет извлекать удаленную конечную точку. Я бы передал эту цепочку (long-ish) команд, они должны получить строковое представление удаленного IP-адреса:
asio::ip::tcp::socket socket(io_service);
// Do all your accepting and other stuff here.
asio::ip::tcp::endpoint remote_ep = socket.remote_endpoint();
asio::ip::address remote_ad = remote_ep.address();
std::string s = remote_ad.to_string();
или однострочный вариант:
asio::ip::tcp::socket socket(io_service);
// Do all your accepting and other stuff here.
std::string s = socket.remote_endpoint().address().to_string();