How to get IP addresss of boost::asio::ip::tcp::socket?

The socket has a function that will retrieve the remote endpoint. I'd give this (long-ish) chain of commands a go, they should retrieve the string representation of the remote end IP address.

The socket has a function that will retrieve the remote endpoint. I'd give this (long-ish) chain of commands a go, they should retrieve the string representation of the remote end IP address: 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(); or the one-liner version: asio::ip::tcp::socket socket(io_service); // Do all your accepting and other stuff here. Std::string s = socket.

Remote_endpoint().address(). To_string().

Thanks for your answer, I figured out the chain can be written simply as: socket. Remote_endpoint().address(). To_string() – kyku Mar 2 '09 at 19:40 1 Yeah, that's how I would have done it (assuming there was no possibilities of nulls or errors at interim points).

I left it expanded for explanatory purposes. In my opinion, the one-liner version is better (I like my code relatively compact so I can see more of it on a screen). – paxdiablo Mar 2 '09 at 22:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions