Overview - Snet Docs

๐Ÿ“ฆ Shunnet Framework

The Shunnet project is the main umbrella repository containing the complete Snet industrial communication framework. It encompasses 36+ NuGet packages covering 35+ industrial protocols, 5 message middleware types, and 12 transport layers โ€” all behind a single unified API.

Key facts:

  • Repository: F:\Snet\Shunnet
  • Target: .NET 8.0 / .NET 10.0
  • License: MIT
  • 36+ NuGet packages
  • 130+ protocol variants
  • 5 middleware types
  • 12 transport layers
  • Plugin hot-reload via AssemblyLoadContext

Sub-projects table (package name + description):

Package Description
Snet.Core Foundation โ€” CoreUnify, DaqAbstract, MqAbstract, CommunicationAbstract, singleton pool, events, WebAPI
Snet.Model Contracts โ€” IDaq, IMq, ICommunication interfaces, data models, enums, attributes
Snet.Utility Tooling โ€” 150+ extension methods, JSON/XML/Protobuf serialization, handlers
Snet.Driver Protocol driver base classes
Snet.Log Structured logging (Serilog-based, 6 levels)
Snet.Modbus Modbus TCP/UDP/RTU/ASCII (6 variants)
Snet.Siemens Siemens S7/PPI/S7Plus/FetchWrite (10 variants)
Snet.Mitsubishi Mitsubishi MC/FX/A1E/A3C/CIP/Links (14 variants)
Snet.Omron Omron Fins/CIP/HostLink/CMode (8 variants)
Snet.AllenBradley Allen-Bradley CIP/PCCC/SLC/DF1/Micro800 (6 variants)
(and 25+ more protocol drivers)
Snet.Mqtt MQTT Client + Broker + WebSocket Broker
Snet.Kafka Kafka Producer + Consumer + AdminClient
Snet.RabbitMQ RabbitMQ Direct/Topic/Fanout/Headers
Snet.NetMQ ZeroMQ Pub/Sub
Snet.Netty TCP Client + Server with custom framing

โ–ถ๏ธ Quick Start

dotnet add package Snet.Modbus
using Snet.Modbus;
using Snet.Model.data;
using Snet.Model.@enum;

// 1. Configure
var basics = new ModbusData.Basics { IpAddress = "192.168.1.100", Port = 502, Station = 1 };
// 2. Instantiate
await using var modbus = new ModbusOperate(basics);
// 3. Connect
await modbus.OnAsync();
// 4. Read
var result = await modbus.ReadAsync(new Address(new AddressDetails("Temperature", "40001", DataType.Float)));
Console.WriteLine(result.GetSource<AddressValue>().ResultValue);
// 5. Disconnect โ€” using auto-calls DisposeAsync

โš™๏ธ Installation & Configuration

Installation approach โ€” install individual protocol packages as needed:

dotnet add package Snet.Core
dotnet add package Snet.Modbus
dotnet add package Snet.Mqtt

Core configuration through Basics pattern โ€” each driver has its own {Driver}Data.Basics class.

๐Ÿง  Core Concepts

  1. Unified API โ€” IDaq (15 sub-interfaces) for data acquisition, IMq (12 sub-interfaces) for messaging, ICommunication (13 sub-interfaces) for transport
  2. Singleton Pool โ€” CoreUnify<T,B> manages up to 255 concurrent instances
  3. Event-Driven โ€” 3 pairs of sync+async events: OnData, OnInfo, OnLanguage
  4. Built-in WebAPI โ€” 6 HTTP endpoints auto-exposed per driver
  5. Plugin Hot-Reload โ€” AssemblyLoadContext with collectible assembly loading
  6. Dual Cache โ€” Process memory (MemoryCache) + Shared memory (MemoryMappedFile)
  7. Virtual Address โ€” 5 simulation modes for offline testing
  8. Auto MQ Forward โ€” AddressMqParam configures automatic MQ forwarding from any driver

๐Ÿ“š Sub-Projects

Each sub-project has its own detailed documentation:

Foundation layer:

Section Content
Core Engine DaqAbstract, MqAbstract, CommunicationAbstract, cache, channel, events, etc.
API Reference IDaq, IMq, ICommunication, CoreUnify, OperateResult, data models

Protocols layer:

Section Content
Protocols Overview 35+ industrial protocol drivers (Siemens, Modbus, Mitsubishi, etc.)

Middleware layer:

Section Content
Middleware Overview MQTT, Kafka, RabbitMQ, NetMQ, Netty

Companion libraries:

Section Content
RPC Overview High-performance DotNetty-based RPC framework
Redis Overview StackExchange.Redis wrapper with unified API
WPF Overview Modern WPF UI library with MVVM/themes/localization

๐Ÿ’ป Code Examples

Multiple protocol example showing unified API:

// Same code pattern works for all 30+ protocols
async Task ReadFromDevice<T>(T operate) where T : IDaq
{
    await operate.OnAsync();
    var addr = new Address(new AddressDetails("Reading", "40001", DataType.Float));
    var result = await operate.ReadAsync(addr);
    if (result.Status)
        Console.WriteLine(result.GetSource<ConcurrentDictionary<string, AddressValue>>()
            .First().Value.ResultValue);
    await operate.OffAsync();
}

โ“ FAQ

  1. How many protocols are supported? โ€” 35+ protocols with 130+ variants
  2. What's the license? โ€” MIT, free for commercial use
  3. How to add a new protocol? โ€” Extend DaqAbstract, register via plugin system
  4. Can I switch protocols at runtime? โ€” Yes, all drivers share the same IDaq interface
  5. Is there AI tooling? โ€” Yes, Snet AI Skills on GitHub generate complete project code from natural language

๐Ÿ“… Version History

Date Changes
latest Current release โ€” .NET 8 / .NET 10 support, 36 packages, 130+ protocol variants