forked from boostorg/beast
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:
@@ -26,9 +26,12 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
|
||||
namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.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>
|
||||
namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
|
||||
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -50,7 +53,7 @@ do_session(tcp::socket& socket, ssl::context& ctx)
|
||||
for(;;)
|
||||
{
|
||||
// This buffer will hold the incoming message
|
||||
boost::beast::multi_buffer buffer;
|
||||
beast::multi_buffer buffer;
|
||||
|
||||
// Read a message
|
||||
ws.read(buffer);
|
||||
@@ -60,7 +63,7 @@ do_session(tcp::socket& socket, ssl::context& ctx)
|
||||
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)
|
||||
@@ -87,11 +90,11 @@ int main(int argc, char* argv[])
|
||||
" websocket-server-sync-ssl 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 SSL context is required, and holds certificates
|
||||
ssl::context ctx{ssl::context::sslv23};
|
||||
|
||||
Reference in New Issue
Block a user