Skip to main content

A Cython Modbus TCP client with heartbeat and multi-connection management.

Project description

modbus-tcp-cython

A Cython Modbus TCP client with structured protocol parsing, heartbeat reconnects, and multi-connection management.

普通请求默认会在超时或 socket 错误后自动关闭连接、重连并重试 1 次。

Build locally

python -m venv .venv
. .venv/bin/activate
python -m pip install -U pip setuptools wheel Cython
python -m pip install .

Basic usage

from modbus_tcp import ModbusTcpClient

client = ModbusTcpClient(
    "192.168.180.18",
    26,
    timeout=5.0,
    request_retries=1,
    request_retry_delay=0.2,
)
client.connect()

try:
    values = client.read_holding_registers(unit_id=3, start_address=2, quantity=1)
    print(values)
finally:
    client.close()

Multi-connection usage

from modbus_tcp import ModbusTcpManager

with ModbusTcpManager() as manager:
    manager.add_client(
        name="line_1",
        host="192.168.180.18",
        port=26,
        unit_id=3,
        heartbeat_address=2,
        heartbeat_interval=5.0,
        request_retries=1,
        request_retry_delay=0.2,
    )
    manager.start_all()

    print(manager.read_holding_registers("line_1", 2, 1))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modbus_tcp_cython-0.1.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

modbus_tcp_cython-0.1.1-cp314-cp314-win_amd64.whl (89.2 kB view details)

Uploaded CPython 3.14Windows x86-64

modbus_tcp_cython-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (756.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modbus_tcp_cython-0.1.1-cp314-cp314-macosx_11_0_arm64.whl (109.3 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

modbus_tcp_cython-0.1.1-cp314-cp314-macosx_10_15_x86_64.whl (114.1 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

modbus_tcp_cython-0.1.1-cp313-cp313-win_amd64.whl (87.6 kB view details)

Uploaded CPython 3.13Windows x86-64

modbus_tcp_cython-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (767.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modbus_tcp_cython-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (108.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

modbus_tcp_cython-0.1.1-cp313-cp313-macosx_10_13_x86_64.whl (113.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

modbus_tcp_cython-0.1.1-cp312-cp312-win_amd64.whl (87.7 kB view details)

Uploaded CPython 3.12Windows x86-64

modbus_tcp_cython-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (772.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modbus_tcp_cython-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (109.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

modbus_tcp_cython-0.1.1-cp312-cp312-macosx_10_13_x86_64.whl (114.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

modbus_tcp_cython-0.1.1-cp311-cp311-win_amd64.whl (89.6 kB view details)

Uploaded CPython 3.11Windows x86-64

modbus_tcp_cython-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (799.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modbus_tcp_cython-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (111.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

modbus_tcp_cython-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl (117.2 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

File details

Details for the file modbus_tcp_cython-0.1.1.tar.gz.

File metadata

  • Download URL: modbus_tcp_cython-0.1.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modbus_tcp_cython-0.1.1.tar.gz
Algorithm Hash digest
SHA256 24fc1c9176bb6a65b89c85fc9e83dcc007273fed887222a8bfd73163c250404a
MD5 eaf1fe5a0d85014965160169c3733336
BLAKE2b-256 f2de59b6d1925c7d9a0546b7956dc4145174c0284b9c78fdd78b7c45449374e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1.tar.gz:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 c938f6cca06dd4308a2742cdc29c656820c430bb1e928eb989e1706d83801164
MD5 0b1f52532edce34fe1321b6d7eb3a626
BLAKE2b-256 0a0968d9cf3395cd949b6809eb0583b384c3c1fd1e936dc252d0e82925cfdea2

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp314-cp314-win_amd64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a13f42a7b7c33868da69ccff74e565b4d7e09c5c20366ee380aab39a102dc1ac
MD5 4bdcf66ca4d5fbbae300162542a4f0dc
BLAKE2b-256 41d54b1a6c534a88b8dd0d02570d8f49d1ecedebcca0c82b1989a722816232ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 076c063e72a1a3c9b4ee57ecdd67e5ce6ec63f15926d05699c5576df0b3439bf
MD5 5a08b61fe1cb0e3d66adfc932ed01631
BLAKE2b-256 52981ecc4825a0e8b658077ad684bc27a1960ef24c272f110356c3d14b1f2f59

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 3aa365ac575a5ce99e59483c4557ffcc5f48b84a4b1d318050b8a30f79dc4255
MD5 c053b1a4dab70a1635f6f4f6e9410241
BLAKE2b-256 69d33d40662f8734687e0a26475a6af2d38af10582a58cd34b8e7fc14a9cd224

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp314-cp314-macosx_10_15_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cf23d7c84086a430a4e163d6d5909f9d1f299ef7a68f98a48761e54ba2706b3f
MD5 430554046eb5054b3de876da00568d44
BLAKE2b-256 2efe624b435f29ebbe0eb63032d91ccd4d5692a22797b7c4858b98e425c373ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b4666ee816783acede92ab2697a928f5c0a07bd60c65284106f11a1e3d617041
MD5 e254e28240a2c4b27b459fa3be07f3d5
BLAKE2b-256 046bc845e4c2f2ada15f03cd895a9823712c8af423c1907f1673a109a355232f

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b43325f7a581c8e9787e14240a0a5c1ae9789b11fc914bbfb2404dae225a82c2
MD5 1888f96cb316bcf5940a714dd77c1a49
BLAKE2b-256 44301c67b5b8139aa3efe4f3488c0458501bd1b27abb030895e8b13671e3b8ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 84ce583617bf095f2394f9d724aeaae44766fc68548ec94d704dc78732826874
MD5 20de4631b601ce66c36c55ddf4f63b28
BLAKE2b-256 a2d0ea5935277925d338cd219775f0f9ef45d56994475af03751685c9315c240

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp313-cp313-macosx_10_13_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ef0190cd47b1c307106bbc833c39e93f772fb6faf0c55a6a6b3bf3dc9e67eeb2
MD5 45d29e1ec79d2b6b796d346c8e0fcf6b
BLAKE2b-256 58fabc1920f69ecf15f9655d87b34e58f6a49b3536b0cde2e4871a54814b0957

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fc9231e38dd92440fefe25addf3627ec8097f89ebac9a16ee0ff9fbe8d386d7d
MD5 6d0ed559596c114a28c441c8881f8234
BLAKE2b-256 4018f1f721f7a9d9b6970218217ff89baaa07698297267e54b72503a5ff688b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86a2e91c09b139b96e91cf579771ec356eb8f6ec58e12c4b82a4d7ead703199d
MD5 6f5ce013591711ebee475417236e72ff
BLAKE2b-256 fdce5a5e6e4df2dc9bded4e997b9390f2ba71288a9037fc6fafc0835116ef8a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 26128bbf8430b9ba78672d1cb7b66f454cb29a48b76a357d4f25db422d68d802
MD5 d861f0e9305b84bc6bc3814f1195b6e9
BLAKE2b-256 286a41626a01947639332d5bfcd4757c753c6ff42db3ce9cb9fd80537fe39566

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2efaeac066fa65c24e96809920b754087591e1e00f768acb1760cbaabf95f002
MD5 2b4ab3ed068a58a8d835c8b80317c8fd
BLAKE2b-256 7095b404723e3e50902aade4d4deea982b9fcf70227ec689616000252e859fab

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c3189e99c83a0e7de596ff7bb71b4559d1e7f97756ddbded1ed743bf7dc2ac50
MD5 1b905e88481355d7e00c3a4d8e96589f
BLAKE2b-256 b701924bf606409ecf3d47fc04d8d140eeed5a24a15444422ae64e61d7cbde64

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eafe95372b10685cf978f95c040a1e81091ad0a422bf55a363a96ee6d2744bd5
MD5 07746fc4a2aceb263af1f94497dfa0f7
BLAKE2b-256 efb59fe642151ebc359a515ef7b4f154a9123106910a5ebaf664e4fdb74062b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modbus_tcp_cython-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for modbus_tcp_cython-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c7d20281f55a785fd52a05840c839de2b938a9bccb878c8a1aabf3c077f6a053
MD5 0bb0f41c46967c8c2dd23578cdd830c0
BLAKE2b-256 ba01461466c72392e68c8770f293aec434d23d13c2b8737bede69b59bf2cc4b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for modbus_tcp_cython-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: wheels.yml on wangzihao223/modbus_tcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page