summaryrefslogtreecommitdiff
path: root/client-qt/udm-client-qt/client_session.h
blob: 0e90d8ae0ed4d86a3fc4feb4ff4fb18b91d3150d (plain)
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
29
30
31
32
33
#ifndef CLIENT_SESSION_H
#define CLIENT_SESSION_H


//boost.asio here, yes i know about qtnetwork, but i have more exp with boost asio

#include <boost/asio.hpp>
#include <QObject>



using boost::asio::ip::tcp;

class client_session : public QObject
{
    Q_OBJECT
public:
    explicit client_session(QObject *parent = 0, boost::asio::io_service *io_service = nullptr);

    tcp::socket& socket();

signals:

public slots:
    void connect(std::string &host, int port);
private:
    void connect_handler(const boost::system::error_code &error);
    char *recv_data_;
    boost::asio::io_service &io_service_;
    tcp::socket socket_;
};

#endif // CLIENT_SESSION_H