allgemeiner commit
[ssftp.git] / src / client / client.cpp
blobaefd65aacb9251c4995986c8383ac0b3c62f5328
1 #include "client.hpp"
2 #include "../command.hpp"
3 #include <boost/thread.hpp>
4 #include <boost/bind.hpp>
7 using namespace std;
8 using namespace boost;
9 using namespace boost::asio::ip;
12 ssftp::client::client::client()
13 :work(io_service)
15 thread thread(boost::bind(&boost::asio::io_service::run, &io_service));
18 bool ssftp::client::client::connect(string ip, unsigned short port)
20 session_ptr_.reset(new session(io_service));
21 tcp::endpoint ep(address::from_string(ip), port);
22 boost::system::error_code error;
23 session_ptr_->socket().connect(ep, error);
24 if(!error)
25 session_ptr_->start();
26 return error ? false : true;
29 void ssftp::client::client::async_login(string username, string password, response_callback callback)
31 session_ptr_->async_login(username, password, callback);