-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUserServer.cpp
executable file
·41 lines (36 loc) · 987 Bytes
/
UserServer.cpp
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
34
35
36
37
38
39
40
41
#include "UserServer.h"
UserServer::UserServer(const std::string& ipAddress,
const int& port, const bool& block, const int& max_event)
: m_UserServer_(NULL)
{
std::cout << "UserServer UserServer" << std::endl;
m_UserServer_ = new TcpServer(ipAddress, port, block, max_event);
}
UserServer::~UserServer()
{
if(m_UserServer_ != NULL)
delete m_UserServer_;
m_UserServer_ = NULL;
std::cout << "UserServer ~UserServer" << std::endl;
}
void UserServer::StartServer()
{
m_UserServer_->set_ServerCallBack(this);
m_UserServer_->Start();
}
void UserServer::DoAnalyseMessage(const std::string& recvData,
std::string& sendData)
{
// 数据处理
}
void UserServer::SendMessage(const std::string& recvData,
std::string& sendData)
{
DoAnalyseMessage(recvData, sendData);
std::cout << "UserServer handle sendMessage" << std::endl;
}
void UserServer::AfterConnect(std::string& sendData)
{
// do your things
std::cout << "UserServer handle Connect" << std::endl;
}