|
@@ -20,12 +20,12 @@ private:
|
|
|
public:
|
|
|
typedef boost::shared_ptr<con_handler> pointer;
|
|
|
con_handler(
|
|
|
- boost::asio::basic_socket_acceptor<boost::asio::ip::tcp>::executor_type
|
|
|
+ basic_socket_acceptor<ip::tcp>::executor_type
|
|
|
&io_service)
|
|
|
: sock(io_service) {}
|
|
|
|
|
|
static pointer
|
|
|
- create(boost::asio::basic_socket_acceptor<boost::asio::ip::tcp>::executor_type
|
|
|
+ create(basic_socket_acceptor<ip::tcp>::executor_type
|
|
|
&io_service) {
|
|
|
return pointer(new con_handler(io_service));
|
|
|
}
|
|
@@ -34,16 +34,16 @@ public:
|
|
|
|
|
|
void start() {
|
|
|
sock.async_read_some(
|
|
|
- boost::asio::buffer(data, max_length),
|
|
|
+ buffer(data, max_length),
|
|
|
boost::bind(&con_handler::handle_read, shared_from_this(),
|
|
|
- boost::asio::placeholders::error,
|
|
|
- boost::asio::placeholders::bytes_transferred));
|
|
|
+ placeholders::error,
|
|
|
+ placeholders::bytes_transferred));
|
|
|
|
|
|
sock.async_write_some(
|
|
|
- boost::asio::buffer(message, max_length),
|
|
|
+ buffer(message, max_length),
|
|
|
boost::bind(&con_handler::handle_write, shared_from_this(),
|
|
|
- boost::asio::placeholders::error,
|
|
|
- boost::asio::placeholders::bytes_transferred));
|
|
|
+ placeholders::error,
|
|
|
+ placeholders::bytes_transferred));
|
|
|
}
|
|
|
|
|
|
void handle_read(const boost::system::error_code &err,
|
|
@@ -75,11 +75,11 @@ private:
|
|
|
con_handler::pointer connection = con_handler::create(executor);
|
|
|
acceptor_.async_accept(connection->socket(),
|
|
|
boost::bind(&Server::handle_accept, this, connection,
|
|
|
- boost::asio::placeholders::error));
|
|
|
+ placeholders::error));
|
|
|
}
|
|
|
|
|
|
public:
|
|
|
- Server(boost::asio::io_service &io_service)
|
|
|
+ Server(io_service &io_service)
|
|
|
: acceptor_(io_service, tcp::endpoint(tcp::v4(), 1234)) {
|
|
|
start_accept();
|
|
|
}
|
|
@@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
|
|
|
sniffer.startSniffing();
|
|
|
|
|
|
try {
|
|
|
- boost::asio::io_service io_service;
|
|
|
+ io_service io_service;
|
|
|
Server server(io_service);
|
|
|
io_service.run();
|
|
|
} catch (std::exception &e) {
|