muduo测试的框架

This commit is contained in:
cuicui 2024-12-23 20:55:55 +08:00
parent 81625bcc6b
commit 3c25f57851
2 changed files with 44 additions and 0 deletions

5
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"recommendations": [
"ms-vscode.cmake-tools"
]
}

View File

@ -0,0 +1,39 @@
/*
muduo网络库给用户提供了两个主要的类
TcpServer
TcpClient
epoll+线
I/O的代码和业务代码区分开
*/
#include <muduo/net/TcpServer.h>
#include <muduo/net/EventLoop.h>
#include <iostream>
using namespace std;
using namespace muduo;
using namespace muduo::net;
class ChatServer{
public:
ChatServer(EventLoop* loop,
const InetAddress& listenAddr,
const string& nameArg)
:_server(loop,listenAddr,nameArg),_loop(loop)
{
}
private:
TcpServer _server;
EventLoop* _loop;
};