boost asio: “host not found (authorative)”

后端 未结 1 547
挽巷
挽巷 2021-01-18 13:02

I am making a program for school in which two programs communicate with each other. So far I have not been able to connect the two programs. Whenever I try to connect to loc

相关标签:
1条回答
  • 2021-01-18 13:37

    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.

    0 讨论(0)
提交回复
热议问题