-
Notifications
You must be signed in to change notification settings - Fork 17
/
server.cpp
32 lines (26 loc) · 905 Bytes
/
server.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
/*======================================================
> File Name: server.cpp
> Author: MiaoShuai
> E-mail:
> Other :
> Created Time: 2015年12月20日 星期日 21时53分51秒
=======================================================*/
#include "server.h"
#include <memory>
#include <string>
using namespace netlib;
Server::Server(std::string ip,int port,int loopNumber)
:baseLoopPtr_(std::make_shared<BaseLoop>(ip,port,loopNumber))
{
}
Server::~Server()
{
}
void Server::start()
{
baseLoopPtr_->setConnectionCallback(connectionCallback_);//设置连接回调
baseLoopPtr_->setMessageCallback(messageCallback_); //设置读回调函数
baseLoopPtr_->setCloseCallback(closeCallback_); //设置关闭回调函数
baseLoopPtr_->setWriteCompleteCallback(writeCompleteCallback_);
baseLoopPtr_->start(); //开始循环
}