STTech.BytesIO.Modbus
3.3.1-alpha61015
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
This is a prerelease version of STTech.BytesIO.Modbus.
dotnet add package STTech.BytesIO.Modbus --version 3.3.1-alpha61015
NuGet\Install-Package STTech.BytesIO.Modbus -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.Modbus" 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.Modbus" Version="3.3.1-alpha61015" />
<PackageReference Include="STTech.BytesIO.Modbus" />
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.Modbus --version 3.3.1-alpha61015
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: STTech.BytesIO.Modbus, 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.Modbus@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.Modbus&version=3.3.1-alpha61015&prerelease
#tool nuget:?package=STTech.BytesIO.Modbus&version=3.3.1-alpha61015&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
STTech.BytesIO.Modbus
STTech.BytesIO.Modbus 是基于 STTech.BytesIO 核心架构实现的工业级 Modbus 协议通信库。支持 Modbus TCP、Modbus RTU 与 Modbus ASCII 协议,提供强类型、直观易用的 API 来操作标准 PLC 与工业传感器寄存器。
🌟 核心特性
- 🎯 主流协议全覆盖:无缝支持 Modbus RTU(串口)、Modbus TCP(网络以太网)及 Modbus ASCII。
- 📋 标准功能码全面支持:
0x01读线圈 (ReadCoilRegister)0x02读离散输入 (ReadDiscreteInputRegister)0x03读保持寄存器 (ReadHoldingRegister)0x04读输入寄存器 (ReadInputRegister)0x05写单个线圈 (WriteSingleCoilRegister)0x06写单个保持寄存器 (WriteSingleHoldingRegister)0x0F写多个线圈 (WriteMultipleCoilRegisters)0x10写多个保持寄存器 (WriteMultipleHoldingRegisters)
- ⚡ 稳健的底层通信:复用
BytesIO强大的自动重连、心跳保活、零拷贝缓冲与 CRC/LRC 自动校验。 - 🧪 虚拟设备支持:内置
VirtualModbusDevice,方便开发者进行离线联调与单元测试。
📦 安装
dotnet add package STTech.BytesIO.Modbus
🚀 快速上手
Modbus TCP 客户端读写示例
using System;
using System.Threading.Tasks;
using STTech.BytesIO.Modbus;
// 1. 创建 Modbus TCP 客户端
var client = new ModbusTcpClient
{
Host = "127.0.0.1",
Port = 502
};
// 2. 异步连接
var connectResult = await client.ConnectAsync();
if (connectResult.IsSuccess)
{
// 3. 读取站号为 1 的保持寄存器(从地址 0 开始,读取 10 个寄存器)
var reply = await client.ReadHoldingRegistersAsync(slaveId: 1, startAddress: 0, count: 10);
if (reply.IsSuccess)
{
short[] values = reply.Data;
Console.WriteLine($"读取成功,寄存器0值: {values[0]}");
}
// 4. 向站号为 1 的保持寄存器写入单个值
await client.WriteSingleHoldingRegisterAsync(slaveId: 1, registerAddress: 0, value: 1234);
}
📄 开源许可证
本项目基于 Apache-2.0 协议开源。
| Product | Versions 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.
-
.NETStandard 2.0
- STTech.BytesIO (>= 3.3.1-alpha61015)
- STTech.CodePlus (>= 1.7.6.2)
-
.NETStandard 2.1
- STTech.BytesIO (>= 3.3.1-alpha61015)
- STTech.CodePlus (>= 1.7.6.2)
-
net10.0
- STTech.BytesIO (>= 3.3.1-alpha61015)
- STTech.CodePlus (>= 1.7.6.2)
-
net6.0
- STTech.BytesIO (>= 3.3.1-alpha61015)
- STTech.CodePlus (>= 1.7.6.2)
-
net8.0
- STTech.BytesIO (>= 3.3.1-alpha61015)
- STTech.CodePlus (>= 1.7.6.2)
-
net9.0
- STTech.BytesIO (>= 3.3.1-alpha61015)
- STTech.CodePlus (>= 1.7.6.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.3.1-alpha61015 | 33 | 10/14/2026 |
| 3.3.0-alpha0730 | 125 | 7/29/2026 |
| 3.2.0-beta0706 | 122 | 7/12/2026 |
| 3.1.0.1-beta0630 | 133 | 6/30/2026 |
| 3.1.0-beta0629 | 125 | 6/29/2026 |
| 3.0.2-beta0324 | 137 | 3/23/2026 |
| 2.14.6.2-alpha0330 | 278 | 3/30/2025 |
| 2.14.6.1-alpha0807 | 229 | 8/6/2024 |
| 2.14.6 | 630 | 2/29/2024 |
| 2.14.6-alpha0225 | 209 | 2/25/2024 |
| 2.14.5.1 | 296 | 1/9/2024 |
| 2.14.5 | 312 | 1/7/2024 |
| 2.14.4 | 274 | 12/24/2023 |
| 2.14.3.2-beta1215 | 270 | 12/20/2023 |
| 2.14.3.1-beta1214 | 242 | 12/13/2023 |
| 2.14.2.1-beta1205 | 241 | 12/4/2023 |
| 2.14.1-beta1128 | 240 | 11/28/2023 |
| 2.13.6.1-alpha1116 | 287 | 11/16/2023 |
| 2.12.9-Alpha0721 | 303 | 7/21/2023 |
Loading failed