Skip to content
View netplus's full-sized avatar

Block or report netplus

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
netplus/README.md

A new beginning of network programming

What is Netplus

Netplus is a network programming library written in c++11. It's highly extensible, and with default configuration it can reach high performance. It's easy to learn. Basically, you can just implement your own business in a channel handler, then the library would do all the dirty work (platform specific considerations, io event delivery&process, basic memory optimization, etc ) for you. You can also write http/https,websocket,based application even you only have little corresponding knowledge background, Cuz it has relevant modules to simplify programming tasks of such kinds. Netplus borrows lots of concepts from Netty, and tries to implement these concepts by c++, such as channel, channel handler, channel pipeline, executor, scheduler, promise. Any one who is familiar with Netty should be able to start with ease.

What can we use Netplus to do

1) Implement a message gateway
2) Use as the network component of a message queue, gameserver or any other network based application.
   please note that netplus is not a gameserver framework, But you can implement one with netplus
3) Implement protocol driver of Middleware, such as kinds of database, message queue server, etc
4) Implement http/https, websocket based application
5) Implement RPC server

Target Arch & Platform

1) Windows on x86/x64
2) Linux on x86/x64/arm
3) IOS/MAC on x86/arm
4) Android on x86/arm

First Impression

//listen on 0.0.0.0:80 port for a http service, 
netp::listen_on("tcp://0.0.0.0:80", [](NRP<netp::channel> const& ch) {
    ch->pipeline()->add_last(netp::make_ref<netp::handler::http>());
    ...
}

//fast request for a http request
NRP<netp::http::request_promise> rp = netp::http::get("https://x.com/");

//listen on 10088 for a rpc service
netp::rpc::listen("tcp://0.0.0.0:10088",[](NRP<netp::rpc> const& r){
   r->bindcall( api_id, []( NRP<netp::rpc> const& r, NRP<netp::packet> cosnt& in, NRP<netp::rpc_call_promise> const& rcp ) {
       NETP_INFO("[rpc]a request in, request pkt len: %u", in->len() );
       NRP<netp::packet> reply = netp::make_ref<netp::packet>();
       reply->write("this is a reply from the call to api_id");
       
       //call return with netp::OK, and a message in reply pkt
       rcp->set(std::make_tuple(netp::OK, reply));
   });
},...);

Learn more from the following urls:

Build and usage: https://github.com/netplus/netplus/wiki#building--usage

Quick Start: https://github.com/netplus/netplus/wiki#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B

Benchmark: https://github.com/netplus/netplus/wiki#benchmark

Examples: https://github.com/netplus/netplus/wiki#examples

Basic concept: https://github.com/netplus/netplus/wiki#concept

Modules: https://github.com/netplus/netplus/wiki#modules

Zhihu: https://www.zhihu.com/column/c_1339539434091040768

Others

QQ group: 576499184 (加群请注明来源,thx)

Popular repositories Loading

  1. netplus netplus Public

    An easy-to-learn, high performance network io library written in modern cpp (c++11), It borrows concepts from Netty, and with well defined internal modules, It enables you to write rpc, http/https,…

    C++ 76 19

  2. GmSSL GmSSL Public

    Forked from guanzhi/GmSSL

    支持国密SM2/SM3/SM4/SM9/SSL的密码工具箱

    C 1

  3. Windows-driver-samples Windows-driver-samples Public

    Forked from OpenVPN/Windows-driver-samples

    This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples.

    C

  4. netplus_deps netplus_deps Public

    C++

  5. namesilo-letsencrypt namesilo-letsencrypt Public

    Forked from ethauvin/namesilo-letsencrypt

    Automatically generate/renew Let's Encrypt certificates with Certbot on NameSilo DNS

    Python

  6. StackWalker StackWalker Public

    Forked from JochenKalmbach/StackWalker

    Walking the callstack in windows applications

    C++