blob: 5caf1a06d08ba978da13b0bd34d694d013c1fd60 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
|