summaryrefslogtreecommitdiff
path: root/telnet_connection.cpp
blob: e2ea96f3eceb9698d9fe9ca9bff9f2960052cfe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "telnet_connection.h"

#include <boost/bind.hpp>

telnet::Connection::Connection(boost::asio::io_service& io_service) : socket(io_service) {
}

void telnet::Connection::handle_read(const boost::system::error_code& error, size_t bytes_transferred) {
	boost::asio::write(socket, buf);
}

void telnet::Connection::start() {
	boost::asio::async_read_until(socket, buf, "\n", boost::bind(&Connection::handle_read, shared_from_this(),
				boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
}