百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

tokio-modbus

> DevOps
开源

基于 Tokio 的 Modbus 库

556 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

基于 Tokio 的 Modbus 库

tokio-modbus

A pure Rust Modbus library based on tokio. Modbus is based on a master/slave communication pattern. To avoid confusion with the Tokio terminology the master is called client and the slave is called server in this library.

Features

  • Pure Rust library
  • Modbus TCP or RTU at your choice
  • Both async (non-blocking, default) and sync (blocking, optional)
  • Client API
  • Server implementations
    • for out-of-the-box usage or
    • as a starting point for a customized implementation
  • Open source (MIT/Apache-2.0)

Installation

Add this to your Cargo.toml:

toml
[dependencies]
tokio-modbus = "*"

Cargo Features

  • "rtu": Asynchronous RTU client (default)
  • "tcp": Asynchronous TCP client (default)
  • "rtu-sync: Synchronous RTU client
  • "tcp-sync": Synchronous TCP client
  • "rtu-server": (Asynchronous) RTU server
  • "tcp-server": (Asynchronous) TCP server
  • "rtu-over-tcp-server": (Asynchronous) RTU over TCP server

Examples

If you only need an asynchronous TCP client add the following line to your Cargo.toml file:

toml
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp"] }

For an asynchronous RTU client:

toml
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["rtu"] }

For an RTU server:

toml
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["rtu-server"] }

For a TCP server:

toml
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp-server"] }

Examples

Various examples for Modbus RTU and TCP using either the asynchronous or synchronous API can be found in the examples folder.

Testing

The workspace contains documentation, tests, and examples for all available features.

bash
cargo test --workspace
cargo test --workspace --all-features

Protocol-Specification

  • Modbus Application Protocol Specification v1.1b3 (PDF)
  • Modbus over serial line specification and implementation guide v1.02 (PDF)
  • Modbus Messaging on TCP/IP Implementation Guide v1.0b (PDF)

License

Copyright (c) 2017-2026 slowtec GmbH

MIT/Apache-2.0

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustasciiasyncautomationclient

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理