License.txt for the terms of the non-commercial license. This software is "source available", but is not
"open source". You must purchase a commercial license to use this software for profit.
Rodbus is library for implementing Modbus client and server applications. The library is safe, memory-efficient and easy to use. All of the error handling in the library is explicit and logging is available by providing a backend to the log crate. Three client interfaces are provided for making requests:
- Async (Rust futures)
- Synchronous (blocking)
The following function codes are supported:
- Read Coils (
- Read Discrete Inputs (
- Read Holding Registers (
- Read Input Registers (
- Write Single Coil (
- Write Single Register (
- Write Multiple Coils (
- Write Multiple Registers (
The library uses the Tokio executor under the hood. The
perf example is a benchmark that
creates multiple sessions on a single server and sends multiple requests in parallel. On a decent workstation,
the benchmark achieved around 200k requests per second spread across 100 concurrent sessions in only 800 KB of memory.
The rodbus-ffi directory contains an idiomatic C/C++ API to the library. Requests can be sent asynchronously using callback functions or synchronously with blocking function calls.
To generate the bindings, do the following:
cargo install cbindgen
cbingen -c cmake/cbindgen.c.toml -o rodbus.h
cbingen -c cmake/cbindgen.cpp.toml -o rodbus.hpp
To use the bindings, you will need to include
rodbus.hpp which each include
You will also need to link with the compiled library
rodbus_ffi.so found in the target directory.
There is also a CMake script that can help you automatically build and link to rodbus from a C/C++ project.
Modbus client CLI
You can test Modbus servers from the command line with the rodbus-client crate.