KBUBComm.Modbus 0.1.2

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

KBUBComm.Modbus

Host-agnostic .NET 8 Modbus TCP client/server primitives.

Supported surface

  • Coils, discrete inputs, input registers, and holding registers
  • Configurable Unit ID
  • Cancellation-aware asynchronous lifecycle
  • Read/write/connect timeouts
  • Atomic ModbusDataImage replacement
  • Read-only server mode
  • Explicit byte and word order
  • Float32, Float64, and signed/unsigned integer codecs

Float32 is the default value convention.

Minimal loopback

using System.Net;
using KBUBComm.Modbus;

await using ModbusTcpServer server = new(new ModbusTcpServerOptions
{
    BindAddress = IPAddress.Loopback,
    Port = 15020,
    UnitId = 1
});

ModbusDataImage image = new();
ushort[] encodedValue = ModbusRegisterCodec.EncodeFloat32(42.5f);
image.InputRegisters[0] = encodedValue[0];
image.InputRegisters[1] = encodedValue[1];
server.ReplaceDataImage(image);
await server.StartAsync();

await using ModbusTcpClient client = new(new ModbusTcpClientOptions
{
    Host = "127.0.0.1",
    Port = 15020,
    UnitId = 1
});

await client.ConnectAsync();
ushort[] registers = await client.ReadInputRegistersAsync(0, 2);
float value = ModbusRegisterCodec.DecodeFloat32(registers);

Lifecycle and thread safety

Dispose the client and server asynchronously. Client requests are serialized per client instance. Server image replacement and bounded updates are synchronized. Treat snapshots as detached copies.

Product 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on KBUBComm.Modbus:

Package Downloads
KBUBComm.NET8

Dependency-only bundle for KBUBComm.Modbus and KBUBComm.OpcUa.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 149 7/16/2026
0.1.0 125 7/16/2026