YASIO - Y et A nother Socket I / O library.
English
Yasio is a lightweight cross-platform asynchronous network library that focuses on clients and game client network services based on various game engines. It supports windows, macos, ios, android, ohos, linux, freebsd and other unix-like operating systems. .
Support platform
Build | Status (github) |
---|
Windows(msvc,clang,mingw) | |
Windows(vs2013) | |
Android | |
iOS/tvOS/watchOS | |
Linux | |
macOS | |
FreeBSD | |
Solaris | |
Application cases
- Idle Girl (HD): used for cocos and unity remastered client network transmission.
- Red Alert OL mobile game project: used for client network transmission, and has been running stably on tens of millions of mobile devices since the project was officially launched by Tencent Games on October 17, 2018.
- x-studio software project: network solution.
- QttAudio: voice-to-mic chat integration solution.
Integration case
- Unity
- yasio_unity: Unity pure C# package, just open the scene
SampleScene
and run it. - xlua: Integrate yasio into xlua, open the scene
U3DScripting
and run it.
- UnrealEngine
- yasio_unreal: UnrealEngine plug-in for yasio.
- sluaunreal: Integrated into Tencent’s sluaunreal.
- UnLua: UnLua integrated into Tencent.
- axmol: Network solution as
axmol
game engine.
document
- https://yasio.github.io/yasio
Use g++ to quickly run the tcptest test program
g++ tests/tcp/main.cpp --std=c++11 -DYASIO_HEADER_ONLY -lpthread -I./ -o tcptest && ./tcptest
Use CMake to compile yasio test programs and sample programs
git clone --recursive https://github.com/yasio/yasio
cd yasio
# 如果是 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打开
characteristic:
- Supports TCP, UDP, and KCP transmission, and the API is unified.
- Supports TCP sticky packet processing, so the business does not need to worry about it at all.
- Support multicast.
- Supports IPv4/IPv6 or Apple IPv6_only networks.
- Supports handling of all network events for multiple connections.
- Support microsecond timer.
- Supports Lua binding.
- Support Cocos2d-x jsb binding.
- Support CocosCreator jsb2.0 binding.
- Support Unity3D.
- Supports Unreal Engine.
- Supports SSL client/server, based on OpenSSL/MbedTLS.
- Supports non-blocking domain name resolution, based on c-ares.
- Supports Header Only integration mode, just define the compilation preprocessor macro
YASIO_HEAD_ONLY=1
. - Supports Unix Domain Socket.
- Supports binary reading and writing, and the two tool classes obstream/ibstream are very convenient to use.
- Supports integer compression encoding method compatible with .net: 7Bit Encoded Int/Int64 .
About C++14/17/20
yasio provides the following C++14/17/20 standard library components that can be used under the C++11 compiler. Please check 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
- yasio::byte_buffer
- yasio::pod_vector
About OpenSSL precompiled libraries (Windows)
Yasio's cmake script selects OpenSSL as the SSL support library by default and will automatically download it from 1kiss. The precompiled library is compiled using VS2022(MSVC-14.39)
. If this version is not installed on your system, please pass in the CMake parameter -DYASIO_SSL_BACKEND=2
, for example, use the cross-platform one-click compilation script build.ps1
provided by the project
powershell build.ps1 -p win32 -a x64 -xc " -DYASIO_SSL_BACKEND=2 "
frame diagram
QQ communication group
Click to join: 829884294