1.6.C++ project: imitating the muduo library to implement the design of the channel module of the concurrent server

The full version of the project is at: Article directory 1. Channel module: event management Channel class implementation 2. Functions provided 3. Realize ideas (1) Function (2) Meaning (3) Functional design 4. Code (1) Framework (2) Complete 1. channel module: event management Channel class implementation 2. Functions provided 1. Management of monitoring events Is the […]

1.5.C++ project: Design of socket module for concurrent server by imitating muduo library

The full version of the project is at: 1. socket module: socket module 2. Functions provided The Socket module is a module that encapsulates socket operations and mainly implements various socket operations. socket module: socket functions create socket Bind address information Start listening Initiate a connection to the server Get new connection Accept data send […]

1.8.C++ project: design of eventloop module imitating muduo library to implement concurrent server

The complete project is at: Article directory 1. Eventloop module: module for event monitoring and event processing 2. Functions provided 3. Realize ideas (1) Function (2) Meaning (3) Functional design 4. Framework 5. Code 1. eventloop module: module for event monitoring and event processing Module for event monitoring and management This module is what we […]

Channel, EPollPoller and EventLoop classes of Muduo network library [In-depth analysis]

Article directory Preface 1. Channel class 1. Main member variables and functions 2. Implementation principle 2. EPollPoller class 1. Implementation principle 2. EventLoop class 1. Function realization SubReactorde’s wake-up operation Foreword Reorganize the classes and knowledge points of the muduo network library. Channel, EPollPoller and EventLoop classes are the most important foundations of the muduo […]

1. C++ project: imitating muduo library to implement high-performance and high-concurrency server

Article directory 1. Achieve goals 2. Prerequisite knowledge (1) HTTP server 1. Concept (2) Reactor model: 1. Concept 2. Classification (1) Single Reactor single thread: single I/O multiplexing + business processing. (2) Single Reactor and multiple threads: single I/O multiplexing + thread pool (business processing) (3) Target positioning-One Thread One Loop master-slave Reactor model high […]

190-MUD engine explained in simple terms (2)

In the previous article we talked about MUD store How to write a data modeldata model Still relatively simple Next let’s talk about MUD world We can understand it as the world state of a MUD For example, we now create and deploy a world contract Then the world contract is essentially to record all […]

In-depth analysis of the SubReatcor wake-up operation in the Muduo library [Interpretation of Wanzi]

Article directory foreword 1. What is eventfd Two, eventfd combined with I/O multiplexing Why can it be combined with IO multiplexing example 3. Application of eventfd in muduo library Pre-knowledge, briefly introduce the channel and poller classes 1. Why do you need to wake up 2. Create wakeupFd_ and wakeupChannel_ 3. Wake up operation wakeup […]

Muduo source code analysis–TcpConnection

TcpConnection class Encapsulates tcp connections one by one, implements four socket callbacks, and registers some upper layer callbacks class TcpConnection : noncopyable, public std::enable_shared_from_this<TcpConnection> {<!– –> public: TcpConnection(EventLoop *loop, const std::string &nameArg, int sockfd, const InetAddress & localAddr, const InetAddress & peerAddr); ~TcpConnection(); EventLoop *getLoop() const {<!– –> return loop_; } const std::string & amp;name() […]

Muduo source code analysis–TcpServer

TcpServer class: Tcp server class // Class used for external server programming class TcpServer {<!– –> public: using ThreadInitCallback = std::function<void(EventLoop *)>; enum Option {<!– –> kNoReusePort, kReusePort, }; TcpServer(EventLoop *loop, const InetAddress & listenAddr, const std::string & nameArg, Option option = kNoReusePort); ~TcpServer(); void setThreadInitCallback(const ThreadInitCallback & amp;cb) {<!– –> threadInitCallback_ = cb; } […]