boost asio - connect using an ip address

自作多情 提交于 2019-12-23 17:46:48

问题


I want to connect to a server socket specified by a destination ip address and port number.

boost::asio::connect seems it does not allow to use this. I have ip destination as a unsigned int value.

Update: I am able to do

ba::ip::tcp::endpoint endpoint( ba::ip::address(ba::ip::address_v4(req.IpDst())), ntohs(req.Port()));

But how can I use endpoint with connect ?


回答1:


It is possible to use:

socket.connect(endpoint);


来源:https://stackoverflow.com/questions/9040424/boost-asio-connect-using-an-ip-address

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