boost asio: “host not found (authorative)”

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 17:55:32
CyberGuy

You should use:

tcp::resolver::query query(host, PORT, boost::asio::ip::resolver_query_base::numeric_service);

The problem was that the constructor for query has the address_configured flag set by default which won't return an address if the loopback device is the only device with an address. By just settings flags to 0 or anything other than address_configured the problem is fixed.

How does Boost Asio's hostname resolution work on Linux? Is it possible to use NSS?

I will more help you if you paste the whole code. For the very beginning there is really useful piece of code here:

http://boost.2283326.n4.nabble.com/Simple-telnet-client-demonstration-with-boost-asio-asynchronous-I-O-td2583017.html

it works and you can test it with your local telnet.

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