FluentModbus.Secure 5.2.0-preview

This is a prerelease version of FluentModbus.Secure.
dotnet add package FluentModbus.Secure --version 5.2.0-preview
                    
NuGet\Install-Package FluentModbus.Secure -Version 5.2.0-preview
                    
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="FluentModbus.Secure" Version="5.2.0-preview" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FluentModbus.Secure" Version="5.2.0-preview" />
                    
Directory.Packages.props
<PackageReference Include="FluentModbus.Secure" />
                    
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 FluentModbus.Secure --version 5.2.0-preview
                    
#r "nuget: FluentModbus.Secure, 5.2.0-preview"
                    
#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 FluentModbus.Secure@5.2.0-preview
                    
#: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=FluentModbus.Secure&version=5.2.0-preview&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FluentModbus.Secure&version=5.2.0-preview&prerelease
                    
Install as a Cake Tool

FluentModbus

GitHub Actions NuGet

FluentModbus is a .NET Standard library (2.0 and 2.1) that provides Modbus TCP/RTU server and client implementations for easy process data exchange. Both, the server and the client, implement class 0, class 1 and class 2 (partially) functions of the specification. Namely, these are:

Class 0:
  • FC03: ReadHoldingRegisters
  • FC16: WriteMultipleRegisters
Class 1:
  • FC01: ReadCoils
  • FC02: ReadDiscreteInputs
  • FC04: ReadInputRegisters
  • FC05: WriteSingleCoil
  • FC06: WriteSingleRegister
Class 2:
  • FC15: WriteMultipleCoils
  • FC23: ReadWriteMultipleRegisters

Modbus/TCP Security (mbaps)

⚠️ Development project — not production-tested. This feature is a work in progress. It has unit tests and a working sample, but it has not been tested or audited for production use. Nutzung auf eigenes Risiko / use at your own risk.

This fork adds support for Modbus/TCP Security — TLS-secured Modbus TCP with mutual X.509 certificate authentication and certificate-role-based authorization, as defined by the Modbus Organization (default port 802, TLS 1.2+). It is available on netstandard2.1 and net8.0.

A short bilingual (English/German) usage guide is in doc/secure-modbus-guide.md.

// server
using var server = new ModbusTcpServer();

server.StartSecure(new IPEndPoint(IPAddress.Any, 802), new ModbusTcpServerSecurityOptions
{
    Certificate = serverCertificate,                                      // incl. private key
    TrustedRootCertificates = new X509Certificate2Collection { rootCa },  // trusted client CA(s)
    Authorize = ctx => ctx.Role == "operator" || IsReadFunction(ctx.FunctionCode)
});

// client
using var client = new ModbusTcpClient();

client.Connect("192.168.0.1:802", new ModbusTcpClientSecurityOptions
{
    Certificate = clientCertificate,                                     // carries the role extension
    TrustedRootCertificates = new X509Certificate2Collection { rootCa }
});

The client's authorization role is carried in an X.509 certificate extension (OID 1.3.6.1.4.1.50316.802.1); use ModbusRoleCertificate.CreateRoleExtension(role) when issuing client certificates. See sample/SampleServerClientTcpSecure for a complete runnable example.

Please see the introduction to get a more detailed description on how to use this library!

Below is a screenshot of the sample console output using a Modbus TCP server and client:

Sample.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.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

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
5.2.0-preview 68 7/19/2026