使用pymodbus模块的Python-Modbus服务器

使用pymodbus模块的Python-Modbus服务器,python,server,modbus,pymodbus,Python,Server,Modbus,Pymodbus,我想创建一个Modbus服务器(IP地址:152.168.96.11-与系统相同)和在不同系统中运行的Modbus客户端(IP地址:152.168.96.32)。我的客户端应用程序正在成功运行,我正在使用pymodbus服务器应用程序创建Modbus服务器应用程序。32位的数据交换(出于测试目的读或写)。我想将特定地址的值读写到Modbus客户端 如何将python pymodbus服务器配置为能够将数据读写到客户端IP地址的服务器 这是pymodbus服务器应用程序- # ----------

我想创建一个Modbus服务器(IP地址:152.168.96.11-与系统相同)和在不同系统中运行的Modbus客户端(IP地址:152.168.96.32)。我的客户端应用程序正在成功运行,我正在使用pymodbus服务器应用程序创建Modbus服务器应用程序。32位的数据交换(出于测试目的读或写)。我想将特定地址的值读写到Modbus客户端

如何将python pymodbus服务器配置为能够将数据读写到客户端IP地址的服务器

这是pymodbus服务器应用程序-

# --------------------------------------------------------------------------- # 
# import the various server implementations
# --------------------------------------------------------------------------- # 
from pymodbus.server.sync import StartTcpServer

from pymodbus.device import ModbusDeviceIdentification
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext

# --------------------------------------------------------------------------- # 
# configure the service logging
# --------------------------------------------------------------------------- # 
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)


def run_server():

    # ----------------------------------------------------------------------- # 
    # initialize your data store
    # ----------------------------------------------------------------------- #
    block = ModbusSequentialDataBlock(0, [888]*32)
    store = ModbusSlaveContext(hr=block)

    slaves  = {
               0x01: store,
              }
    context = ModbusServerContext(slaves=slaves, single=True)

    # ----------------------------------------------------------------------- # 
    # initialize the server information
    # ----------------------------------------------------------------------- # 
    # If you don't set this or any fields, they are defaulted to empty strings.
    # ----------------------------------------------------------------------- # 
    identity = ModbusDeviceIdentification()
    identity.VendorName = 'Pymodbus'
    identity.ProductCode = 'PM'
    identity.VendorUrl = 'http://github.com/riptideio/pymodbus/'
    identity.ProductName = 'Pymodbus Server'
    identity.ModelName = 'Pymodbus Server'
    identity.MajorMinorRevision = '1.0'

    # ----------------------------------------------------------------------- #
    # run the server you want
    # ----------------------------------------------------------------------- # 
    # Tcp:
    StartTcpServer(context, identity=identity, address=('0.0.0.0', 255))


if __name__ == "__main__":
    run_server()
参考Github中提出的问题,并从参与者那里跟进