Linux下轻量级Web服务器,用于巩固网络编程。
- 使用模拟proactor的事件处理模式
- 使用epoll进行多路IO复用,采用LT+ET的模式,实现并发
- 通过半同步半反应堆线程池的工作线程处理数据
- 使用状态机解析HTTP请求报文,支持GET和POST请求解析
- 使用升序链表定时器容器来处理定时功能,从而处理非活跃连接
- 实现MySql数据库连接池,通过访问数据库实现web端用户注册,登陆功能。
├── http 连接对象文件
│ ├── http_coon.cpp
│ └── http_coon.h
├── main.cpp
├── README.md
├── resources 资源文件
│ ├── favicon.ico
│ ├── index.html
│ ├── loginFail.html
│ ├── login.html
│ ├── picture.html
│ ├── registerFail.html
│ ├── register.html
│ ├── registerSuccess.html
│ ├── video.html
│ ├── video.mp4
│ └── wallhaven-72lej9.png
├── server 服务器类
│ ├── server.cpp
│ └── server.h
├── sql 数据库连接池
│ ├── sqlConnectionPool.cpp
│ └── sqlConnectionPool.h
├── threadpool 线程池
│ ├── thread_pool.cpp
│ └── thread_pool.h
└── timer 定时器容器
├── timer.cpp
└── timer.h
- OS: Manjaro Linux x86_64 Kernel: 5.10.126-1-MANJARO
- GCC 12.1
- CMake 3.23.2
- MySql 8
- CLion
将resources目录下的资源文件全部移动到 /var/www/server目录下
然后进行编译运行,注意依赖库!
- 日志功能
- 通过堆数据结构 优化定时器容器
- 通过使用Mysql的connector/c++ 改写数据库连接池