Skip to content

hangge1/cpp_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpp_server

cpp_server 是一个用于学习 C++ 网络服务器编程的实践仓库。项目从 Socket 基础、TCP 消息封装、多线程网络程序开始,逐步探索 select、IOCP、epoll 等网络通信模型,以及服务端性能优化相关问题。

学习目标

  • 掌握多平台 C++ 程序开发、调试和发布流程。
  • 理解主流平台下 C++ TCP 网络通信的基本流程。
  • 学习 select、IOCP、epoll 等网络模型,并根据场景选择合适方案。
  • 逐步构建高性能服务器,从少量连接扩展到高并发连接。
  • 练习多线程、内存管理、内存池、对象池等服务端基础能力。

开发环境

平台 环境
Windows Windows 11 + Visual Studio 2022
Linux Ubuntu 20.04 64-bit
macOS Xcode

辅助工具:VMware、Git、Beyond Compare 等。

目录结构

src/   Visual Studio 示例工程和 C++ 源码
doc/   网络编程学习笔记与阶段性文档

当前示例

  • HelloSocket: Socket 基础示例
  • HelloThread: 多线程基础示例
  • EasyTcpClient: TCP 客户端封装实践
  • EasyTcpServer: TCP 服务端封装实践
  • VCProjectTemplate: Visual Studio 工程模板实践

文档索引

学习路线

  1. 搭建不同平台下的 C++ 开发环境。
  2. 学习 Socket 网络编程基础。
  3. 封装结构化 TCP 消息。
  4. 引入多线程处理客户端连接。
  5. 对比 select、IOCP、epoll 等模型。
  6. 通过压测和计时工具分析性能瓶颈。

License

This project is licensed under the MIT License. See LICENSE for details.

Unless otherwise noted, third-party dependencies, assets, course/tutorial materials, and externally sourced resources remain under their original licenses.

About

C++ network server programming notes and examples.

Topics

Resources

License

Stars

14 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages