Boost asio socket: how to get your own IP, port adress?

五迷三道 提交于 2019-12-10 18:48:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!