title: Is there a way for me to duplicate my pymodbus server so that they can run in along side eachother without crashing?
body: <p>I am new to modbus and pymodbus in general, this is the code i have written and it seems to run fine! for my project i would like to duplicate this code somehow and make it possible for them to run along side eachother without crashing.</p>
  <p>For the end-user it should be as simple as this:</p>
  <p>program:&quot;how many servers would you like to run&quot;</p>
  <p>user: &quot;3&quot;</p>
  <p>program &quot;what are the adress and count of server 1&quot;</p>
  <p>user: &quot;....&quot;</p>
  <p>program &quot;what are the adress and count of server 2&quot;</p>
  <p>user: &quot;....&quot;</p>
  <p>program &quot;what are the adress and count of server 3&quot;</p>
  <p>user: &quot;....&quot;</p>
  <p>and then they all run and it is possible to get updates alongside the program.</p>
  <p>Here is the code i have written up until now:</p>
  <pre><code>import pymodbus
  from pymodbus.version import version
  from pymodbus.server.sync import StartSerialServer
  from pymodbus.device import ModbusDeviceIdentification
  from pymodbus.datastore import ModbusSequentialDataBlock
  from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
  from pymodbus.transaction import ModbusRtuFramer
  from pymodbus.constants import Defaults
  
  
  from pymodbus.client.sync import ModbusSerialClient as modclient
  
  #import logging
  
  #FORMAT = ('%(asctime)-15s %(threadName)-15s' ' %(levelname)-8s %(module)-15s:%(lineno)-8s % (message)s')
  #logging.basicConfig(format=FORMAT)
  #log = logging.getLogger()
  #log.setLevel(logging.DEBUG)
  
  store = ModbusSlaveContext(
      di=ModbusSequentialDataBlock(0, [17] * 100),  # adresse, verdi( di = digital inputs)
      co=ModbusSequentialDataBlock(0, [17] * 100),  # --_-- (Coils)
      hr=ModbusSequentialDataBlock(0, [17] * 100),  # --_-- (Holding registers)
      ir=ModbusSequentialDataBlock(0, [17] * 100))  # --_-- (input registers)
  
  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 = version.short()
  
  context = ModbusServerContext(slaves=store, single=True)
  
  client = modclient(method=&quot;rtu&quot;,
                 port=&quot;COM2&quot;,
                 timeout=1000,
                 stopbits=1,
                 bytesize= 8,
                 parity= &quot;N&quot;,
                 baudrate=9600)
  client.connect()
  
  while True: #kopier og send in
      #input_reg = client.read_holding_registers(address=0,count=0,unit=0)
      #co_reg = client.read_coils(address=, count=, unit=)
      holding_reg = client.read_holding_registers(address=0,count=8,unit=1) #for addressen 1 osv
      print(holding_reg)
  
  
      #reg_read = holding_reg.registers[2] #leser tredje verdi i arrayet
  </code></pre>
  <p>This is what i get in my terminal when i run it: (the error happens if i dont send a value to it)</p>
  <pre><code>WriteRegisterResponse 0 =&gt; 6
  WriteRegisterResponse 0 =&gt; 6
  WriteRegisterResponse 0 =&gt; 6
  Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
  WriteRegisterResponse 0 =&gt; 6
  </code></pre>