FluentModbus 1.2.0

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

FluentModbus is a .NET Standard library that provides a Modbus TCP server and client implementation for easy process data exchange. Support for Modbus RTU and ASCII mode is planned for the next major version. Both, the server and the client, implement class 0 and class 1 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

Please see the introduction and the sample application, to get started with FluentModbus.

Quick start

Client

var unitIdentifier = (byte)0xFF;
var startingAddress = (ushort)0;
var count = (ushort)10;
var client = new ModbusTcpClient();
var endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 502);

client.Connect(endPoint)

// read data
var shortData = client.ReadHoldingRegisters<short>(unitIdentifier, startingAddress, count);

// write data
var intData = new int[] { 4263, 4554 };
client.WriteMultipleRegisters(unitIdentifier, startingAddress, intData);

Server

var cts = new CancellationTokenSource();
var random = new Random();
var server = new ModbusTcpServer();

server.Start();

while (!cts.IsCancellationRequested)
{
    var intData = server.GetHoldingRegisterBuffer<int>();

    // lock is required to synchronize buffer access between
    // this application and one or more Modbus clients
    lock (server.Lock)
    {
        intData[20] = random.Next(0, 100);
    }

    // update server buffer content only once per second
    Thread.Sleep(TimeSpan.FromSeconds(1));
}

server.Dispose();
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 was computed.  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 was computed. 
.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 (12)

Showing the top 5 NuGet packages that depend on FluentModbus:

Package Downloads
SnowyRiver.Modbus.FluentModbus

Package Description

IIoT.Architecture.Base

Package Description

SMAModbusConnector

A Modbus Connector for SMA devices

VL.IO.Modbus

VL wrapper for the FluentModus libary

ECS.Crosser.Modules.Modbus.rtu.reader

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on FluentModbus:

Repository Stars
pkuehnel/TeslaSolarCharger
A software to let your Tesla charge with solar energy ☀
eclipse-aaspe/package-explorer
AASX Package Explorer
Version Downloads Last Updated
5.3.2 151,865 3/28/2025
5.3.1 49,380 1/2/2025
5.3.0 60,975 9/19/2024
5.2.0 72,349 4/23/2024
5.1.0 42,608 2/21/2024
5.0.3 66,929 8/3/2023
5.0.2 126,178 11/17/2022
5.0.1 3,265 11/14/2022
5.0.0 20,544 9/8/2022
4.1.0 2,782 8/17/2022
4.0.0 1,105 8/16/2022
4.0.0-preview.5 304 7/28/2022
4.0.0-preview.4.final 331 6/20/2022
4.0.0-preview.3.final 907 5/25/2022
4.0.0-preview.2.final 1,637 10/19/2021
4.0.0-preview.1.final 356 9/21/2021
3.2.2 7,913 7/28/2022
3.2.1 28,343 10/19/2021
3.2.0 2,928 9/14/2021
3.1.1 2,387 6/23/2021
3.1.0 4,529 4/13/2021
3.0.1 1,413 3/25/2021
3.0.1-preview.1.final 685 2/15/2021
2.4.2 2,733 12/22/2020
2.4.1 1,466 11/27/2020
2.4.0 1,169 11/9/2020
2.3.0 1,585 11/6/2020
2.2.1 1,334 9/21/2020
2.2.0 1,210 9/1/2020
2.1.0 1,131 8/6/2020
2.0.0 4,527 12/9/2019
2.0.0-preview.3.final 431 12/6/2019
2.0.0-preview.2.final 456 12/4/2019
2.0.0-preview.1.final 467 12/4/2019
1.4.1 1,238 11/23/2019
1.4.0 1,197 11/17/2019
1.4.0-alpha.1.final 457 11/17/2019
1.3.0 1,193 11/13/2019
1.2.0 2,263 5/11/2019