1 #ifndef client_hpp_INCLUDED
2 #define client_hpp_INCLUDED
5 #include <boost/asio.hpp>
6 #include <boost/shared_ptr.hpp>
9 #include "../connection.hpp"
10 #include "../connector.hpp"
17 class client
: public model
19 boost::asio::io_service io_service
;
20 boost::asio::io_service::work work
;
21 session_ptr session_ptr_
;
23 void user_cmd_handler();
29 session_ptr
session_ptr() { return session_ptr_
; }
31 bool connect(std::string ip
, unsigned short port
);
33 template<typename handler_type
>
34 void async_connect(std::string host
, unsigned short port
, handler_type handler
)
36 connector
connector(session_ptr_
->socket());
37 connector
.async_login(host
, port
, handler
);
41 void async_login(std::string username
, std::string password
, response_handler handler
);
44 typedef boost::shared_ptr
<client
> client_ptr
;