Skip to content

Instantly share code, notes, and snippets.

@edwardtoday
Created May 16, 2014 09:13
Show Gist options
  • Select an option

  • Save edwardtoday/05c50d5cf9b38934e81f to your computer and use it in GitHub Desktop.

Select an option

Save edwardtoday/05c50d5cf9b38934e81f to your computer and use it in GitHub Desktop.
Slow TCP endpoint resolution
// this is slow
boost::asio::ip::tcp::resolver resolver1(io_);
auto endpoint_iterator1 = resolver1.resolve({ "8.8.8.8", "53" });
boost::asio::connect(socket_, endpoint_iterator1);
// this is faster
boost::asio::ip::tcp::resolver::query q(boost::asio::ip::tcp::v4(),
"8.8.8.8",
"53");
auto endpoint_iterator2 = resolver2.resolve(q);
boost::asio::connect(socket_, endpoint_iterator2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment