Skip to main content

modbus-tcp-server

PyPI PyPI version PyPI Wheel

A thread-based MODBUS TCP server for testing purposes.

Installation

Just type

pip install modbus-tcp-server

And to run it

modbus-tcp-server 127.0.0.1

Just run it without any arguments to see the command line.

Limitations

It does only the commands related to reading and writing analog inputs, discrete inputs, holding registers and coils, so only commands 1-6 and 15-16 are supported.

Also, it spawns a thread per a client. This might be unacceptable to you, however it can also with with gevent.

Custom data provider

To implement a custom data provider, just extend BaseDataSource to provide data of your choosing and launch it that way:

from modbus_tcp_server.network import AcceptThread
from modbus_tcp_server.data_source import BaseDataSource

class CustomDB(BaseDataSource):
    ...

c_db = CustomDB()

at = AcceptThread('0.0.0.0', 502, c_db).start()

Note that since everything is handled in a single thread, if your reads or writes take too long this will hang on them. File a Issue if you've got a problem with that.

Change log

v0.2

  • added support for commands 15 and 16
  • added exceptions GatewayPathUnavailable and GatewayTargetDeviceFailedToRespond

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-server-0.2.tar.gz (8.7 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_server-0.2-py3.8.egg (9.2 kB view details)

Uploaded Egg

modbus_tcp_server-0.2-py2.py3-none-any.whl (10.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file modbus-tcp-server-0.2.tar.gz.

File metadata

  • Download URL: modbus-tcp-server-0.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.0

File hashes

Hashes for modbus-tcp-server-0.2.tar.gz
Algorithm Hash digest
SHA256 89f1fd844e45b64d51382617f95baf1d12bbdd3017f437551ff929a3e9aece30
MD5 70eb1c58b1b5fd05cf85019dc85ddd0a
BLAKE2b-256 d4d3201a746227b2a0968a2e0771913f5d843ebc07cea7b74b756ae0eaaf243f

See more details on using hashes here.

File details

Details for the file modbus_tcp_server-0.2-py3.8.egg.

File metadata

  • Download URL: modbus_tcp_server-0.2-py3.8.egg
  • Upload date:
  • Size: 9.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.0

File hashes

Hashes for modbus_tcp_server-0.2-py3.8.egg
Algorithm Hash digest
SHA256 1ec70a79ec3d6f2b04668c1c6369a5ea90d890c969324bf14b88dcbef7f74589
MD5 ec60b89fed98726843ee35bfdede2554
BLAKE2b-256 4bd7fd467e8aac051dfcaf3415bfdb1bb3abb2297e1fc27fe593232ab776efde

See more details on using hashes here.

File details

Details for the file modbus_tcp_server-0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: modbus_tcp_server-0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.8.0

File hashes

Hashes for modbus_tcp_server-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 de3907c0024f90772d2bd1995808a9c01472c2eb323a9d2ba2cbc876da09ea7f
MD5 6c3b09173194528ae1a9e037f6c66fb3
BLAKE2b-256 08268a995b4cb1ef7a03507e63ed608cf7f9d2a59d7c88fdf27bf361b4e90723

See more details on using hashes here.

Supported by

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