Giter Site home page Giter Site logo

zhaoyaogit / yasio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yasio/yasio

0.0 1.0 0.0 34.12 MB

A multi-platform support c++11 library with focus on asio (asynchronous socket I/O) for any client application, support windows & linux & apple & android & win10-universal.

Home Page: https://yasio.org/

License: Other

C++ 95.57% C 0.29% Batchfile 0.12% Makefile 0.21% CMake 2.98% Shell 0.56% Java 0.27%

yasio's Introduction

yasio logo

YASIO - Yet another Asynchronous Socket I/O.

Android Build Status iOS Build Status Windows Build Status Linux Build Status macOS Build Status

Release 996.icu LICENSE GitHub stars GitHub forks Language grade: C/C++ Total alerts

Supported Platforms

Powered

English

yasio 是一个轻量级跨平台的异步socket库,专注于客户端和基于各种游戏引擎的游戏客户端网络服务, 支持windows & linux & apple & android & win10-universal。

应用案例

  • 红警OL手游项目: 用于客户端网络传输,并且随着该项目于2018年10月17日由腾讯游戏发行正式上线后稳定运行于上千万移动设备上。
  • x-studio软件项目: 用于实现局域网UDP+TCP发现更新机制。

集成案例

  • xlua: 将yasio集成到xlua, 使基于xlua的unity3d可以直接使用yasio的lua绑定接口。
  • Unreal Engine 4: 将yasio集成到Unreal Engine 4, 未来会完善Lua, 可能基于Tencent的UnLua。
  • Engine-x: 作为Engine-x游戏引擎的异步TCP解决方案。

文档

使用g++快速运行tcptest测试程序

g++ tests/tcp/main.cpp --std=c++11 -DYASIO_HEADER_ONLY -lpthread -I./ -o tcptest && ./tcptest

使用CMake编译yasio的测试程序和示例程序

git clone https://github.com/yasio/yasio
cd yasio
git submodule update --init --recursive

# 如果是macOS Xcode, 这里命令应该换成: cmake -B build -GXcode
cmake -B build

# 使用CMake命令行编译, 如果需要调试,则使用相应平台IDE打开即可:
# a. Windows: 使用VisualStudio打开build/yasio.sln
# b. macOS: 使用Xcode打开build/yasio.xcodeproj
cmake --build build --config Debug

# # 者直接用VS打开 

特性:

  • 支持TCP,UDP,KCP传输,且API是统一的。
  • 支持TCP粘包处理,业务完全不必关心。
  • 支持组播。
  • 支持IPv4/IPv6或者苹果IPv6_only网络。
  • 支持处理多个连接的所有网络事件。
  • 支持微秒级定时器。
  • 支持Lua绑定。
  • 支持Cocos2d-x jsb绑定。
  • 支持CocosCreator jsb2.0绑定
  • 支持Unity3D
  • 支持虚幻4
  • 支持SSL客户端,基于OpenSSL。
  • 支持非阻塞域名解析,基于c-ares。
  • 支持Header Only集成方式,只需要定义编译预处理器宏YASIO_HEAD_ONLY=1即可。
  • 支持Unix Domain Socket。
  • 支持二进制读写,两个工具类obstream/ibstream非常方便使用。
  • 支持和.net的兼容的整数压缩编码方式: 7Bit Encoded Int/Int64

发送延迟

yasio比同样使用消息队列的Cocos2d-x WebSocket实现处理发送消息快30倍以上:

网络实现 实际执行发送操作延迟
yasio 0.06 ~ 0.1(ms)
Cocos2d-X WebSocket > 3~5(ms)

参考: Cocos2d-X WebSocket.cpp

框架图

image

QQ交流群

点击加入:829884294

yasio's People

Contributors

halx99 avatar bel2020 avatar huizhen avatar blus007 avatar ttsair avatar xinglongli612 avatar lattice0 avatar anssser avatar binesiyu avatar

Watchers

James Cloos 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.