mirror of
https://github.com/boostorg/asio.git
synced 2026-01-24 17:42:08 +00:00
Initial merge of Networking TS compatibility.
Merged from chriskohlhoff/asio master branch as of commit 4a4d28b0d24c53236e229bd1b5f378c9964b1ebb.
This commit is contained in:
@@ -25,8 +25,8 @@ class server
|
||||
public:
|
||||
/// Constructor opens the acceptor and starts waiting for the first incoming
|
||||
/// connection.
|
||||
server(boost::asio::io_service& io_service, unsigned short port)
|
||||
: acceptor_(io_service,
|
||||
server(boost::asio::io_context& io_context, unsigned short port)
|
||||
: acceptor_(io_context,
|
||||
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port))
|
||||
{
|
||||
// Create the data to be sent to each client.
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
stocks_.push_back(s);
|
||||
|
||||
// Start an accept operation for a new connection.
|
||||
connection_ptr new_conn(new connection(acceptor_.get_io_service()));
|
||||
connection_ptr new_conn(new connection(acceptor_.get_io_context()));
|
||||
acceptor_.async_accept(new_conn->socket(),
|
||||
boost::bind(&server::handle_accept, this,
|
||||
boost::asio::placeholders::error, new_conn));
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
// Start an accept operation for a new connection.
|
||||
connection_ptr new_conn(new connection(acceptor_.get_io_service()));
|
||||
connection_ptr new_conn(new connection(acceptor_.get_io_context()));
|
||||
acceptor_.async_accept(new_conn->socket(),
|
||||
boost::bind(&server::handle_accept, this,
|
||||
boost::asio::placeholders::error, new_conn));
|
||||
@@ -110,9 +110,9 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
unsigned short port = boost::lexical_cast<unsigned short>(argv[1]);
|
||||
|
||||
boost::asio::io_service io_service;
|
||||
s11n_example::server server(io_service, port);
|
||||
io_service.run();
|
||||
boost::asio::io_context io_context;
|
||||
s11n_example::server server(io_context, port);
|
||||
io_context.run();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user