问题
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