STTech.BytesIO 3.3.1-alpha61015

This is a prerelease version of STTech.BytesIO.
dotnet add package STTech.BytesIO --version 3.3.1-alpha61015
                    
NuGet\Install-Package STTech.BytesIO -Version 3.3.1-alpha61015
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="STTech.BytesIO" Version="3.3.1-alpha61015" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="STTech.BytesIO" Version="3.3.1-alpha61015" />
                    
Directory.Packages.props
<PackageReference Include="STTech.BytesIO" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add STTech.BytesIO --version 3.3.1-alpha61015
                    
#r "nuget: STTech.BytesIO, 3.3.1-alpha61015"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package STTech.BytesIO@3.3.1-alpha61015
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=STTech.BytesIO&version=3.3.1-alpha61015&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=STTech.BytesIO&version=3.3.1-alpha61015&prerelease
                    
Install as a Cake Tool

STTech.BytesIO

NuGet License

STTech.BytesIO 是一个高性能、轻量级、面向工业自动化与高并发场景的 .NET 字节流通信框架。它为开发者提供了高度统一的编程模型,用于处理 TCP (Socket/SSL)、串口 (SerialPort) 以及 进程间通信 (IPC/NamedPipe) 等底层通信。


🌟 核心特性

  • 🎯 统一 API 架构:无论底层是 TCP、串口还是 IPC,客户端统一继承自 BytesClient,服务端继承自 BytesServer,拥有完全一致的 ConnectAsync()、SendAsync()、OnDataReceived 交互体验。
  • ⚡ 零拷贝高性能处理:深度集成 System.IO.Pipelines,极大减少内存分配与 GC 压力,轻松应对高频吞吐场景。
  • 📦 协议解包器 (Unpacker):内置支持定长、分隔符、头部带长度字段等多种常用解包器,彻底告别粘包、分包问题。
  • 🔄 工业级可靠性:内置自动重连机制、双向心跳检测(Heartbeat)、通信监控(Monitor)及发送队列管理。

📦 安装

通过 NuGet 命令行安装:

dotnet add package STTech.BytesIO

🚀 快速上手

1. TCP 客户端示例

using STTech.BytesIO.Tcp;

// 创建 TCP 客户端
var client = new TcpClient
{
    Host = "127.0.0.1",
    Port = 8080
};

// 绑定数据接收事件
client.OnDataReceived += (sender, e) =>
{
    Console.WriteLine($"收到服务端数据: {e.Data.ToHexString()}");
};

// 连接并发送数据
var connectResult = await client.ConnectAsync();
if (connectResult.IsSuccess)
{
    await client.SendAsync(new byte[] { 0x01, 0x02, 0x03 });
}

2. 串口客户端示例

using STTech.BytesIO.Serial;

// 创建串口客户端
var serialClient = new SerialClient
{
    PortName = "COM1",
    BaudRate = 115200
};

serialClient.OnDataReceived += (sender, e) =>
{
    Console.WriteLine($"收到串口数据: {e.Data.ToHexString()}");
};

await serialClient.ConnectAsync();

🧩 官方扩展模块

  • STTech.BytesIO.Modbus:支持 Modbus RTU / TCP / ASCII 协议的高级工业通信库。
  • STTech.BytesIO.Quic:基于 .NET 8+ 原生 QUIC 协议的高性能多路复用通信库。
  • STTech.BytesIO.P2P:基于 Libp2p 实现的去中心化点对点通信模块。
  • STTech.BytesIO.SerialPortStream:基于 SerialPortStream 底层实现的增强型串口通信库。

📄 开源许可证

本项目基于 Apache-2.0 协议开源。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on STTech.BytesIO:

Package Downloads
STTech.BytesIO.Modbus

BytesIO Modbus 通信库,提供 Modbus-SerialPort / Modbus-TCP 通信客户端,支持 ASCII、RTU 协议及多种标准寄存器操作命令。

STTech.BytesIO.SerialPortStream

STTech.BytesIO 串口扩展库,基于 SerialPortStream 实现,提供比原生 SerialPort 更稳定、更高性能的串口通信支持。

STTech.BytesIO.Quic

这是一个基于 QUIC 协议的高性能 .NET 字节流通信库,作为 STTech.BytesIO 的扩展库,提供了统一的编程模型。 QUIC 协议原生支持加密(TLS 1.3)和多流并发,适用于高可靠性、低延迟的通信场景。

STTech.BytesIO.P2P

这是一个基于 Libp2p 协议的 .NET P2P 字节流通信库,作为 STTech.BytesIO 的扩展库,提供了统一的编程模型。 支持 TCP/QUIC 传输、Noise/TLS 加密、DHT 节点发现、Relay 中继穿透等 P2P 网络特性。 通过 PeerClient 和 BootstrapServer 两个核心类,快速构建去中心化点对点通信应用。

ApeFree.ApeRpc.BytesIO

面向直连场景的高性能轻量级 RPC 类库,基于 STTech.BytesIO 统一网络通信层抽象(TCP、IPC 命名管道、串口 SerialPort 等),结合零拷贝 Unpacker 粘包解析器与 MatchHandler 响应匹配机制,支持全双工方法调用与远程事件订阅推送。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.3.1-alpha61015 0 10/14/2026
3.3.0-alpha0730 165 7/29/2026
3.2.0-beta0706 141 7/12/2026
3.1.0.1-beta0630 156 6/30/2026
3.1.0-beta0629 151 6/29/2026
3.0.2-beta0324 147 3/23/2026

v3.0 Major Update:
1. Architectural Consolidation: Merged Core, TCP, Serial, and IPC projects into a single unified library.
2. Lightweight Dependency: Migrated to official System.IO.Ports, reducing external package dependencies.
3. Performance Tuning: Deeply integrated System.IO.Pipelines for high-performance zero-copy data processing.
4. Simplified API: Provided a more intuitive and consistent interface for all transport types.