diff options
Diffstat (limited to 'telnet_connection.cpp')
-rw-r--r-- | telnet_connection.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/telnet_connection.cpp b/telnet_connection.cpp new file mode 100644 index 0000000..e2ea96f --- /dev/null +++ b/telnet_connection.cpp @@ -0,0 +1,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)); +} |