net is a namespace alias for boost::asio:

The namespace alias beast::net replaces boost::asio in all code
and documentation.
This commit is contained in:
Vinnie Falco
2018-12-02 17:51:43 -08:00
parent a5739c3ea0
commit f995fd41a3
185 changed files with 2486 additions and 2392 deletions
@@ -22,8 +22,11 @@
#include <string>
#include <thread>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
namespace websocket = boost::beast::websocket; // from <boost/beast/websocket.hpp>
namespace beast = boost::beast; // from <boost/beast.hpp>
namespace http = beast::http; // from <boost/beast/http.hpp>
namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp>
namespace net = boost::asio; // from <boost/asio.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
//------------------------------------------------------------------------------
@@ -42,7 +45,7 @@ do_session(tcp::socket& socket)
for(;;)
{
// This buffer will hold the incoming message
boost::beast::multi_buffer buffer;
beast::multi_buffer buffer;
// Read a message
ws.read(buffer);
@@ -52,7 +55,7 @@ do_session(tcp::socket& socket)
ws.write(buffer.data());
}
}
catch(boost::system::system_error const& se)
catch(beast::system_error const& se)
{
// This indicates that the session was closed
if(se.code() != websocket::error::closed)
@@ -79,11 +82,11 @@ int main(int argc, char* argv[])
" websocket-server-sync 0.0.0.0 8080\n";
return EXIT_FAILURE;
}
auto const address = boost::asio::ip::make_address(argv[1]);
auto const address = net::ip::make_address(argv[1]);
auto const port = static_cast<unsigned short>(std::atoi(argv[2]));
// The io_context is required for all I/O
boost::asio::io_context ioc{1};
net::io_context ioc{1};
// The acceptor receives incoming connections
tcp::acceptor acceptor{ioc, {address, port}};