4#ifndef TCPSERVERCLIENTOBJECT_H
5#define TCPSERVERCLIENTOBJECT_H
6#include <QAbstractSocket>
9#include <Kanoop/utility/abstractthreadclass.h>
59 QTcpSocket*
socket()
const {
return _socket; }
71 virtual
void threadFinished() override final;
74 void startClearTextClient();
76 void startSslClient();
88 void onDisconnected();
90 void onErrorOcurred(QAbstractSocket::SocketError errorCode);
94 void onSslErrors(const QList<QSslError> errors);
Abstract base class for QObject-based workers that run in a dedicated QThread.
virtual void threadStarted()=0
Entry point called on the worker thread immediately after it starts.
Manages the lifetime of a single accepted TCP (or SSL/TLS) client socket.
virtual void receivedData(const QByteArray &data)=0
Called whenever data arrives from the client.
QTcpSocket * socket() const
Return the underlying socket for this client.
virtual ~TcpServerClientObject()
Destructor — disconnects and cleans up the socket.
TcpServer * server() const
Return the owning TcpServer.
virtual void clientStarted()
Called on the client thread immediately after the connection is established.
virtual void clientFinished()
Called on the client thread just before the connection is torn down.
void writeData(const QByteArray &data)
Send data to the connected client.
TcpServerClientObject(TcpServer *server, qintptr fd, bool useSsl=false)
Construct a client object for an accepted connection.
Abstract TCP server supporting both plain-text and TLS/SSL connections.