All Projects → wlgq2 → Uv Cpp

wlgq2 / Uv Cpp

Licence: mit
libuv wrapper in C++11 /libuv C++11网络库

Labels

Projects that are alternatives of or similar to Uv Cpp

jwEngine
A cross-platform C++<->lua server quick solution
Stars: ✭ 226 (-52.92%)
Mutual labels:  tcp, libuv
Rsock
The best companion of kcptun
Stars: ✭ 242 (-49.58%)
Mutual labels:  libuv, tcp
Mirror
#1 Open Source Unity Networking Library
Stars: ✭ 2,905 (+505.21%)
Mutual labels:  libuv, tcp
ccxx
This is a cross-platform library software library about c, c ++, unix4, posix. Include gtest, benchmark, cmake, process lock, daemon, libuv, lua, cpython, re2, json, yaml, mysql, redis, opencv, qt, lz4, oci ... https://hub.docker.com/u/oudream
Stars: ✭ 31 (-93.54%)
Mutual labels:  tcp, libuv
Networksocket
NetworkSocket是一个以中间件(middleware)扩展通讯协议,以插件(plug)扩展服务器功能的支持SSL安全传输的通讯框架;目前支持http、websocket、fast、flex策略与silverlight策略协议。
Stars: ✭ 435 (-9.37%)
Mutual labels:  tcp
Fpga Network Stack
Scalable Network Stack for FPGAs (TCP/IP, RoCEv2)
Stars: ✭ 345 (-28.12%)
Mutual labels:  tcp
Statsd Php
a PHP client for statsd
Stars: ✭ 327 (-31.87%)
Mutual labels:  tcp
Message Io
Event-driven message library for building network applications easy and fast.
Stars: ✭ 321 (-33.12%)
Mutual labels:  tcp
Udp2raw Tunnel
A Tunnel which Turns UDP Traffic into Encrypted UDP/FakeTCP/ICMP Traffic by using Raw Socket,helps you Bypass UDP FireWalls(or Unstable UDP Environment)
Stars: ✭ 4,839 (+908.13%)
Mutual labels:  tcp
Luv
Bare libuv bindings for lua
Stars: ✭ 466 (-2.92%)
Mutual labels:  libuv
Networker
A simple to use TCP and UDP networking library for .NET. Compatible with Unity.
Stars: ✭ 408 (-15%)
Mutual labels:  tcp
Kache
A simple in memory cache written using go
Stars: ✭ 349 (-27.29%)
Mutual labels:  tcp
Logstash Logger
Ruby logger that writes logstash events
Stars: ✭ 442 (-7.92%)
Mutual labels:  tcp
Mobileimsdk
一个原创移动端IM通信层框架,轻量级、高度提炼,历经8年、久经考验。可能是市面上唯一同时支持UDP+TCP+WebSocket三种协议的同类开源框架,支持iOS、Android、Java、H5,服务端基于Netty。
Stars: ✭ 3,864 (+705%)
Mutual labels:  tcp
Cnp3
Computer Networking : Principles, Protocols and Practice (first and second edition, third edition is being written on https://github.com/cnp3/ebook)
Stars: ✭ 471 (-1.87%)
Mutual labels:  tcp
Luvit
Lua + libUV + jIT = pure awesomesauce
Stars: ✭ 3,443 (+617.29%)
Mutual labels:  libuv
Goben
goben is a golang tool to measure TCP/UDP transport layer throughput between hosts.
Stars: ✭ 391 (-18.54%)
Mutual labels:  tcp
Bizsocket
异步socket,对一些业务场景做了支持
Stars: ✭ 469 (-2.29%)
Mutual labels:  tcp
Notebook
🍎 笔记本
Stars: ✭ 381 (-20.62%)
Mutual labels:  tcp
Deep Into Node
深入理解Node.js:核心思想与源码分析
Stars: ✭ 4,005 (+734.38%)
Mutual labels:  libuv

uv-cpp

Github release Platform License Project Status: Active – The project has reached a stable, usable state and is being actively developed.


Language Translations:


uv-cpp is a simple interface, high-performance network library based on C++11.

Dependencies

Features

  • C++11 functional/bind style callback instead of C-style function pointer.
  • TCP and UDP wrapper.
  • DNSandHttp:DNS query and http support,Http routing based on radix tree.
  • TimerandTimerWheel:Heartbeat timeout judgment with time complexity of O(1).
  • Async:libuv async wrapper,but optimized the problem of calling multiple times but callback will only be called once.
  • PacketandPacketBuffer:Send and receive packet of Tcp data stream. Support custom data packet structure (such as uvnsq)
  • Log interface.

Build Instructions

  • VS2017 (windows)
  • Codeblocks (linux)
  • CMake (linux)

Benchmark

ping-pong VS boost.asio-1.67


environment:Intel Core i5 8265U + debian8 + gcc8.3.0 + libuv1.30.0 + '-O2'

size peer pack 1K bytes 2K bytes 4K bytes 8K bytes
uv-cpp 16138 kbyte 32071 kbyte 59264 kbyte 123813 kbyte
boost.asio 16119 kbyte 31566 kbyte 58322 kbyte 126210 kbyte

asio1


environment:i5-8265U + 4G memory + 4k bytes ping-pong concurrency| 10|100|1000|5000| :---------:|:--------:|:--------:|:--------:|:--------:| uv-cpp | 654282 kbyte|591869 kbyte|401500 kbyte|412855 kbyte| boost.asio | 633818 kbyte|585716 kbyte|371386 kbyte|382402 kbyte|

asio2

Apache bench VS nginx-1.14.2


environment:Intel Core i5 8265U + debian8 + gcc8.3.0 + libuv1.30.0 + '-O2'
1000 concurrency && 100000 request. uv_http nginx_http

Quick start

A simple echo server

#include <iostream>
#include <uv/include/uv11.h>

int main(int argc, char** args)
{
    uv::EventLoop* loop = uv::EventLoop::DefaultLoop();
	
    uv::TcpServer server(loop);
    server.setMessageCallback([](uv::TcpConnectionPtr ptr,const char* data, ssize_t size)
    {
        ptr->write(data, size, nullptr);
    });
    //server.setTimeout(60); //heartbeat timeout.
	
    uv::SocketAddr addr("0.0.0.0", 10005, uv::SocketAddr::Ipv4);
    server.bindAndListen(addr);
    loop->run();
}

A simple http service router which based on radix tree.

int main(int argc, char** args)
{
    uv::EventLoop loop;
    uv::http::HttpServer::SetBufferMode(uv::GlobalConfig::BufferMode::CycleBuffer);

    uv::http::HttpServer server(&loop);
	
    //example:  127.0.0.1:10010/test
    server.Get("/test",std::bind(&func1,std::placeholders::_1,std::placeholders::_2));
    
    //example:  127.0.0.1:10010/some123abc
    server.Get("/some*",std::bind(&func2, std::placeholders::_1, std::placeholders::_2));
    
    //example:  127.0.0.1:10010/value:1234
    server.Get("/value:",std::bind(&func3, std::placeholders::_1, std::placeholders::_2));
    
    //example:  127.0.0.1:10010/sum?param1=100&param2=23
    server.Get("/sum",std::bind(&func4, std::placeholders::_1, std::placeholders::_2));
    
    uv::SocketAddr addr("127.0.0.1", 10010);
    server.bindAndListen(addr);
    loop.run();
}

More examples here.
API's document here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].