Giter Club home page Giter Club logo

cppserver's Introduction

基于我的理解,模仿muduo逐步实现基于Reactor模式的多线程服务器
基于该网络库,实现了简易的HTTP服务器,websocket服务器
每个迭代的版本介绍讲解在我的博客内,博客地址
实现linux服务器开发思路

迭代的版本及讲解
1.从简单的socket编程开始
2.多线程登场,服务于多客户端
3.epoll登场,单线程也可服务多用户
4.添加类,模块化
5.添加Channel类,Reactor模式初形成
6.添加类EventLoop,增添回调函数
7.添加Acceptor class
8.添加Buffer类,缓冲区很有必要
9.添加Connection类
10.继续完善Connection类,单Reactor模式成型
11.添加线程池,单Reactor+threadpool模式成型
12.添加可跨线程调用的函数
13.主从Reactor模型
14.主从Reactor+thread pool模式,和Connection对象的引用计数的困惑讲解
15.添加定时器
16.完善定时器功能,添加EventLoop关于定时器的相关操作函数
17.添加异步日志——1.日志消息的存储和输出
18.添加异步日志——2.实现异步
19.添加异步日志——3.继续完善
20.添加HTTP模块
21.添加websocket模块

主从 Reactor 模式中,分为了 主Reactor 和 从Reactor,分别处理 新建立的连接和分发、处理客户端读写事件
主从多线程模型由多个 Reactor 线程组成。MainReactor 负责处理客户端连接的 Accept 事件,连接建立成功后将新创建的连接注册到任一SubReactor。再由SubReactor分配线程池中的 I/O 线程与其连接绑定,它将负责连接生命周期内所有的 I/O 事件。

主从Reactor模型

cppserver's People

Contributors

liwook avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.