# yuesong-feng/30daymakecppserver

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/yuesong-feng-30daymakecppserver).**

7,040 stars · 885 forks · C++

## Links

- GitHub: https://github.com/yuesong-feng/30dayMakeCppServer
- awesome-repositories: https://awesome-repositories.com/repository/yuesong-feng-30daymakecppserver.md

## Topics

`cpp` `cppserver` `epoll` `server` `socket`

## Description

This project is a C++ TCP server framework and educational socket programming guide. It provides a high-performance network library focused on event-driven architecture, implementing a reactor pattern to handle thousands of simultaneous client connections.

The framework is distinguished by its multi-threaded event loop, which utilizes a main-sub reactor coordination model to distribute network events across a worker thread pool. It includes an abstraction layer for non-blocking socket I/O and event multiplexing via the epoll system call, decoupling network transport from application business logic through callback functions.

The project covers low-level socket programming, including connection lifecycle management and bidirectional data exchange. It incorporates concurrency primitives for task scheduling and load balancing, non-blocking I/O buffering, and automatic memory release using smart pointers.

Development tools are included for automated building, code formatting, and static analysis to maintain source code quality.

## Tags

### Education & Learning Resources

- [TCP/IP Socket Programming Guides](https://awesome-repositories.com/f/education-learning-resources/tcp-ip-socket-programming-guides.md) — Serves as a comprehensive educational guide and resource for implementing TCP/IP socket programming in C++.

### Networking & Communication

- [Reactor Patterns](https://awesome-repositories.com/f/networking-communication/reactor-patterns.md) — Provides a complete implementation of the reactor pattern to dispatch high-concurrency network events to handlers.
- [C++ Networking Libraries](https://awesome-repositories.com/f/networking-communication/c-networking-libraries.md) — Provides a networking library specifically for C++ to implement TCP servers and data exchange.
- [IO Multiplexing](https://awesome-repositories.com/f/networking-communication/connection-multiplexing/io-multiplexing.md) — Utilizes kernel-level IO multiplexing via epoll to monitor and manage thousands of concurrent connections on a single thread. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day03-%E9%AB%98%E5%B9%B6%E5%8F%91%E8%BF%98%E5%BE%97%E7%94%A8epoll.md))
- [Network Socket Bindings](https://awesome-repositories.com/f/networking-communication/network-socket-bindings.md) — Enables binding server listeners to specific network interfaces and port numbers for identification. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day01-%E4%BB%8E%E4%B8%80%E4%B8%AA%E6%9C%80%E7%AE%80%E5%8D%95%E7%9A%84socket%E5%BC%80%E5%A7%8B.md))
- [Multi-Threaded Event Distribution](https://awesome-repositories.com/f/networking-communication/networking/network-programming/multi-threaded-event-distribution.md) — Implements a multi-threaded event distribution system to parallelize network event processing across CPU cores.
- [Multi-Reactor Implementations](https://awesome-repositories.com/f/networking-communication/reactor-patterns/multi-reactor-implementations.md) — Implements a multi-reactor architecture that distributes network event processing across a worker thread pool.
- [Socket Networking](https://awesome-repositories.com/f/networking-communication/socket-networking.md) — Provides low-level socket management for establishing raw TCP and UDP communication endpoints. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day01-%E4%BB%8E%E4%B8%80%E4%B8%AA%E6%9C%80%E7%AE%80%E5%8D%95%E7%9A%84socket%E5%BC%80%E5%A7%8B.md))
- [Non-Blocking Socket I/O](https://awesome-repositories.com/f/networking-communication/socket-networking/non-blocking-socket-i-o.md) — Implements asynchronous reading and writing of network sockets to prevent execution stalls during network latency. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day14-%E6%94%AF%E6%8C%81%E4%B8%9A%E5%8A%A1%E9%80%BB%E8%BE%91%E8%87%AA%E5%AE%9A%E4%B9%89%E3%80%81%E5%AE%8C%E5%96%84Connection%E7%B1%BB.md))
- [Epoll Wrappers](https://awesome-repositories.com/f/networking-communication/socket-networking/non-blocking-socket-i-o/epoll-wrappers.md) — Ships a C++ abstraction layer for managing non-blocking socket I/O via the epoll system call.
- [Socket Buffers](https://awesome-repositories.com/f/networking-communication/socket-networking/socket-buffers.md) — Implements dedicated socket buffers to accumulate raw data streams and decouple low-level IO from logic. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day09-%E7%BC%93%E5%86%B2%E5%8C%BA-%E5%A4%A7%E4%BD%9C%E7%94%A8.md))
- [TCP Server Frameworks](https://awesome-repositories.com/f/networking-communication/tcp-server-frameworks.md) — Provides a high-performance C++ TCP server framework with an event-driven architecture.
- [TCP Socket Programming](https://awesome-repositories.com/f/networking-communication/tcp-socket-programming.md) — Manages the complete lifecycle of TCP sockets from creation and binding to accepting connections.
- [Bidirectional Socket Communication](https://awesome-repositories.com/f/networking-communication/bidirectional-socket-communication.md) — Facilitates reading data from sockets into buffers and writing responses back to clients. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day02-%E4%B8%8D%E8%A6%81%E6%94%BE%E8%BF%87%E4%BB%BB%E4%BD%95%E4%B8%80%E4%B8%AA%E9%94%99%E8%AF%AF.md))
- [Connection Lifecycle Managers](https://awesome-repositories.com/f/networking-communication/connection-lifecycle-managers.md) — Includes a centralized server manager to track active client connections and manage their lifecycles. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day08-%E4%B8%80%E5%88%87%E7%9A%86%E6%98%AF%E7%B1%BB%EF%BC%8C%E8%BF%9ETCP%E8%BF%9E%E6%8E%A5%E4%B9%9F%E4%B8%8D%E4%BE%8B%E5%A4%96.md))
- [Buffered Message Callbacks](https://awesome-repositories.com/f/networking-communication/packet-buffering/message-extraction-from-buffers/buffered-message-callbacks.md) — Executes business logic callbacks only after the server has fully received and buffered a complete message from a client. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day15-macOS%E6%94%AF%E6%8C%81%E3%80%81%E5%AE%8C%E5%96%84%E4%B8%9A%E5%8A%A1%E9%80%BB%E8%BE%91%E8%87%AA%E5%AE%9A%E4%B9%89.md))
- [I/O Buffering](https://awesome-repositories.com/f/networking-communication/socket-networking/non-blocking-socket-i-o/i-o-buffering.md) — Ships non-blocking I/O buffers to decouple socket data transmission from application logic.
- [TCP Connection Acceptance](https://awesome-repositories.com/f/networking-communication/tcp-connection-lifecycles/tcp-connection-acceptance.md) — Handles the server-side acceptance of incoming TCP connections on bound addresses. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day01-%E4%BB%8E%E4%B8%80%E4%B8%AA%E6%9C%80%E7%AE%80%E5%8D%95%E7%9A%84socket%E5%BC%80%E5%A7%8B.md))

### Operating Systems & Systems Programming

- [Network Event Monitoring Schedulers](https://awesome-repositories.com/f/operating-systems-systems-programming/network-event-monitoring-schedulers.md) — Provides low-level scheduling to monitor and trigger network read and write events across multiple file descriptors. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day03-%E9%AB%98%E5%B9%B6%E5%8F%91%E8%BF%98%E5%BE%97%E7%94%A8epoll.md))

### Software Engineering & Architecture

- [Event-Driven Architectures](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-architectures.md) — Implements an event-driven server architecture based on the reactor pattern using epoll.
- [Event-Driven Callbacks](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-callbacks.md) — Binds business logic callbacks to socket descriptors using an event-driven pattern for asynchronous request handling. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day08-%E4%B8%80%E5%88%87%E7%9A%86%E6%98%AF%E7%B1%BB%EF%BC%8C%E8%BF%9ETCP%E8%BF%9E%E6%8E%A5%E4%B9%9F%E4%B8%8D%E4%BE%8B%E5%A4%96.md))
- [Non-blocking IO Architectures](https://awesome-repositories.com/f/software-engineering-architecture/non-blocking-io-architectures.md) — Implements non-blocking I/O architectures using multiplexing to prevent thread blocking during network tasks.
- [Reactor Pattern Event Loops](https://awesome-repositories.com/f/software-engineering-architecture/reactor-pattern-event-loops.md) — Utilizes a reactor-based event loop to monitor multiple file descriptors and trigger registered callbacks.
- [Event Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/reactive-messaging/reactive-event-driven-systems/event-dispatchers.md) — Routes network events triggered by file descriptors to registered listener objects for targeted processing. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day05-epoll%E9%AB%98%E7%BA%A7%E7%94%A8%E6%B3%95-Channel%E7%99%BB%E5%9C%BA.md))
- [Business Logic Components](https://awesome-repositories.com/f/software-engineering-architecture/business-logic-components.md) — Isolates business logic from network transport by transforming connection events into application states via callbacks. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day14-%E6%94%AF%E6%8C%81%E4%B8%9A%E5%8A%A1%E9%80%BB%E8%BE%91%E8%87%AA%E5%AE%9A%E4%B9%89%E3%80%81%E5%AE%8C%E5%96%84Connection%E7%B1%BB.md))
- [Worker Queue Management](https://awesome-repositories.com/f/software-engineering-architecture/concurrent-task-runners/worker-queue-management.md) — Distributes network events across worker threads via a synchronized queue to reduce switching overhead. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day10-%E5%8A%A0%E5%85%A5%E7%BA%BF%E7%A8%8B%E6%B1%A0%E5%88%B0%E6%9C%8D%E5%8A%A1%E5%99%A8.md))
- [File Descriptor Mappings](https://awesome-repositories.com/f/software-engineering-architecture/file-descriptor-mappings.md) — Provides a mechanism to associate raw socket file descriptors with connection metadata objects.
- [Resource Ownership Transfer](https://awesome-repositories.com/f/software-engineering-architecture/resource-ownership-transfer.md) — Utilizes C++ move semantics to transfer ownership of network resources and eliminate unnecessary memory copying. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day16-%E9%87%8D%E6%9E%84%E6%A0%B8%E5%BF%83%E5%BA%93%E3%80%81%E4%BD%BF%E7%94%A8%E6%99%BA%E8%83%BD%E6%8C%87%E9%92%88.md))

### System Administration & Monitoring

- [Socket Event Loops](https://awesome-repositories.com/f/system-administration-monitoring/administrative-operations/linux-system-administration/networking/connection-lifecycle-management/parallel-network-i-o/event-driven-i-o/asynchronous-event-loops/socket-event-loops.md) — Implements socket event loops that monitor multiple file descriptors and trigger non-blocking callback functions. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day06-%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8E%E4%BA%8B%E4%BB%B6%E9%A9%B1%E5%8A%A8%E6%A0%B8%E5%BF%83%E7%B1%BB%E7%99%BB%E5%9C%BA.md))
- [OS-Specific Event Notifications](https://awesome-repositories.com/f/system-administration-monitoring/administrative-operations/linux-system-administration/networking/connection-lifecycle-management/parallel-network-i-o/event-driven-i-o/asynchronous-event-loops/socket-event-loops/os-specific-event-notifications.md) — Provides abstractions for monitoring socket events using system-specific interfaces like epoll and kqueue. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day15-macOS%E6%94%AF%E6%8C%81%E3%80%81%E5%AE%8C%E5%96%84%E4%B8%9A%E5%8A%A1%E9%80%BB%E8%BE%91%E8%87%AA%E5%AE%9A%E4%B9%89.md))
- [Object-Oriented Socket Wrappers](https://awesome-repositories.com/f/system-administration-monitoring/administrative-operations/linux-system-administration/networking/socket-protocol-layering/socket-management/object-oriented-socket-wrappers.md) — Provides an object-oriented interface for socket creation, binding, and listening to abstract low-level system calls. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day04-%E6%9D%A5%E7%9C%8B%E7%9C%8B%E6%88%91%E4%BB%AC%E7%9A%84%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%B1%BB.md))

### User Interface & Experience

- [OS Event Polling](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/event-handling-architectures/event-handling-systems/event-queue-polling/os-event-polling.md) — Implements a high-level interface for OS-native polling mechanisms like epoll to monitor network I/O readiness. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day04-%E6%9D%A5%E7%9C%8B%E7%9C%8B%E6%88%91%E4%BB%AC%E7%9A%84%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%B1%BB.md))

### Part of an Awesome List

- [Network Load Balancing Strategies](https://awesome-repositories.com/f/awesome-lists/devops/concurrency-threading/network-load-balancing-strategies.md) — Employs scheduling strategies to distribute new network connections evenly across worker threads. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day12-%E5%B0%86%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%94%B9%E5%86%99%E4%B8%BA%E4%B8%BB%E4%BB%8EReactor%E5%A4%9A%E7%BA%BF%E7%A8%8B%E6%A8%A1%E5%BC%8F.md))

### Development Tools & Productivity

- [Concurrent Task Execution](https://awesome-repositories.com/f/development-tools-productivity/concurrent-task-execution.md) — Supports executing asynchronous functions in a thread pool and retrieving results via futures. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day11-%E5%AE%8C%E5%96%84%E7%BA%BF%E7%A8%8B%E6%B1%A0%EF%BC%8C%E5%8A%A0%E5%85%A5%E4%B8%80%E4%B8%AA%E7%AE%80%E5%8D%95%E7%9A%84%E6%B5%8B%E8%AF%95%E7%A8%8B%E5%BA%8F.md))

### Programming Languages & Runtimes

- [File Descriptor Metadata Mapping](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/execution-models/multi-threaded-execution/event-loops/file-descriptor-event-monitoring/file-descriptor-metadata-mapping.md) — Binds raw system file descriptors to dedicated objects to store connection metadata and track specific event interests. ([source](https://github.com/yuesong-feng/30dayMakeCppServer/blob/main/day05-epoll%E9%AB%98%E7%BA%A7%E7%94%A8%E6%B3%95-Channel%E7%99%BB%E5%9C%BA.md))
- [Task Schedulers](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/task-orchestration-frameworks/task-schedulers.md) — Implements task scheduling to distribute network events across multiple CPU cores via worker pools.
