
Zitat von mozdemir
HI Andreas,
you are right. this is not crash. It is an exception.
I did the following small code to explain the issue better
============================================
#include <iostream> #include
#include using namespace boost::asio;
int main(int argc, char* argv[]) { io_service ios; try { int i; for (i=0;i<1000;i++) { int m_port = 80; std::string m_host = "www.yahoo.com"; boost::system::error_code ec; boost::asio::ip::tcp::resolver resolver( ios ); boost::asio::ip::tcp::resolver::query query( m_host, boost::lexical_cast< std::string >( m_port ));
boost::asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve( query ); for(;endpointIterator != ip::tcp::resolver_iterator(); ++endpointIterator) { std::cout << "i: " << i << " ip: " << endpointIterator->endpoint().address().to_string() << std::endl; } }
} catch(std::exception const& ex) { std::cerr << "Error: " << ex.what() << '\n'; } } =============================================
the output goes fine but around 300, it throws the exception.
i: 327 ip: 98.139.183.24 i: 328 ip: 98.139.183.24 i: 329 ip: 98.139.183.24
Error: Host not found (authoritative)
============================================
you are suggesting to handle the exception which I will do. But i wonder why this is not happening in windows but ubuntu?
I wonder if my ubuntu is missing some configuration. I did install Miredo for Ipv6 but it did not help. i feel like this is something to do with network settings issue, NAT issue or something....
Thank you for the suggestion. mustafa
I'm not sure right now whether it is against the policy of this mailing list, but take a look at this: http://stackoverflow.com/questions/4956915/how-can-i-adapt-this-c-testcase-s... This looks similar to your example. Let us know if it helped. Regards, Andreas