diff options
author | Othmar Gsenger <otti@anytun.org> | 2008-10-19 20:23:49 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@anytun.org> | 2008-10-19 20:23:49 +0000 |
commit | 3c66fe726ae8044b2d3ce90115217a6240473598 (patch) | |
tree | d0d2f3575d23c8262c07f35343177fd4706d95c8 /src/syncTcpConnection.h | |
parent | move to asio socket libary for sync (diff) |
now with files
Diffstat (limited to 'src/syncTcpConnection.h')
-rw-r--r-- | src/syncTcpConnection.h | 28 |
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 |