问题
I have a TCP server using boost asio. I have accepted a socket connection. How to get IP, Port of my server machine as it is seen by my user server is currently communicating with?
回答1:
I believe it's basic_stream_socket::local_endpoint(), but that's not necessarily what the other end sees if you are behind a NAT gateway.
来源:https://stackoverflow.com/questions/6846050/boost-asio-socket-how-to-get-your-own-ip-port-adress