MCPcopy Create free account
hub / github.com/Shangyizhou/A-Tiny-Network-Library / EchoServer

Method EchoServer

example/echoServerAsync.cc:9–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7{
8public:
9 EchoServer(EventLoop *loop, const InetAddress &addr, const std::string &name)
10 : server_(loop, addr, name)
11 , loop_(loop)
12 {
13 // 注册回调函数
14 server_.setConnectionCallback(
15 std::bind(&EchoServer::onConnection, this, std::placeholders::_1));
16
17 server_.setMessageCallback(
18 std::bind(&EchoServer::onMessage, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
19
20 // 设置合适的subloop线程数量
21 // server_.setThreadNum(3);
22 }
23
24 void start()
25 {

Callers

nothing calls this directly

Calls 2

setConnectionCallbackMethod · 0.45
setMessageCallbackMethod · 0.45

Tested by

no test coverage detected