Re: [Boost-bugs] [Boost C++ Libraries] #4690: boost::asio::ip::tcp::resolver fails to resolve query if service_name is empty

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4690: boost::asio::ip::tcp::resolver fails to resolve query if service_name is empty
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-10-16 08:59:58


#4690: boost::asio::ip::tcp::resolver fails to resolve query if service_name is
empty
----------------------------------------------+-----------------------------
  Reporter: Gennady Proskurin <gpr@…> | Owner: chris_kohlhoff
      Type: Bugs | Status: closed
 Milestone: To Be Determined | Component: asio
   Version: Boost 1.44.0 | Severity: Problem
Resolution: worksforme | Keywords:
----------------------------------------------+-----------------------------
Changes (by chris_kohlhoff):

  * status: new => closed
  * resolution: => worksforme

Comment:

 I assume this is some sort of linux system? I cannot reproduce any such
 error on mine.

 Using the following slightly modified version of your testcase:

 {{{
 #include <iostream>
 #include <boost/asio.hpp>

 void print_result(const char* serv,
     boost::asio::ip::tcp::resolver::iterator iter,
     const boost::system::error_code& ec)
 {
     if( ec )
         std::cerr << "service: '" << serv << "' FAIL: " << ec.message() <<
 "\n";
     else
     {
         std::cerr << "service: '" << serv << "' OK\n";
         std::cerr << "endpoint: " << iter->endpoint() << "\n";
     }
 }

 void do_resolv(const char* serv)
 {
     boost::asio::io_service io;
     boost::asio::ip::tcp::resolver resolver(io);
     boost::asio::ip::tcp::resolver::query q("127.0.0.1", serv);
     boost::system::error_code ec;
     boost::asio::ip::tcp::resolver::iterator iter =
 resolver.resolve(q,ec);
     print_result(serv, iter, ec);
 }

 int main()
 {
     do_resolv("");
     do_resolv("12345");
     do_resolv("ftp");
     return 0;
 }
 }}}

 I get the following output:

 {{{
 service: '' OK
 endpoint: 127.0.0.1:0
 service: '12345' OK
 endpoint: 127.0.0.1:12345
 service: 'ftp' OK
 endpoint: 127.0.0.1:21
 }}}

 The problem may be specific to your target platform, in which case you
 will probably need to do some debugging to find out what is going on.
 Please reopen the bug if you find more information.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4690#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC