QModbusTcpConnectionObserver Class

The QModbusTcpConnectionObserver class represents the interface for objects that can be passed to QModbusTcpServer::installConnectionObserver . 更多...

头: #include <QModbusTcpConnectionObserver>
CMake: find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
qmake: QT += serialbus

公共函数

virtual bool acceptNewConnection (QTcpSocket * newClient ) = 0

详细描述

The interface must be implemented by the developer to be able to monitor every incoming TCP connection from another Modbus client.

另请参阅 QModbusTcpServer::installConnectionObserver .

成员函数文档编制

[pure virtual] bool QModbusTcpConnectionObserver:: acceptNewConnection ( QTcpSocket * newClient )

This function is a callback for every incoming TCP connection. The user should provide newClient to receive a notification when a new client connection is established and to determine whether the connection is to be accepted.

函数应返回 true if the connection is to be accepted. Otherwise, the socket is closed/rejected.