| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #pragma once
- #include "../pch/pch.h"
- #include "PosMessage.h"
- using boost::asio::ip::tcp;
- class CServer;
- class CClientSession
- {
- public:
- CClientSession(boost::asio::io_context& io_context)
- : socket_(io_context)
- {
- }
- ~CClientSession();
- void SetServer(CServer* server);
- tcp::socket& socket()
- {
- return socket_;
- }
- void start();
- void stop();
- void send_message(std::string msg);
- void SetNum(int m_num)
- {
- m_nClientNum = m_num;
- }
- int GetNum()
- {
- return m_nClientNum;
- }
- private:
- void handle_read(const boost::system::error_code& error,
- size_t bytes_transferred);
- tcp::socket socket_;
-
- PosMessage m_pos_message;
- CServer* m_server;
- int m_nClientNum;
- std::string m_username = "";
- };
|