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
IIoT.Architecture.Base

Package Description

SnowyRiver.Modbus.FluentModbus

Package Description

SMAModbusConnector

A Modbus Connector for SMA devices

ECS.Crosser.Modules.Modbus.rtu.reader

Package Description

Iotatech.Weighings

Collection of weighing module abstractions for .NET commonly used in Iotatechnology projects.

GitHub repositories (1)

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

Repository Stars
pkuehnel/TeslaSolarCharger
A software to let your Tesla charge with solar energy ☀
Version Downloads Last Updated
5.3.2 58,403 3/28/2025
5.3.1 40,226 1/2/2025
5.3.0 49,187 9/19/2024
5.2.0 67,593 4/23/2024
5.1.0 38,203 2/21/2024
5.0.3 61,176 8/3/2023
5.0.2 105,381 11/17/2022
5.0.1 3,190 11/14/2022
5.0.0 20,066 9/8/2022
4.1.0 2,699 8/17/2022
4.0.0 1,022 8/16/2022
4.0.0-preview.5 247 7/28/2022
4.0.0-preview.4.final 282 6/20/2022
4.0.0-preview.3.final 866 5/25/2022
4.0.0-preview.2.final 1,302 10/19/2021
4.0.0-preview.1.final 305 9/21/2021
3.2.2 7,840 7/28/2022
3.2.1 27,627 10/19/2021
3.2.0 2,782 9/14/2021
3.1.1 2,295 6/23/2021
3.1.0 4,437 4/13/2021
3.0.1 1,333 3/25/2021
3.0.1-preview.1.final 626 2/15/2021
2.4.2 2,629 12/22/2020
2.4.1 1,387 11/27/2020
2.4.0 1,082 11/9/2020
2.3.0 1,465 11/6/2020
2.2.1 1,251 9/21/2020
2.2.0 1,124 9/1/2020
2.1.0 1,046 8/6/2020
2.0.0 4,331 12/9/2019
2.0.0-preview.3.final 372 12/6/2019
2.0.0-preview.2.final 398 12/4/2019
2.0.0-preview.1.final 411 12/4/2019
1.4.1 1,151 11/23/2019
1.4.0 1,115 11/17/2019
1.4.0-alpha.1.final 390 11/17/2019
1.3.0 1,112 11/13/2019
1.2.0 1,991 5/11/2019