Snet.Log
25.271.5
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Snet.Log --version 25.271.5
NuGet\Install-Package Snet.Log -Version 25.271.5
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="Snet.Log" Version="25.271.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Snet.Log" Version="25.271.5" />
<PackageReference Include="Snet.Log" />
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 Snet.Log --version 25.271.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Snet.Log, 25.271.5"
#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 Snet.Log@25.271.5
#: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=Snet.Log&version=25.271.5
#tool nuget:?package=Snet.Log&version=25.271.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<img src="https://api.shunnet.top/pic/shun.png" height="32"> Snet - 工业协议与数据采集框架
🚀 统一 · 高效 · 灵活 · 可扩展
面向工业数据采集、传输、转发、消息中间件的全栈式解决方案
✨ 框架特色
- ✅ 所有协议公共函数 支持同步 / 异步
- ✅ 协议 读写参数统一,入参出参统一
- ✅ 支持多点转发 / 多点解析
- ✅ 快速对接与配置,可即插即用
- ✅ 支持虚拟点位(模拟测试更便捷)
- ✅ 采集协议全面支持 订阅模式
- ✅ 采集与转发协议接口统一
- ✅ 事件结果统一,并支持 异步事件
- ✅ 所有采集协议均支持 WebAPI 控制与数据获取
- ✅ 快捷二次开发,仅需继承接口与抽象类即可
🧩 核心组件
[ Snet.Log ] 日志系统
Verbose详细信息Debug调试Info信息Warning警告Error错误Fatal致命错误
[ Snet.Unility ] 公共方法集合
- 字节、枚举、文件、字符串、验证、比对、转换、反射、Json、Xml、Ftp、System ...
[ Snet.Model ]
- 特性、数据结构、枚举、接口
[ Snet.Core ]
- 抽象、扩展、处理、反射、队列、中间件、脚本、订阅、虚拟地址、TCP、UDP、HTTP、WS、串口、WebApi
[ Snet.Driver ]
- 底层驱动通信库
📡 采集协议
支持 20+ 种工业通信协议,覆盖 PLC / 工控 / 电力 / DB / 标准通信 等:
三菱 / 西门子 / Modbus / 汇川 / 欧姆龙 / LSis / 基恩士 / 松下 / 罗克韦尔 / 倍福
通用电器 / 安川 / 山武 / 永宏 / 丰炜 / 富士 / 信捷 / 麦格米特 / 横河 / 丰田 / 台达 / 维控
电力通讯规约 / OPC (UA、DA、DAHttp) / DB (SqlServer、MySql、Oracle、SQLite)
TEP (Tcp扩展插件) / Sim (模拟库) / 英威腾 / 西蒙
接口定义:
/// <summary>
/// 数采接口
/// </summary>
public interface IDaq : IOn, IOff, IRead, IWrite, ISubscribe,
IGetStatus, IEvent, IGetParam, ICreateInstance,
ILog, IWA, IGetObject, ILanguage, IDisposable { }
📬 消息中间件协议
支持常见的高性能消息中间件:
- Kafka [AdminClient、Producer、Consumer]
- Mqtt [Client (Publish/Subscribe)、Service、WSService]
- RabbitMQ [Publish、Subscribe]
- Netty [Client (Publish/Subscribe)、Service]
- NetMQ [Publish、Subscribe]
接口定义:
/// <summary>
/// 消息中间件接口
/// </summary>
public interface IMq : IOn, IOff, IProducer, IConsumer, IGetStatus,
IEvent, IGetParam, ICreateInstance, ILog, ILanguage,
IDisposable { }
🖥️ 协议服务端 (数据模拟)
- Mqtt 服务端
- Mqtt WebSocket 服务端
- OpcUa 服务端
- Socket 服务端
- WebSocket 服务端
⚡ 实例创建方式
支持 无参、有参、单例、接口化实例 等多种方式,快速上手:
// 以 OPC UA 为例
using Snet.Opc.ua.client;
OpcUaClientOperate? operate = null;
IDaq? daq = null;
// 无参实例
operate = new OpcUaClientOperate();
// 调用 CreateInstance 创建
operate = new OpcUaClientOperate()
.CreateInstance(new OpcUaClientData.Basics())
.GetRData<OpcUaClientOperate>();
// 有参实例
operate = new OpcUaClientOperate(new OpcUaClientData.Basics());
// 单例模式
operate = OpcUaClientOperate.Instance(new OpcUaClientData.Basics());
// 接口实例
daq = new OpcUaClientOperate(new OpcUaClientData.Basics());
📥 采集应用示例
通过 NuGet 安装协议包,快速实现采集:
using Snet.Opc.ua.client;
using (OpcUaClientOperate operate = new OpcUaClientOperate(new OpcUaClientData.Basics
{
ServerUrl = "opc.tcp://127.0.0.1:6688",
UserName = "user",
Password = "password",
...
}))
{
// 打开连接
operate.On();
// 读取数据
var result = operate.Read(address);
// 订阅数据
operate.OnDataEvent += (s, e) => LogHelper.Info(e.ToJson(true));
operate.Subscribe(address);
// 写入数据
operate.Write(new ConcurrentDictionary<string, object> { ["Tag1"] = 123 });
// 关闭
operate.Off();
}
🔄 转发应用示例
using Snet.Mqtt.client;
using (MqttClientOperate operate = new MqttClientOperate(new MqttClientData.Basics
{
IpAddress = "127.0.0.1",
Port = 6688,
UserName = "user",
Password = "password",
...
}))
{
// 打开
operate.On();
// 生产
operate.Produce("topic", "content");
// 消费
operate.OnDataEvent += (s, e) =>
{
string str = e.GetRData<string>();
};
operate.Consume("topic");
// 关闭
operate.Off();
}
⚙️ 常用操作类名
SerialOperate // 串口通信
HttpClientOperate // HTTP 客户端
HttpServiceOperate // HTTP 服务端
TcpClientOperate // TCP 客户端
TcpServiceOperate // TCP 服务端
UdpOperate // UDP 通信
WsClientOperate // WebSocket 客户端
WsServiceOperate // WebSocket 服务端
ProcessCacheOperate // 内存缓存
ShareCacheOperate // 共享缓存
MqOperate // 消息队列
ReflectionOperate // 反射操作
📦 快速开始
- 打开 NuGet 搜索并安装对应协议包
- 引入命名空间
using Snet.XXX - 按照上方示例编写采集/转发代码
🏗️ 架构总结
Snet 框架通过 统一接口设计 与 模块化协议支持,实现了:
- 数据采集
- 协议转发
- 消息中间件交互
- 模拟服务端测试
- 高效日志与缓存
从 设备 → 协议 → 中间件 → 应用层 全链路打通,支持快速构建工业物联网系统。
📜 许可证
本项目基于 MIT 开源。
请阅读 LICENSE 获取完整条款。
⚠️ 软件按 “原样” 提供,作者不对使用后果承担责任。
🌍 演示
👉 点击查看演示地址
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Serilog.Sinks.Console (>= 6.0.0)
- Serilog.Sinks.File (>= 7.0.0)
-
net9.0
- Serilog.Sinks.Console (>= 6.0.0)
- Serilog.Sinks.File (>= 7.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Snet.Log:
| Package | Downloads |
|---|---|
|
Snet.Model
核心组件:Model(特性、结构、模型、枚举、接口) |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.43.1 | 532 | 2/12/2026 |
| 26.41.1 | 850 | 2/10/2026 |
| 26.35.1 | 1,382 | 2/4/2026 |
| 26.15.1 | 1,622 | 1/15/2026 |
| 26.13.1 | 868 | 1/13/2026 |
| 25.357.1 | 1,504 | 12/23/2025 |
| 25.329.1 | 1,469 | 11/25/2025 |
| 25.322.1 | 2,806 | 11/18/2025 |
| 25.317.1 | 3,756 | 11/13/2025 |
| 25.307.1 | 3,157 | 11/3/2025 |
| 25.300.1 | 6,245 | 10/27/2025 |
| 25.288.1 | 8,222 | 10/15/2025 |
| 25.271.6 | 7,519 | 9/27/2025 |
| 25.271.5 | 152 | 9/27/2025 |
| 25.271.4 | 125 | 9/27/2025 |
| 25.271.3 | 147 | 9/27/2025 |
| 25.271.2 | 129 | 9/27/2025 |
| 25.271.1 | 121 | 9/27/2025 |
| 25.267.1 | 3,612 | 9/24/2025 |
| 25.253.1 | 9,041 | 9/10/2025 |
Loading failed