pymodbus.server package
Submodules
pymodbus.server.asynchronous module
Implementation of a Twisted Modbus Server
- pymodbus.server.asynchronous.StartSerialServer(context, identity=None, framer=<class 'pymodbus.framer.ascii_framer.ModbusAsciiFramer'>, defer_reactor_run=False, custom_functions=[], **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
defer_reactor_run – True/False defer running reactor.run() as part of starting server, to be explictly started by the user
custom_functions – An optional list of custom function classes supported by server instance.
- pymodbus.server.asynchronous.StartTcpServer(context, identity=None, address=None, console=False, defer_reactor_run=False, custom_functions=[], **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
defer_reactor_run – True/False defer running reactor.run() as part of starting server, to be explictly started by the user
custom_functions – An optional list of custom function classes supported by server instance.
- pymodbus.server.asynchronous.StartUdpServer(context, identity=None, address=None, defer_reactor_run=False, custom_functions=[], **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
defer_reactor_run – True/False defer running reactor.run() as part of starting server, to be explictly started by the user
custom_functions – An optional list of custom function classes supported by server instance.
- pymodbus.server.asynchronous.StopServer()
Helper method to stop Async Server
pymodbus.server.sync module
Implementation of a Threaded Modbus Server
- pymodbus.server.sync.StartSerialServer(context=None, identity=None, custom_functions=[], **kwargs)
A factory to start and run a serial modbus server
- Parameters
context – The ModbusServerContext datastore
identity – An optional identify structure
custom_functions – An optional list of custom function classes supported by server instance.
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
- pymodbus.server.sync.StartTcpServer(context=None, identity=None, address=None, custom_functions=[], **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.
custom_functions – An optional list of custom function classes supported by server instance.
ignore_missing_slaves – True to not send errors on a request to a missing slave
- pymodbus.server.sync.StartTlsServer(context=None, identity=None, address=None, sslctx=None, certfile=None, keyfile=None, custom_functions=[], **kwargs)
A factory to start and run a tls modbus server
- Parameters
context – The ModbusServerContext datastore
identity – An optional identify structure
address – An optional (interface, port) to bind to.
sslctx – The SSLContext to use for TLS (default None and auto create)
certfile – The cert file path for TLS (used if sslctx is None)
keyfile – The key file path for TLS (used if sslctx is None)
custom_functions – An optional list of custom function classes supported by server instance.
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, custom_functions=[], **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.
custom_functions – An optional list of custom function classes supported by server instance.
framer – The framer to operate with (default ModbusSocketFramer)
ignore_missing_slaves – True to not send errors on a request to a missing slave