![]() |
Banking_System_Server
1.0.0
Qt-based banking app for user/admin account management, transactions, secure server communication via PostgreSQL/Supabase.
|
The ServerHandler class handles incoming client connections in a separate thread. More...
#include <serverhandler.h>
Public Member Functions | |
ServerHandler (QMutex *m, qintptr handle=0, QObject *parent=nullptr) | |
Constructs a ServerHandler object with the specified parameters. More... | |
~ServerHandler () | |
Destructor for the ServerHandler class. More... | |
void | readyRead () |
Slot to handle readyRead signal from QTcpSocket. More... | |
void | run () |
Implements QRunnable's run method to handle the client connection. More... | |
The ServerHandler class handles incoming client connections in a separate thread.
This class is responsible for managing communication with a client, verifying data integrity using cryptographic hashes, and processing requests through the RequestManager. It operates in a separate thread to ensure that the server remains responsive.
|
explicit |
Constructs a ServerHandler object with the specified parameters.
Initializes the ServerHandler with a mutex, socket handle, and optional parent QObject.
m | Pointer to a QMutex used for synchronization. |
handle | The socket descriptor for the incoming connection. |
parent | The parent QObject. |
ServerHandler::~ServerHandler | ( | ) |
Destructor for the ServerHandler class.
Cleans up resources by deleting the client socket and RequestManager.
void ServerHandler::readyRead | ( | ) |
Slot to handle readyRead signal from QTcpSocket.
Reads data from the client socket, verifies its integrity using a cryptographic hash, and processes the request using RequestManager. Sends the response back to the client.
Referenced by run().
void ServerHandler::run | ( | ) |
Implements QRunnable's run method to handle the client connection.
Sets up the client socket, connects signals for reading data and disconnection, and starts the event loop to process client requests.