Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

CppNet

> 编程语言
Open source

Cross platform network library with C++11

1.1K stars0 likes0 views
WebsiteGitHub

About

Cross platform network library with C++11

See chinese
See the details in chinese wiki

Introduction

Cppnet is a proactor mode and multithreaded network with C++11 on tcp. Support Window, Linux and macOS.

  • Simple:

    • Only export a little interfaces, all net io insterface are asynchronous callbacks
    • Insterface as much as possible like calling the socket API of the system
    • There is only one additional buffer interface for the client
    • Support both IPv4 and IPv6
  • Fast:

    • Use epoll, wepoll and kqueue
    • Multithreaded threads are handled by the kernel
    • Each socket has a single memory pool object. All memory requested from the memory pool is managed by an intelligent pointer
    • Using time wheel to realize timer
  • Clear:

    • Three layers: event-driven layer, session management layer and interface layer
    • Upward notification through callbacks between layers. Clear division of responsibilities among modules, pay to Caesar what belongs to Caesar and God what belongs to God
    • The interface decoupling module is used to meet the minimum interface principle and dependency inversion principle

Quick Start

Quick use of cppnet and precautions, see quick start.

Interface

cppnet has three types of external interfaces, which are also defined in three header files

  • Initialization and global configuration, defined in cppnet
  • socket operation, defined in cppnet_socket
  • buffer read, defined in cppnet_buffer

For details, see API.

Example

All simples are in test:

  • simple: Most simple example.
  • echo: Test program of echo with 200 connection.
  • http: Simple HTTP server is implemented with reference to muduo.
  • sendfile: Example of sending and receiving files.
  • pingpong: Pingpong test program.
  • rpc: Interesting rpc program.
  • multi_port: Example of multiple listening ports.

Efficiency

Apache ab is used to pressure test the http test service in the test directory, and compared with muduo.
For details, see ab benchmark。

Build

Look at Build

Licenses

This program is under the terms of the BSD 3-Clause License. For details, see BSD-3-Clause.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++epolliocpkqueuesocket

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言