Skip to content

Latest commit

 

History

History
132 lines (101 loc) · 6.9 KB

README_EN.md

File metadata and controls

132 lines (101 loc) · 6.9 KB

yasio logo

YASIO - Yet Another Socket I/O library.

Latest Release 996.icu LICENSE GitHub stars GitHub forks codeql

简体中文

yasio is a multi-platform support and lightweight library with focus on asynchronous socket I/O for any client application, support windows, macos, ios, android, linux, freebsd and other unix-like systems.

Supported Platforms

Build Status (github)
Windows(msvc,clang,mingw) Windows Build Status
Windows(vs2013) Windows VS2013 status
Android Android Build Status
iOS/tvOS/watchOS iOS Build Status
Linux Linux Build Status
macOS macOS Build Status
FreeBSD FreeBSD Build Status
Solaris Solaris Build Status

Showcase

Integration Demos

  • Unity
    • yasio_unity: The unity c# wrapper of yasio, open scene SampleScene and run it.
    • xlua: Integrate yasio to xlua, open scene U3DScripting and run it.
  • xlua:
  • UnrealEngine
    • yasio_unreal: The yasio UnrealEngine plugin
    • sluaunreal: Integrate to Tencent's sluaunreal(A lua bindings solution for UE4)
    • UnLua: Integrate to Tencent's sluaunreal(Yet another lua bindings solution for UE4)
  • axmol: Use as tcp/udp asynchronous socket solution of game engine axmol

Docomentation

Simple run tcptest with g++

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

Build more examples with cmake

git clone --recursive https://github.com/yasio/yasio
cd yasio
# For macOS xcode, it's shoud be: cmake -B build -GXcode
cmake -B build

# Use cmake command to build examples & tests, or use platform specific IDE to open yasio project
# a. Windows: Use Visual Studio(2013~2019 supported) to open build/yasio.sln
# b. macOS: Use Xcode to open build/yasio.xcodeproj
cmake --build build --config Debug

About new build.ps1

  • Cross-platform, it can run on Windows, Linux, macOS

  • All github ci actions use it

  • Support options

    • -p: build target os: win32,winuwp,linux,android,osx,ios,tvos,watchos
    • -a: build arch: x86,x64,arm,arm64
    • -cc: c/c++ compiler toolchain: clang, msvc, gcc or empty use default compiler avaiable on current OS;
      For msvc can be msvc-120, mvsc-140, mvsc-160
    • -xc: additional cmake options: i.e. -xc '-DCXX_STD=23','-DYASIO_ENABLE_EXT_HTTP=OFF'
  • Support build target matrix

    OS Build targets Build toolchain
    Windows win32,winuwp msvc,clang
    Linux linux,android gcc,clang
    macOS osx,ios,tvos,watchos clang

Features:

  • Support TCP/UDP/KCP, and manipulate APIs are same
  • Support process sticking packets for TCP internal, user do not need to care it
  • Support multicast
  • Support IPv4/IPv6 network
  • Support multi-connections at one thread
  • Support high-resolution deadline timer
  • Support lua bindings
  • Support cocos2d-x jsb
  • Support CocosCreator jsb2.0
  • Support Unity3D
  • Support Unreal Engine
  • Support ssl client/server with OpenSSL/MbedTLS
  • Support async resolve with c-ares
  • Support header only with YASIO_HEAD_ONLY=1 set at config.hpp or compiler flags
  • Support Unix Domain Socket
  • Support BinaryStram by obstream/ibstream, easy to use
  • Support 7Bit Encoded Int/Int64 compatible with dotnet

About some features of C++14/17/20 on C++11

yasio provide follow C++14/17/20 standard components compatible with C++11 compiler, please see: yasio/string_view.hpp, yasio/shared_mutex.hpp, yasio/memory.hpp

  • cxx14::make_unique
  • cxx17::string_view
  • cxx17::shared_mutex
  • cxx20::starts_with
  • cxx20::ends_with

Abount OpenSSL prebuilt (Windows)

The OpenSSL prebuilts are download from 1kiss and built by vs2022 msvc-14.36, If your installed visual studio version less then vs2022, please pass -DYASIO_SSL_BACKEND=2 to use mbedtls instead, i.e:

powershell build.ps1 -p win32 -a x64 -xc "'-DYASIO_SSL_BACKEND=2'"

Core framework

image