summaryrefslogtreecommitdiff
path: root/src/syncTcpConnection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/syncTcpConnection.h')
-rw-r--r--src/syncTcpConnection.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/syncTcpConnection.h b/src/syncTcpConnection.h
new file mode 100644
index 0000000..5caf1a0
--- /dev/null
+++ b/src/syncTcpConnection.h
@@ -0,0 +1,28 @@
+#ifndef _SYNCTCPCONNECTION_H_
+#define _SYNCTCPCONNECTION_H_
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <asio.hpp>
+
+#include <string>
+
+class SyncTcpConnection
+ : public boost::enable_shared_from_this<SyncTcpConnection>
+{
+public:
+ typedef boost::shared_ptr<SyncTcpConnection> pointer;
+ static pointer create(asio::io_service& io_service)
+ {
+ return pointer(new SyncTcpConnection(io_service));
+ };
+ asio::ip::tcp::socket& socket();
+ void start();
+ void Send(std::string message);
+private:
+ SyncTcpConnection(asio::io_service& io_service);
+
+ void handle_write(const asio::error_code& /*error*/,
+ size_t /*bytes_transferred*/);
+ asio::ip::tcp::socket socket_;
+};
+#endif