AMWD.Protocols.Modbus.Tcp 0.5.1-1
Modbus Protocol for .NET | TCP
The Modbus TCP protocol implementation.
Example
A simple example which reads the voltage between L1 and N of a Janitza device.
string host = "modbus-device.internal";
int port = 502;
using var client = new ModbusTcpClient(host, port);
await client.ConnectAsync(CancellationToken.None);
byte unitId = 5;
ushort startAddress = 19000;
ushort count = 2;
var registers = await client.ReadHoldingRegistersAsync(unitId, startAddress, count);
float voltage = registers.GetSingle();
Console.WriteLine($"The voltage of device #{unitId} between L1 and N is: {voltage:N2}V");
If you have a device speaking RTU connected over TCP, you can use it as followed:
// [...]
using var client = new ModbusTcpClient(host, port)
{
Protocol = new RtuProtocol()
};
// [...]
Sources
Published under MIT License (see choose a license)
No packages depend on AMWD.Protocols.Modbus.Tcp.
.NET 10.0
- AMWD.Protocols.Modbus.Common (>= 0.5.1-1)
.NET 8.0
- AMWD.Protocols.Modbus.Common (>= 0.5.1-1)
.NET Standard 2.0
- AMWD.Protocols.Modbus.Common (>= 0.5.1-1)
| Version | Downloads | Last updated |
|---|---|---|
| 0.5.1-test.5 | 3 | 20.07.2026 |
| 0.5.1-test.4 | 1 | 20.07.2026 |
| 0.5.1-test.3 | 1 | 20.07.2026 |
| 0.5.1-2 | 1 | 20.07.2026 |
| 0.5.1-1 | 3 | 18.07.2026 |