pymodbus.server package

Submodules

pymodbus.server.async module

Implementation of a Twisted Modbus Server

pymodbus.server.async.StartTcpServer(context, identity=None, address=None, console=False, defer_reactor_run=False, **kwargs)

Helper method to start the Modbus Async TCP server

Parameters:
  • context – The server data context
  • identify – The server identity to use (default empty)
  • address – An optional (interface, port) to bind to.
  • console – A flag indicating if you want the debug console
  • ignore_missing_slaves – True to not send errors on a request

to a missing slave :param defer_reactor_run: True/False defer running reactor.run() as part of starting server, to be explictly started by the user

pymodbus.server.async.StartUdpServer(context, identity=None, address=None, defer_reactor_run=False, **kwargs)

Helper method to start the Modbus Async Udp server

Parameters:
  • context – The server data context
  • identify – The server identity to use (default empty)
  • address – An optional (interface, port) to bind to.
  • ignore_missing_slaves – True to not send errors on a request

to a missing slave :param defer_reactor_run: True/False defer running reactor.run() as part of starting server, to be explictly started by the user

pymodbus.server.async.StartSerialServer(context, identity=None, framer=<class 'pymodbus.framer.ascii_framer.ModbusAsciiFramer'>, defer_reactor_run=False, **kwargs)

Helper method to start the Modbus Async Serial server

Parameters:
  • context – The server data context
  • identify – The server identity to use (default empty)
  • framer – The framer to use (default ModbusAsciiFramer)
  • port – The serial port to attach to
  • baudrate – The baud rate to use for the serial device
  • console – A flag indicating if you want the debug console
  • ignore_missing_slaves – True to not send errors on a request to a

missing slave :param defer_reactor_run: True/False defer running reactor.run() as part of starting server, to be explictly started by the user

pymodbus.server.async.StopServer()

Helper method to stop Async Server

pymodbus.server.sync module

Implementation of a Threaded Modbus Server

pymodbus.server.sync.StartTcpServer(context=None, identity=None, address=None, **kwargs)

A factory to start and run a tcp modbus server

Parameters:
  • context – The ModbusServerContext datastore
  • identity – An optional identify structure
  • address – An optional (interface, port) to bind to.
  • ignore_missing_slaves – True to not send errors on a request to a missing slave
pymodbus.server.sync.StartUdpServer(context=None, identity=None, address=None, **kwargs)

A factory to start and run a udp modbus server

Parameters:
  • context – The ModbusServerContext datastore
  • identity – An optional identify structure
  • address – An optional (interface, port) to bind to.
  • framer – The framer to operate with (default ModbusSocketFramer)
  • ignore_missing_slaves – True to not send errors on a request to a missing slave
pymodbus.server.sync.StartSerialServer(context=None, identity=None, **kwargs)

A factory to start and run a serial modbus server

Parameters:
  • context – The ModbusServerContext datastore
  • identity – An optional identify structure
  • framer – The framer to operate with (default ModbusAsciiFramer)
  • port – The serial port to attach to
  • stopbits – The number of stop bits to use
  • bytesize – The bytesize of the serial messages
  • parity – Which kind of parity to use
  • baudrate – The baud rate to use for the serial device
  • timeout – The timeout to use for the serial device
  • ignore_missing_slaves – True to not send errors on a request to a missing slave

Module contents