https://github.com/bonk-dev/dotbus
dotbus is a lightweight and efficient Modbus/TCP library for C#. Designed with a focus on minimal memory allocation.
https://github.com/bonk-dev/dotbus
async chsarp dotnet modbus modbus-tcp zero-allocation
Last synced: 2 months ago
JSON representation
dotbus is a lightweight and efficient Modbus/TCP library for C#. Designed with a focus on minimal memory allocation.
- Host: GitHub
- URL: https://github.com/bonk-dev/dotbus
- Owner: bonk-dev
- License: mit
- Created: 2024-06-17T13:18:38.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T07:48:44.000Z (almost 2 years ago)
- Last Synced: 2025-10-10T23:07:47.468Z (6 months ago)
- Topics: async, chsarp, dotnet, modbus, modbus-tcp, zero-allocation
- Language: C#
- Homepage:
- Size: 39.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# .bus
dotbus is a lightweight and efficient Modbus/TCP library for C#.
Designed with a focus on minimal memory allocation.
## Usage
```csharp
var client = new TcpClient()
{
NoDelay = true
};
// Connect the TcpClient
await client.ConnectAsync("192.168.0.10", 502);
var stream = client.GetStream();
// Create the ModbusTcpClient (slave id: 0x01)
await using var mClient = new ModbusTcpClient(stream, 0x01);
// Allocate buffer for coils
var coils = new Memory(new bool[2000]);
// Read coils
await mClient.ReadCoilsAsync(coils, 0, Requests.MaxCoilAmount);
```
See full usage in the ```dotbus.cli``` project.