Nesta página

QModbusTcpConnectionObserver Class

A classe `QModbusTcpConnectionObserver` representa a interface para objetos que podem ser passados para ` QModbusTcpServer::installConnectionObserver`. Mais...

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

Funções públicas

virtual bool acceptNewConnection(QTcpSocket *newClient) = 0

Descrição detalhada

A interface deve ser implementada pelo desenvolvedor para que seja possível monitorar todas as conexões TCP recebidas de outro cliente Modbus.

Veja também QModbusTcpServer::installConnectionObserver.

Documentação das funções de membro

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

Esta função é uma callback para cada conexão TCP recebida. O usuário deve fornecer um ` newClient ` para receber uma notificação quando uma nova conexão de cliente for estabelecida e para determinar se a conexão deve ser aceita.

A função deve retornar true se a conexão for aceita. Caso contrário, o soquete é fechado/rejeitado.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.