GithubHelp home page GithubHelp logo

mingyunyuansu / cppnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caozhiyi/cppnet

0.0 0.0 0.0 1.24 MB

Cross platform network library with C++11

License: BSD 3-Clause "New" or "Revised" License

Shell 0.01% C++ 77.14% C 19.68% Makefile 1.36% CMake 1.82%

cppnet's Introduction

cppnet logo

Build Status Licenses

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

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.

cppnet's People

Contributors

caozhiyi avatar simonhancrew avatar awen162 avatar yerannnnnn avatar logerrors avatar tangyu1018 avatar mingyunyuansu 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.