mirror of
https://github.com/boostorg/beast.git
synced 2025-08-01 22:04:34 +02:00
Tidy up resolver calls
This commit is contained in:
@@ -12,6 +12,7 @@ Version 61:
|
|||||||
* Fix shadowing warnings
|
* Fix shadowing warnings
|
||||||
* Tidy up http-crawl example
|
* Tidy up http-crawl example
|
||||||
* Add multi_port to server-framework
|
* Add multi_port to server-framework
|
||||||
|
* Tidy up resolver calls
|
||||||
|
|
||||||
API Changes:
|
API Changes:
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ int main()
|
|||||||
|
|
||||||
// Look up the domain name
|
// Look up the domain name
|
||||||
std::string const host = "www.example.com";
|
std::string const host = "www.example.com";
|
||||||
auto const lookup = r.resolve(boost::asio::ip::tcp::resolver::query{host, "https"}, ec);
|
auto const lookup = r.resolve({host, "https"}, ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
return fail("resolve", ec);
|
return fail("resolve", ec);
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ int main()
|
|||||||
|
|
||||||
// Look up the domain name
|
// Look up the domain name
|
||||||
std::string const host = "www.example.com";
|
std::string const host = "www.example.com";
|
||||||
auto const lookup = r.resolve(boost::asio::ip::tcp::resolver::query{host, "http"}, ec);
|
auto const lookup = r.resolve({host, "http"}, ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
return fail("resolve", ec);
|
return fail("resolve", ec);
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ main(int, char const*[])
|
|||||||
|
|
||||||
// Look up the domain name
|
// Look up the domain name
|
||||||
boost::asio::ip::tcp::resolver r(ios);
|
boost::asio::ip::tcp::resolver r(ios);
|
||||||
auto lookup = r.resolve(boost::asio::ip::tcp::resolver::query{host, "http"}, ec);
|
auto lookup = r.resolve({host, "http"}, ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
{
|
{
|
||||||
fail("resolve", ec);
|
fail("resolve", ec);
|
||||||
|
@@ -34,7 +34,7 @@ int main()
|
|||||||
|
|
||||||
// Look up the domain name
|
// Look up the domain name
|
||||||
std::string const host = "echo.websocket.org";
|
std::string const host = "echo.websocket.org";
|
||||||
auto const lookup = r.resolve(boost::asio::ip::tcp::resolver::query{host, "https"}, ec);
|
auto const lookup = r.resolve({host, "https"}, ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
return fail("resolve", ec);
|
return fail("resolve", ec);
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ int main()
|
|||||||
|
|
||||||
// Look up the domain name
|
// Look up the domain name
|
||||||
std::string const host = "echo.websocket.org";
|
std::string const host = "echo.websocket.org";
|
||||||
auto const lookup = r.resolve(boost::asio::ip::tcp::resolver::query{host, "http"}, ec);
|
auto const lookup = r.resolve({host, "http"}, ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
return fail("resolve", ec);
|
return fail("resolve", ec);
|
||||||
|
|
||||||
|
@@ -40,8 +40,7 @@ boost::asio::ip::tcp::socket sock{ios};
|
|||||||
char const* const host = "www.example.com";
|
char const* const host = "www.example.com";
|
||||||
boost::asio::ip::tcp::resolver r{ios};
|
boost::asio::ip::tcp::resolver r{ios};
|
||||||
boost::asio::ip::tcp::socket stream{ios};
|
boost::asio::ip::tcp::socket stream{ios};
|
||||||
boost::asio::connect(stream, r.resolve(
|
boost::asio::connect(stream, r.resolve({host, "http"}));
|
||||||
boost::asio::ip::tcp::resolver::query{host, "http"}));
|
|
||||||
|
|
||||||
// At this point `stream` is a connected to a remote
|
// At this point `stream` is a connected to a remote
|
||||||
// host and may be used to perform stream operations.
|
// host and may be used to perform stream operations.
|
||||||
|
@@ -58,8 +58,7 @@ boost::asio::ip::tcp::socket sock{ios};
|
|||||||
std::string const host = "mywebapp.com";
|
std::string const host = "mywebapp.com";
|
||||||
boost::asio::ip::tcp::resolver r{ios};
|
boost::asio::ip::tcp::resolver r{ios};
|
||||||
stream<boost::asio::ip::tcp::socket> ws{ios};
|
stream<boost::asio::ip::tcp::socket> ws{ios};
|
||||||
boost::asio::connect(ws.next_layer(),
|
boost::asio::connect(ws.next_layer(), r.resolve({host, "ws"}));
|
||||||
r.resolve(boost::asio::ip::tcp::resolver::query{host, "ws"}));
|
|
||||||
//]
|
//]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user