class QModbusTcpServer

The QModbusTcpServer class represents a Modbus server that uses a TCP server for its communication with the Modbus client. More

Inheritance diagram of PySide6.QtSerialBus.QModbusTcpServer

Synopsis

Methods

Signals

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

Communication via Modbus requires the interaction between a single Modbus client instance and single Modbus server. This class provides the Modbus server implementation via a TCP server.

Modbus TCP networks can have multiple servers. Servers are read/written by a client device represented by QModbusTcpClient .

__init__([parent=None])
Parameters:

parentQObject

Constructs a QModbusTcpServer with the specified parent. The serverAddress preset is 255.

installConnectionObserver(observer)
Parameters:

observerQModbusTcpConnectionObserver

Installs an observer that can be used to obtain notifications when a new TCP client connects to this server instance. In addition, the observer can be used to reject the incoming TCP connection.

QModbusTcpServer takes ownership of the given observer. Any previously set observer will be deleted. The observer can be uninstalled by calling this function with nullptr as parameter.

modbusClientDisconnected(modbusClient)
Parameters:

modbusClientQTcpSocket

This signal is emitted when a current TCP based modbusClient disconnects from this Modbus TCP server. Note that there might be several TCP clients connected at the same time.

Notifications on incoming new connections can be received by installing a QModbusTcpConnectionObserver via installConnectionObserver() .