diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-12-31 01:25:38 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-12-31 01:25:38 +0100 |
commit | 0e7f2cef26bde782a5758b5e9a3dfe20f745df8f (patch) | |
tree | 736b53010218fba8134a1660c7a3ad5ef998f01c /telnet_connection.cpp | |
parent | b439fcd1916cef267bde32f3424d8311519d3d16 (diff) |
Added an echoing telnet server as a base for a telnet command interface.
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)); +} |