Created
May 16, 2014 09:13
-
-
Save edwardtoday/05c50d5cf9b38934e81f to your computer and use it in GitHub Desktop.
Slow TCP endpoint resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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